blob: 3f42489141f0b27c9bc8d5b58f8fa44177065b27 [file] [log] [blame]
Simon Dardisae5b53e2017-08-11 14:36:05 +00001; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \
Simon Dardis0310eb72017-07-21 17:19:00 +00002; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt \
Simon Dardisae5b53e2017-08-11 14:36:05 +00003; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,ADDR32
4; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \
Simon Dardis0310eb72017-07-21 17:19:00 +00005; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -membedded-data \
Simon Dardisae5b53e2017-08-11 14:36:05 +00006; RUN: | FileCheck %s --check-prefixes=EMBDATA,COMMON,ADDR32
7
8; RUN: llc < %s -march=mips64 -mcpu=mips4 -mips-ssection-threshold=8 -verify-machineinstrs \
9; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -target-abi n64 \
10; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,N64
11; RUN: llc < %s -march=mips64 -mcpu=mips4 -mips-ssection-threshold=8 -verify-machineinstrs \
12; RUN: -relocation-model=static -mattr=+noabicalls,+sym32 -mgpopt -target-abi n64 \
13; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,N64
14; RUN: llc < %s -march=mips64 -mcpu=mips4 -mips-ssection-threshold=8 -verify-machineinstrs \
15; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -target-abi n32 \
16; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,ADDR32
Simon Dardis0310eb72017-07-21 17:19:00 +000017
18; Test the layout of objects when compiling for static, noabicalls environment.
Akira Hatanakaf58d6812011-09-13 20:00:35 +000019
Simon Dardise7cc5402016-11-08 13:03:45 +000020%struct.anon = type { i32, i32 }
Chris Lattner68535f72009-08-13 06:28:06 +000021
Simon Dardisae5b53e2017-08-11 14:36:05 +000022; Check that when synthesizing a pointer to the second element of foo, that
23; we use the correct addition operation. O32 and N32 have 32-bit address
24; spaces, so they use addiu. N64 has a 64bit address space, but has a submode
25; where symbol sizes are 32 bits. In those cases we use daddiu.
26
27; CHECK-LABEL: A1:
28; N64: daddiu ${{[0-9]+}}, $gp, %gp_rel(foo)
29; ADDR32: addiu ${{[0-9]+}}, $gp, %gp_rel(foo)
30
Simon Dardis0310eb72017-07-21 17:19:00 +000031; BASIC: .type s0,@object
32; BASIC-NEXT: .section .sdata,"aw",@progbits
33
34; EMDATA: .type s0,@object
35; EMDATA-NEXT: .section .rodata,"a",@progbits
36
Simon Dardise7cc5402016-11-08 13:03:45 +000037@s0 = constant [8 x i8] c"AAAAAAA\00", align 4
Chris Lattner68535f72009-08-13 06:28:06 +000038
Simon Dardis0310eb72017-07-21 17:19:00 +000039; BASIC: .type foo,@object
40; BASIC-NOT: .section
41
42; EMBDATA: .type foo,@object
43; EMBDATA-NEXT: .section .sdata,"aw",@progbits
Chris Lattner68535f72009-08-13 06:28:06 +000044@foo = global %struct.anon { i32 2, i32 3 }
Simon Dardise7cc5402016-11-08 13:03:45 +000045
Simon Dardis0310eb72017-07-21 17:19:00 +000046; COMMON: .type bar,@object
47; COMMON-NEXT: .section .sbss,"aw",@nobits
48@bar = global %struct.anon zeroinitializer
Chris Lattner68535f72009-08-13 06:28:06 +000049
50define i8* @A0() nounwind {
51entry:
David Blaikief72d05b2015-03-13 18:20:45 +000052 ret i8* getelementptr ([8 x i8], [8 x i8]* @s0, i32 0, i32 0)
Chris Lattner68535f72009-08-13 06:28:06 +000053}
54
55define i32 @A1() nounwind {
56entry:
David Blaikief72d05b2015-03-13 18:20:45 +000057 load i32, i32* getelementptr (%struct.anon, %struct.anon* @foo, i32 0, i32 0), align 8
58 load i32, i32* getelementptr (%struct.anon, %struct.anon* @foo, i32 0, i32 1), align 4
Chris Lattner68535f72009-08-13 06:28:06 +000059 add i32 %1, %0
60 ret i32 %2
61}
62