[llvm] r375372 - [InstCombine] Add tests for uadd/sub.sat(a, b) == 0; NFC
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 20 12:50:32 PDT 2019
Author: nikic
Date: Sun Oct 20 12:50:31 2019
New Revision: 375372
URL: http://llvm.org/viewvc/llvm-project?rev=375372&view=rev
Log:
[InstCombine] Add tests for uadd/sub.sat(a, b) == 0; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/saturating-add-sub.ll
Modified: llvm/trunk/test/Transforms/InstCombine/saturating-add-sub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/saturating-add-sub.ll?rev=375372&r1=375371&r2=375372&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/saturating-add-sub.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/saturating-add-sub.ll Sun Oct 20 12:50:31 2019
@@ -1156,6 +1156,50 @@ define i8 @test_scalar_uadd_sub_const(i8
ret i8 %res
}
+define i1 @scalar_uadd_eq_zero(i8 %a, i8 %b) {
+; CHECK-LABEL: @scalar_uadd_eq_zero(
+; CHECK-NEXT: [[SAT:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[SAT]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sat = call i8 @llvm.uadd.sat.i8(i8 %a, i8 %b)
+ %cmp = icmp eq i8 %sat, 0
+ ret i1 %cmp
+}
+
+define i1 @scalar_uadd_ne_zero(i8 %a, i8 %b) {
+; CHECK-LABEL: @scalar_uadd_ne_zero(
+; CHECK-NEXT: [[SAT:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[SAT]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sat = call i8 @llvm.uadd.sat.i8(i8 %a, i8 %b)
+ %cmp = icmp ne i8 %sat, 0
+ ret i1 %cmp
+}
+
+define i1 @scalar_usub_eq_zero(i8 %a, i8 %b) {
+; CHECK-LABEL: @scalar_usub_eq_zero(
+; CHECK-NEXT: [[SAT:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[SAT]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sat = call i8 @llvm.usub.sat.i8(i8 %a, i8 %b)
+ %cmp = icmp eq i8 %sat, 0
+ ret i1 %cmp
+}
+
+define i1 @scalar_usub_ne_zero(i8 %a, i8 %b) {
+; CHECK-LABEL: @scalar_usub_ne_zero(
+; CHECK-NEXT: [[SAT:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[SAT]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sat = call i8 @llvm.usub.sat.i8(i8 %a, i8 %b)
+ %cmp = icmp ne i8 %sat, 0
+ ret i1 %cmp
+}
+
; Raw IR tests
define i32 @uadd_sat(i32 %x, i32 %y) {
More information about the llvm-commits
mailing list