1; RUN: llc -mtriple=thumbv7-linux-gnueabihf %s -o - | FileCheck %s
2
3define float @test_load_s32_float(i32* %addr) {
4; CHECK-LABEL: test_load_s32_float:
5; CHECK: ldr [[TMP:r[0-9]+]], [r0]
6; CHECK: vmov [[RES_INT:s[0-9]+]], [[TMP]]
7; CHECK: vcvt.f32.s32 s0, [[RES_INT]]
8
9  %val = load i32, i32* %addr, align 1
10  %res = sitofp i32 %val to float
11  ret float %res
12}
13
14define double @test_load_s32_double(i32* %addr) {
15; CHECK-LABEL: test_load_s32_double:
16; CHECK: ldr [[TMP:r[0-9]+]], [r0]
17; CHECK: vmov [[RES_INT:s[0-9]+]], [[TMP]]
18; CHECK: vcvt.f64.s32 d0, [[RES_INT]]
19
20  %val = load i32, i32* %addr, align 1
21  %res = sitofp i32 %val to double
22  ret double %res
23}
24
25define float @test_load_u32_float(i32* %addr) {
26; CHECK-LABEL: test_load_u32_float:
27; CHECK: ldr [[TMP:r[0-9]+]], [r0]
28; CHECK: vmov [[RES_INT:s[0-9]+]], [[TMP]]
29; CHECK: vcvt.f32.u32 s0, [[RES_INT]]
30
31  %val = load i32, i32* %addr, align 1
32  %res = uitofp i32 %val to float
33  ret float %res
34}
35
36define double @test_load_u32_double(i32* %addr) {
37; CHECK-LABEL: test_load_u32_double:
38; CHECK: ldr [[TMP:r[0-9]+]], [r0]
39; CHECK: vmov [[RES_INT:s[0-9]+]], [[TMP]]
40; CHECK: vcvt.f64.u32 d0, [[RES_INT]]
41
42  %val = load i32, i32* %addr, align 1
43  %res = uitofp i32 %val to double
44  ret double %res
45}
46
47define void @test_store_f32(float %in, float* %addr) {
48; CHECK-LABEL: test_store_f32:
49; CHECK: vmov [[TMP:r[0-9]+]], s0
50; CHECK: str [[TMP]], [r0]
51
52  store float %in, float* %addr, align 1
53  ret void
54}
55
56define void @test_store_float_s32(float %in, i32* %addr) {
57; CHECK-LABEL: test_store_float_s32:
58; CHECK: vcvt.s32.f32 [[TMP:s[0-9]+]], s0
59; CHECK: vmov [[TMP_INT:r[0-9]+]], [[TMP]]
60; CHECK: str [[TMP_INT]], [r0]
61
62  %val = fptosi float %in to i32
63  store i32 %val, i32* %addr, align 1
64  ret void
65}
66
67define void @test_store_double_s32(double %in, i32* %addr) {
68; CHECK-LABEL: test_store_double_s32:
69; CHECK: vcvt.s32.f64 [[TMP:s[0-9]+]], d0
70; CHECK: vmov [[TMP_INT:r[0-9]+]], [[TMP]]
71; CHECK: str [[TMP_INT]], [r0]
72
73  %val = fptosi double %in to i32
74  store i32 %val, i32* %addr, align 1
75  ret void
76}
77
78define void @test_store_float_u32(float %in, i32* %addr) {
79; CHECK-LABEL: test_store_float_u32:
80; CHECK: vcvt.u32.f32 [[TMP:s[0-9]+]], s0
81; CHECK: vmov [[TMP_INT:r[0-9]+]], [[TMP]]
82; CHECK: str [[TMP_INT]], [r0]
83
84  %val = fptoui float %in to i32
85  store i32 %val, i32* %addr, align 1
86  ret void
87}
88
89define void @test_store_double_u32(double %in, i32* %addr) {
90; CHECK-LABEL: test_store_double_u32:
91; CHECK: vcvt.u32.f64 [[TMP:s[0-9]+]], d0
92; CHECK: vmov [[TMP_INT:r[0-9]+]], [[TMP]]
93; CHECK: str [[TMP_INT]], [r0]
94
95  %val = fptoui double %in to i32
96  store i32 %val, i32* %addr, align 1
97  ret void
98}
99