[clang] [Headers][X86] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow PALIGNR byte shift intrinsics to be used in constexpr (PR #162005)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 11 01:56:34 PST 2025
================
@@ -13097,6 +13106,33 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
return Success(APValue(ResultElements.data(), ResultElements.size()), E);
}
+
+ case X86::BI__builtin_ia32_palignr128:
+ case X86::BI__builtin_ia32_palignr256:
+ case X86::BI__builtin_ia32_palignr512: {
+ APValue R;
+ if (!evalShuffleGeneric(Info, E, R, [](unsigned DstIdx, unsigned Shift) {
+ // Default to -1 → zero-fill this destination element
+ unsigned VecIdx = 1;
+ int ElemIdx = -1;
+
+ int Lane = DstIdx / 16;
+ int Offset = DstIdx % 16;
+
+ // Elements come from VecB first, then VecA after the shift boundary
+ unsigned ShiftedIdx = Offset + Shift;
----------------
RKSimon wrote:
```suggestion
unsigned ShiftedIdx = Offset + (Shift & 0xFF);
```
https://github.com/llvm/llvm-project/pull/162005
More information about the cfe-commits
mailing list