Skip to content

Conversation

@DeepakRajendrakumaran
Copy link
Contributor

@DeepakRajendrakumaran DeepakRajendrakumaran commented Aug 13, 2024

This Fixes #106142

Rotate requires the count to be normalized depending on base type. This was already done with f251b17 but there was a behavioral mismatch between x86 and x64 with the mod(%) operator

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Aug 13, 2024
@JulieLeeMSFT
Copy link
Member

@tannergooding @jakobbotsch , please review the code before RC1 snap.
Cc @dotnet/jit-contrib .

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the test?

@JulieLeeMSFT
Copy link
Member

Thanks for the work. If tests pass, I will merge today.

case GT_ROL:
{
// Normalize the "rotate by" value
arg1 %= (sizeof(TBase) * BITS_PER_BYTE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the behavioral difference for negative inputs, since %= is remainder of truncating division and so handles signed values differently?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. It was different for negative inputs. For eg. one of the test case has the rotate count show up as -2 in here.

@tannergooding tannergooding merged commit 0fbc04b into dotnet:main Aug 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Bad codegen with Avx512F.VL.RotateLeftVariable and Avx512F.VL.RotateRightVariable on win-x86

4 participants