[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
Mon Nov 10 05:04:16 PST 2025
================
@@ -11665,8 +11665,20 @@ static bool evalShuffleGeneric(
if (SrcIdx < 0) {
// Zero out this element
QualType ElemTy = VT->getElementType();
- ResultElements.push_back(
- APValue(APFloat::getZero(Info.Ctx.getFloatTypeSemantics(ElemTy))));
+ if (ElemTy->isRealFloatingType()) {
+ ResultElements.push_back(
+ APValue(APFloat::getZero(Info.Ctx.getFloatTypeSemantics(ElemTy))));
+ } else if (ElemTy->isIntegerType()) {
+ unsigned BitWidth = Info.Ctx.getTypeSize(ElemTy);
+ bool IsUnsigned = ElemTy->isUnsignedIntegerType();
+ llvm::APSInt ZeroValue(BitWidth, IsUnsigned);
+ ZeroValue = 0;
+ ResultElements.push_back(APValue(ZeroValue));
----------------
RKSimon wrote:
`APValue Zero(Info.Ctx.MakeIntValue(0, ElemT));` ?
@tbaederr Would a general `Info.Ctx.MakeNullValue(ElemT))` helper make sense or is there something like that already?
https://github.com/llvm/llvm-project/pull/162005
More information about the cfe-commits
mailing list