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

[SCEV] [NFC] add more test cases for range of addrecexpr with nsw flag

This commit is contained in:
Zheng Chen 2020-01-10 22:43:29 -05:00
parent 328bb420a2
commit edd7ca0f0e

View File

@ -39,12 +39,12 @@ exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw
; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-neg
; CHECK: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,1) S: [-2147483648,1)
define void @test-addrec-nsw(float* %input, i32 %offset, i32 %numIterations) {
define void @test-addrec-nsw-start-neg-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp slt i32 %offset, -10
%max = select i1 %cmp, i32 %offset, i32 -10
%cmp = icmp slt i32 %offset, -10
%max = select i1 %cmp, i32 %offset, i32 -10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
@ -58,3 +58,64 @@ loop:
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-neg
; CHECK: --> {(-1 + (10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: full-set S: full-set
define void @test-addrec-nsw-start-pos-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp slt i32 %offset, 10
%max = select i1 %cmp, i32 %offset, i32 10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, -1
%index32 = add nsw i32 %nexti, %max
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-pos
; CHECK: --> {(1 + (10 smax %offset))<nuw><nsw>,+,1}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648)
define void @test-addrec-nsw-start-pos-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp sgt i32 %offset, 10
%min = select i1 %cmp, i32 %offset, i32 10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, 1
%index32 = add nsw i32 %nexti, %min
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-pos
; CHECK: --> {(1 + (-10 smax %offset))<nsw>,+,1}<nsw><%loop> U: full-set S: full-set
define void @test-addrec-nsw-start-neg-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp sgt i32 %offset, -10
%min = select i1 %cmp, i32 %offset, i32 -10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, 1
%index32 = add nsw i32 %nexti, %min
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}