xref: /llvm-project/llvm/test/CodeGen/PowerPC/lower-globaladdr64-aix.ll (revision 80e2c26dfdd2e5ab1bbbf747ebff8c316399653c)
1; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -code-model=small \
2; RUN: -stop-after=machine-cp -print-before=register-coalescer 2>&1 < \
3; RUN: %s | FileCheck --check-prefix=SMALL %s
4
5; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -code-model=medium \
6; RUN: -stop-after=machine-cp 2>&1 < %s | FileCheck --check-prefix=MEDIUM %s
7
8; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -code-model=large \
9; RUN: -stop-after=machine-cp -print-before=register-coalescer 2>&1 < \
10; RUN: %s | FileCheck --check-prefix=LARGE %s
11
12; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp \
13; RUN: -print-before=register-coalescer 2>&1 < %s | FileCheck \
14; RUN: --check-prefix=SMALL %s
15
16@msg = common global ptr null, align 8
17@ptr = common global ptr null, align 8
18
19define void @foo() {
20entry:
21; SMALL: %0:g8rc_and_g8rc_nox0 = LDtoc @msg, $x2 :: (load (s64) from got)
22; SMALL: %1:g8rc = LD 0, %0:g8rc_and_g8rc_nox0 :: (dereferenceable load (s64) from @msg)
23; SMALL: %2:g8rc_and_g8rc_nox0 = LDtoc @ptr, $x2 :: (load (s64) from got)
24; SMALL: STD %1:g8rc, 0, %2:g8rc_and_g8rc_nox0 :: (store (s64) into @ptr)
25
26; MEDIUM: Medium code model is not supported on AIX.
27
28; LARGE: %0:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @msg
29; LARGE: %1:g8rc_and_g8rc_nox0 = LDtocL @msg, %0:g8rc_and_g8rc_nox0, implicit $x2 :: (load (s64) from got)
30; LARGE: %2:g8rc = LD 0, %1:g8rc_and_g8rc_nox0 :: (dereferenceable load (s64) from @msg)
31; LARGE: %3:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @ptr
32; LARGE: %4:g8rc_and_g8rc_nox0 = LDtocL @ptr, %3:g8rc_and_g8rc_nox0, implicit $x2 :: (load (s64) from got)
33; LARGE: STD %2:g8rc, 0, %4:g8rc_and_g8rc_nox0 :: (store (s64) into @ptr)
34
35  %0 = load ptr, ptr @msg, align 8
36  store ptr %0, ptr @ptr, align 8
37  ret void
38}
39