1 ; RUN: llc -march=mips < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s 2 ; RUN: llc -march=mipsel < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s 3 4 ; RUN-TODO: llc -march=mips64 -target-abi o32 < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s 5 ; RUN-TODO: llc -march=mips64el -target-abi o32 < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s 6 7 ; RUN: llc -march=mips64 -target-abi n32 < %s | FileCheck --check-prefix=ALL --check-prefix=N32 %s 8 ; RUN: llc -march=mips64el -target-abi n32 < %s | FileCheck --check-prefix=ALL --check-prefix=N32 %s 9 10 ; RUN: llc -march=mips64 -target-abi n64 < %s | FileCheck --check-prefix=ALL --check-prefix=N64 %s 11 ; RUN: llc -march=mips64el -target-abi n64 < %s | FileCheck --check-prefix=ALL --check-prefix=N64 %s 12 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 30 ; ALL-NOT: .align 31 ; ALL-LABEL: byte: 32 ; ALL: .byte 1 33 ; ALL: .size byte, 1 34 35 ; ALL: .align 1 36 ; ALL-LABEL: halfword: 37 ; ALL: .2byte 258 38 ; ALL: .size halfword, 2 39 40 ; ALL: .align 2 41 ; ALL-LABEL: word: 42 ; ALL: .4byte 16909060 43 ; ALL: .size word, 4 44 45 ; ALL: .align 2 46 ; ALL-LABEL: float: 47 ; ALL: .4byte 1065353216 48 ; ALL: .size float, 4 49 50 ; ALL: .align 3 51 ; ALL-LABEL: dword: 52 ; ALL: .8byte 283686952306183 53 ; ALL: .size dword, 8 54 55 ; ALL: .align 3 56 ; ALL-LABEL: double: 57 ; ALL: .8byte 4607182418800017408 58 ; ALL: .size double, 8 59 60 ; O32: .align 2 61 ; N32: .align 2 62 ; N64: .align 3 63 ; 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 79 ; ALL-NOT: .align 80 ; ALL-LABEL: byte_array: 81 ; ALL: .ascii "\001\002" 82 ; ALL: .size byte_array, 2 83 84 ; ALL: .align 1 85 ; ALL-LABEL: halfword_array: 86 ; ALL: .2byte 1 87 ; ALL: .2byte 2 88 ; ALL: .size halfword_array, 4 89 90 ; ALL: .align 2 91 ; ALL-LABEL: word_array: 92 ; ALL: .4byte 1 93 ; ALL: .4byte 2 94 ; ALL: .size word_array, 8 95 96 ; ALL: .align 2 97 ; ALL-LABEL: float_array: 98 ; ALL: .4byte 1065353216 99 ; ALL: .4byte 1073741824 100 ; ALL: .size float_array, 8 101 102 ; ALL: .align 3 103 ; ALL-LABEL: dword_array: 104 ; ALL: .8byte 1 105 ; ALL: .8byte 2 106 ; ALL: .size dword_array, 16 107 108 ; ALL: .align 3 109 ; ALL-LABEL: double_array: 110 ; ALL: .8byte 4607182418800017408 111 ; ALL: .8byte 4611686018427387904 112 ; ALL: .size double_array, 16 113 114 ; O32: .align 2 115 ; N32: .align 2 116 ; N64: .align 3 117 ; 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 131 ; ALL: .align 3 132 ; 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. 141