blob: 79729788e6200644f33817368b9564a4893d0c10 [file] [log] [blame]
Bill Wendlingc61b5062010-10-12 22:08:41 +00001;RUN: llc -mtriple=armv7-apple-darwin -mcpu=cortex-a8 -mattr=-neonfp -show-mc-encoding < %s | FileCheck %s
2
3
4; FIXME: Once the ARM integrated assembler is up and going, these sorts of tests
5; should run on .s source files rather than using llc to generate the
6; assembly.
7
8
Bill Wendling34c2b092010-10-12 22:55:35 +00009define double @f1(double %a, double %b) nounwind readnone {
Bill Wendlingc61b5062010-10-12 22:08:41 +000010entry:
11; CHECK: f1
Bill Wendling34c2b092010-10-12 22:55:35 +000012; CHECK: vadd.f64 d16, d17, d16 @ encoding: [0xa0,0x0b,0x71,0xee]
13 %add = fadd double %a, %b
14 ret double %add
15}
16
17define float @f2(float %a, float %b) nounwind readnone {
18entry:
19; CHECK: f2
Bill Wendlingc61b5062010-10-12 22:08:41 +000020; CHECK: vadd.f32 s0, s1, s0 @ encoding: [0x80,0x0a,0x30,0xee]
21 %add = fadd float %a, %b
22 ret float %add
23}
24
Bill Wendling34c2b092010-10-12 22:55:35 +000025define double @f3(double %a, double %b) nounwind readnone {
Bill Wendlingc61b5062010-10-12 22:08:41 +000026entry:
Bill Wendling34c2b092010-10-12 22:55:35 +000027; CHECK: f3
28; CHECK: vsub.f64 d16, d17, d16 @ encoding: [0xe0,0x0b,0x71,0xee]
29 %sub = fsub double %a, %b
30 ret double %sub
31}
32
33define float @f4(float %a, float %b) nounwind readnone {
34entry:
35; CHECK: f4
36; CHECK: vsub.f32 s0, s1, s0 @ encoding: [0xc0,0x0a,0x30,0xee]
37 %sub = fsub float %a, %b
38 ret float %sub
39}
40
Bill Wendlingda32e822010-10-12 23:22:27 +000041define double @f5(double %a, double %b) nounwind readnone {
Bill Wendling34c2b092010-10-12 22:55:35 +000042entry:
43; CHECK: f5
Bill Wendlingda32e822010-10-12 23:22:27 +000044; CHECK: vdiv.f64 d16, d17, d16 @ encoding: [0xa0,0x0b,0xc1,0xee]
45 %div = fdiv double %a, %b
46 ret double %div
47}
48
49define float @f6(float %a, float %b) nounwind readnone {
50entry:
51; CHECK: f6
52; CHECK: vdiv.f32 s0, s1, s0 @ encoding: [0x80,0x0a,0x80,0xee]
53 %div = fdiv float %a, %b
54 ret float %div
55}
56
57define double @f7(double %a, double %b) nounwind readnone {
58entry:
59; CHECK: f7
60; CHECK: vmul.f64 d16, d17, d16 @ encoding: [0xa0,0x0b,0x61,0xee]
61 %mul = fmul double %a, %b
62 ret double %mul
63}
64
65define float @f8(float %a, float %b) nounwind readnone {
66entry:
67; CHECK: f8
68; CHECK: vmul.f32 s0, s1, s0 @ encoding: [0x80,0x0a,0x20,0xee]
69 %mul = fmul float %a, %b
70 ret float %mul
71}
72
Bill Wendling40fbeab2010-10-12 23:47:37 +000073define double @f9(double %a, double %b) nounwind readnone {
74entry:
75; CHECK: f9
76; CHECK: vnmul.f64 d16, d17, d16 @ encoding: [0xe0,0x0b,0x61,0xee]
77 %mul = fmul double %a, %b
78 %sub = fsub double -0.000000e+00, %mul
79 ret double %sub
80}
81
82define void @f10(float %a, float %b, float* %c) nounwind readnone {
83entry:
84; CHECK: f10
85; CHECK: vnmul.f32 s0, s1, s0 @ encoding: [0xc0,0x0a,0x20,0xee]
86 %mul = fmul float %a, %b
87 %sub = fsub float -0.000000e+00, %mul
88 store float %sub, float* %c, align 4
89 ret void
90}
91
Bill Wendlingc67e1a32010-10-13 00:04:29 +000092define i1 @f11(double %a, double %b) nounwind readnone {
Bill Wendlingda32e822010-10-12 23:22:27 +000093entry:
Bill Wendlingc67e1a32010-10-13 00:04:29 +000094; CHECK: f11
Bill Wendling34c2b092010-10-12 22:55:35 +000095; CHECK: vcmpe.f64 d17, d16 @ encoding: [0xe0,0x1b,0xf4,0xee]
96 %cmp = fcmp oeq double %a, %b
97 ret i1 %cmp
98}
99
Bill Wendlingc67e1a32010-10-13 00:04:29 +0000100define i1 @f12(float %a, float %b) nounwind readnone {
Bill Wendling34c2b092010-10-12 22:55:35 +0000101entry:
Bill Wendlingc67e1a32010-10-13 00:04:29 +0000102; CHECK: f12
Bill Wendling34c2b092010-10-12 22:55:35 +0000103; CHECK: vcmpe.f32 s1, s0 @ encoding: [0xc0,0x0a,0xf4,0xee]
104 %cmp = fcmp oeq float %a, %b
105 ret i1 %cmp
Bill Wendlingc61b5062010-10-12 22:08:41 +0000106}
Bill Wendling97c79342010-10-13 00:38:07 +0000107
108define i1 @f13(double %a) nounwind readnone {
109entry:
110; CHECK: f13
111; CHECK: vcmpe.f64 d16, #0 @ encoding: [0xc0,0x0b,0xf5,0xee]
112 %cmp = fcmp oeq double %a, 0.000000e+00
113 ret i1 %cmp
114}
115
116define i1 @f14(float %a) nounwind readnone {
117entry:
118; CHECK: f14
119; CHECK: vcmpe.f32 s0, #0 @ encoding: [0xc0,0x0a,0xb5,0xee]
120 %cmp = fcmp oeq float %a, 0.000000e+00
121 ret i1 %cmp
122}
123
124define double @f15(double %a) nounwind {
125entry:
126; CHECK: f15
127; CHECK: vabs.f64 d16, d16 @ encoding: [0xe0,0x0b,0xf0,0xee]
128 %call = tail call double @fabsl(double %a)
129 ret double %call
130}
131
132declare double @fabsl(double)
133
134define float @f16(float %a) nounwind {
135entry:
136; CHECK: f16
Bill Wendling8f053b42010-10-13 01:17:33 +0000137; FIXME: This call generates a "bfc" instruction instead of "vabs.f32".
Bill Wendling97c79342010-10-13 00:38:07 +0000138 %call = tail call float @fabsf(float %a)
139 ret float %call
140}
141
142declare float @fabsf(float)
Bill Wendlinga56cbba2010-10-13 00:56:35 +0000143
144define float @f17(double %a) nounwind readnone {
145entry:
146; CHECK: f17
147; CHECK: vcvt.f32.f64 s0, d16 @ encoding: [0xe0,0x0b,0xb7,0xee]
148 %conv = fptrunc double %a to float
149 ret float %conv
150}
151
152define double @f18(float %a) nounwind readnone {
153entry:
154; CHECK: f18
155; CHECK: vcvt.f64.f32 d16, s0 @ encoding: [0xc0,0x0a,0xf7,0xee]
156 %conv = fpext float %a to double
157 ret double %conv
158}
Bill Wendling8f053b42010-10-13 01:17:33 +0000159
160define double @f19(double %a) nounwind readnone {
161entry:
162; CHECK: f19
163; CHECK: vneg.f64 d16, d16 @ encoding: [0x60,0x0b,0xf1,0xee]
164 %sub = fsub double -0.000000e+00, %a
165 ret double %sub
166}
167
168define float @f20(float %a) nounwind readnone {
169entry:
170; CHECK: f20
171; FIXME: This produces an 'eor' instruction.
172 %sub = fsub float -0.000000e+00, %a
173 ret float %sub
174}
175
176define double @f21(double %a) nounwind readnone {
177entry:
178; CHECK: f21
179; CHECK: vsqrt.f64 d16, d16 @ encoding: [0xe0,0x0b,0xf1,0xee]
180 %call = tail call double @sqrtl(double %a) nounwind
181 ret double %call
182}
183
184declare double @sqrtl(double) readnone
185
186define float @f22(float %a) nounwind readnone {
187entry:
188; CHECK: f22
189; CHECK: vsqrt.f32 s0, s0 @ encoding: [0xc0,0x0a,0xb1,0xee]
190 %call = tail call float @sqrtf(float %a) nounwind
191 ret float %call
192}
193
194declare float @sqrtf(float) readnone