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