================
@@ -15959,6 +15959,54 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const
CallExpr *E,
default:
return false;
+ case X86::BI__builtin_ia32_crc32qi:
+ case X86::BI__builtin_ia32_crc32hi:
+ case X86::BI__builtin_ia32_crc32si:
+ case X86::BI__builtin_ia32_crc32di: {
+ APSInt CRC, Data;
+ if (!EvaluateInteger(E->getArg(0), CRC, Info) ||
+ !EvaluateInteger(E->getArg(1), Data, Info))
+ return false;
+
+ // Get the input values
+ uint64_t CRCVal = CRC.getZExtValue();
+ uint64_t DataVal = Data.getZExtValue();
+
+ // Determine the data width based on the builtin
+ unsigned DataBytes;
+ switch (BuiltinOp) {
+ case X86::BI__builtin_ia32_crc32qi:
+ DataBytes = 1;
+ break;
+ case X86::BI__builtin_ia32_crc32hi:
+ DataBytes = 2;
+ break;
+ case X86::BI__builtin_ia32_crc32si:
+ DataBytes = 4;
+ break;
+ case X86::BI__builtin_ia32_crc32di:
+ DataBytes = 8;
+ break;
+ default:
+ llvm_unreachable("Unknown CRC32 builtin");
+ }
+
+ // CRC32C polynomial (iSCSI polynomial, bit-reversed)
+ static const uint32_t CRC32C_POLY = 0x82F63B78;
+
+ // Process each byte
+ uint32_t Result = static_cast<uint32_t>(CRCVal);
+ for (unsigned i = 0; i < DataBytes; ++i) {
----------------
raventid wrote:
Fixed by
https://github.com/llvm/llvm-project/pull/173908/changes/e06b49fd965ade188b3ff7fe9b0a77443050064d
https://github.com/llvm/llvm-project/pull/173908
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits