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