2015-10-06 23:36:44 +08:00
|
|
|
; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
|
2014-11-06 04:48:56 +08:00
|
|
|
|
|
|
|
; Test the code generation in the presence of a scalar out-of-scop value being
|
|
|
|
; used from within the SCoP.
|
|
|
|
|
|
|
|
; CHECH-LABEL: @scalar-function-argument
|
|
|
|
; CHECK: polly.split_new_and_old
|
|
|
|
|
|
|
|
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
define void @scalar-function-argument(float* %A, float %sqrinv) {
|
|
|
|
entry:
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
for.body:
|
|
|
|
%indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
|
|
|
|
%mul104 = fmul float 1.0, %sqrinv
|
2015-02-28 03:20:19 +08:00
|
|
|
%rp107 = getelementptr float, float* %A, i64 %indvar
|
2014-11-06 04:48:56 +08:00
|
|
|
store float %mul104, float* %rp107, align 4
|
|
|
|
%indvar.next = add nsw i64 %indvar, 1
|
|
|
|
%cmp = icmp slt i64 1024, %indvar.next
|
|
|
|
br i1 %cmp, label %for.end, label %for.body
|
|
|
|
|
|
|
|
for.end:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECH-LABEL: @scalar-outside-of-scop
|
|
|
|
; CHECK: polly.split_new_and_old
|
|
|
|
|
|
|
|
define void @scalar-outside-of-scop(float* %A) {
|
|
|
|
entry:
|
|
|
|
%sqrinv = call float @getFloat()
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
for.body:
|
|
|
|
%indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
|
|
|
|
%mul104 = fmul float 1.0, %sqrinv
|
2015-02-28 03:20:19 +08:00
|
|
|
%rp107 = getelementptr float, float* %A, i64 %indvar
|
2014-11-06 04:48:56 +08:00
|
|
|
store float %mul104, float* %rp107, align 4
|
|
|
|
%indvar.next = add nsw i64 %indvar, 1
|
|
|
|
%cmp = icmp slt i64 1024, %indvar.next
|
|
|
|
br i1 %cmp, label %for.end, label %for.body
|
|
|
|
|
|
|
|
for.end:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare float @getFloat()
|