blob: cd1aacc2318ae1c91e697dc7ad5c59a9bb89d5ae [file] [log] [blame]
Jyotsna Vermad9225242013-02-13 21:38:46 +00001; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s
2; Check that we generate load instructions with global + offset
3
4%struct.struc = type { i8, i8, i16, i32 }
5
6@foo = common global %struct.struc zeroinitializer, align 4
7
8define void @loadWord(i32 %val1, i32 %val2, i32* nocapture %ival) nounwind {
9; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memw(##foo{{ *}}+{{ *}}4)
10entry:
11 %cmp = icmp sgt i32 %val1, %val2
12 br i1 %cmp, label %if.then, label %if.end
13
14if.then: ; preds = %entry
David Blaikief72d05b2015-03-13 18:20:45 +000015 %0 = load i32, i32* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 3), align 4
Jyotsna Vermad9225242013-02-13 21:38:46 +000016 store i32 %0, i32* %ival, align 4
17 br label %if.end
18
19if.end: ; preds = %if.then, %entry
20 ret void
21}
22
23define void @loadByte(i32 %val1, i32 %val2, i8* nocapture %ival) nounwind {
24; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memb(##foo{{ *}}+{{ *}}1)
25entry:
26 %cmp = icmp sgt i32 %val1, %val2
27 br i1 %cmp, label %if.then, label %if.end
28
29if.then: ; preds = %entry
David Blaikief72d05b2015-03-13 18:20:45 +000030 %0 = load i8, i8* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 1), align 1
Jyotsna Vermad9225242013-02-13 21:38:46 +000031 store i8 %0, i8* %ival, align 1
32 br label %if.end
33
34if.end: ; preds = %if.then, %entry
35 ret void
36}
37
38define void @loadHWord(i32 %val1, i32 %val2, i16* %ival) nounwind {
39; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memh(##foo{{ *}}+{{ *}}2)
40entry:
41 %cmp = icmp sgt i32 %val1, %val2
42 br i1 %cmp, label %if.then, label %if.end
43
44if.then: ; preds = %entry
David Blaikief72d05b2015-03-13 18:20:45 +000045 %0 = load i16, i16* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 2), align 2
Jyotsna Vermad9225242013-02-13 21:38:46 +000046 store i16 %0, i16* %ival, align 2
47 br label %if.end
48
49if.end: ; preds = %if.then, %entry
50 ret void
51}