2017-08-11 22:36:05 +08:00
|
|
|
; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \
|
2017-07-22 01:19:00 +08:00
|
|
|
; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt \
|
2017-08-11 22:36:05 +08:00
|
|
|
; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,ADDR32
|
|
|
|
; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \
|
2017-07-22 01:19:00 +08:00
|
|
|
; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -membedded-data \
|
2017-08-11 22:36:05 +08:00
|
|
|
; RUN: | FileCheck %s --check-prefixes=EMBDATA,COMMON,ADDR32
|
|
|
|
|
|
|
|
; RUN: llc < %s -march=mips64 -mcpu=mips4 -mips-ssection-threshold=8 -verify-machineinstrs \
|
|
|
|
; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -target-abi n64 \
|
|
|
|
; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,N64
|
|
|
|
; RUN: llc < %s -march=mips64 -mcpu=mips4 -mips-ssection-threshold=8 -verify-machineinstrs \
|
|
|
|
; RUN: -relocation-model=static -mattr=+noabicalls,+sym32 -mgpopt -target-abi n64 \
|
|
|
|
; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,N64
|
|
|
|
; RUN: llc < %s -march=mips64 -mcpu=mips4 -mips-ssection-threshold=8 -verify-machineinstrs \
|
|
|
|
; RUN: -relocation-model=static -mattr=+noabicalls -mgpopt -target-abi n32 \
|
|
|
|
; RUN: | FileCheck %s --check-prefixes=BASIC,COMMON,ADDR32
|
2017-07-22 01:19:00 +08:00
|
|
|
|
|
|
|
; Test the layout of objects when compiling for static, noabicalls environment.
|
2011-09-14 04:00:35 +08:00
|
|
|
|
2016-11-08 21:03:45 +08:00
|
|
|
%struct.anon = type { i32, i32 }
|
2009-08-13 14:28:06 +08:00
|
|
|
|
2017-08-11 22:36:05 +08:00
|
|
|
; Check that when synthesizing a pointer to the second element of foo, that
|
|
|
|
; we use the correct addition operation. O32 and N32 have 32-bit address
|
|
|
|
; spaces, so they use addiu. N64 has a 64bit address space, but has a submode
|
|
|
|
; where symbol sizes are 32 bits. In those cases we use daddiu.
|
|
|
|
|
|
|
|
; CHECK-LABEL: A1:
|
|
|
|
; N64: daddiu ${{[0-9]+}}, $gp, %gp_rel(foo)
|
|
|
|
; ADDR32: addiu ${{[0-9]+}}, $gp, %gp_rel(foo)
|
|
|
|
|
2017-07-22 01:19:00 +08:00
|
|
|
; BASIC: .type s0,@object
|
|
|
|
; BASIC-NEXT: .section .sdata,"aw",@progbits
|
|
|
|
|
|
|
|
; EMDATA: .type s0,@object
|
|
|
|
; EMDATA-NEXT: .section .rodata,"a",@progbits
|
|
|
|
|
2016-11-08 21:03:45 +08:00
|
|
|
@s0 = constant [8 x i8] c"AAAAAAA\00", align 4
|
2009-08-13 14:28:06 +08:00
|
|
|
|
2017-07-22 01:19:00 +08:00
|
|
|
; BASIC: .type foo,@object
|
|
|
|
; BASIC-NOT: .section
|
|
|
|
|
|
|
|
; EMBDATA: .type foo,@object
|
|
|
|
; EMBDATA-NEXT: .section .sdata,"aw",@progbits
|
2009-08-13 14:28:06 +08:00
|
|
|
@foo = global %struct.anon { i32 2, i32 3 }
|
2016-11-08 21:03:45 +08:00
|
|
|
|
2017-07-22 01:19:00 +08:00
|
|
|
; COMMON: .type bar,@object
|
|
|
|
; COMMON-NEXT: .section .sbss,"aw",@nobits
|
|
|
|
@bar = global %struct.anon zeroinitializer
|
2009-08-13 14:28:06 +08:00
|
|
|
|
|
|
|
define i8* @A0() nounwind {
|
|
|
|
entry:
|
2015-03-14 02:20:45 +08:00
|
|
|
ret i8* getelementptr ([8 x i8], [8 x i8]* @s0, i32 0, i32 0)
|
2009-08-13 14:28:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @A1() nounwind {
|
|
|
|
entry:
|
2015-03-14 02:20:45 +08:00
|
|
|
load i32, i32* getelementptr (%struct.anon, %struct.anon* @foo, i32 0, i32 0), align 8
|
|
|
|
load i32, i32* getelementptr (%struct.anon, %struct.anon* @foo, i32 0, i32 1), align 4
|
2009-08-13 14:28:06 +08:00
|
|
|
add i32 %1, %0
|
|
|
|
ret i32 %2
|
|
|
|
}
|
|
|
|
|