mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
add tests related to PR28466
llvm-svn: 275995
This commit is contained in:
parent
2987170664
commit
4a78584835
@ -132,7 +132,21 @@ define i32 @select_icmp_and_8_eq_0_or_8(i32 %x) {
|
||||
}
|
||||
|
||||
; PR28466: https://llvm.org/bugs/show_bug.cgi?id=28466
|
||||
; InstSimplify needs to recognize variations of this pattern.
|
||||
|
||||
define i32 @select_icmp_trunc_8_eq_0_or_8(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_trunc_8_eq_0_or_8(
|
||||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 %x to i8
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[TRUNC]], 0
|
||||
; CHECK-NEXT: [[OR:%.*]] = or i32 %x, 128
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 [[OR]], i32 %x
|
||||
; CHECK-NEXT: ret i32 [[SEL]]
|
||||
;
|
||||
%trunc = trunc i32 %x to i8
|
||||
%cmp = icmp slt i8 %trunc, 0
|
||||
%or = or i32 %x, 128
|
||||
%sel = select i1 %cmp, i32 %or, i32 %x
|
||||
ret i32 %sel
|
||||
}
|
||||
|
||||
define i32 @select_icmp_and_8_ne_0_or_128(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_and_8_ne_0_or_128(
|
||||
@ -145,6 +159,21 @@ define i32 @select_icmp_and_8_ne_0_or_128(i32 %x) {
|
||||
ret i32 %or.x
|
||||
}
|
||||
|
||||
define i32 @select_icmp_trunc_8_ne_0_or_128(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_trunc_8_ne_0_or_128(
|
||||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 %x to i8
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[TRUNC]], 0
|
||||
; CHECK-NEXT: [[OR:%.*]] = or i32 %x, 128
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 %x, i32 [[OR]]
|
||||
; CHECK-NEXT: ret i32 [[SEL]]
|
||||
;
|
||||
%trunc = trunc i32 %x to i8
|
||||
%cmp = icmp slt i8 %trunc, 0
|
||||
%or = or i32 %x, 128
|
||||
%sel = select i1 %cmp, i32 %x, i32 %or
|
||||
ret i32 %sel
|
||||
}
|
||||
|
||||
define i32 @select_icmp_and_8_ne_0_and_not_8(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_and_8_ne_0_and_not_8(
|
||||
; CHECK-NEXT: [[AND1:%.*]] = and i32 %x, -9
|
||||
@ -157,6 +186,21 @@ define i32 @select_icmp_and_8_ne_0_and_not_8(i32 %x) {
|
||||
ret i32 %x.and1
|
||||
}
|
||||
|
||||
define i32 @select_icmp_trunc_8_ne_0_and_not_8(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_trunc_8_ne_0_and_not_8(
|
||||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 %x to i4
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i4 [[TRUNC]], 0
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 %x, -9
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 %x, i32 [[AND]]
|
||||
; CHECK-NEXT: ret i32 [[SEL]]
|
||||
;
|
||||
%trunc = trunc i32 %x to i4
|
||||
%cmp = icmp slt i4 %trunc, 0
|
||||
%and = and i32 %x, -9
|
||||
%sel = select i1 %cmp, i32 %x, i32 %and
|
||||
ret i32 %sel
|
||||
}
|
||||
|
||||
define i32 @select_icmp_and_8_eq_0_and_not_8(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_and_8_eq_0_and_not_8(
|
||||
; CHECK-NEXT: ret i32 %x
|
||||
@ -168,6 +212,21 @@ define i32 @select_icmp_and_8_eq_0_and_not_8(i32 %x) {
|
||||
ret i32 %and1.x
|
||||
}
|
||||
|
||||
define i32 @select_icmp_trunc_8_eq_0_and_not_8(i32 %x) {
|
||||
; CHECK-LABEL: @select_icmp_trunc_8_eq_0_and_not_8(
|
||||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 %x to i4
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i4 [[TRUNC]], 0
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 %x, -9
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 [[AND]], i32 %x
|
||||
; CHECK-NEXT: ret i32 [[SEL]]
|
||||
;
|
||||
%trunc = trunc i32 %x to i4
|
||||
%cmp = icmp slt i4 %trunc, 0
|
||||
%and = and i32 %x, -9
|
||||
%sel = select i1 %cmp, i32 %and, i32 %x
|
||||
ret i32 %sel
|
||||
}
|
||||
|
||||
define i64 @select_icmp_x_and_8_eq_0_y_and_not_8(i32 %x, i64 %y) {
|
||||
; CHECK-LABEL: @select_icmp_x_and_8_eq_0_y_and_not_8(
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 %x, 8
|
||||
|
Loading…
Reference in New Issue
Block a user