-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AArch64][GlobalISel] Legalize s16 G_FCONSTANT to avoid widening to G_CONSTANT #161205
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
Conversation
@llvm/pr-subscribers-llvm-globalisel @llvm/pr-subscribers-backend-aarch64 Author: Ryan Cowan (HolyMolyCowMan) ChangesWhen widening a This PR legalizes Full diff: https://github.com/llvm/llvm-project/pull/161205.diff 1 Files Affected:
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 7ee54c5932b15..1593f32d1fc6c 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -678,8 +678,8 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
.widenScalarToNextPow2(0)
.clampScalar(0, s8, s64);
getActionDefinitionsBuilder(G_FCONSTANT)
- .legalFor({s32, s64, s128})
- .legalFor(HasFP16, {s16})
+ // Always legalize s16 to prevent G_FCONSTANT being widened to G_CONSTANT
+ .legalFor({s16, s32, s64, s128})
.clampScalar(0, MinFPScalar, s128);
// FIXME: fix moreElementsToNextPow2
|
Yeah this needs to address the regbank regressions. |
By moving the |
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.
LGTM
…_CONSTANT (#161205) When widening a `G_FCONSTANT` it is converted to a `G_CONSTANT` to avoid loss in accuracy (see #56454). This means that some folds such as `G_FPEXT(G_FCONSTANT)` fail to work when the scalar has been widened. This PR legalizes `s16`s by default in line with how s16 `G_CONSTANT`s are treated.
When widening a
G_FCONSTANT
it is converted to aG_CONSTANT
to avoid loss in accuracy (see #56454). This means that some folds such asG_FPEXT(G_FCONSTANT)
fail to work when the scalar has been widened.This PR legalizes
s16
s by default in line with how s16G_CONSTANT
s are treated.