Simon Dardis | ae5b53e | 2017-08-11 14:36:05 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \ |
Simon Dardis | 0310eb7 | 2017-07-21 17:19:00 +0000 | [diff] [blame] | 2 | ; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt \ |
Simon Dardis | ae5b53e | 2017-08-11 14:36:05 +0000 | [diff] [blame] | 3 | ; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,ADDR32 |
| 4 | ; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \ |
Simon Dardis | 0310eb7 | 2017-07-21 17:19:00 +0000 | [diff] [blame] | 5 | ; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -membedded-data \ |
Simon Dardis | ae5b53e | 2017-08-11 14:36:05 +0000 | [diff] [blame] | 6 | ; 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 Dardis | 0310eb7 | 2017-07-21 17:19:00 +0000 | [diff] [blame] | 17 | |
| 18 | ; Test the layout of objects when compiling for static, noabicalls environment. |
Akira Hatanaka | f58d681 | 2011-09-13 20:00:35 +0000 | [diff] [blame] | 19 | |
Simon Dardis | e7cc540 | 2016-11-08 13:03:45 +0000 | [diff] [blame] | 20 | %struct.anon = type { i32, i32 } |
Chris Lattner | 68535f7 | 2009-08-13 06:28:06 +0000 | [diff] [blame] | 21 | |
Simon Dardis | ae5b53e | 2017-08-11 14:36:05 +0000 | [diff] [blame] | 22 | ; 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 Dardis | 0310eb7 | 2017-07-21 17:19:00 +0000 | [diff] [blame] | 31 | ; 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 Dardis | e7cc540 | 2016-11-08 13:03:45 +0000 | [diff] [blame] | 37 | @s0 = constant [8 x i8] c"AAAAAAA\00", align 4 |
Chris Lattner | 68535f7 | 2009-08-13 06:28:06 +0000 | [diff] [blame] | 38 | |
Simon Dardis | 0310eb7 | 2017-07-21 17:19:00 +0000 | [diff] [blame] | 39 | ; BASIC: .type foo,@object |
| 40 | ; BASIC-NOT: .section |
| 41 | |
| 42 | ; EMBDATA: .type foo,@object |
| 43 | ; EMBDATA-NEXT: .section .sdata,"aw",@progbits |
Chris Lattner | 68535f7 | 2009-08-13 06:28:06 +0000 | [diff] [blame] | 44 | @foo = global %struct.anon { i32 2, i32 3 } |
Simon Dardis | e7cc540 | 2016-11-08 13:03:45 +0000 | [diff] [blame] | 45 | |
Simon Dardis | 0310eb7 | 2017-07-21 17:19:00 +0000 | [diff] [blame] | 46 | ; COMMON: .type bar,@object |
| 47 | ; COMMON-NEXT: .section .sbss,"aw",@nobits |
| 48 | @bar = global %struct.anon zeroinitializer |
Chris Lattner | 68535f7 | 2009-08-13 06:28:06 +0000 | [diff] [blame] | 49 | |
| 50 | define i8* @A0() nounwind { |
| 51 | entry: |
David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 52 | ret i8* getelementptr ([8 x i8], [8 x i8]* @s0, i32 0, i32 0) |
Chris Lattner | 68535f7 | 2009-08-13 06:28:06 +0000 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | define i32 @A1() nounwind { |
| 56 | entry: |
David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 57 | 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 Lattner | 68535f7 | 2009-08-13 06:28:06 +0000 | [diff] [blame] | 59 | add i32 %1, %0 |
| 60 | ret i32 %2 |
| 61 | } |
| 62 | |