[llvm] [SystemZ] Allow forming overflow op for i128 (PR #153557)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 05:28:25 PDT 2025


================
@@ -523,7 +523,7 @@ class SystemZTargetLowering : public TargetLowering {
                             bool MathUsed) const override {
     // Form add and sub with overflow intrinsics regardless of any extra
     // users of the math result.
-    return VT == MVT::i32 || VT == MVT::i64;
+    return VT == MVT::i32 || VT == MVT::i64 || VT == MVT::i128;
----------------
nikic wrote:

I pushed additional check lines without z13. And here is the diff on top if we only do this for legal types: https://gist.github.com/nikic/6f84e1c7090a8c356f93e27fe0023a62

It looks like forming uaddo still results in a much better expansion even if we don't have legal i128. For usubo we get the same expansion either way (possibly there is a missed optimization opportunity in there?)

https://github.com/llvm/llvm-project/pull/153557


More information about the llvm-commits mailing list