mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 10:01:42 +00:00
Missing reduction detection test cases
llvm-svn: 211235
This commit is contained in:
parent
62aeb8b653
commit
da80386700
35
polly/test/ScopInfo/reduction_only_reduction_like_access.ll
Normal file
35
polly/test/ScopInfo/reduction_only_reduction_like_access.ll
Normal file
@ -0,0 +1,35 @@
|
||||
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
|
||||
;
|
||||
; CHECK: Reduction like: 0
|
||||
;
|
||||
; void f(int *sum) {
|
||||
; for (int i = 0; i < 100; i++)
|
||||
; sum[i] = sum[99-i] + i;
|
||||
; }
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
|
||||
|
||||
define void @f(i32* %sum) {
|
||||
entry:
|
||||
br label %for.cond
|
||||
|
||||
for.cond: ; preds = %for.inc, %entry
|
||||
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
|
||||
%exitcond = icmp ne i32 %i.0, 100
|
||||
br i1 %exitcond, label %for.body, label %for.end
|
||||
|
||||
for.body: ; preds = %for.cond
|
||||
%sub = sub nsw i32 99, %i.0
|
||||
%arrayidx = getelementptr inbounds i32* %sum, i32 %sub
|
||||
%tmp = load i32* %arrayidx, align 4
|
||||
%add = add nsw i32 %tmp, %i.0
|
||||
%arrayidx1 = getelementptr inbounds i32* %sum, i32 %i.0
|
||||
store i32 %add, i32* %arrayidx1, align 4
|
||||
br label %for.inc
|
||||
|
||||
for.inc: ; preds = %for.body
|
||||
%inc = add nsw i32 %i.0, 1
|
||||
br label %for.cond
|
||||
|
||||
for.end: ; preds = %for.cond
|
||||
ret void
|
||||
}
|
64
polly/test/ScopInfo/reduction_simple_fp.ll
Normal file
64
polly/test/ScopInfo/reduction_simple_fp.ll
Normal file
@ -0,0 +1,64 @@
|
||||
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
|
||||
;
|
||||
; CHECK: Function: f_no_fast_math
|
||||
; CHECK: Reduction like: 0
|
||||
; CHECK: Function: f_fast_math
|
||||
; CHECK: Reduction like: 1
|
||||
;
|
||||
; void f(float *sum) {
|
||||
; for (int i = 0; i < 100; i++)
|
||||
; *sum += 3.41 * i;
|
||||
; }
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
|
||||
|
||||
define void @f_no_fast_math(float* %sum) {
|
||||
entry:
|
||||
br label %for.cond
|
||||
|
||||
for.cond: ; preds = %for.inc, %entry
|
||||
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
|
||||
%exitcond = icmp ne i32 %i.0, 100
|
||||
br i1 %exitcond, label %for.body, label %for.end
|
||||
|
||||
for.body: ; preds = %for.cond
|
||||
%conv = sitofp i32 %i.0 to float
|
||||
%pi = fptrunc double 3.41 to float
|
||||
%mul = fmul float %conv, %pi
|
||||
%tmp = load float* %sum, align 4
|
||||
%add = fadd float %tmp, %mul
|
||||
store float %add, float* %sum, align 4
|
||||
br label %for.inc
|
||||
|
||||
for.inc: ; preds = %for.body
|
||||
%inc = add nsw i32 %i.0, 1
|
||||
br label %for.cond
|
||||
|
||||
for.end: ; preds = %for.cond
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @f_fast_math(float* %sum) {
|
||||
entry:
|
||||
br label %for.cond
|
||||
|
||||
for.cond: ; preds = %for.inc, %entry
|
||||
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
|
||||
%exitcond = icmp ne i32 %i.0, 100
|
||||
br i1 %exitcond, label %for.body, label %for.end
|
||||
|
||||
for.body: ; preds = %for.cond
|
||||
%conv = sitofp i32 %i.0 to float
|
||||
%pi = fptrunc double 3.41 to float
|
||||
%mul = fmul fast float %conv, %pi
|
||||
%tmp = load float* %sum, align 4
|
||||
%add = fadd fast float %tmp, %mul
|
||||
store float %add, float* %sum, align 4
|
||||
br label %for.inc
|
||||
|
||||
for.inc: ; preds = %for.body
|
||||
%inc = add nsw i32 %i.0, 1
|
||||
br label %for.cond
|
||||
|
||||
for.end: ; preds = %for.cond
|
||||
ret void
|
||||
}
|
26
polly/test/ScopInfo/reduction_simple_w_constant.ll
Normal file
26
polly/test/ScopInfo/reduction_simple_w_constant.ll
Normal file
@ -0,0 +1,26 @@
|
||||
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
|
||||
;
|
||||
; CHECK: Reduction like: 1
|
||||
;
|
||||
; void f(int *sum) {
|
||||
; for (int i = 0; i <= 100; i++)
|
||||
; sum += 3;
|
||||
; }
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
|
||||
|
||||
define void @f(i32* %sum) {
|
||||
entry:
|
||||
br label %for.cond
|
||||
|
||||
for.cond: ; preds = %for.cond, %entry
|
||||
%i1.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ]
|
||||
%sum.reload = load i32* %sum
|
||||
%add = add nsw i32 %sum.reload, 3
|
||||
%inc = add nsw i32 %i1.0, 1
|
||||
store i32 %add, i32* %sum
|
||||
%cmp = icmp slt i32 %i1.0, 100
|
||||
br i1 %cmp, label %for.cond, label %for.end
|
||||
|
||||
for.end: ; preds = %for.cond
|
||||
ret void
|
||||
}
|
27
polly/test/ScopInfo/reduction_simple_w_iv.ll
Normal file
27
polly/test/ScopInfo/reduction_simple_w_iv.ll
Normal file
@ -0,0 +1,27 @@
|
||||
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
|
||||
;
|
||||
; CHECK: Reduction like: 1
|
||||
;
|
||||
; void f(int* sum) {
|
||||
; for (int i = 0; i <= 100; i++)
|
||||
; sum += i * 3;
|
||||
; }
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
|
||||
|
||||
define void @f(i32* %sum) {
|
||||
entry:
|
||||
br label %for.cond
|
||||
|
||||
for.cond: ; preds = %for.cond, %entr
|
||||
%i1.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ]
|
||||
%sum.reload = load i32* %sum
|
||||
%mul = mul nsw i32 %i1.0, 3
|
||||
%add = add nsw i32 %sum.reload, %mul
|
||||
%inc = add nsw i32 %i1.0, 1
|
||||
store i32 %add, i32* %sum
|
||||
%cmp = icmp slt i32 %i1.0, 100
|
||||
br i1 %cmp, label %for.cond, label %for.end
|
||||
|
||||
for.end: ; preds = %for.cond
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user