[llvm] [CGP]: Optimize mul.overflow. (PR #148343)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 12:44:51 PDT 2025


================
@@ -395,7 +446,21 @@ define { i128, i8 } @i128_checked_mul(i128 %x, i128 %y) {
 
 define { i128, i8 } @i128_overflowing_mul(i128 %x, i128 %y) {
 ; CHECK-LABEL: i128_overflowing_mul:
-; CHECK:       // %bb.0:
+; CHECK:       // %bb.0: // %overflow.entry
+; CHECK-NEXT:    cmp x1, x0, asr #63
+; CHECK-NEXT:    b.ne .LBB22_3
+; CHECK-NEXT:  // %bb.1: // %overflow.entry
+; CHECK-NEXT:    asr x8, x2, #63
+; CHECK-NEXT:    cmp x3, x8
+; CHECK-NEXT:    b.ne .LBB22_3
----------------
aengelke wrote:

Is it possible to fold these into a single branch, maybe by reducing the number of covered cases a bit further (e.g., only positive numbers)?

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


More information about the llvm-commits mailing list