blob: 2acb33f9aebf431193f6eed96a865a93256bb699 [file] [log] [blame]
Tanya Lattner6263f942008-02-17 20:02:20 +00001; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +00002; RUN: grep fabs | count 2
Tanya Lattner6263f942008-02-17 20:02:20 +00003; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +00004; RUN: grep fmscs | count 1
Tanya Lattner6263f942008-02-17 20:02:20 +00005; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +00006; RUN: grep fcvt | count 2
Tanya Lattner6263f942008-02-17 20:02:20 +00007; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +00008; RUN: grep fuito | count 2
Tanya Lattner6263f942008-02-17 20:02:20 +00009; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +000010; RUN: grep fto.i | count 4
Tanya Lattner6263f942008-02-17 20:02:20 +000011; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +000012; RUN: grep bmi | count 1
Tanya Lattner6263f942008-02-17 20:02:20 +000013; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +000014; RUN: grep bgt | count 1
Tanya Lattner6263f942008-02-17 20:02:20 +000015; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | \
Dan Gohman28beeea2007-08-15 13:36:28 +000016; RUN: grep fcmpezs | count 1
Evan Cheng02b985c2007-01-19 09:20:23 +000017
Tanya Lattner6263f942008-02-17 20:02:20 +000018define void @test(float* %P, double* %D) {
19 %A = load float* %P ; <float> [#uses=1]
20 %B = load double* %D ; <double> [#uses=1]
21 store float %A, float* %P
22 store double %B, double* %D
23 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +000024}
25
Tanya Lattner6263f942008-02-17 20:02:20 +000026declare float @fabsf(float)
Evan Cheng02b985c2007-01-19 09:20:23 +000027
Tanya Lattner6263f942008-02-17 20:02:20 +000028declare double @fabs(double)
Evan Cheng02b985c2007-01-19 09:20:23 +000029
Tanya Lattner6263f942008-02-17 20:02:20 +000030define void @test_abs(float* %P, double* %D) {
31 %a = load float* %P ; <float> [#uses=1]
32 %b = call float @fabsf( float %a ) ; <float> [#uses=1]
33 store float %b, float* %P
34 %A = load double* %D ; <double> [#uses=1]
35 %B = call double @fabs( double %A ) ; <double> [#uses=1]
36 store double %B, double* %D
37 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +000038}
39
Tanya Lattner6263f942008-02-17 20:02:20 +000040define void @test_add(float* %P, double* %D) {
41 %a = load float* %P ; <float> [#uses=2]
42 %b = add float %a, %a ; <float> [#uses=1]
43 store float %b, float* %P
44 %A = load double* %D ; <double> [#uses=2]
45 %B = add double %A, %A ; <double> [#uses=1]
46 store double %B, double* %D
47 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +000048}
49
Tanya Lattner6263f942008-02-17 20:02:20 +000050define void @test_ext_round(float* %P, double* %D) {
51 %a = load float* %P ; <float> [#uses=1]
52 %b = fpext float %a to double ; <double> [#uses=1]
53 %A = load double* %D ; <double> [#uses=1]
54 %B = fptrunc double %A to float ; <float> [#uses=1]
55 store double %b, double* %D
56 store float %B, float* %P
57 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +000058}
59
Tanya Lattner6263f942008-02-17 20:02:20 +000060define void @test_fma(float* %P1, float* %P2, float* %P3) {
61 %a1 = load float* %P1 ; <float> [#uses=1]
62 %a2 = load float* %P2 ; <float> [#uses=1]
63 %a3 = load float* %P3 ; <float> [#uses=1]
64 %X = mul float %a1, %a2 ; <float> [#uses=1]
65 %Y = sub float %X, %a3 ; <float> [#uses=1]
66 store float %Y, float* %P1
67 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +000068}
69
Tanya Lattner6263f942008-02-17 20:02:20 +000070define i32 @test_ftoi(float* %P1) {
71 %a1 = load float* %P1 ; <float> [#uses=1]
72 %b1 = fptosi float %a1 to i32 ; <i32> [#uses=1]
73 ret i32 %b1
Evan Cheng02b985c2007-01-19 09:20:23 +000074}
75
Tanya Lattner6263f942008-02-17 20:02:20 +000076define i32 @test_ftou(float* %P1) {
77 %a1 = load float* %P1 ; <float> [#uses=1]
78 %b1 = fptoui float %a1 to i32 ; <i32> [#uses=1]
79 ret i32 %b1
Evan Cheng02b985c2007-01-19 09:20:23 +000080}
81
Tanya Lattner6263f942008-02-17 20:02:20 +000082define i32 @test_dtoi(double* %P1) {
83 %a1 = load double* %P1 ; <double> [#uses=1]
84 %b1 = fptosi double %a1 to i32 ; <i32> [#uses=1]
85 ret i32 %b1
Evan Cheng02b985c2007-01-19 09:20:23 +000086}
87
Tanya Lattner6263f942008-02-17 20:02:20 +000088define i32 @test_dtou(double* %P1) {
89 %a1 = load double* %P1 ; <double> [#uses=1]
90 %b1 = fptoui double %a1 to i32 ; <i32> [#uses=1]
91 ret i32 %b1
Evan Cheng02b985c2007-01-19 09:20:23 +000092}
93
Tanya Lattner6263f942008-02-17 20:02:20 +000094define void @test_utod(double* %P1, i32 %X) {
95 %b1 = uitofp i32 %X to double ; <double> [#uses=1]
96 store double %b1, double* %P1
97 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +000098}
99
Tanya Lattner6263f942008-02-17 20:02:20 +0000100define void @test_utod2(double* %P1, i8 %X) {
101 %b1 = uitofp i8 %X to double ; <double> [#uses=1]
102 store double %b1, double* %P1
103 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +0000104}
105
Tanya Lattner6263f942008-02-17 20:02:20 +0000106define void @test_cmp(float* %glob, i32 %X) {
Evan Cheng02b985c2007-01-19 09:20:23 +0000107entry:
Tanya Lattner6263f942008-02-17 20:02:20 +0000108 %tmp = load float* %glob ; <float> [#uses=2]
109 %tmp3 = getelementptr float* %glob, i32 2 ; <float*> [#uses=1]
110 %tmp4 = load float* %tmp3 ; <float> [#uses=2]
111 %tmp.upgrd.1 = fcmp oeq float %tmp, %tmp4 ; <i1> [#uses=1]
112 %tmp5 = fcmp uno float %tmp, %tmp4 ; <i1> [#uses=1]
113 %tmp6 = or i1 %tmp.upgrd.1, %tmp5 ; <i1> [#uses=1]
114 br i1 %tmp6, label %cond_true, label %cond_false
Evan Cheng02b985c2007-01-19 09:20:23 +0000115
Tanya Lattner6263f942008-02-17 20:02:20 +0000116cond_true: ; preds = %entry
117 %tmp.upgrd.2 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
118 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +0000119
Tanya Lattner6263f942008-02-17 20:02:20 +0000120cond_false: ; preds = %entry
121 %tmp7 = tail call i32 (...)* @baz( ) ; <i32> [#uses=0]
122 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +0000123}
124
Tanya Lattner6263f942008-02-17 20:02:20 +0000125declare i1 @llvm.isunordered.f32(float, float)
Evan Cheng02b985c2007-01-19 09:20:23 +0000126
Tanya Lattner6263f942008-02-17 20:02:20 +0000127declare i32 @bar(...)
Evan Cheng02b985c2007-01-19 09:20:23 +0000128
Tanya Lattner6263f942008-02-17 20:02:20 +0000129declare i32 @baz(...)
Evan Cheng02b985c2007-01-19 09:20:23 +0000130
Tanya Lattner6263f942008-02-17 20:02:20 +0000131define void @test_cmpfp0(float* %glob, i32 %X) {
Evan Cheng02b985c2007-01-19 09:20:23 +0000132entry:
Tanya Lattner6263f942008-02-17 20:02:20 +0000133 %tmp = load float* %glob ; <float> [#uses=1]
134 %tmp.upgrd.3 = fcmp ogt float %tmp, 0.000000e+00 ; <i1> [#uses=1]
135 br i1 %tmp.upgrd.3, label %cond_true, label %cond_false
Evan Cheng02b985c2007-01-19 09:20:23 +0000136
Tanya Lattner6263f942008-02-17 20:02:20 +0000137cond_true: ; preds = %entry
138 %tmp.upgrd.4 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
139 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +0000140
Tanya Lattner6263f942008-02-17 20:02:20 +0000141cond_false: ; preds = %entry
142 %tmp1 = tail call i32 (...)* @baz( ) ; <i32> [#uses=0]
143 ret void
Evan Cheng02b985c2007-01-19 09:20:23 +0000144}