1 ; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s
2 ; Check that we generate load instructions with global + offset
4 %struct.struc = type { i8, i8, i16, i32 }
6 @foo = common global %struct.struc zeroinitializer, align 4
8 define void @loadWord(i32 %val1, i32 %val2, i32* nocapture %ival) nounwind {
9 ; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memw(##foo{{ *}}+{{ *}}4)
11 %cmp = icmp sgt i32 %val1, %val2
12 br i1 %cmp, label %if.then, label %if.end
14 if.then: ; preds = %entry
15 %0 = load i32* getelementptr inbounds (%struct.struc* @foo, i32 0, i32 3), align 4
16 store i32 %0, i32* %ival, align 4
19 if.end: ; preds = %if.then, %entry
23 define void @loadByte(i32 %val1, i32 %val2, i8* nocapture %ival) nounwind {
24 ; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memb(##foo{{ *}}+{{ *}}1)
26 %cmp = icmp sgt i32 %val1, %val2
27 br i1 %cmp, label %if.then, label %if.end
29 if.then: ; preds = %entry
30 %0 = load i8* getelementptr inbounds (%struct.struc* @foo, i32 0, i32 1), align 1
31 store i8 %0, i8* %ival, align 1
34 if.end: ; preds = %if.then, %entry
38 define void @loadHWord(i32 %val1, i32 %val2, i16* %ival) nounwind {
39 ; CHECK: r{{[0-9]+}}{{ *}}={{ *}}memh(##foo{{ *}}+{{ *}}2)
41 %cmp = icmp sgt i32 %val1, %val2
42 br i1 %cmp, label %if.then, label %if.end
44 if.then: ; preds = %entry
45 %0 = load i16* getelementptr inbounds (%struct.struc* @foo, i32 0, i32 2), align 2
46 store i16 %0, i16* %ival, align 2
49 if.end: ; preds = %if.then, %entry