1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[InstCombine] Add test cases demonstrating that we don't optmize select+cmp+cttz/ctlz when the bitwidth is larger than 64 bits.

llvm-svn: 306365
This commit is contained in:
Craig Topper 2017-06-27 04:50:47 +00:00
parent a7df05b4cf
commit 2f9e7f4ffd

View File

@ -318,10 +318,37 @@ entry:
ret i16 %cond
}
define i128 @test7(i128 %x) {
; CHECK-LABEL: @test7(
; CHECK-NEXT: [[TMP0:%.*]] = tail call i128 @llvm.ctlz.i128(i128 [[X:%.*]], i1 true), !range !3
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i128 [[X]], 0
; CHECK-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i128 [[TMP0]], i128 128
; CHECK-NEXT: ret i128 [[COND]]
;
%1 = tail call i128 @llvm.ctlz.i128(i128 %x, i1 true)
%tobool = icmp ne i128 %x, 0
%cond = select i1 %tobool, i128 %1, i128 128
ret i128 %cond
}
define i128 @test8(i128 %x) {
; CHECK-LABEL: @test8(
; CHECK-NEXT: [[TMP0:%.*]] = tail call i128 @llvm.cttz.i128(i128 [[X:%.*]], i1 true), !range !3
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i128 [[X]], 0
; CHECK-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i128 [[TMP0]], i128 128
; CHECK-NEXT: ret i128 [[COND]]
;
%1 = tail call i128 @llvm.cttz.i128(i128 %x, i1 true)
%tobool = icmp ne i128 %x, 0
%cond = select i1 %tobool, i128 %1, i128 128
ret i128 %cond
}
declare i16 @llvm.ctlz.i16(i16, i1)
declare i32 @llvm.ctlz.i32(i32, i1)
declare i64 @llvm.ctlz.i64(i64, i1)
declare i128 @llvm.ctlz.i128(i128, i1)
declare i16 @llvm.cttz.i16(i16, i1)
declare i32 @llvm.cttz.i32(i32, i1)
declare i64 @llvm.cttz.i64(i64, i1)
declare i128 @llvm.cttz.i128(i128, i1)