1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[CVP] Extend tests to illustrate an old patch isn't needed

Back in https://reviews.llvm.org/D19559, I tried to teach CVP about range facts implied by value/value icmps (i.e. no constants.)  In the meantime, we've implemented the optimization, but I couldn't find tests checked in, so adding them.

llvm-svn: 340660
This commit is contained in:
Philip Reames 2018-08-24 21:56:43 +00:00
parent b6de49258b
commit c6a0f43fb3

View File

@ -603,3 +603,45 @@ exit:
exit2:
ret i1 false
}
define i1 @slt(i8 %a, i8 %b) {
; CHECK-LABEL: @slt(
; CHECK: ret i1 true
entry:
%cmp = icmp slt i8 %a, %b
call void @llvm.assume(i1 %cmp)
%res = icmp slt i8 %a, 127
ret i1 %res
}
define i1 @sgt(i8 %a, i8 %b) {
; CHECK-LABEL: @sgt(
; CHECK: ret i1 true
entry:
%cmp = icmp sgt i8 %a, %b
call void @llvm.assume(i1 %cmp)
%res = icmp sgt i8 %a, -128
ret i1 %res
}
define i1 @ult(i8 %a, i8 %b) {
; CHECK-LABEL: @ult(
; CHECK: ret i1 true
entry:
%cmp = icmp ult i8 %a, %b
call void @llvm.assume(i1 %cmp)
%res = icmp ult i8 %a, 255
ret i1 %res
}
define i1 @ugt(i8 %a, i8 %b) {
; CHECK-LABEL: @ugt(
; CHECK: ret i1 true
entry:
%cmp = icmp ugt i8 %a, %b
call void @llvm.assume(i1 %cmp)
%res = icmp ugt i8 %a, 0
ret i1 %res
}
declare void @llvm.assume(i1)