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(float* %P, double* %D) {
5 %A = load float, float* %P ; <float> [#uses=1]
6 %B = load double, double* %D ; <double> [#uses=1]
7 store float %A, float* %P
8 store double %B, double* %D
12 declare float @fabsf(float)
14 declare double @fabs(double)
16 define void @test_abs(float* %P, double* %D) {
17 ;CHECK-LABEL: test_abs:
18 %a = load float, float* %P ; <float> [#uses=1]
20 %b = call float @fabsf( float %a ) readnone ; <float> [#uses=1]
21 store float %b, float* %P
22 %A = load double, double* %D ; <double> [#uses=1]
24 %B = call double @fabs( double %A ) readnone ; <double> [#uses=1]
25 store double %B, double* %D
29 define void @test_add(float* %P, double* %D) {
30 ;CHECK-LABEL: test_add:
31 %a = load float, float* %P ; <float> [#uses=2]
32 %b = fadd float %a, %a ; <float> [#uses=1]
33 store float %b, float* %P
34 %A = load double, double* %D ; <double> [#uses=2]
35 %B = fadd double %A, %A ; <double> [#uses=1]
36 store double %B, double* %D
40 define void @test_ext_round(float* %P, double* %D) {
41 ;CHECK-LABEL: test_ext_round:
42 %a = load float, float* %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, double* %D ; <double> [#uses=1]
47 %B = fptrunc double %A to float ; <float> [#uses=1]
48 store double %b, double* %D
49 store float %B, float* %P
53 define void @test_fma(float* %P1, float* %P2, float* %P3) {
54 ;CHECK-LABEL: test_fma:
55 %a1 = load float, float* %P1 ; <float> [#uses=1]
56 %a2 = load float, float* %P2 ; <float> [#uses=1]
57 %a3 = load float, float* %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, float* %P1
65 define i32 @test_ftoi(float* %P1) {
66 ;CHECK-LABEL: test_ftoi:
67 %a1 = load float, float* %P1 ; <float> [#uses=1]
69 %b1 = fptosi float %a1 to i32 ; <i32> [#uses=1]
73 define i32 @test_ftou(float* %P1) {
74 ;CHECK-LABEL: test_ftou:
75 %a1 = load float, float* %P1 ; <float> [#uses=1]
77 %b1 = fptoui float %a1 to i32 ; <i32> [#uses=1]
81 define i32 @test_dtoi(double* %P1) {
82 ;CHECK-LABEL: test_dtoi:
83 %a1 = load double, double* %P1 ; <double> [#uses=1]
85 %b1 = fptosi double %a1 to i32 ; <i32> [#uses=1]
89 define i32 @test_dtou(double* %P1) {
90 ;CHECK-LABEL: test_dtou:
91 %a1 = load double, double* %P1 ; <double> [#uses=1]
93 %b1 = fptoui double %a1 to i32 ; <i32> [#uses=1]
97 define void @test_utod(double* %P1, i32 %X) {
98 ;CHECK-LABEL: test_utod:
100 %b1 = uitofp i32 %X to double ; <double> [#uses=1]
101 store double %b1, double* %P1
105 define void @test_utod2(double* %P1, i8 %X) {
106 ;CHECK-LABEL: test_utod2:
108 %b1 = uitofp i8 %X to double ; <double> [#uses=1]
109 store double %b1, double* %P1
113 define void @test_cmp(float* %glob, i32 %X) {
114 ;CHECK-LABEL: test_cmp:
116 %tmp = load float, float* %glob ; <float> [#uses=2]
117 %tmp3 = getelementptr float, float* %glob, i32 2 ; <float*> [#uses=1]
118 %tmp4 = load float, float* %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(float* %glob, i32 %X) {
142 ;CHECK-LABEL: test_cmpfp0:
144 %tmp = load float, float* %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]