-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[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
Merged
Merged
[X86][GlobalIsel] support G_FABS #136718
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d4475cb
[X86][GlobalIsel] support fabs for f80
22e2c83
add float and double
0ed32a7
update test
8221bc6
remove s8
6a58699
update fabs for f32 and f64
db0e1cb
fix indent
f35b674
add x87 specific runs
2782568
fix tst
860903d
remove unused marker
d4d3d44
fix clang format
4838b22
fix clang format
63eebe0
remove const pool
a718a5b
remove noise
e57ab03
add fallback
f5e5274
format extension issue
ac44b20
Merge branch 'main' into gisel_fabs
RKSimon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,48 @@ | ||
; 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=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=x86_64-- -mattr=+x87,-sse2,-sse -fast-isel | 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,SDAG-ISEL | ||
; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse2,-sse -fast-isel | FileCheck %s --check-prefixes=X86,Fast-ISEL | ||
; RUN: llc < %s -mtriple=i686-- -mattr=+x87,-sse2,-sse -global-isel -global-isel-abort=0 | FileCheck %s --check-prefixes=X86,GISEL-ISEL | ||
|
||
define void @test_float_abs(ptr %argptr) { | ||
; SDAG-ISEL-LABEL: test_float_abs: | ||
; SDAG-ISEL: # %bb.0: | ||
; SDAG-ISEL-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
; SDAG-ISEL-NEXT: andb $127, 3(%eax) | ||
; SDAG-ISEL-NEXT: retl | ||
; | ||
; Fast-ISEL-LABEL: test_float_abs: | ||
; Fast-ISEL: # %bb.0: | ||
; Fast-ISEL-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
; Fast-ISEL-NEXT: andb $127, 3(%eax) | ||
; Fast-ISEL-NEXT: retl | ||
; | ||
; GISEL-ISEL-LABEL: test_float_abs: | ||
; GISEL-ISEL: # %bb.0: | ||
; GISEL-ISEL-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
; GISEL-ISEL-NEXT: andl $2147483647, (%eax) # imm = 0x7FFFFFFF | ||
; GISEL-ISEL-NEXT: retl | ||
%arg = load float, float* %argptr | ||
%abs = tail call float @llvm.fabs.f32(float %arg) | ||
store float %abs, ptr %argptr | ||
ret void | ||
} | ||
|
||
define void @test_double_abs(ptr %argptr) { | ||
; X86-LABEL: test_double_abs: | ||
; X86: # %bb.0: | ||
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
; X86-NEXT: fldl (%eax) | ||
; X86-NEXT: fabs | ||
; X86-NEXT: fstpl (%eax) | ||
; X86-NEXT: retl | ||
%arg = load double, double* %argptr | ||
%abs = tail call double @llvm.fabs.f64(double %arg) | ||
store double %abs, double* %argptr | ||
ret void | ||
} | ||
|
||
define x86_fp80 @test_x86_fp80_abs(x86_fp80 %arg) { | ||
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: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
lower
generate the selectable code? Then we probably can add tests forfloat
anddouble
as 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,-sse2
restricts 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.