Skip to content

Commit 641ae74

Browse files
committed
Pre-commit test (NFC)
1 parent b9adc4a commit 641ae74

File tree

1 file changed

+28
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+28
-0
lines changed

llvm/test/Transforms/InstCombine/not.ll

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,34 @@ define <3 x i5> @not_or_neg_commute_vec(<3 x i5> %x, <3 x i5> %p) {
436436
ret <3 x i5> %not
437437
}
438438

439+
define i8 @not_or_neg_nsw(i8 %x, i8 %y) {
440+
; CHECK-LABEL: @not_or_neg_nsw(
441+
; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[Y:%.*]], -1
442+
; CHECK-NEXT: [[TMP2:%.*]] = xor i8 [[X:%.*]], -1
443+
; CHECK-NEXT: [[NOT:%.*]] = and i8 [[TMP1]], [[TMP2]]
444+
; CHECK-NEXT: ret i8 [[NOT]]
445+
;
446+
%s = sub nsw i8 0, %y
447+
%o = or i8 %s, %x
448+
%not = xor i8 %o, -1
449+
ret i8 %not
450+
}
451+
452+
define <3 x i5> @not_or_neg_commute_vec_nsw(<3 x i5> %x, <3 x i5> %p) {
453+
; CHECK-LABEL: @not_or_neg_commute_vec_nsw(
454+
; CHECK-NEXT: [[Y:%.*]] = mul <3 x i5> [[P:%.*]], <i5 1, i5 2, i5 3>
455+
; CHECK-NEXT: [[TMP1:%.*]] = add <3 x i5> [[X:%.*]], splat (i5 -1)
456+
; CHECK-NEXT: [[TMP2:%.*]] = xor <3 x i5> [[Y]], splat (i5 -1)
457+
; CHECK-NEXT: [[NOT:%.*]] = and <3 x i5> [[TMP1]], [[TMP2]]
458+
; CHECK-NEXT: ret <3 x i5> [[NOT]]
459+
;
460+
%y = mul <3 x i5> %p, <i5 1, i5 2, i5 3> ; thwart complexity-based-canonicalization
461+
%s = sub nsw <3 x i5> <i5 0, i5 0, i5 poison>, %x
462+
%o = or <3 x i5> %y, %s
463+
%not = xor <3 x i5> %o, <i5 -1, i5 poison, i5 -1>
464+
ret <3 x i5> %not
465+
}
466+
439467
; negative test
440468

441469
define i8 @not_or_neg_use1(i8 %x, i8 %y) {

0 commit comments

Comments
 (0)