xref: /aosp_15_r20/external/llvm/test/CodeGen/Hexagon/swp-vsum.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=hexagon -mcpu=hexagonv5 -enable-pipeliner < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=hexagon -mcpu=hexagonv5 -O3 < %s | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Simple vector total.
5*9880d681SAndroid Build Coastguard Worker; CHECK: loop0(.LBB0_[[LOOP:.]],
6*9880d681SAndroid Build Coastguard Worker; CHECK: .LBB0_[[LOOP]]:
7*9880d681SAndroid Build Coastguard Worker; CHECK: add([[REG:r([0-9]+)]], r{{[0-9]+}})
8*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: add(r{{[0-9]+}}, #4)
9*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[REG]] = memw(r{{[0-9]+}} + r{{[0-9]+}}<<#0)
10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: endloop0
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i32* %a, i32 %n) {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  br label %for.body
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerfor.body:
17*9880d681SAndroid Build Coastguard Worker  %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ]
18*9880d681SAndroid Build Coastguard Worker  %arrayidx.phi = phi i32* [ %a, %entry ], [ %arrayidx.inc, %for.body ]
19*9880d681SAndroid Build Coastguard Worker  %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
20*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* %arrayidx.phi, align 4
21*9880d681SAndroid Build Coastguard Worker  %add = add nsw i32 %0, %sum.02
22*9880d681SAndroid Build Coastguard Worker  %inc = add nsw i32 %i.01, 1
23*9880d681SAndroid Build Coastguard Worker  %exitcond = icmp eq i32 %inc, 10000
24*9880d681SAndroid Build Coastguard Worker  %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1
25*9880d681SAndroid Build Coastguard Worker  br i1 %exitcond, label %for.end, label %for.body
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerfor.end:
28*9880d681SAndroid Build Coastguard Worker  ret i32 %add
29*9880d681SAndroid Build Coastguard Worker}
30