Avoid NEON SP-FP unless unsafe-math or Darwin
[oota-llvm.git] / test / CodeGen / ARM / fp_convert.ll
1 ; RUN: llc < %s -march=arm -mattr=+vfp2 | FileCheck %s -check-prefix=VFP2
2 ; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s -check-prefix=VFP2
3 ; RUN: llc < %s -march=arm -mcpu=cortex-a8 --enable-unsafe-fp-math | FileCheck %s -check-prefix=NEON
4 ; RUN: llc < %s -march=arm -mcpu=cortex-a8 | FileCheck %s -check-prefix=VFP2
5 ; RUN: llc < %s -march=arm -mcpu=cortex-a9 | FileCheck %s -check-prefix=VFP2
6
7 define i32 @test1(float %a, float %b) {
8 ; VFP2: test1:
9 ; VFP2: vcvt.s32.f32 s{{.}}, s{{.}}
10 ; NEON: test1:
11 ; NEON: vadd.f32 [[D0:d[0-9]+]]
12 ; NEON: vcvt.s32.f32 d0, [[D0]]
13 entry:
14         %0 = fadd float %a, %b
15         %1 = fptosi float %0 to i32
16         ret i32 %1
17 }
18
19 define i32 @test2(float %a, float %b) {
20 ; VFP2: test2:
21 ; VFP2: vcvt.u32.f32 s{{.}}, s{{.}}
22 ; NEON: test2:
23 ; NEON: vadd.f32 [[D0:d[0-9]+]]
24 ; NEON: vcvt.u32.f32 d0, [[D0]]
25 entry:
26         %0 = fadd float %a, %b
27         %1 = fptoui float %0 to i32
28         ret i32 %1
29 }
30
31 define float @test3(i32 %a, i32 %b) {
32 ; VFP2: test3:
33 ; VFP2: vcvt.f32.u32 s{{.}}, s{{.}}
34 ; NEON: test3:
35 ; NEON: vcvt.f32.u32 d
36 entry:
37         %0 = add i32 %a, %b
38         %1 = uitofp i32 %0 to float
39         ret float %1
40 }
41
42 define float @test4(i32 %a, i32 %b) {
43 ; VFP2: test4:
44 ; VFP2: vcvt.f32.s32 s{{.}}, s{{.}}
45 ; NEON: test4:
46 ; NEON: vcvt.f32.s32 d
47 entry:
48         %0 = add i32 %a, %b
49         %1 = sitofp i32 %0 to float
50         ret float %1
51 }