Avoid NEON SP-FP unless unsafe-math or Darwin
[oota-llvm.git] / test / CodeGen / ARM / fnegs.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=NFP0
3 ; RUN: llc < %s -march=arm -mcpu=cortex-a8 | FileCheck %s -check-prefix=CORTEXA8
4 ; RUN: llc < %s -march=arm -mcpu=cortex-a8 --enable-unsafe-fp-math | FileCheck %s -check-prefix=CORTEXA8U
5 ; RUN: llc < %s -march=arm -mcpu=cortex-a9 | FileCheck %s -check-prefix=CORTEXA9
6
7 define float @test1(float* %a) {
8 entry:
9         %0 = load float* %a, align 4            ; <float> [#uses=2]
10         %1 = fsub float -0.000000e+00, %0               ; <float> [#uses=2]
11         %2 = fpext float %1 to double           ; <double> [#uses=1]
12         %3 = fcmp olt double %2, 1.234000e+00           ; <i1> [#uses=1]
13         %retval = select i1 %3, float %1, float %0              ; <float> [#uses=1]
14         ret float %retval
15 }
16 ; VFP2: test1:
17 ; VFP2:         vneg.f32        s{{.*}}, s{{.*}}
18
19 ; NFP1: test1:
20 ; NFP1:         vneg.f32        d{{.*}}, d{{.*}}
21
22 ; NFP0: test1:
23 ; NFP0:         vneg.f32        s{{.*}}, s{{.*}}
24
25 ; CORTEXA8: test1:
26 ; CORTEXA8:     vneg.f32        s{{.*}}, s{{.*}}
27
28 ; CORTEXA8U: test1:
29 ; CORTEXA8U:    vneg.f32        d{{.*}}, d{{.*}}
30
31 ; CORTEXA9: test1:
32 ; CORTEXA9:     vneg.f32        s{{.*}}, s{{.*}}
33
34 define float @test2(float* %a) {
35 entry:
36         %0 = load float* %a, align 4            ; <float> [#uses=2]
37         %1 = fmul float -1.000000e+00, %0               ; <float> [#uses=2]
38         %2 = fpext float %1 to double           ; <double> [#uses=1]
39         %3 = fcmp olt double %2, 1.234000e+00           ; <i1> [#uses=1]
40         %retval = select i1 %3, float %1, float %0              ; <float> [#uses=1]
41         ret float %retval
42 }
43 ; VFP2: test2:
44 ; VFP2:         vneg.f32        s{{.*}}, s{{.*}}
45
46 ; NFP1: test2:
47 ; NFP1:         vneg.f32        d{{.*}}, d{{.*}}
48
49 ; NFP0: test2:
50 ; NFP0:         vneg.f32        s{{.*}}, s{{.*}}
51
52 ; CORTEXA8: test2:
53 ; CORTEXA8:     vneg.f32        s{{.*}}, s{{.*}}
54
55 ; CORTEXA8U: test2:
56 ; CORTEXA8U:    vneg.f32        d{{.*}}, d{{.*}}
57
58 ; CORTEXA9: test2:
59 ; CORTEXA9:     vneg.f32        s{{.*}}, s{{.*}}
60