[llvm] [llubi] Implement intrinsics for integer arithmetic/bit manipulation (PR #193702)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 02:58:47 PDT 2026
================
@@ -381,6 +472,171 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
}
return AnyValue();
}
+ case Intrinsic::ssa_copy:
+ case Intrinsic::expect:
+ case Intrinsic::expect_with_probability:
+ return getValue(CB.getArgOperand(0));
+ case Intrinsic::donothing:
+ return AnyValue();
+ case Intrinsic::vscale:
+ return APInt(RetTy->getScalarSizeInBits(), Ctx.getVScale());
+ case Intrinsic::abs: {
+ const bool IsIntMinPoison =
+ getBooleanNonPoison(getValue(CB.getArgOperand(1)).asBoolean());
+ return visitIntUnOpWithResult(CB, [&](const APInt &Operand) -> AnyValue {
+ if (IsIntMinPoison && Operand.isMinSignedValue())
+ return AnyValue::poison();
+ return Operand.abs();
+ });
+ }
+ case Intrinsic::smax: {
+ return visitIntBinOpWithResult(
+ CB, [](const APInt &LHS, const APInt &RHS) -> AnyValue {
+ return APIntOps::smax(LHS, RHS);
+ });
+ }
+ case Intrinsic::smin: {
+ return visitIntBinOpWithResult(
+ CB, [](const APInt &LHS, const APInt &RHS) -> AnyValue {
+ return APIntOps::smin(LHS, RHS);
+ });
+ }
+ case Intrinsic::umax: {
+ return visitIntBinOpWithResult(
+ CB, [](const APInt &LHS, const APInt &RHS) -> AnyValue {
+ return APIntOps::umax(LHS, RHS);
+ });
+ }
+ case Intrinsic::umin: {
+ return visitIntBinOpWithResult(
+ CB, [](const APInt &LHS, const APInt &RHS) -> AnyValue {
+ return APIntOps::umin(LHS, RHS);
+ });
+ }
+ case Intrinsic::scmp:
+ case Intrinsic::ucmp: {
+ std::uint32_t BitWidth = RetTy->getScalarSizeInBits();
----------------
nikic wrote:
```suggestion
unsigned BitWidth = RetTy->getScalarSizeInBits();
```
https://github.com/llvm/llvm-project/pull/193702
More information about the llvm-commits
mailing list