1 ; RUN: llc < %s -mtriple=arm-apple-ios -mattr=+vfp2 -disable-post-ra | FileCheck %s
2 ; RUN: llc < %s -mtriple=arm-apple-ios -mattr=+vfp2 -disable-post-ra -regalloc=basic | FileCheck %s
4 define void @test(ptr %P, ptr %D) {
5 %A = load float, ptr %P ; <float> [#uses=1]
6 %B = load double, ptr %D ; <double> [#uses=1]
8 store double %B, ptr %D
12 declare float @fabsf(float)
14 declare double @fabs(double)
16 define void @test_abs(ptr %P, ptr %D) {
17 ;CHECK-LABEL: test_abs:
18 %a = load float, ptr %P ; <float> [#uses=1]
20 %b = call float @fabsf( float %a ) readnone ; <float> [#uses=1]
21 store float %b, ptr %P
22 %A = load double, ptr %D ; <double> [#uses=1]
24 %B = call double @fabs( double %A ) readnone ; <double> [#uses=1]
25 store double %B, ptr %D
29 define void @test_add(ptr %P, ptr %D) {
30 ;CHECK-LABEL: test_add:
31 %a = load float, ptr %P ; <float> [#uses=2]
32 %b = fadd float %a, %a ; <float> [#uses=1]
33 store float %b, ptr %P
34 %A = load double, ptr %D ; <double> [#uses=2]
35 %B = fadd double %A, %A ; <double> [#uses=1]
36 store double %B, ptr %D
40 define void @test_ext_round(ptr %P, ptr %D) {
41 ;CHECK-LABEL: test_ext_round:
42 %a = load float, ptr %P ; <float> [#uses=1]
43 ;CHECK-DAG: vcvt.f64.f32
44 ;CHECK-DAG: vcvt.f32.f64
45 %b = fpext float %a to double ; <double> [#uses=1]
46 %A = load double, ptr %D ; <double> [#uses=1]
47 %B = fptrunc double %A to float ; <float> [#uses=1]
48 store double %b, ptr %D
49 store float %B, ptr %P
53 define void @test_fma(ptr %P1, ptr %P2, ptr %P3) {
54 ;CHECK-LABEL: test_fma:
55 %a1 = load float, ptr %P1 ; <float> [#uses=1]
56 %a2 = load float, ptr %P2 ; <float> [#uses=1]
57 %a3 = load float, ptr %P3 ; <float> [#uses=1]
59 %X = fmul float %a1, %a2 ; <float> [#uses=1]
60 %Y = fsub float %X, %a3 ; <float> [#uses=1]
61 store float %Y, ptr %P1
65 define i32 @test_ftoi(ptr %P1) {
66 ;CHECK-LABEL: test_ftoi:
67 %a1 = load float, ptr %P1 ; <float> [#uses=1]
69 %b1 = fptosi float %a1 to i32 ; <i32> [#uses=1]
73 define i32 @test_ftou(ptr %P1) {
74 ;CHECK-LABEL: test_ftou:
75 %a1 = load float, ptr %P1 ; <float> [#uses=1]
77 %b1 = fptoui float %a1 to i32 ; <i32> [#uses=1]
81 define i32 @test_dtoi(ptr %P1) {
82 ;CHECK-LABEL: test_dtoi:
83 %a1 = load double, ptr %P1 ; <double> [#uses=1]
85 %b1 = fptosi double %a1 to i32 ; <i32> [#uses=1]
89 define i32 @test_dtou(ptr %P1) {
90 ;CHECK-LABEL: test_dtou:
91 %a1 = load double, ptr %P1 ; <double> [#uses=1]
93 %b1 = fptoui double %a1 to i32 ; <i32> [#uses=1]
97 define void @test_utod(ptr %P1, i32 %X) {
98 ;CHECK-LABEL: test_utod:
100 %b1 = uitofp i32 %X to double ; <double> [#uses=1]
101 store double %b1, ptr %P1
105 define void @test_utod2(ptr %P1, i8 %X) {
106 ;CHECK-LABEL: test_utod2:
108 %b1 = uitofp i8 %X to double ; <double> [#uses=1]
109 store double %b1, ptr %P1
113 define void @test_cmp(ptr %glob, i32 %X) {
114 ;CHECK-LABEL: test_cmp:
116 %tmp = load float, ptr %glob ; <float> [#uses=2]
117 %tmp3 = getelementptr float, ptr %glob, i32 2 ; <ptr> [#uses=1]
118 %tmp4 = load float, ptr %tmp3 ; <float> [#uses=2]
119 %tmp.upgrd.1 = fcmp oeq float %tmp, %tmp4 ; <i1> [#uses=1]
120 %tmp5 = fcmp uno float %tmp, %tmp4 ; <i1> [#uses=1]
121 %tmp6 = or i1 %tmp.upgrd.1, %tmp5 ; <i1> [#uses=1]
124 br i1 %tmp6, label %cond_true, label %cond_false
126 cond_true: ; preds = %entry
127 %tmp.upgrd.2 = tail call i32 (...) @bar( ) ; <i32> [#uses=0]
130 cond_false: ; preds = %entry
131 %tmp7 = tail call i32 (...) @baz( ) ; <i32> [#uses=0]
135 declare i1 @llvm.isunordered.f32(float, float)
137 declare i32 @bar(...)
139 declare i32 @baz(...)
141 define void @test_cmpfp0(ptr %glob, i32 %X) {
142 ;CHECK-LABEL: test_cmpfp0:
144 %tmp = load float, ptr %glob ; <float> [#uses=1]
146 %tmp.upgrd.3 = fcmp ogt float %tmp, 0.000000e+00 ; <i1> [#uses=1]
147 br i1 %tmp.upgrd.3, label %cond_true, label %cond_false
149 cond_true: ; preds = %entry
150 %tmp.upgrd.4 = tail call i32 (...) @bar( ) ; <i32> [#uses=0]
153 cond_false: ; preds = %entry
154 %tmp1 = tail call i32 (...) @baz( ) ; <i32> [#uses=0]