Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 128ff37

Browse files
committed
[x86] add tests to show current codegen for obscured fneg/fabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268533 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 83e3b70 commit 128ff37

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

test/CodeGen/X86/fp-logic.ll

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,53 @@ define float @movmsk(float %x) {
262262
ret float %bc2
263263
}
264264

265+
define double @bitcast_fabs(double %x) {
266+
; CHECK-LABEL: bitcast_fabs:
267+
; CHECK: # BB#0:
268+
; CHECK-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
269+
; CHECK-NEXT: andpd %xmm1, %xmm0
270+
; CHECK-NEXT: retq
271+
;
272+
%bc1 = bitcast double %x to i64
273+
%and = and i64 %bc1, 9223372036854775807
274+
%bc2 = bitcast i64 %and to double
275+
ret double %bc2
276+
}
277+
278+
define float @bitcast_fneg(float %x) {
279+
; CHECK-LABEL: bitcast_fneg:
280+
; CHECK: # BB#0:
281+
; CHECK-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
282+
; CHECK-NEXT: xorps %xmm1, %xmm0
283+
; CHECK-NEXT: retq
284+
;
285+
%bc1 = bitcast float %x to i32
286+
%xor = xor i32 %bc1, 2147483648
287+
%bc2 = bitcast i32 %xor to float
288+
ret float %bc2
289+
}
290+
291+
define <2 x double> @bitcast_fabs_vec(<2 x double> %x) {
292+
; CHECK-LABEL: bitcast_fabs_vec:
293+
; CHECK: # BB#0:
294+
; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
295+
; CHECK-NEXT: retq
296+
;
297+
%bc1 = bitcast <2 x double> %x to <2 x i64>
298+
%and = and <2 x i64> %bc1, <i64 9223372036854775807, i64 9223372036854775807>
299+
%bc2 = bitcast <2 x i64> %and to <2 x double>
300+
ret <2 x double> %bc2
301+
}
302+
303+
define <4 x float> @bitcast_fneg_vec(<4 x float> %x) {
304+
; CHECK-LABEL: bitcast_fneg_vec:
305+
; CHECK: # BB#0:
306+
; CHECK-NEXT: xorps {{.*}}(%rip), %xmm0
307+
; CHECK-NEXT: retq
308+
;
309+
%bc1 = bitcast <4 x float> %x to <4 x i32>
310+
%xor = xor <4 x i32> %bc1, <i32 2147483648, i32 2147483648, i32 2147483648, i32 2147483648>
311+
%bc2 = bitcast <4 x i32> %xor to <4 x float>
312+
ret <4 x float> %bc2
313+
}
314+

0 commit comments

Comments
 (0)