Skip to content

Commit 3ddf368

Browse files
[X86] Fix warning in cpu detection due to unsigned comparison
a15532d landed a patch that added support for detecting more AMD znver2 CPUs and cleaned up some of the surrounding code, including the znver3 detection. Since one model group is 00h-0fh, I adjusted the check to include checking if the value is greater than zero. Since the value is unsigned, this is always true and gcc warns on it. This patch removes the comparison with zero to get rid of the compiler warning.
1 parent 3aa516e commit 3ddf368

File tree

2 files changed

+2
-2
lines changed
  • compiler-rt/lib/builtins/cpu_model
  • llvm/lib/TargetParser

2 files changed

+2
-2
lines changed

compiler-rt/lib/builtins/cpu_model/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static const char *getAMDProcessorTypeAndSubtype(unsigned Family,
676676
case 25:
677677
CPU = "znver3";
678678
*Type = AMDFAM19H;
679-
if ((Model >= 0x00 && Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
679+
if ((Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
680680
(Model >= 0x30 && Model <= 0x3f) || (Model >= 0x40 && Model <= 0x4f) ||
681681
(Model >= 0x50 && Model <= 0x5f)) {
682682
// Family 19h Models 00h-0Fh (Genesis, Chagall) Zen 3

llvm/lib/TargetParser/Host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
11601160
case 25:
11611161
CPU = "znver3";
11621162
*Type = X86::AMDFAM19H;
1163-
if ((Model >= 0x00 && Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
1163+
if (Model <= 0x0f || (Model >= 0x20 && Model <= 0x2f) ||
11641164
(Model >= 0x30 && Model <= 0x3f) || (Model >= 0x40 && Model <= 0x4f) ||
11651165
(Model >= 0x50 && Model <= 0x5f)) {
11661166
// Family 19h Models 00h-0Fh (Genesis, Chagall) Zen 3

0 commit comments

Comments
 (0)