-
Notifications
You must be signed in to change notification settings - Fork 14.3k
PowerPC/VSX: Select FMINNUM_IEEE and FMAXNUM_IEEE #112195
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
Changes from all commits
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 |
---|---|---|
|
@@ -2722,6 +2722,15 @@ def : Pat<(v2f64 (any_fmaxnum v2f64:$src1, v2f64:$src2)), | |
def : Pat<(v2f64 (any_fminnum v2f64:$src1, v2f64:$src2)), | ||
(v2f64 (XVMINDP $src1, $src2))>; | ||
|
||
def : Pat<(v4f32 (fmaxnum_ieee v4f32:$src1, v4f32:$src2)), | ||
(v4f32 (XVMAXSP $src1, $src2))>; | ||
def : Pat<(v4f32 (fminnum_ieee v4f32:$src1, v4f32:$src2)), | ||
(v4f32 (XVMINSP $src1, $src2))>; | ||
def : Pat<(v2f64 (fmaxnum_ieee v2f64:$src1, v2f64:$src2)), | ||
(v2f64 (XVMAXDP $src1, $src2))>; | ||
def : Pat<(v2f64 (fminnum_ieee v2f64:$src1, v2f64:$src2)), | ||
(v2f64 (XVMINDP $src1, $src2))>; | ||
|
||
// f32 abs | ||
def : Pat<(f32 (fabs f32:$S)), | ||
(f32 (COPY_TO_REGCLASS (XSABSDP | ||
|
@@ -2735,39 +2744,23 @@ def : Pat<(f32 (fneg (fabs f32:$S))), | |
// f32 Min. | ||
def : Pat<(f32 (fminnum_ieee f32:$A, f32:$B)), | ||
(f32 FpMinMax.F32Min)>; | ||
def : Pat<(f32 (fminnum_ieee (fcanonicalize f32:$A), f32:$B)), | ||
(f32 FpMinMax.F32Min)>; | ||
def : Pat<(f32 (fminnum_ieee f32:$A, (fcanonicalize f32:$B))), | ||
(f32 FpMinMax.F32Min)>; | ||
Comment on lines
-2738
to
-2741
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. Don't understand these patterns folding out a canonicalize on each individual operand. If FpMinMax.F32Min has the IEEE snan behavior, both need to be guaranteed quiet. Can these be removed as a precommit? 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. Just remove them will fail some current test cases. |
||
def : Pat<(f32 (fminnum_ieee (fcanonicalize f32:$A), (fcanonicalize f32:$B))), | ||
def : Pat<(f32 (fminnum f32:$A, f32:$B)), | ||
(f32 FpMinMax.F32Min)>; | ||
// F32 Max. | ||
def : Pat<(f32 (fmaxnum_ieee f32:$A, f32:$B)), | ||
(f32 FpMinMax.F32Max)>; | ||
def : Pat<(f32 (fmaxnum_ieee (fcanonicalize f32:$A), f32:$B)), | ||
(f32 FpMinMax.F32Max)>; | ||
def : Pat<(f32 (fmaxnum_ieee f32:$A, (fcanonicalize f32:$B))), | ||
(f32 FpMinMax.F32Max)>; | ||
def : Pat<(f32 (fmaxnum_ieee (fcanonicalize f32:$A), (fcanonicalize f32:$B))), | ||
def : Pat<(f32 (fmaxnum f32:$A, f32:$B)), | ||
(f32 FpMinMax.F32Max)>; | ||
wzssyqa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// f64 Min. | ||
def : Pat<(f64 (fminnum_ieee f64:$A, f64:$B)), | ||
(f64 (XSMINDP $A, $B))>; | ||
def : Pat<(f64 (fminnum_ieee (fcanonicalize f64:$A), f64:$B)), | ||
(f64 (XSMINDP $A, $B))>; | ||
def : Pat<(f64 (fminnum_ieee f64:$A, (fcanonicalize f64:$B))), | ||
(f64 (XSMINDP $A, $B))>; | ||
def : Pat<(f64 (fminnum_ieee (fcanonicalize f64:$A), (fcanonicalize f64:$B))), | ||
def : Pat<(f64 (fminnum f64:$A, f64:$B)), | ||
(f64 (XSMINDP $A, $B))>; | ||
// f64 Max. | ||
def : Pat<(f64 (fmaxnum_ieee f64:$A, f64:$B)), | ||
(f64 (XSMAXDP $A, $B))>; | ||
def : Pat<(f64 (fmaxnum_ieee (fcanonicalize f64:$A), f64:$B)), | ||
(f64 (XSMAXDP $A, $B))>; | ||
def : Pat<(f64 (fmaxnum_ieee f64:$A, (fcanonicalize f64:$B))), | ||
(f64 (XSMAXDP $A, $B))>; | ||
def : Pat<(f64 (fmaxnum_ieee (fcanonicalize f64:$A), (fcanonicalize f64:$B))), | ||
def : Pat<(f64 (fmaxnum f64:$A, f64:$B)), | ||
(f64 (XSMAXDP $A, $B))>; | ||
|
||
def : Pat<(int_ppc_vsx_stxvd2x_be v2f64:$rS, ForceXForm:$dst), | ||
|
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.
This is beyond what the title suggests. Do all subtargets have the ignore signaling behavior, and only vsx has the ieee behavior?
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.
It's a bootstrap problem:
If we fix
FMAXNUM_IEEE
only, some of test cases will fail.The problem is that currently
FMINNUM
is expanded toFCANONICALIZE + FCANONICALIZE + FMINNUM_IEEE
while FCANONICALIZE is not defined by here: I will submit it in a future patch.
It seems that PowerPC doesn't have min/max operation in its scale part.
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.
If we fix
expandFMINNUMFMAXNUM
first, some PowerPC test cases will fails with complains that we cannot legalizeFMINNUM_IEEE
.Uh oh!
There was an error while loading. Please reload this page.
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.
So my plan to break this bootstrap problem is:
Legal
to ISD::FMINNUM for PowerPC/VSX.add FMINNUM_IEEE to PowerPC/VSX.
FCANONICALIZE
support to PowerPC/VSX.FCANONICALIZE
ifFMINNUM_IEEE
is available.fmininumnum
to PowerPC/VSX.setOperationAction(ISD::FMINNUM, MVT::f32, Legal);
from PowerPC/VSX.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.
My concern with the break down here is that it will leave things in an invalid state. Shouldn't step 1-4 be done together for the compiler behaviour to be valid? At the minimun, step 4, test casess should be added with the corresponding code change?
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.
Let's ask @arsenm. I was asked to split these changes when I was working on other architectures.
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.
@arsenm ping