blob: 2eba743299605957a561fe11894daa13c801fc61 [file] [log] [blame]
Jyotsna Verma84256432013-03-01 17:37:13 +00001; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s
2; Check that the packetizer generates valid packets with constant
3; extended add and base+offset store instructions.
4
5; CHECK: {
6; CHECK-NEXT: r{{[0-9]+}}{{ *}}={{ *}}add(r{{[0-9]+}}, ##{{[0-9]+}})
7; CHECK-NEXT: memw(r{{[0-9]+}}+{{ *}}##{{[0-9]+}}){{ *}}={{ *}}r{{[0-9]+}}.new
8; CHECK-NEXT: }
9
10define i32 @test(i32* nocapture %a, i32* nocapture %b, i32 %c) nounwind {
11entry:
12 %add = add nsw i32 %c, 200002
David Blaikiea79ac142015-02-27 21:17:42 +000013 %0 = load i32, i32* %a, align 4
Jyotsna Verma84256432013-03-01 17:37:13 +000014 %add1 = add nsw i32 %0, 200000
David Blaikie79e6c742015-02-27 19:29:02 +000015 %arrayidx2 = getelementptr inbounds i32, i32* %a, i32 3000
Jyotsna Verma84256432013-03-01 17:37:13 +000016 store i32 %add1, i32* %arrayidx2, align 4
David Blaikiea79ac142015-02-27 21:17:42 +000017 %1 = load i32, i32* %b, align 4
Jyotsna Verma84256432013-03-01 17:37:13 +000018 %add4 = add nsw i32 %1, 200001
David Blaikie79e6c742015-02-27 19:29:02 +000019 %arrayidx5 = getelementptr inbounds i32, i32* %a, i32 1
Jyotsna Verma84256432013-03-01 17:37:13 +000020 store i32 %add4, i32* %arrayidx5, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000021 %arrayidx7 = getelementptr inbounds i32, i32* %b, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +000022 %2 = load i32, i32* %arrayidx7, align 4
Jyotsna Verma84256432013-03-01 17:37:13 +000023 %cmp = icmp sgt i32 %add4, %2
24 br i1 %cmp, label %if.then, label %if.else
25
26if.then: ; preds = %entry
David Blaikie79e6c742015-02-27 19:29:02 +000027 %arrayidx8 = getelementptr inbounds i32, i32* %a, i32 2
David Blaikiea79ac142015-02-27 21:17:42 +000028 %3 = load i32, i32* %arrayidx8, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000029 %arrayidx9 = getelementptr inbounds i32, i32* %b, i32 2000
David Blaikiea79ac142015-02-27 21:17:42 +000030 %4 = load i32, i32* %arrayidx9, align 4
Jyotsna Verma84256432013-03-01 17:37:13 +000031 %sub = sub nsw i32 %3, %4
David Blaikie79e6c742015-02-27 19:29:02 +000032 %arrayidx10 = getelementptr inbounds i32, i32* %a, i32 4000
Jyotsna Verma84256432013-03-01 17:37:13 +000033 store i32 %sub, i32* %arrayidx10, align 4
34 br label %if.end
35
36if.else: ; preds = %entry
David Blaikie79e6c742015-02-27 19:29:02 +000037 %arrayidx11 = getelementptr inbounds i32, i32* %b, i32 3200
Jyotsna Verma84256432013-03-01 17:37:13 +000038 store i32 %add, i32* %arrayidx11, align 4
39 br label %if.end
40
41if.end: ; preds = %if.else, %if.then
42 ret i32 %add
43}