-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[X86][GlobalIsel] support G_FABS #136718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[X86][GlobalIsel] support G_FABS #136718
Changes from 12 commits
d4475cb
22e2c83
0ed32a7
8221bc6
6a58699
db0e1cb
f35b674
2782568
860903d
d4d3d44
4838b22
63eebe0
a718a5b
e57ab03
f5e5274
ac44b20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=+x87,-sse2,-sse | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=+x87,-sse2,-sse -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=+x87,-sse2,-sse -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse2,-sse | FileCheck %s --check-prefixes=X86 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse2,-sse -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X86 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse2,-sse -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86 | ||
|
||
|
|
||
| define x86_fp80 @test_x86_fp80_abs(x86_fp80 %arg) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably would be nice to see how we handle floats and double without SSE. |
||
| ; X64-LABEL: test_x86_fp80_abs: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,43 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87 | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=-x87 | FileCheck %s --check-prefixes=X86 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=-x87 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=FASTISEL-X86 | ||
|
|
||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87,+sse,+sse2 | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87,+sse,+sse2 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64 | ||
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87,+sse,+sse2 -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=-x87,+sse,+sse2 | FileCheck %s --check-prefixes=X86 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=-x87,+sse,+sse2 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=FASTISEL-X86 | ||
| ; RUN: llc < %s -mtriple=i686-- -mattr=-x87,+sse,+sse2 -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X86 | ||
|
|
||
| define float @test_float_abs(float %arg) { | ||
| ; X64-LABEL: test_float_abs: | ||
| ; X64: # %bb.0: | ||
| ; X64-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; X64-NEXT: retq | ||
| ; | ||
| ; GISEL-X64-LABEL: test_float_abs: | ||
| ; GISEL-X64: # %bb.0: | ||
| ; GISEL-X64-NEXT: movd %xmm0, %eax | ||
| ; GISEL-X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF | ||
| ; GISEL-X64-NEXT: movd %eax, %xmm0 | ||
| ; GISEL-X64-NEXT: retq | ||
| ; | ||
| ; X86-LABEL: test_float_abs: | ||
| ; X86: # %bb.0: | ||
| ; X86-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF | ||
| ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax | ||
| ; X86-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero | ||
| ; X86-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0 | ||
| ; X86-NEXT: movd %xmm0, %eax | ||
| ; X86-NEXT: retl | ||
| ; | ||
| ; FASTISEL-X86-LABEL: test_float_abs: | ||
| ; FASTISEL-X86: # %bb.0: | ||
| ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
| ; FASTISEL-X86-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF | ||
| ; FASTISEL-X86-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero | ||
| ; FASTISEL-X86-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0 | ||
| ; FASTISEL-X86-NEXT: movd %xmm0, %eax | ||
| ; FASTISEL-X86-NEXT: retl | ||
| ; | ||
| ; GISEL-X86-LABEL: test_float_abs: | ||
| ; GISEL-X86: # %bb.0: | ||
| ; GISEL-X86-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF | ||
| ; GISEL-X86-NEXT: andl {{[0-9]+}}(%esp), %eax | ||
| ; GISEL-X86-NEXT: retl | ||
| %abs = tail call float @llvm.fabs.f32(float %arg) | ||
| ret float %abs | ||
| } | ||
|
|
@@ -32,6 +48,14 @@ define double @test_double_abs(double %arg) { | |
| ; X64-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; X64-NEXT: retq | ||
| ; | ||
| ; GISEL-X64-LABEL: test_double_abs: | ||
| ; GISEL-X64: # %bb.0: | ||
| ; GISEL-X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF | ||
| ; GISEL-X64-NEXT: movq %xmm0, %rcx | ||
| ; GISEL-X64-NEXT: andq %rax, %rcx | ||
| ; GISEL-X64-NEXT: movq %rcx, %xmm0 | ||
| ; GISEL-X64-NEXT: retq | ||
| ; | ||
| ; X86-LABEL: test_double_abs: | ||
| ; X86: # %bb.0: | ||
| ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
|
|
@@ -41,10 +65,30 @@ define double @test_double_abs(double %arg) { | |
| ; | ||
| ; FASTISEL-X86-LABEL: test_double_abs: | ||
| ; FASTISEL-X86: # %bb.0: | ||
| ; FASTISEL-X86-NEXT: pushl %ebp | ||
| ; FASTISEL-X86-NEXT: .cfi_def_cfa_offset 8 | ||
|
||
| ; FASTISEL-X86-NEXT: .cfi_offset %ebp, -8 | ||
| ; FASTISEL-X86-NEXT: movl %esp, %ebp | ||
| ; FASTISEL-X86-NEXT: .cfi_def_cfa_register %ebp | ||
| ; FASTISEL-X86-NEXT: andl $-8, %esp | ||
| ; FASTISEL-X86-NEXT: subl $8, %esp | ||
| ; FASTISEL-X86-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero | ||
| ; FASTISEL-X86-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0 | ||
| ; FASTISEL-X86-NEXT: movlps %xmm0, (%esp) | ||
| ; FASTISEL-X86-NEXT: movl (%esp), %eax | ||
| ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx | ||
| ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
| ; FASTISEL-X86-NEXT: andl $2147483647, %edx # imm = 0x7FFFFFFF | ||
| ; FASTISEL-X86-NEXT: movl %ebp, %esp | ||
| ; FASTISEL-X86-NEXT: popl %ebp | ||
| ; FASTISEL-X86-NEXT: .cfi_def_cfa %esp, 4 | ||
| ; FASTISEL-X86-NEXT: retl | ||
| ; | ||
| ; GISEL-X86-LABEL: test_double_abs: | ||
| ; GISEL-X86: # %bb.0: | ||
| ; GISEL-X86-NEXT: movl $-1, %eax | ||
| ; GISEL-X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF | ||
| ; GISEL-X86-NEXT: andl {{[0-9]+}}(%esp), %eax | ||
| ; GISEL-X86-NEXT: andl {{[0-9]+}}(%esp), %edx | ||
| ; GISEL-X86-NEXT: retl | ||
| %abs = tail call double @llvm.fabs.f64(double %arg) | ||
| ret double %abs | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
lowergenerate the selectable code? Then we probably can add tests forfloatanddoubleas well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+x87,-sse,-sse2restricts SDAG Isel for float and double. It requires SSE.exact message
SSE register return with SSE disabled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that error comes from the globalisel code, not sdag. You can also just stop testing with those features forced off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use X87 with and without SSE for
s80. So there is no need forcing-sse.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.