-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: fix arm64 issue around flags and neg with contained operand #113391
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
If `neg` has a contained operand (`mul`) it cannot set flags. Fixes dotnet#113320
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.
Pull Request Overview
This PR introduces a regression test to verify the JIT fix addressing an arm64 issue where a neg instruction with a contained operand (mul) cannot set flags.
- Adds a new test file to capture the faulty behavior
- Verifies JIT behavior on Arm64 in both Debug and Release builds
Also fixes issue I ran into in #112998. @dotnet/jit-contrib PTAL |
{ | ||
return true; | ||
} | ||
|
||
// We do not support setting zero flag for madd/msub. | ||
if (OperIs(GT_NEG) && (!gtGetOp1()->OperIs(GT_MUL) || !gtGetOp1()->isContained())) |
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.
I presume just if (OperIs(GT_NEG) && !gtGetOp1()->isContained())
would be enough since NEG can't contain anything. Also, we should've had a separate node type for MUL+ADD/SUB (likely my fault)
@@ -19978,17 +19978,21 @@ bool GenTree::SupportsSettingZeroFlag() | |||
} | |||
#endif | |||
#elif defined(TARGET_ARM64) | |||
if (OperIs(GT_AND, GT_AND_NOT, GT_NEG)) | |||
if (OperIs(GT_AND, GT_AND_NOT)) | |||
{ | |||
return true; | |||
} | |||
|
|||
// We do not support setting zero flag for madd/msub. |
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 do not support setting zero flag for madd/msub. | |
// We do not support setting zero flag for mneg/madd/msub. |
feel free to skip to avoid CI rerun...
If
neg
has a contained operand (mul
) it cannot set flags.Fixes #113320