mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
cf9fa4358d
Also check the case where one operand isn't constant, which isn't handled right now, because the SPF code requires both operands to be ranges. Move the tests to directly check ranges rather than go through an and, to make it more obvious that this has no relation to bitmasks.
127 lines
3.0 KiB
LLVM
127 lines
3.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -correlated-propagation -S | FileCheck %s
|
|
|
|
define i32 @test(i32 %a) {
|
|
; CHECK-LABEL: @test(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 128
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: continue:
|
|
; CHECK-NEXT: ret i32 [[A]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret i32 -1
|
|
;
|
|
entry:
|
|
%cmp = icmp ult i32 %a, 128
|
|
br i1 %cmp, label %continue, label %exit
|
|
continue:
|
|
%and = and i32 %a, 255
|
|
ret i32 %and
|
|
exit:
|
|
ret i32 -1
|
|
}
|
|
|
|
define i32 @test2(i32 %a) {
|
|
; CHECK-LABEL: @test2(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: continue:
|
|
; CHECK-NEXT: ret i32 [[A]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret i32 -1
|
|
;
|
|
entry:
|
|
%cmp = icmp ult i32 %a, 256
|
|
br i1 %cmp, label %continue, label %exit
|
|
continue:
|
|
%and = and i32 %a, 255
|
|
ret i32 %and
|
|
exit:
|
|
ret i32 -1
|
|
}
|
|
|
|
define i32 @test3(i32 %a) {
|
|
; CHECK-LABEL: @test3(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: continue:
|
|
; CHECK-NEXT: ret i32 [[A]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret i32 -1
|
|
;
|
|
entry:
|
|
%cmp = icmp ult i32 %a, 256
|
|
br i1 %cmp, label %continue, label %exit
|
|
continue:
|
|
%and = and i32 %a, 1023
|
|
ret i32 %and
|
|
exit:
|
|
ret i32 -1
|
|
}
|
|
|
|
|
|
define i32 @neg1(i32 %a) {
|
|
; CHECK-LABEL: @neg1(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[A:%.*]], 256
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: continue:
|
|
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 255
|
|
; CHECK-NEXT: ret i32 [[AND]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret i32 -1
|
|
;
|
|
entry:
|
|
%cmp = icmp ule i32 %a, 256
|
|
br i1 %cmp, label %continue, label %exit
|
|
continue:
|
|
%and = and i32 %a, 255
|
|
ret i32 %and
|
|
exit:
|
|
ret i32 -1
|
|
}
|
|
|
|
define i32 @neg2(i32 %a) {
|
|
; CHECK-LABEL: @neg2(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 513
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: continue:
|
|
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 255
|
|
; CHECK-NEXT: ret i32 [[AND]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret i32 -1
|
|
;
|
|
entry:
|
|
%cmp = icmp ult i32 %a, 513
|
|
br i1 %cmp, label %continue, label %exit
|
|
continue:
|
|
%and = and i32 %a, 255
|
|
ret i32 %and
|
|
exit:
|
|
ret i32 -1
|
|
}
|
|
|
|
define i32 @neg3(i32 %a) {
|
|
; CHECK-LABEL: @neg3(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
|
|
; CHECK: continue:
|
|
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 254
|
|
; CHECK-NEXT: ret i32 [[AND]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret i32 -1
|
|
;
|
|
entry:
|
|
%cmp = icmp ult i32 %a, 256
|
|
br i1 %cmp, label %continue, label %exit
|
|
continue:
|
|
%and = and i32 %a, 254
|
|
ret i32 %and
|
|
exit:
|
|
ret i32 -1
|
|
}
|