1 ; The reason for the bug was that when deciding if a global
2 ; variable can be part of sdata, we were wrongly ignoring
3 ; the presence of any section specified for the variable
4 ; using the section attribute. If such a section is specified,
5 ; and that section is not sdata*/sbss* then the variable
6 ; cannot use GPREL addressing, i.e. memw(#variablename).
8 ; RUN: llc -march=hexagon < %s | FileCheck %s
10 ; CHECK-DAG: memw(##b)
11 ; CHECK-DAG: memw(gp+#d)
12 ; CHECK-DAG: memw(##g)
13 ; CHECK-DAG: memw(gp+#h)
14 ; CHECK-DAG: memw(gp+#f)
15 ; CHECK-DAG: memw(##e)
16 ; CHECK-DAG: memw(gp+#a)
17 ; CHECK-DAG: memw(gp+#c)
21 @b = global i32 0, section ".data.section", align 4
22 @a = common global i32 0, align 4
23 @d = global i32 0, section ".sbss", align 4
24 @c = global i32 0, section ".sdata", align 4
25 @f = global i32 0, section ".sbss.4", align 4
26 @e = global i32 0, section ".sdatafoo", align 4
27 @h = global i32 0, section ".sdata.4", align 4
28 @g = global i32 0, section ".sbssfoo", align 4
30 define void @foo() nounwind {
32 %0 = load i32, ptr @b, align 4
33 store i32 %0, ptr @a, align 4
34 %1 = load i32, ptr @d, align 4
35 store i32 %1, ptr @c, align 4
36 %2 = load i32, ptr @f, align 4
37 store i32 %2, ptr @e, align 4
38 %3 = load i32, ptr @h, align 4
39 store i32 %3, ptr @g, align 4
43 define void @bar() nounwind section ".function.section" {
45 %0 = load i32, ptr @a, align 4
46 store i32 %0, ptr @b, align 4
50 define i32 @main() nounwind readnone {