summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Wennborg <hans@chromium.org>2020-03-19 10:12:16 +0100
committerHans Wennborg <hans@chromium.org>2020-03-19 10:12:16 +0100
commit5401d393f88b9fa99a8d3a2a1b3013e757d958a2 (patch)
treef9b0f96850d2b09ebdf8405c66bf480a2148226e
parent623461b2ce421cd287f1bea50c0998003375a782 (diff)
downloadllvm-5401d393f88b9fa99a8d3a2a1b3013e757d958a2.tar.gz
../llvm/utils/update_test_checks.py --opt-binary bin/opt ../llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll
-rw-r--r--llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll30
1 files changed, 24 insertions, 6 deletions
diff --git a/llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll b/llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll
index bdf75ca7e82e..0cdb56748d51 100644
--- a/llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll
+++ b/llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll
@@ -34,9 +34,12 @@ define i8 @smax_nsw(i8 %a, i8 %b) {
define i8 @abs_swapped(i8 %a) {
; CHECK-LABEL: @abs_swapped(
; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A]], 0
-; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[NEG]], i8 [[A]]
-; CHECK-NEXT: ret i8 [[M1]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[A]], 0
+; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 [[A]], 0
+; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
+; CHECK-NEXT: [[M2:%.*]] = select i1 [[CMP2]], i8 [[NEG]], i8 [[A]]
+; CHECK-NEXT: [[R:%.*]] = or i8 [[M2]], [[M1]]
+; CHECK-NEXT: ret i8 [[R]]
;
%neg = sub i8 0, %a
%cmp1 = icmp sgt i8 %a, 0
@@ -51,7 +54,13 @@ define i8 @abs_swapped(i8 %a) {
define i8 @nabs_swapped(i8 %a) {
; CHECK-LABEL: @nabs_swapped(
-; CHECK-NEXT: ret i8 0
+; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A]], 0
+; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], 0
+; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
+; CHECK-NEXT: [[M2:%.*]] = select i1 [[CMP2]], i8 [[NEG]], i8 [[A]]
+; CHECK-NEXT: [[R:%.*]] = xor i8 [[M2]], [[M1]]
+; CHECK-NEXT: ret i8 [[R]]
;
%neg = sub i8 0, %a
%cmp1 = icmp slt i8 %a, 0
@@ -66,7 +75,13 @@ define i8 @nabs_swapped(i8 %a) {
define i8 @abs_different_constants(i8 %a) {
; CHECK-LABEL: @abs_different_constants(
-; CHECK-NEXT: ret i8 0
+; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[A]], -1
+; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 [[A]], 0
+; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
+; CHECK-NEXT: [[M2:%.*]] = select i1 [[CMP2]], i8 [[NEG]], i8 [[A]]
+; CHECK-NEXT: [[R:%.*]] = xor i8 [[M2]], [[M1]]
+; CHECK-NEXT: ret i8 [[R]]
;
%neg = sub i8 0, %a
%cmp1 = icmp sgt i8 %a, -1
@@ -83,8 +98,11 @@ define i8 @nabs_different_constants(i8 %a) {
; CHECK-LABEL: @nabs_different_constants(
; CHECK-NEXT: [[NEG:%.*]] = sub i8 0, [[A:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A]], 0
+; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], -1
; CHECK-NEXT: [[M1:%.*]] = select i1 [[CMP1]], i8 [[A]], i8 [[NEG]]
-; CHECK-NEXT: ret i8 [[M1]]
+; CHECK-NEXT: [[M2:%.*]] = select i1 [[CMP2]], i8 [[NEG]], i8 [[A]]
+; CHECK-NEXT: [[R:%.*]] = or i8 [[M2]], [[M1]]
+; CHECK-NEXT: ret i8 [[R]]
;
%neg = sub i8 0, %a
%cmp1 = icmp slt i8 %a, 0