[Hexagon] Add PIC support
[oota-llvm.git] / test / CodeGen / Hexagon / pic-static.ll
1 ; RUN: llc -march=hexagon -mcpu=hexagonv5 -relocation-model=pic < %s | FileCheck %s
2
3 ; CHECK-DAG: r{{[0-9]+}} = add({{pc|PC}}, ##_GLOBAL_OFFSET_TABLE_@PCREL)
4 ; CHECK-DAG: r{{[0-9]+}} = add({{pc|PC}}, ##x@PCREL)
5 ; CHECK: r{{[0-9]+}} = memw(r{{[0-9]+}}{{.*}}+{{.*}}##bar@GOT)
6
7 @x = internal global i32 9, align 4
8 @bar = external global i32*
9
10 define i32 @foo(i32 %y) nounwind {
11 entry:
12   store i32* @x, i32** @bar, align 4, !tbaa !0
13   %0 = load i32, i32* @x, align 4, !tbaa !3
14   %add = add nsw i32 %0, %y
15   ret i32 %add
16 }
17
18 !0 = !{!"any pointer", !1}
19 !1 = !{!"omnipotent char", !2}
20 !2 = !{!"Simple C/C++ TBAA"}
21 !3 = !{!"int", !1}