Skip to content

Conversation

@tannergooding
Copy link
Member

#40167 redid part of the CPUID logic as part of exposing X86Base.CpuId. As part of that, the check for BMI1/2 was updated to use an incorrect index.

This fixes the logic to use 4 named constants during lookup to help avoid this issue.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 10, 2020
@tannergooding
Copy link
Member Author

CC. @jkotas

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks

__cpuid(cpuidInfo, 0x80000001);

if ((cpuidInfo[3] & (1 << 5)) != 0) // LZCNT
if ((cpuidInfo[ECX] & (1 << 5)) != 0) // LZCNT
Copy link
Contributor

Choose a reason for hiding this comment

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

The commit description only mentions changes for BMI1/2.
Is this change from 3 to ECX=2 for LZCNT intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, spotted the comment

    //      LZCNT - ECX bit 5

on line 1351

@tannergooding tannergooding changed the title Fixing an issue with the CPUID check for BMI1/BMI2 Fixing an issue with the CPUID check for BMI1/BMI2 and LZCNT Sep 10, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
@tannergooding tannergooding deleted the cpuid branch July 1, 2025 14:39
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants