mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[InstSimplify] Add tests for icmp with urem divisor (NFC)
This commit is contained in:
parent
2f952ff535
commit
40de912d78
@ -723,6 +723,50 @@ define i1 @urem7(i32 %X) {
|
||||
ret i1 %B
|
||||
}
|
||||
|
||||
define i1 @urem8(i8 %X, i8 %Y) {
|
||||
; CHECK-LABEL: @urem8(
|
||||
; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp ule i8 [[A]], [[X]]
|
||||
; CHECK-NEXT: ret i1 [[B]]
|
||||
;
|
||||
%A = urem i8 %X, %Y
|
||||
%B = icmp ule i8 %A, %X
|
||||
ret i1 %B
|
||||
}
|
||||
|
||||
define i1 @urem9(i8 %X, i8 %Y) {
|
||||
; CHECK-LABEL: @urem9(
|
||||
; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 [[A]], [[X]]
|
||||
; CHECK-NEXT: ret i1 [[B]]
|
||||
;
|
||||
%A = urem i8 %X, %Y
|
||||
%B = icmp ugt i8 %A, %X
|
||||
ret i1 %B
|
||||
}
|
||||
|
||||
define i1 @urem10(i8 %X, i8 %Y) {
|
||||
; CHECK-LABEL: @urem10(
|
||||
; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp uge i8 [[X]], [[A]]
|
||||
; CHECK-NEXT: ret i1 [[B]]
|
||||
;
|
||||
%A = urem i8 %X, %Y
|
||||
%B = icmp uge i8 %X, %A
|
||||
ret i1 %B
|
||||
}
|
||||
|
||||
define i1 @urem11(i8 %X, i8 %Y) {
|
||||
; CHECK-LABEL: @urem11(
|
||||
; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp ult i8 [[X]], [[A]]
|
||||
; CHECK-NEXT: ret i1 [[B]]
|
||||
;
|
||||
%A = urem i8 %X, %Y
|
||||
%B = icmp ult i8 %X, %A
|
||||
ret i1 %B
|
||||
}
|
||||
|
||||
; PR9343 #15
|
||||
define i1 @srem2(i16 %X, i32 %Y) {
|
||||
; CHECK-LABEL: @srem2(
|
||||
@ -961,7 +1005,7 @@ define i1 @alloca_compare(i64 %idx) {
|
||||
|
||||
define i1 @alloca_compare_no_null_opt(i64 %idx) #0 {
|
||||
; CHECK-LABEL: @alloca_compare_no_null_opt(
|
||||
; CHECK-NEXT: [[SV:%.*]] = alloca { i32, i32, [124 x i32] }
|
||||
; CHECK-NEXT: [[SV:%.*]] = alloca { i32, i32, [124 x i32] }, align 8
|
||||
; CHECK-NEXT: [[CMP:%.*]] = getelementptr inbounds { i32, i32, [124 x i32] }, { i32, i32, [124 x i32] }* [[SV]], i32 0, i32 2, i64 [[IDX:%.*]]
|
||||
; CHECK-NEXT: [[X:%.*]] = icmp eq i32* [[CMP]], null
|
||||
; CHECK-NEXT: ret i1 [[X]]
|
||||
@ -995,7 +1039,7 @@ unreachableblock:
|
||||
|
||||
define i1 @alloca_argument_compare(i64* %arg) {
|
||||
; CHECK-LABEL: @alloca_argument_compare(
|
||||
; CHECK-NEXT: [[ALLOC:%.*]] = alloca i64
|
||||
; CHECK-NEXT: [[ALLOC:%.*]] = alloca i64, align 8
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64* [[ARG:%.*]], [[ALLOC]]
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
@ -1008,7 +1052,7 @@ define i1 @alloca_argument_compare(i64* %arg) {
|
||||
|
||||
define i1 @alloca_argument_compare_swapped(i64* %arg) {
|
||||
; CHECK-LABEL: @alloca_argument_compare_swapped(
|
||||
; CHECK-NEXT: [[ALLOC:%.*]] = alloca i64
|
||||
; CHECK-NEXT: [[ALLOC:%.*]] = alloca i64, align 8
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64* [[ALLOC]], [[ARG:%.*]]
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user