[PATCH] D98152: [InstCombine] Canonicalize SPF to min/max intrinsics

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 10:03:19 PST 2021


nikic added a comment.

In D98152#2614366 <https://reviews.llvm.org/D98152#2614366>, @spatel wrote:

> Thanks for sharing this! I added a couple of 'not' op enhancements to instcombine, so we should be slightly closer now.

Thanks! I've updated with new results. It looks like we still need a few more folds for not to reach parity.



================
Comment at: llvm/test/Transforms/InstCombine/max-of-nots.ll:85
+; CHECK-NEXT:    [[TMP2:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[Z]])
+; CHECK-NEXT:    [[R_V:%.*]] = select i1 [[CMPYX]], i8 [[TMP1]], i8 [[TMP2]]
 ; CHECK-NEXT:    [[R:%.*]] = xor i8 [[R_V]], -1
----------------
Still regresses


================
Comment at: llvm/test/Transforms/InstCombine/max-of-nots.ll:111
+; CHECK-NEXT:    [[CMPYX:%.*]] = icmp ult i8 [[Y]], [[X]]
+; CHECK-NEXT:    [[R:%.*]] = select i1 [[CMPYX]], i8 [[TMP1]], i8 [[TMP2]]
 ; CHECK-NEXT:    call void @extra_use(i8 [[NX]])
----------------
Still regresses


================
Comment at: llvm/test/Transforms/InstCombine/max-of-nots.ll:198
+; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @llvm.smax.i32(i32 [[NOT_VALUE]], i32 [[NOT_Y]])
+; CHECK-NEXT:    [[MIN:%.*]] = xor i32 [[TMP1]], -1
 ; CHECK-NEXT:    ret i32 [[MIN]]
----------------
Still regresses -- in this case we'd want to push the not into NOT_VALUE and drop the other two.


================
Comment at: llvm/test/Transforms/InstCombine/max-of-nots.ll:356
+; CHECK-NEXT:    [[YK:%.*]] = sub i8 [[NOTB]], [[K]]
+; CHECK-NEXT:    call void @use(i8 [[CK]], i8 [[MK]], i8 [[YK]], i8 [[K]])
 ; CHECK-NEXT:    ret void
----------------
These all still regress


================
Comment at: llvm/test/Transforms/InstCombine/max-of-nots.ll:9
+; CHECK-NEXT:    [[TMP1:%.*]] = call <2 x i32> @llvm.umin.v2i32(<2 x i32> [[NOTX]], <2 x i32> [[NOTY]])
+; CHECK-NEXT:    ret <2 x i32> [[TMP1]]
 ;
----------------
nikic wrote:
> Regression
Fixed


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98152/new/

https://reviews.llvm.org/D98152



More information about the llvm-commits mailing list