This patch adds additional features and cpus from libgcc. Unfortunately we've overflowed the existing 32-bits of features so we had to add a new __cpu_features2 variable to hold the additional bits. This matches libgcc as far as I can tell.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c: In function ‘getAvailableFeatures’: /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:470:22: warning: left shift count is negative [-Wshift-count-negative] Features2 |= 1 << (F - 32); \ ^ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:474:5: note: in expansion of macro ‘setFeature’ setFeature(FEATURE_CMOV); ^~~~~~~~~~ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:470:22: warning: left shift count is negative [-Wshift-count-negative] Features2 |= 1 << (F - 32); \ ^ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:476:5: note: in expansion of macro ‘setFeature’ setFeature(FEATURE_MMX); ^~~~~~~~~~ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:470:22: warning: left shift count is negative [-Wshift-count-negative] Features2 |= 1 << (F - 32); \ ^ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:478:5: note: in expansion of macro ‘setFeature’ setFeature(FEATURE_SSE); ^~~~~~~~~~ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:470:22: warning: left shift count is negative [-Wshift-count-negative] Features2 |= 1 << (F - 32); \ ^ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:480:5: note: in expansion of macro ‘setFeature’ setFeature(FEATURE_SSE2); ^~~~~~~~~~ /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm/projects/compiler-rt/lib/builtins/cpu_model.c:470:22: warning: left shift count is negative [-Wshift-count-negative] Features2 |= 1 << (F - 32); \ ^ ...
Comment Actions
@vitalybuka, the macro in the code specifically checks the value before doing the shift. Is there something wrong with my logic?
#define setFeature(F) \
do { \ if (F < 32) \ Features |= 1 << F; \ else if (F < 64) \ Features2 |= 1 << (F - 32); \ } while (0)
compiler-rt/trunk/lib/builtins/cpu_model.c | ||
---|---|---|
467–468 ↗ | (On Diff #170297) | F = 31 This should probably be Features |= 1U << F; |