[X86] Correct the implementation of the testFeature macro in getIntelProcessorTypeAnd...
authorCraig Topper <craig.topper@intel.com>
Fri, 21 Aug 2020 06:45:34 +0000 (23:45 -0700)
committerCraig Topper <craig.topper@intel.com>
Fri, 21 Aug 2020 06:50:45 +0000 (23:50 -0700)
commitdf9a9bb7beb7bc04ca4188fe0e527baac2900ff1
treec2d6c0a836cc2c2340d6df355759d18b3565fcce
parent927da43ade12fffc8077c248e0243711071b2094
[X86] Correct the implementation of the testFeature macro in getIntelProcessorTypeAndSubtype to do a proper bit test.

Instead of ANDing with a one hot mask representing the bit to
be tested, we were ANDing with just the bit number. This tests
multiple bits none of them the correct one.

This caused skylake-avx512, cascadelake and cooperlake to all
be misdetected. Based on experiments with the Intel SDE, it seems
that all of these CPUs are being detected as being cooperlake.
This is bad since its the newest CPU of the 3.
compiler-rt/lib/builtins/cpu_model.c