[llvm] a7a8e23 - [InstCombine] Add more vscale icmp tests (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 06:25:36 PDT 2023
Author: Nikita Popov
Date: 2023-03-16T14:25:27+01:00
New Revision: a7a8e237e8cf8022d004384f54f18a7b79c4d6fb
URL: https://github.com/llvm/llvm-project/commit/a7a8e237e8cf8022d004384f54f18a7b79c4d6fb
DIFF: https://github.com/llvm/llvm-project/commit/a7a8e237e8cf8022d004384f54f18a7b79c4d6fb.diff
LOG: [InstCombine] Add more vscale icmp tests (NFC)
In particular cover cases where vscale_range entries are larger
than the vscale bitwidth.
Added:
Modified:
llvm/test/Transforms/InstCombine/icmp-vscale.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/icmp-vscale.ll b/llvm/test/Transforms/InstCombine/icmp-vscale.ll
index 15fcf717accce..83264ccd3c762 100644
--- a/llvm/test/Transforms/InstCombine/icmp-vscale.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-vscale.ll
@@ -126,6 +126,79 @@ define i1 @vscale_ugt_min() vscale_range(5,10) {
ret i1 %res
}
+define i1 @vscale_uge_no_max() vscale_range(5) {
+; CHECK-LABEL: @vscale_uge_no_max(
+; CHECK-NEXT: ret i1 true
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp uge i8 %vscale, 5
+ ret i1 %res
+}
+
+define i1 @vscale_ugt_no_max() vscale_range(5) {
+; CHECK-LABEL: @vscale_ugt_no_max(
+; CHECK-NEXT: ret i1 false
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp ugt i8 %vscale, 5
+ ret i1 %res
+}
+
+define i1 @vscale_uge_max_overflow() vscale_range(5,256) {
+; CHECK-LABEL: @vscale_uge_max_overflow(
+; CHECK-NEXT: [[VSCALE:%.*]] = call i8 @llvm.vscale.i8()
+; CHECK-NEXT: [[RES:%.*]] = icmp ugt i8 [[VSCALE]], 4
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp uge i8 %vscale, 5
+ ret i1 %res
+}
+
+define i1 @vscale_ugt_max_overflow() vscale_range(5,256) {
+; CHECK-LABEL: @vscale_ugt_max_overflow(
+; CHECK-NEXT: [[VSCALE:%.*]] = call i8 @llvm.vscale.i8()
+; CHECK-NEXT: [[RES:%.*]] = icmp ugt i8 [[VSCALE]], 5
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp ugt i8 %vscale, 5
+ ret i1 %res
+}
+
+define i1 @vscale_eq_min_overflow() vscale_range(256,300) {
+; CHECK-LABEL: @vscale_eq_min_overflow(
+; CHECK-NEXT: [[VSCALE:%.*]] = call i8 @llvm.vscale.i8()
+; CHECK-NEXT: [[RES:%.*]] = icmp eq i8 [[VSCALE]], 42
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp eq i8 %vscale, 42
+ ret i1 %res
+}
+
+define i1 @vscale_ult_min_overflow() vscale_range(256,300) {
+; CHECK-LABEL: @vscale_ult_min_overflow(
+; CHECK-NEXT: [[VSCALE:%.*]] = call i8 @llvm.vscale.i8()
+; CHECK-NEXT: [[RES:%.*]] = icmp ult i8 [[VSCALE]], 42
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp ult i8 %vscale, 42
+ ret i1 %res
+}
+
+define i1 @vscale_ugt_min_overflow() vscale_range(256,300) {
+; CHECK-LABEL: @vscale_ugt_min_overflow(
+; CHECK-NEXT: [[VSCALE:%.*]] = call i8 @llvm.vscale.i8()
+; CHECK-NEXT: [[RES:%.*]] = icmp ult i8 [[VSCALE]], 42
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %vscale = call i8 @llvm.vscale.i8()
+ %res = icmp ult i8 %vscale, 42
+ ret i1 %res
+}
+
declare i8 @llvm.vscale.i8()
declare i16 @llvm.vscale.i16()
declare i32 @llvm.vscale.i32()
More information about the llvm-commits
mailing list