1 ; RUN: llc -mtriple=thumbv7-linux-gnueabihf %s -o - | FileCheck %s
3 define float @test_load_s32_float(ptr %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]]
9 %val = load i32, ptr %addr, align 1
10 %res = sitofp i32 %val to float
14 define double @test_load_s32_double(ptr %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]]
20 %val = load i32, ptr %addr, align 1
21 %res = sitofp i32 %val to double
25 define float @test_load_u32_float(ptr %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]]
31 %val = load i32, ptr %addr, align 1
32 %res = uitofp i32 %val to float
36 define double @test_load_u32_double(ptr %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]]
42 %val = load i32, ptr %addr, align 1
43 %res = uitofp i32 %val to double
47 define void @test_store_f32(float %in, ptr %addr) {
48 ; CHECK-LABEL: test_store_f32:
49 ; CHECK: vmov [[TMP:r[0-9]+]], s0
50 ; CHECK: str [[TMP]], [r0]
52 store float %in, ptr %addr, align 1
56 define void @test_store_float_s32(float %in, ptr %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]
62 %val = fptosi float %in to i32
63 store i32 %val, ptr %addr, align 1
67 define void @test_store_double_s32(double %in, ptr %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]
73 %val = fptosi double %in to i32
74 store i32 %val, ptr %addr, align 1
78 define void @test_store_float_u32(float %in, ptr %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]
84 %val = fptoui float %in to i32
85 store i32 %val, ptr %addr, align 1
89 define void @test_store_double_u32(double %in, ptr %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]
95 %val = fptoui double %in to i32
96 store i32 %val, ptr %addr, align 1