1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/Hexagon/swp-max.ll
Brendon Cahoon e37295579e MachinePipeliner pass that implements Swing Modulo Scheduling
Software pipelining is an optimization for improving ILP by
overlapping loop iterations. Swing Modulo Scheduling (SMS) is
an implementation of software pipelining that attempts to
reduce register pressure and generate efficient pipelines with
a low compile-time cost.

This implementaion of SMS is a target-independent back-end pass.
When enabled, the pass should run just prior to the register
allocation pass, while the machine IR is in SSA form. If the pass
is successful, then the original loop is replaced by the optimized
loop. The optimized loop contains one or more prolog blocks, the
pipelined kernel, and one or more epilog blocks.

This pass is enabled for Hexagon only. To enable for other targets,
a couple of target specific hooks must be implemented, and the
pass needs to be called from the target's TargetMachine
implementation.

Differential Review: http://reviews.llvm.org/D16829

llvm-svn: 277169
2016-07-29 16:44:44 +00:00

43 lines
1.5 KiB
LLVM

; RUN: llc -march=hexagon -mcpu=hexagonv5 -enable-pipeliner \
; RUN: -pipeliner-max-stages=2 < %s | FileCheck %s
@A = global [8 x i32] [i32 4, i32 -3, i32 5, i32 -2, i32 -1, i32 2, i32 6, i32 -2], align 8
define i32 @test(i32 %Left, i32 %Right) {
entry:
%add = add nsw i32 %Right, %Left
%div = sdiv i32 %add, 2
%cmp9 = icmp slt i32 %div, %Left
br i1 %cmp9, label %for.end, label %for.body.preheader
for.body.preheader:
br label %for.body
; CHECK: loop0(.LBB0_[[LOOP:.]],
; CHECK: .LBB0_[[LOOP]]:
; CHECK: [[REG1:(r[0-9]+)]] = max(r{{[0-9]+}}, [[REG1]])
; CHECK: [[REG0:(r[0-9]+)]] = add([[REG2:(r[0-9]+)]], [[REG0]])
; CHECK: [[REG2]] = memw
; CHECK: endloop0
for.body:
%MaxLeftBorderSum.012 = phi i32 [ %MaxLeftBorderSum.1, %for.body ], [ 0, %for.body.preheader ]
%i.011 = phi i32 [ %dec, %for.body ], [ %div, %for.body.preheader ]
%LeftBorderSum.010 = phi i32 [ %add1, %for.body ], [ 0, %for.body.preheader ]
%arrayidx = getelementptr inbounds [8 x i32], [8 x i32]* @A, i32 0, i32 %i.011
%0 = load i32, i32* %arrayidx, align 4
%add1 = add nsw i32 %0, %LeftBorderSum.010
%cmp2 = icmp sgt i32 %add1, %MaxLeftBorderSum.012
%MaxLeftBorderSum.1 = select i1 %cmp2, i32 %add1, i32 %MaxLeftBorderSum.012
%dec = add nsw i32 %i.011, -1
%cmp = icmp slt i32 %dec, %Left
br i1 %cmp, label %for.end.loopexit, label %for.body
for.end.loopexit:
br label %for.end
for.end:
%MaxLeftBorderSum.0.lcssa = phi i32 [ 0, %entry ], [ %MaxLeftBorderSum.1, %for.end.loopexit ]
ret i32 %MaxLeftBorderSum.0.lcssa
}