Skip to content

Commit 86ab519

Browse files
[X86][NFC] Moved/Updated FNEG testcases (#162269)
- Moved existing testcases from ```llvm/test/CodeGen/X86/fast-isel-fneg.ll``` to ```llvm/test/CodeGen/X86/isel-fneg.ll```. - Added **x86_fp80** testcase and **GISEL** RUN lines as precommit testcases for GISEL. - Two i686 testcases are disabled because it is crashing in later passes only for GISEL. It will resolve after adding **FNEG GISEL implementation**, I will add that in next PR.
1 parent b52efa5 commit 86ab519

File tree

2 files changed

+208
-101
lines changed

2 files changed

+208
-101
lines changed

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

Lines changed: 0 additions & 101 deletions
This file was deleted.

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

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86,FASTISEL-X86
3+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 -fast-isel=0 | FileCheck %s --check-prefixes=X86,SDAG-X86
4+
; DISABLED: llc < %s -mtriple=i686-linux-gnu -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefixes=X86,GISEL-X86
5+
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel -mattr=+sse | FileCheck %s --check-prefixes=X86,SSE-X86,FASTISEL-SSE-X86
6+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel=0 -fast-isel=0 -mattr=+sse | FileCheck %s --check-prefixes=X86,SSE-X86,SDAG-SSE-X86
7+
; DISABLED: llc < %s -mtriple=i686-linux-gnu -global-isel=1 -global-isel-abort=2 -mattr=+sse | FileCheck %s --check-prefixes=X86,SSE-X86,GISEL-SSE-X86
8+
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel -mattr=+sse | FileCheck %s --check-prefixes=X64,SSE-X64,FASTISEL-SSE-X64
9+
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel=0 -fast-isel=0 -mattr=+sse | FileCheck %s --check-prefixes=X64,SSE-X64,SDAG-SSE-X64
10+
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel=1 -global-isel-abort=2 -mattr=+sse | FileCheck %s --check-prefixes=X64,SSE-X64,GISEL-SSE-X64
11+
12+
define double @fneg_f64(double %x) nounwind {
13+
; X86-LABEL: fneg_f64:
14+
; X86: # %bb.0:
15+
; X86-NEXT: fldl {{[0-9]+}}(%esp)
16+
; X86-NEXT: fchs
17+
; X86-NEXT: retl
18+
;
19+
; FASTISEL-SSE-X64-LABEL: fneg_f64:
20+
; FASTISEL-SSE-X64: # %bb.0:
21+
; FASTISEL-SSE-X64-NEXT: movq %xmm0, %rax
22+
; FASTISEL-SSE-X64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000
23+
; FASTISEL-SSE-X64-NEXT: xorq %rax, %rcx
24+
; FASTISEL-SSE-X64-NEXT: movq %rcx, %xmm0
25+
; FASTISEL-SSE-X64-NEXT: retq
26+
;
27+
; SDAG-SSE-X64-LABEL: fneg_f64:
28+
; SDAG-SSE-X64: # %bb.0:
29+
; SDAG-SSE-X64-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
30+
; SDAG-SSE-X64-NEXT: retq
31+
;
32+
; GISEL-SSE-X64-LABEL: fneg_f64:
33+
; GISEL-SSE-X64: # %bb.0:
34+
; GISEL-SSE-X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
35+
; GISEL-SSE-X64-NEXT: movq %xmm0, %rcx
36+
; GISEL-SSE-X64-NEXT: xorq %rax, %rcx
37+
; GISEL-SSE-X64-NEXT: movq %rcx, %xmm0
38+
; GISEL-SSE-X64-NEXT: retq
39+
%y = fneg double %x
40+
ret double %y
41+
}
42+
43+
define float @fneg_f32(float %x) nounwind {
44+
; FASTISEL-X86-LABEL: fneg_f32:
45+
; FASTISEL-X86: # %bb.0:
46+
; FASTISEL-X86-NEXT: flds {{[0-9]+}}(%esp)
47+
; FASTISEL-X86-NEXT: fchs
48+
; FASTISEL-X86-NEXT: retl
49+
;
50+
; SDAG-X86-LABEL: fneg_f32:
51+
; SDAG-X86: # %bb.0:
52+
; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp)
53+
; SDAG-X86-NEXT: fchs
54+
; SDAG-X86-NEXT: retl
55+
;
56+
; SSE-X86-LABEL: fneg_f32:
57+
; SSE-X86: # %bb.0:
58+
; SSE-X86-NEXT: pushl %eax
59+
; SSE-X86-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
60+
; SSE-X86-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
61+
; SSE-X86-NEXT: movss %xmm0, (%esp)
62+
; SSE-X86-NEXT: flds (%esp)
63+
; SSE-X86-NEXT: popl %eax
64+
; SSE-X86-NEXT: retl
65+
;
66+
; FASTISEL-SSE-X64-LABEL: fneg_f32:
67+
; FASTISEL-SSE-X64: # %bb.0:
68+
; FASTISEL-SSE-X64-NEXT: movd %xmm0, %eax
69+
; FASTISEL-SSE-X64-NEXT: xorl $2147483648, %eax # imm = 0x80000000
70+
; FASTISEL-SSE-X64-NEXT: movd %eax, %xmm0
71+
; FASTISEL-SSE-X64-NEXT: retq
72+
;
73+
; SDAG-SSE-X64-LABEL: fneg_f32:
74+
; SDAG-SSE-X64: # %bb.0:
75+
; SDAG-SSE-X64-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
76+
; SDAG-SSE-X64-NEXT: retq
77+
;
78+
; GISEL-SSE-X64-LABEL: fneg_f32:
79+
; GISEL-SSE-X64: # %bb.0:
80+
; GISEL-SSE-X64-NEXT: movd %xmm0, %eax
81+
; GISEL-SSE-X64-NEXT: addl $-2147483648, %eax # imm = 0x80000000
82+
; GISEL-SSE-X64-NEXT: movd %eax, %xmm0
83+
; GISEL-SSE-X64-NEXT: retq
84+
%y = fneg float %x
85+
ret float %y
86+
}
87+
88+
define void @fneg_f64_mem(ptr %x, ptr %y) nounwind {
89+
; X86-LABEL: fneg_f64_mem:
90+
; X86: # %bb.0:
91+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
92+
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
93+
; X86-NEXT: fldl (%ecx)
94+
; X86-NEXT: fchs
95+
; X86-NEXT: fstpl (%eax)
96+
; X86-NEXT: retl
97+
;
98+
; FASTISEL-SSE-X64-LABEL: fneg_f64_mem:
99+
; FASTISEL-SSE-X64: # %bb.0:
100+
; FASTISEL-SSE-X64-NEXT: movq {{.*#+}} xmm0 = mem[0],zero
101+
; FASTISEL-SSE-X64-NEXT: movq %xmm0, %rax
102+
; FASTISEL-SSE-X64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000
103+
; FASTISEL-SSE-X64-NEXT: xorq %rax, %rcx
104+
; FASTISEL-SSE-X64-NEXT: movq %rcx, %xmm0
105+
; FASTISEL-SSE-X64-NEXT: movq %xmm0, (%rsi)
106+
; FASTISEL-SSE-X64-NEXT: retq
107+
;
108+
; SDAG-SSE-X64-LABEL: fneg_f64_mem:
109+
; SDAG-SSE-X64: # %bb.0:
110+
; SDAG-SSE-X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
111+
; SDAG-SSE-X64-NEXT: xorq (%rdi), %rax
112+
; SDAG-SSE-X64-NEXT: movq %rax, (%rsi)
113+
; SDAG-SSE-X64-NEXT: retq
114+
;
115+
; GISEL-SSE-X64-LABEL: fneg_f64_mem:
116+
; GISEL-SSE-X64: # %bb.0:
117+
; GISEL-SSE-X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
118+
; GISEL-SSE-X64-NEXT: xorq (%rdi), %rax
119+
; GISEL-SSE-X64-NEXT: movq %rax, (%rsi)
120+
; GISEL-SSE-X64-NEXT: retq
121+
%a = load double, ptr %x
122+
%b = fneg double %a
123+
store double %b, ptr %y
124+
ret void
125+
}
126+
127+
define void @fneg_f32_mem(ptr %x, ptr %y) nounwind {
128+
; FASTISEL-X86-LABEL: fneg_f32_mem:
129+
; FASTISEL-X86: # %bb.0:
130+
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
131+
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
132+
; FASTISEL-X86-NEXT: movl $-2147483648, %edx # imm = 0x80000000
133+
; FASTISEL-X86-NEXT: xorl (%ecx), %edx
134+
; FASTISEL-X86-NEXT: movl %edx, (%eax)
135+
; FASTISEL-X86-NEXT: retl
136+
;
137+
; SDAG-X86-LABEL: fneg_f32_mem:
138+
; SDAG-X86: # %bb.0:
139+
; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
140+
; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
141+
; SDAG-X86-NEXT: movl $-2147483648, %edx # imm = 0x80000000
142+
; SDAG-X86-NEXT: xorl (%ecx), %edx
143+
; SDAG-X86-NEXT: movl %edx, (%eax)
144+
; SDAG-X86-NEXT: retl
145+
;
146+
; FASTISEL-SSE-X86-LABEL: fneg_f32_mem:
147+
; FASTISEL-SSE-X86: # %bb.0:
148+
; FASTISEL-SSE-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
149+
; FASTISEL-SSE-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
150+
; FASTISEL-SSE-X86-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
151+
; FASTISEL-SSE-X86-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
152+
; FASTISEL-SSE-X86-NEXT: movss %xmm0, (%eax)
153+
; FASTISEL-SSE-X86-NEXT: retl
154+
;
155+
; SDAG-SSE-X86-LABEL: fneg_f32_mem:
156+
; SDAG-SSE-X86: # %bb.0:
157+
; SDAG-SSE-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
158+
; SDAG-SSE-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
159+
; SDAG-SSE-X86-NEXT: movl $-2147483648, %edx # imm = 0x80000000
160+
; SDAG-SSE-X86-NEXT: xorl (%ecx), %edx
161+
; SDAG-SSE-X86-NEXT: movl %edx, (%eax)
162+
; SDAG-SSE-X86-NEXT: retl
163+
;
164+
; FASTISEL-SSE-X64-LABEL: fneg_f32_mem:
165+
; FASTISEL-SSE-X64: # %bb.0:
166+
; FASTISEL-SSE-X64-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
167+
; FASTISEL-SSE-X64-NEXT: movd %xmm0, %eax
168+
; FASTISEL-SSE-X64-NEXT: xorl $2147483648, %eax # imm = 0x80000000
169+
; FASTISEL-SSE-X64-NEXT: movd %eax, %xmm0
170+
; FASTISEL-SSE-X64-NEXT: movd %xmm0, (%rsi)
171+
; FASTISEL-SSE-X64-NEXT: retq
172+
;
173+
; SDAG-SSE-X64-LABEL: fneg_f32_mem:
174+
; SDAG-SSE-X64: # %bb.0:
175+
; SDAG-SSE-X64-NEXT: movl $-2147483648, %eax # imm = 0x80000000
176+
; SDAG-SSE-X64-NEXT: xorl (%rdi), %eax
177+
; SDAG-SSE-X64-NEXT: movl %eax, (%rsi)
178+
; SDAG-SSE-X64-NEXT: retq
179+
;
180+
; GISEL-SSE-X64-LABEL: fneg_f32_mem:
181+
; GISEL-SSE-X64: # %bb.0:
182+
; GISEL-SSE-X64-NEXT: movl $-2147483648, %eax # imm = 0x80000000
183+
; GISEL-SSE-X64-NEXT: xorl (%rdi), %eax
184+
; GISEL-SSE-X64-NEXT: movl %eax, (%rsi)
185+
; GISEL-SSE-X64-NEXT: retq
186+
%a = load float, ptr %x
187+
%b = fneg float %a
188+
store float %b, ptr %y
189+
ret void
190+
}
191+
192+
define x86_fp80 @test_fp80(x86_fp80 %a) nounwind {
193+
; X86-LABEL: test_fp80:
194+
; X86: # %bb.0:
195+
; X86-NEXT: fldt {{[0-9]+}}(%esp)
196+
; X86-NEXT: fchs
197+
; X86-NEXT: retl
198+
;
199+
; X64-LABEL: test_fp80:
200+
; X64: # %bb.0:
201+
; X64-NEXT: fldt {{[0-9]+}}(%rsp)
202+
; X64-NEXT: fchs
203+
; X64-NEXT: retq
204+
%1 = fneg x86_fp80 %a
205+
ret x86_fp80 %1
206+
}
207+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
208+
; SSE-X64: {{.*}}

0 commit comments

Comments
 (0)