summaryrefslogtreecommitdiff
path: root/test/CodeGen/Mips/2008-07-15-SmallSection.ll
blob: 3f42489141f0b27c9bc8d5b58f8fa44177065b27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \
; RUN:     -relocation-model=static -mattr=+noabicalls -mgpopt \
; RUN:   | FileCheck %s --check-prefixes=BASIC,COMMON,ADDR32
; RUN: llc < %s -march=mips -mcpu=mips32 -mips-ssection-threshold=8 -verify-machineinstrs \
; RUN:     -relocation-model=static -mattr=+noabicalls -mgpopt -membedded-data \
; 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

; Test the layout of objects when compiling for static, noabicalls environment.

%struct.anon = type { i32, i32 }

; 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)

; BASIC: .type  s0,@object
; BASIC-NEXT: .section .sdata,"aw",@progbits

; EMDATA: .type  s0,@object
; EMDATA-NEXT: .section .rodata,"a",@progbits

@s0 = constant [8 x i8] c"AAAAAAA\00", align 4

; BASIC: .type  foo,@object
; BASIC-NOT:  .section

; EMBDATA: .type  foo,@object
; EMBDATA-NEXT:  .section .sdata,"aw",@progbits
@foo = global %struct.anon { i32 2, i32 3 }

; COMMON:  .type bar,@object
; COMMON-NEXT:  .section  .sbss,"aw",@nobits
@bar = global %struct.anon zeroinitializer

define i8* @A0() nounwind {
entry:
	ret i8* getelementptr ([8 x i8], [8 x i8]* @s0, i32 0, i32 0)
}

define i32 @A1() nounwind {
entry:
  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 
  add i32 %1, %0
  ret i32 %2
}