1; RUN: llc -march=hexagon -mcpu=hexagonv4 < %s | FileCheck %s
2; Check that we generate store 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 @storeByte(i32 %val1, i32 %val2, i8 zeroext %ival) nounwind {
9; CHECK: memb(##foo{{ *}}+{{ *}}1){{ *}}={{ *}}r{{[0-9]+}}
10entry:
11  %cmp = icmp sgt i32 %val1, %val2
12  br i1 %cmp, label %if.then, label %if.end
13
14if.then:                                          ; preds = %entry
15  store i8 %ival, i8* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 1), align 1
16  br label %if.end
17
18if.end:                                           ; preds = %if.then, %entry
19  ret void
20}
21
22define void @storeHW(i32 %val1, i32 %val2, i16 signext %ival) nounwind {
23; CHECK: memh(##foo{{ *}}+{{ *}}2){{ *}}={{ *}}r{{[0-9]+}}
24entry:
25  %cmp = icmp sgt i32 %val1, %val2
26  br i1 %cmp, label %if.then, label %if.end
27
28if.then:                                          ; preds = %entry
29  store i16 %ival, i16* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 2), align 2
30  br label %if.end
31
32if.end:                                           ; preds = %if.then, %entry
33  ret void
34}
35
36