mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[InstCombine] Added testcases for PR50104, NFC
This commit is contained in:
parent
746a7315fd
commit
ae044bb842
@ -289,3 +289,60 @@ define i8 @ctpop_rotate_right(i8 %a, i8 %amt) {
|
||||
|
||||
declare i8 @llvm.fshl.i8(i8, i8, i8)
|
||||
declare i8 @llvm.fshr.i8(i8, i8, i8)
|
||||
|
||||
define i8 @sub_ctpop(i8 %a) {
|
||||
; CHECK-LABEL: @sub_ctpop(
|
||||
; CHECK-NEXT: [[CNT:%.*]] = tail call i8 @llvm.ctpop.i8(i8 [[A:%.*]]), !range [[RNG0]]
|
||||
; CHECK-NEXT: [[RES:%.*]] = sub nuw nsw i8 8, [[CNT]]
|
||||
; CHECK-NEXT: ret i8 [[RES]]
|
||||
;
|
||||
%cnt = tail call i8 @llvm.ctpop.i8(i8 %a)
|
||||
%res = sub i8 8, %cnt
|
||||
ret i8 %res
|
||||
}
|
||||
|
||||
define i8 @sub_ctpop_wrong_cst(i8 %a) {
|
||||
; CHECK-LABEL: @sub_ctpop_wrong_cst(
|
||||
; CHECK-NEXT: [[CNT:%.*]] = tail call i8 @llvm.ctpop.i8(i8 [[A:%.*]]), !range [[RNG0]]
|
||||
; CHECK-NEXT: [[RES:%.*]] = sub nsw i8 5, [[CNT]]
|
||||
; CHECK-NEXT: ret i8 [[RES]]
|
||||
;
|
||||
%cnt = tail call i8 @llvm.ctpop.i8(i8 %a)
|
||||
%res = sub i8 5, %cnt
|
||||
ret i8 %res
|
||||
}
|
||||
|
||||
define i8 @sub_ctpop_unknown(i8 %a, i8 %b) {
|
||||
; CHECK-LABEL: @sub_ctpop_unknown(
|
||||
; CHECK-NEXT: [[CNT:%.*]] = tail call i8 @llvm.ctpop.i8(i8 [[A:%.*]]), !range [[RNG0]]
|
||||
; CHECK-NEXT: [[RES:%.*]] = sub i8 [[B:%.*]], [[CNT]]
|
||||
; CHECK-NEXT: ret i8 [[RES]]
|
||||
;
|
||||
%cnt = tail call i8 @llvm.ctpop.i8(i8 %a)
|
||||
%res = sub i8 %b, %cnt
|
||||
ret i8 %res
|
||||
}
|
||||
|
||||
define <2 x i32> @sub_ctpop_vec(<2 x i32> %a) {
|
||||
; CHECK-LABEL: @sub_ctpop_vec(
|
||||
; CHECK-NEXT: [[CNT:%.*]] = tail call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> [[A:%.*]])
|
||||
; CHECK-NEXT: [[RES:%.*]] = sub nuw nsw <2 x i32> <i32 32, i32 32>, [[CNT]]
|
||||
; CHECK-NEXT: ret <2 x i32> [[RES]]
|
||||
;
|
||||
%cnt = tail call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> %a)
|
||||
%res = sub <2 x i32> <i32 32, i32 32>, %cnt
|
||||
ret <2 x i32> %res
|
||||
}
|
||||
|
||||
define <2 x i32> @sub_ctpop_vec_extra_use(<2 x i32> %a, <2 x i32>* %p) {
|
||||
; CHECK-LABEL: @sub_ctpop_vec_extra_use(
|
||||
; CHECK-NEXT: [[CNT:%.*]] = tail call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> [[A:%.*]])
|
||||
; CHECK-NEXT: store <2 x i32> [[CNT]], <2 x i32>* [[P:%.*]], align 8
|
||||
; CHECK-NEXT: [[RES:%.*]] = sub nuw nsw <2 x i32> <i32 32, i32 32>, [[CNT]]
|
||||
; CHECK-NEXT: ret <2 x i32> [[RES]]
|
||||
;
|
||||
%cnt = tail call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> %a)
|
||||
store <2 x i32> %cnt, <2 x i32>* %p
|
||||
%res = sub <2 x i32> <i32 32, i32 32>, %cnt
|
||||
ret <2 x i32> %res
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user