[llvm] [InstCombine] Simplification for (-a * b) / (a * b). (PR #71768)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 05:39:09 PST 2023


================
@@ -1432,6 +1432,47 @@ define <2 x i8> @sdiv_sdiv_mul_nsw(<2 x i8> %x, <2 x i8> %y, <2 x i8> %z) {
   ret <2 x i8> %r
 }
 
+; -(X * Y) / (X * Y) --> -1
+define i32 @sdiv_neg_mul_mul(i32 %0, i32 %1) {
+; CHECK-LABEL: @sdiv_neg_mul_mul(
+; CHECK-NEXT:    ret i32 -1
----------------
nikic wrote:

These don't look properly generated -- shouldn't there be an extra `;` line here?

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


More information about the llvm-commits mailing list