mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[InstCombine] Add cttz/ctlz + select non-bitwidth tests; NFC
llvm-svn: 349322
This commit is contained in:
parent
b018fd8e94
commit
38e5dd7e13
@ -343,6 +343,62 @@ define i128 @test8(i128 %x) {
|
||||
ret i128 %cond
|
||||
}
|
||||
|
||||
define i32 @test_ctlz_not_bw(i32 %x) {
|
||||
; CHECK-LABEL: @test_ctlz_not_bw(
|
||||
; CHECK-NEXT: [[CT:%.*]] = tail call i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 false), !range !1
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0
|
||||
; CHECK-NEXT: [[RES:%.*]] = select i1 [[CMP]], i32 123, i32 [[CT]]
|
||||
; CHECK-NEXT: ret i32 [[RES]]
|
||||
;
|
||||
%ct = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false)
|
||||
%cmp = icmp ne i32 %x, 0
|
||||
%res = select i1 %cmp, i32 %ct, i32 123
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
define i32 @test_ctlz_not_bw_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @test_ctlz_not_bw_multiuse(
|
||||
; CHECK-NEXT: [[CT:%.*]] = tail call i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 false), !range !1
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 123, i32 [[CT]]
|
||||
; CHECK-NEXT: [[RES:%.*]] = or i32 [[SEL]], [[CT]]
|
||||
; CHECK-NEXT: ret i32 [[RES]]
|
||||
;
|
||||
%ct = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false)
|
||||
%cmp = icmp ne i32 %x, 0
|
||||
%sel = select i1 %cmp, i32 %ct, i32 123
|
||||
%res = or i32 %sel, %ct
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
define i32 @test_cttz_not_bw(i32 %x) {
|
||||
; CHECK-LABEL: @test_cttz_not_bw(
|
||||
; CHECK-NEXT: [[CT:%.*]] = tail call i32 @llvm.cttz.i32(i32 [[X:%.*]], i1 false), !range !1
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0
|
||||
; CHECK-NEXT: [[RES:%.*]] = select i1 [[CMP]], i32 123, i32 [[CT]]
|
||||
; CHECK-NEXT: ret i32 [[RES]]
|
||||
;
|
||||
%ct = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
|
||||
%cmp = icmp ne i32 %x, 0
|
||||
%res = select i1 %cmp, i32 %ct, i32 123
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
define i32 @test_cttz_not_bw_multiuse(i32 %x) {
|
||||
; CHECK-LABEL: @test_cttz_not_bw_multiuse(
|
||||
; CHECK-NEXT: [[CT:%.*]] = tail call i32 @llvm.cttz.i32(i32 [[X:%.*]], i1 false), !range !1
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 123, i32 [[CT]]
|
||||
; CHECK-NEXT: [[RES:%.*]] = or i32 [[SEL]], [[CT]]
|
||||
; CHECK-NEXT: ret i32 [[RES]]
|
||||
;
|
||||
%ct = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)
|
||||
%cmp = icmp ne i32 %x, 0
|
||||
%sel = select i1 %cmp, i32 %ct, i32 123
|
||||
%res = or i32 %sel, %ct
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
declare i16 @llvm.ctlz.i16(i16, i1)
|
||||
declare i32 @llvm.ctlz.i32(i32, i1)
|
||||
declare i64 @llvm.ctlz.i64(i64, i1)
|
||||
|
Loading…
Reference in New Issue
Block a user