1; RUN: llc -mtriple=thumbv7em-apple-macho -mcpu=cortex-m4 %s -o - -O0 | FileCheck %s
2; RUN: llc -mtriple=thumbv7em-apple-macho -mcpu=cortex-m4 %s -o - | FileCheck %s
3
4; Note: vldr and vstr really do have 64-bit variants even with -fp64
5define void @test_load_store(double* %addr) {
6; CHECK-LABEL: test_load_store:
7; CHECK: vldr [[TMP:d[0-9]+]], [r0]
8; CHECK: vstr [[TMP]], [r0]
9  %val = load volatile double, double* %addr
10  store volatile double %val, double* %addr
11  ret void
12}
13
14define void @test_cmp(double %l, double %r, i1* %addr.dst) {
15; CHECK-LABEL: test_cmp:
16; CHECK: bl ___eqdf2
17  %res = fcmp oeq double %l, %r
18  store i1 %res, i1* %addr.dst
19  ret void
20}
21
22define void @test_ext(float %in, double* %addr) {
23; CHECK-LABEL: test_ext:
24; CHECK: bl ___extendsfdf2
25  %res = fpext float %in to double
26  store double %res, double* %addr
27  ret void
28}
29
30define void @test_trunc(double %in, float* %addr) {
31; CHECK-LABEL: test_trunc:
32; CHECK: bl ___truncdfsf2
33  %res = fptrunc double %in to float
34  store float %res, float* %addr
35  ret void
36}
37
38define void @test_itofp(i32 %in, double* %addr) {
39; CHECK-LABEL: test_itofp:
40; CHECK: bl ___floatsidf
41  %res = sitofp i32 %in to double
42  store double %res, double* %addr
43;  %res = fptoui double %tmp to i32
44  ret void
45}
46
47define i32 @test_fptoi(double* %addr) {
48; CHECK-LABEL: test_fptoi:
49; CHECK: bl ___fixunsdfsi
50  %val = load double, double* %addr
51  %res = fptoui double %val to i32
52  ret i32 %res
53}
54
55define void @test_binop(double* %addr) {
56; CHECK-LABEL: test_binop:
57; CHECK: bl ___adddf3
58  %in = load double, double* %addr
59  %res = fadd double %in, %in
60  store double %res, double* %addr
61  ret void
62}
63