[clang] First draft: [Clang] Add constant evaluation support for x86 psadbw/p… (PR #169253)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 25 04:59:26 PST 2025
================
@@ -12078,6 +12080,54 @@ static bool evalPackBuiltin(const CallExpr *E, EvalInfo &Info, APValue &Result,
return true;
}
+static bool EvaluatePSADBW128(const CallExpr *E, EvalInfo &Info, APValue &Result) {
+ // 1) Evaluate the arguments into APValues
+ APValue A, B;
+ if (!Evaluate(A, Info, E->getArg(0)) ||
+ !Evaluate(B, Info, E->getArg(1)))
+ return false;
+
+ if (!A.isVector() || !B.isVector())
----------------
RKSimon wrote:
The ia32_psadbw builtins have fixed types - don't bother with so much isVector/getVectorLength checks - `assert((getVectorLength() % 16) == 0)` should be enough.
https://github.com/llvm/llvm-project/pull/169253
More information about the cfe-commits
mailing list