[clang] [X86][Clang] Add AVX512 Integer Comparison Intrinsics for constexpr Evaluation (PR #164026)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 23 02:02:51 PDT 2025
================
@@ -3101,6 +3101,61 @@ static bool interp__builtin_vec_set(InterpState &S, CodePtr OpPC,
return true;
}
+static bool evalICmpImm(const uint8_t imm, APSInt A, APSInt B,
+ bool IsUnsigned) {
+ switch (imm & 0x7) {
+ case 0x00: // _MM_CMPINT_EQ
+ return (A == B);
+ case 0x01: // _MM_CMPINT_LT
+ return IsUnsigned ? A.ult(B) : A.slt(B);
+ case 0x02: // _MM_CMPINT_LE
+ return IsUnsigned ? A.ule(B) : A.sle(B);
+ case 0x03: // _MM_CMPINT_FALSE
+ return false;
+ case 0x04: // _MM_CMPINT_NE
+ return (A != B);
+ case 0x05: // _MM_CMPINT_NLT
+ return IsUnsigned ? A.ugt(B) : A.sgt(B);
+ case 0x06: // _MM_CMPINT_NLE
+ return IsUnsigned ? A.uge(B) : A.sge(B);
+ case 0x07: // _MM_CMPINT_TRUE
+ return true;
+ default:
+ llvm_unreachable("Invalid Op");
+ }
+}
+
+static bool interp__builtin_cmp_mask(InterpState &S, CodePtr OpPC,
----------------
RKSimon wrote:
interp__builtin_cmp_mask -> interp__builtin_ia32_cmp_mask
https://github.com/llvm/llvm-project/pull/164026
More information about the cfe-commits
mailing list