-
Notifications
You must be signed in to change notification settings - Fork 171
Closed
awslabs/aws-checksums
#72Labels
bugThis issue is a bug.This issue is a bug.needs-reviewThis issue or pull request needs review from a core team member.This issue or pull request needs review from a core team member.p2This is a standard priority issueThis is a standard priority issue
Description
Describe the bug
s_has_vpclmulqdq() is not checking the correct bit to detect VPCLMULQDQ.
According to the documentation it is bit 10. (code is checking bit 20).
Input Output
EAX=07H, ECX=0 ECX[bit 10] VPCLMULQDQ
EAX=07H, ECX=0 EBX[bit 16] AVX512F
EAX=07H, ECX=0 EBX[bit 31] AVX512VL
https://en.wikichip.org/wiki/x86/vpclmulqdq
Expected Behavior
s_has_vpclmulqdq() should return TRUE if the CPU supports it.
Current Behavior
s_has_vpclmulqdq() returns FALSE incorrectly.
Reproduction Steps
call s_has_vpclmulqdq() on any modern IA system.
Possible Solution
diff --git a/source/arch/intel/cpuid.c b/source/arch/intel/cpuid.c
index 44fdff0..465fccd 100644
--- a/source/arch/intel/cpuid.c
+++ b/source/arch/intel/cpuid.c
@@ -116,8 +116,8 @@ static bool s_has_bmi2(void) {
static bool s_has_vpclmulqdq(void) {
uint32_t abcd[4];
/* Check VPCLMULQDQ:
- * CPUID.(EAX=07H, ECX=0H):ECX.VPCLMULQDQ[bit 20]==1 */
- uint32_t vpclmulqdq_mask = (1 << 20);
+ * CPUID.(EAX=07H, ECX=0H):ECX.VPCLMULQDQ[bit 10]==1 */
+ uint32_t vpclmulqdq_mask = (1 << 10);
aws_run_cpuid(7, 0, abcd);
if ((abcd[2] & vpclmulqdq_mask) != vpclmulqdq_mask) {
return false;
Additional Information/Context
No response
aws-c-common version used
latest mainline branch
Compiler and version used
gcc version 11.4.1 20231218
Operating System and version
CentOS9
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.needs-reviewThis issue or pull request needs review from a core team member.This issue or pull request needs review from a core team member.p2This is a standard priority issueThis is a standard priority issue