• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; 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
15  %0 = load i32, i32* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 3), align 4
16  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]+}}{{ *}}={{ *}}memub(##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
30  %0 = load i8, i8* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 1), align 1
31  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]+}}{{ *}}={{ *}}memuh(##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
45  %0 = load i16, i16* getelementptr inbounds (%struct.struc, %struct.struc* @foo, i32 0, i32 2), align 2
46  store i16 %0, i16* %ival, align 2
47  br label %if.end
48
49if.end:                                           ; preds = %if.then, %entry
50  ret void
51}
52