Skip to content

Commit c2f2a95

Browse files
committed
[X86] Add more test cases for fast-isel handling of fneg.
The fneg double case is falling back to a subsd in 32-bit mode if you write a test that doesn't trigger a fast-isel abort on the return value. The subsd lowering has different behavior with respect to nans than using an xor. This is inconsisent with what we would do in SelectionDAG and can lead to differences between -O0 and -O2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360088 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 17ff078 commit c2f2a95

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

test/CodeGen/X86/fast-isel-fneg.ll

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s
3-
; RUN: llc < %s -fast-isel -mtriple=i686-- -mattr=+sse2 | FileCheck --check-prefix=SSE2 %s
2+
; RUN: llc < %s -fast-isel -fast-isel-abort=3 -mtriple=x86_64-apple-darwin10 | FileCheck %s
3+
; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=i686-- -mattr=+sse2 | FileCheck --check-prefix=SSE2 %s
44

55
define double @doo(double %x) nounwind {
66
; CHECK-LABEL: doo:
@@ -48,3 +48,54 @@ define float @foo(float %x) nounwind {
4848
%y = fsub float -0.0, %x
4949
ret float %y
5050
}
51+
52+
define void @goo(double* %x, double* %y) nounwind {
53+
; CHECK-LABEL: goo:
54+
; CHECK: ## %bb.0:
55+
; CHECK-NEXT: movq {{.*#+}} xmm0 = mem[0],zero
56+
; CHECK-NEXT: movq %xmm0, %rax
57+
; CHECK-NEXT: movabsq $-9223372036854775808, %rcx ## imm = 0x8000000000000000
58+
; CHECK-NEXT: xorq %rax, %rcx
59+
; CHECK-NEXT: movq %rcx, %xmm0
60+
; CHECK-NEXT: movq %xmm0, (%rsi)
61+
; CHECK-NEXT: retq
62+
;
63+
; SSE2-LABEL: goo:
64+
; SSE2: # %bb.0:
65+
; SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
66+
; SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
67+
; SSE2-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
68+
; SSE2-NEXT: subsd (%ecx), %xmm0
69+
; SSE2-NEXT: movsd %xmm0, (%eax)
70+
; SSE2-NEXT: retl
71+
%a = load double, double* %x
72+
%b = fsub double -0.0, %a
73+
store double %b, double* %y
74+
ret void
75+
}
76+
77+
define void @loo(float* %x, float* %y) nounwind {
78+
; CHECK-LABEL: loo:
79+
; CHECK: ## %bb.0:
80+
; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
81+
; CHECK-NEXT: movd %xmm0, %eax
82+
; CHECK-NEXT: xorl $2147483648, %eax ## imm = 0x80000000
83+
; CHECK-NEXT: movd %eax, %xmm0
84+
; CHECK-NEXT: movd %xmm0, (%rsi)
85+
; CHECK-NEXT: retq
86+
;
87+
; SSE2-LABEL: loo:
88+
; SSE2: # %bb.0:
89+
; SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
90+
; SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
91+
; SSE2-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
92+
; SSE2-NEXT: movd %xmm0, %ecx
93+
; SSE2-NEXT: xorl $2147483648, %ecx # imm = 0x80000000
94+
; SSE2-NEXT: movd %ecx, %xmm0
95+
; SSE2-NEXT: movd %xmm0, (%eax)
96+
; SSE2-NEXT: retl
97+
%a = load float, float* %x
98+
%b = fsub float -0.0, %a
99+
store float %b, float* %y
100+
ret void
101+
}

0 commit comments

Comments
 (0)