================
@@ -3802,6 +3802,20 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC,
const CallExpr *Call,
return interp__builtin_ia32_movmsk_op(S, OpPC, Call);
}
+ case X86::BI__builtin_ia32_psignb128:
+ case X86::BI__builtin_ia32_psignb256:
+ case X86::BI__builtin_ia32_psignw128:
+ case X86::BI__builtin_ia32_psignw256:
+ case X86::BI__builtin_ia32_psignd128:
+ case X86::BI__builtin_ia32_psignd256:
+ return interp__builtin_elementwise_int_binop(
+ S, OpPC, Call, [](const APSInt &AElem, const APSInt &BElem) -> APInt {
+ return BElem[BElem.getBitWidth() - 1]
+ ? static_cast<const APInt &>(-AElem)
+ : BElem.isZero() ? APInt(AElem.getBitWidth(), 0)
+ : static_cast<const APInt &>(AElem);
+ });
----------------
RKSimon wrote:
You might be able to just do this (we don't use anything from the APSInt at all
so we can tweak the callback to take APInt refs):
```
return interp__builtin_elementwise_int_binop(
S, OpPC, Call, [](const APInt &AElem, const APInt &BElem) {
if (BElem.isZero())
return APInt::getZero(AElem.getBitWidth());
if (BElem.isNegative())
return -AElem;
return AElem;
});
```
https://github.com/llvm/llvm-project/pull/163685
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits