blob: 3e0e5250d2fb8b577e3ba96b6535683dc7412b6d [file] [log] [blame]
Mehdi Amini945a6602015-02-27 18:32:11 +00001; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64
Bill Schmidt579de942013-08-30 02:43:08 +00002
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
10define i32* @t1() nounwind {
11entry:
12; ELF64: t1
13 %addr = alloca i32*, align 4
David Blaikief72d05b2015-03-13 18:20:45 +000014 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
Bill Schmidt579de942013-08-30 02:43:08 +000015; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 124
David Blaikiea79ac142015-02-27 21:17:42 +000016 %0 = load i32*, i32** %addr, align 4
Bill Schmidt579de942013-08-30 02:43:08 +000017 ret i32* %0
18}
19
20define i32* @t2() nounwind {
21entry:
22; ELF64: t2
23 %addr = alloca i32*, align 4
David Blaikief72d05b2015-03-13 18:20:45 +000024 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
Bill Schmidt579de942013-08-30 02:43:08 +000025; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 1148
David Blaikiea79ac142015-02-27 21:17:42 +000026 %0 = load i32*, i32** %addr, align 4
Bill Schmidt579de942013-08-30 02:43:08 +000027 ret i32* %0
28}
29
30define i32* @t3() nounwind {
31entry:
32; ELF64: t3
33 %addr = alloca i32*, align 4
David Blaikief72d05b2015-03-13 18:20:45 +000034 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
Bill Schmidt579de942013-08-30 02:43:08 +000035; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 140
David Blaikiea79ac142015-02-27 21:17:42 +000036 %0 = load i32*, i32** %addr, align 4
Bill Schmidt579de942013-08-30 02:43:08 +000037 ret i32* %0
38}
39
40define i32* @t4() nounwind {
41entry:
42; ELF64: t4
43 %addr = alloca i32*, align 4
David Blaikief72d05b2015-03-13 18:20:45 +000044 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
Bill Schmidt579de942013-08-30 02:43:08 +000045; ELF64: addi {{[0-9]+}}, {{[0-9]+}}, 1284
David Blaikiea79ac142015-02-27 21:17:42 +000046 %0 = load i32*, i32** %addr, align 4
Bill Schmidt579de942013-08-30 02:43:08 +000047 ret i32* %0
48}