blob: e992169f6b646114c38bbb5504fb535f6e2f2ba6 [file] [log] [blame]
Daniel Sanders0d972702016-06-24 12:23:17 +00001; RUN: llc -march=mips < %s | FileCheck --check-prefixes=ALL,O32 %s
2; RUN: llc -march=mipsel < %s | FileCheck --check-prefixes=ALL,O32 %s
Daniel Sanders9fe0ad02014-04-16 09:59:46 +00003
Daniel Sanders0d972702016-06-24 12:23:17 +00004; RUN-TODO: llc -march=mips64 -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
5; RUN-TODO: llc -march=mips64el -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
Daniel Sanders9fe0ad02014-04-16 09:59:46 +00006
Daniel Sanders0d972702016-06-24 12:23:17 +00007; RUN: llc -march=mips64 -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
8; RUN: llc -march=mips64el -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
Daniel Sanders9fe0ad02014-04-16 09:59:46 +00009
Daniel Sanders0d972702016-06-24 12:23:17 +000010; RUN: llc -march=mips64 -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
11; RUN: llc -march=mips64el -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000012
13; Test the memory layout for all ABI's and byte orders as specified by section
14; 4 of MD00305 (MIPS ABIs Described).
15; Bitfields are not covered since they are not available as a type in LLVM IR.
16;
17; The assembly directives deal with endianness so we don't need to account for
18; that.
19
20; Deliberately request alignments that are too small for the target so we get
21; the minimum alignment instead of the preferred alignment.
22@byte = global i8 1, align 1
23@halfword = global i16 258, align 1
24@word = global i32 16909060, align 1
25@float = global float 1.0, align 1
26@dword = global i64 283686952306183, align 1
27@double = global double 1.0, align 1
28@pointer = global i8* @byte
29
Dan Gohman61d15ae2016-01-26 00:03:25 +000030; ALL-NOT: .p2align
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000031; ALL-LABEL: byte:
32; ALL: .byte 1
33; ALL: .size byte, 1
34
Dan Gohman61d15ae2016-01-26 00:03:25 +000035; ALL: .p2align 1
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000036; ALL-LABEL: halfword:
37; ALL: .2byte 258
38; ALL: .size halfword, 2
39
Dan Gohman61d15ae2016-01-26 00:03:25 +000040; ALL: .p2align 2
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000041; ALL-LABEL: word:
42; ALL: .4byte 16909060
43; ALL: .size word, 4
44
Dan Gohman61d15ae2016-01-26 00:03:25 +000045; ALL: .p2align 2
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000046; ALL-LABEL: float:
47; ALL: .4byte 1065353216
48; ALL: .size float, 4
49
Dan Gohman61d15ae2016-01-26 00:03:25 +000050; ALL: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000051; ALL-LABEL: dword:
52; ALL: .8byte 283686952306183
53; ALL: .size dword, 8
54
Dan Gohman61d15ae2016-01-26 00:03:25 +000055; ALL: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000056; ALL-LABEL: double:
57; ALL: .8byte 4607182418800017408
58; ALL: .size double, 8
59
Dan Gohman61d15ae2016-01-26 00:03:25 +000060; O32: .p2align 2
61; N32: .p2align 2
62; N64: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000063; ALL-LABEL: pointer:
64; O32: .4byte byte
65; O32: .size pointer, 4
66; N32: .4byte byte
67; N32: .size pointer, 4
68; N64: .8byte byte
69; N64: .size pointer, 8
70
71@byte_array = global [2 x i8] [i8 1, i8 2], align 1
72@halfword_array = global [2 x i16] [i16 1, i16 2], align 1
73@word_array = global [2 x i32] [i32 1, i32 2], align 1
74@float_array = global [2 x float] [float 1.0, float 2.0], align 1
75@dword_array = global [2 x i64] [i64 1, i64 2], align 1
76@double_array = global [2 x double] [double 1.0, double 2.0], align 1
77@pointer_array = global [2 x i8*] [i8* @byte, i8* @byte]
78
Dan Gohman61d15ae2016-01-26 00:03:25 +000079; ALL-NOT: .p2align
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000080; ALL-LABEL: byte_array:
81; ALL: .ascii "\001\002"
82; ALL: .size byte_array, 2
83
Dan Gohman61d15ae2016-01-26 00:03:25 +000084; ALL: .p2align 1
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000085; ALL-LABEL: halfword_array:
86; ALL: .2byte 1
87; ALL: .2byte 2
88; ALL: .size halfword_array, 4
89
Dan Gohman61d15ae2016-01-26 00:03:25 +000090; ALL: .p2align 2
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000091; ALL-LABEL: word_array:
92; ALL: .4byte 1
93; ALL: .4byte 2
94; ALL: .size word_array, 8
95
Dan Gohman61d15ae2016-01-26 00:03:25 +000096; ALL: .p2align 2
Daniel Sanders9fe0ad02014-04-16 09:59:46 +000097; ALL-LABEL: float_array:
98; ALL: .4byte 1065353216
99; ALL: .4byte 1073741824
100; ALL: .size float_array, 8
101
Dan Gohman61d15ae2016-01-26 00:03:25 +0000102; ALL: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +0000103; ALL-LABEL: dword_array:
104; ALL: .8byte 1
105; ALL: .8byte 2
106; ALL: .size dword_array, 16
107
Dan Gohman61d15ae2016-01-26 00:03:25 +0000108; ALL: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +0000109; ALL-LABEL: double_array:
110; ALL: .8byte 4607182418800017408
111; ALL: .8byte 4611686018427387904
112; ALL: .size double_array, 16
113
Dan Gohman61d15ae2016-01-26 00:03:25 +0000114; O32: .p2align 2
115; N32: .p2align 2
116; N64: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +0000117; ALL-LABEL: pointer_array:
118; O32: .4byte byte
119; O32: .4byte byte
120; O32: .size pointer_array, 8
121; N32: .4byte byte
122; N32: .4byte byte
123; N32: .size pointer_array, 8
124; N64: .8byte byte
125; N64: .8byte byte
126; N64: .size pointer_array, 16
127
128%mixed = type { i8, double, i16 }
129@mixed = global %mixed { i8 1, double 1.0, i16 515 }, align 1
130
Dan Gohman61d15ae2016-01-26 00:03:25 +0000131; ALL: .p2align 3
Daniel Sanders9fe0ad02014-04-16 09:59:46 +0000132; ALL-LABEL: mixed:
133; ALL: .byte 1
134; ALL: .space 7
135; ALL: .8byte 4607182418800017408
136; ALL: .2byte 515
137; ALL: .space 6
138; ALL: .size mixed, 24
139
140; Bitfields are not available in LLVM IR so we can't test them here.