| 1 |
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=PPC64 |
| 2 |
; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-ibm-aix-xcoff -mcpu=pwr7 | FileCheck %s --check-prefix=PPC64 |
| 3 |
|
| 4 |
%struct.A = type { i32, [2 x [2 x i32]], i8, [3 x [3 x [3 x i32]]] } |
| 5 |
%struct.B = type { i32, [2 x [2 x [2 x %struct.A]]] } |
| 6 |
|
| 7 |
@arr = common global [2 x [2 x [2 x [2 x [2 x i32]]]]] zeroinitializer, align 4 |
| 8 |
@A = common global [3 x [3 x %struct.A]] zeroinitializer, align 4 |
| 9 |
@B = common global [2 x [2 x [2 x %struct.B]]] zeroinitializer, align 4 |
| 10 |
|
| 11 |
define ptr @t1() nounwind { |
| 12 |
entry: |
| 13 |
; PPC64: t1 |
| 14 |
%addr = alloca ptr, align 4 |
| 15 |
store ptr getelementptr inbounds ([2 x [2 x [2 x [2 x [2 x i32]]]]], ptr @arr, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1), ptr %addr, align 4 |
| 16 |
; PPC64: addi {{[0-9]+}}, {{[0-9]+}}, 124 |
| 17 |
%0 = load ptr, ptr %addr, align 4 |
| 18 |
ret ptr %0 |
| 19 |
} |
| 20 |
|
| 21 |
define ptr @t2() nounwind { |
| 22 |
entry: |
| 23 |
; PPC64: t2 |
| 24 |
%addr = alloca ptr, align 4 |
| 25 |
store ptr getelementptr inbounds ([3 x [3 x %struct.A]], ptr @A, i32 0, i32 2, i32 2, i32 3, i32 1, i32 2, i32 2), ptr %addr, align 4 |
| 26 |
; PPC64: addi {{[0-9]+}}, {{[0-9]+}}, 1148 |
| 27 |
%0 = load ptr, ptr %addr, align 4 |
| 28 |
ret ptr %0 |
| 29 |
} |
| 30 |
|
| 31 |
define ptr @t3() nounwind { |
| 32 |
entry: |
| 33 |
; PPC64: t3 |
| 34 |
%addr = alloca ptr, align 4 |
| 35 |
store ptr getelementptr inbounds ([3 x [3 x %struct.A]], ptr @A, i32 0, i32 0, i32 1, i32 1, i32 0, i32 1), ptr %addr, align 4 |
| 36 |
; PPC64: addi {{[0-9]+}}, {{[0-9]+}}, 140 |
| 37 |
%0 = load ptr, ptr %addr, align 4 |
| 38 |
ret ptr %0 |
| 39 |
} |
| 40 |
|
| 41 |
define ptr @t4() nounwind { |
| 42 |
entry: |
| 43 |
; PPC64: t4 |
| 44 |
%addr = alloca ptr, align 4 |
| 45 |
store ptr getelementptr inbounds ([2 x [2 x [2 x %struct.B]]], ptr @B, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 3, i32 1, i32 2, i32 1), ptr %addr, align 4 |
| 46 |
; PPC64: addi {{[0-9]+}}, {{[0-9]+}}, 1284 |
| 47 |
%0 = load ptr, ptr %addr, align 4 |
| 48 |
ret ptr %0 |
| 49 |
} |