|
| 1 | +; RUN: llc --march=mips64 -mcpu=mips64r2 < %s | FileCheck %s |
| 2 | + |
| 3 | +; Generated from the C program: |
| 4 | +; |
| 5 | +; #include <stdio.h> |
| 6 | +; #include <string.h> |
| 7 | +; |
| 8 | +; struct SmallStruct_1b { |
| 9 | +; char x1; |
| 10 | +; }; |
| 11 | +; |
| 12 | +; struct SmallStruct_2b { |
| 13 | +; char x1; |
| 14 | +; char x2; |
| 15 | +; }; |
| 16 | +; |
| 17 | +; struct SmallStruct_3b { |
| 18 | +; char x1; |
| 19 | +; char x2; |
| 20 | +; char x3; |
| 21 | +; }; |
| 22 | +; |
| 23 | +; struct SmallStruct_4b { |
| 24 | +; char x1; |
| 25 | +; char x2; |
| 26 | +; char x3; |
| 27 | +; char x4; |
| 28 | +; }; |
| 29 | +; |
| 30 | +; struct SmallStruct_5b { |
| 31 | +; char x1; |
| 32 | +; char x2; |
| 33 | +; char x3; |
| 34 | +; char x4; |
| 35 | +; char x5; |
| 36 | +; }; |
| 37 | +; |
| 38 | +; struct SmallStruct_6b { |
| 39 | +; char x1; |
| 40 | +; char x2; |
| 41 | +; char x3; |
| 42 | +; char x4; |
| 43 | +; char x5; |
| 44 | +; char x6; |
| 45 | +; }; |
| 46 | +; |
| 47 | +; struct SmallStruct_7b { |
| 48 | +; char x1; |
| 49 | +; char x2; |
| 50 | +; char x3; |
| 51 | +; char x4; |
| 52 | +; char x5; |
| 53 | +; char x6; |
| 54 | +; char x7; |
| 55 | +; }; |
| 56 | +; |
| 57 | +; struct SmallStruct_8b { |
| 58 | +; char x1; |
| 59 | +; char x2; |
| 60 | +; char x3; |
| 61 | +; char x4; |
| 62 | +; char x5; |
| 63 | +; char x6; |
| 64 | +; char x7; |
| 65 | +; char x8; |
| 66 | +; }; |
| 67 | +; |
| 68 | +; struct SmallStruct_9b { |
| 69 | +; char x1; |
| 70 | +; char x2; |
| 71 | +; char x3; |
| 72 | +; char x4; |
| 73 | +; char x5; |
| 74 | +; char x6; |
| 75 | +; char x7; |
| 76 | +; char x8; |
| 77 | +; char x9; |
| 78 | +; }; |
| 79 | +; |
| 80 | +; void varArgF_SmallStruct(char* c, ...); |
| 81 | +; |
| 82 | +; void smallStruct_1b(struct SmallStruct_1b* ss) { |
| 83 | +; varArgF_SmallStruct("", *ss); |
| 84 | +; } |
| 85 | +; |
| 86 | +; void smallStruct_2b(struct SmallStruct_2b* ss) { |
| 87 | +; varArgF_SmallStruct("", *ss); |
| 88 | +; } |
| 89 | +; |
| 90 | +; void smallStruct_3b(struct SmallStruct_3b* ss) |
| 91 | +; { |
| 92 | +; varArgF_SmallStruct("", *ss); |
| 93 | +; } |
| 94 | +; |
| 95 | +; void smallStruct_4b(struct SmallStruct_4b* ss) |
| 96 | +; { |
| 97 | +; varArgF_SmallStruct("", *ss); |
| 98 | +; } |
| 99 | +; |
| 100 | +; void smallStruct_5b(struct SmallStruct_5b* ss) |
| 101 | +; { |
| 102 | +; varArgF_SmallStruct("", *ss); |
| 103 | +; } |
| 104 | +; |
| 105 | +; void smallStruct_6b(struct SmallStruct_6b* ss) |
| 106 | +; { |
| 107 | +; varArgF_SmallStruct("", *ss); |
| 108 | +; } |
| 109 | +; |
| 110 | +; void smallStruct_7b(struct SmallStruct_7b* ss) |
| 111 | +; { |
| 112 | +; varArgF_SmallStruct("", *ss); |
| 113 | +; } |
| 114 | +; |
| 115 | +; void smallStruct_8b(struct SmallStruct_8b* ss) |
| 116 | +; { |
| 117 | +; varArgF_SmallStruct("", *ss); |
| 118 | +; } |
| 119 | +; |
| 120 | +; void smallStruct_9b(struct SmallStruct_9b* ss) |
| 121 | +; { |
| 122 | +; varArgF_SmallStruct("", *ss); |
| 123 | +; } |
| 124 | + |
| 125 | +%struct.SmallStruct_1b = type { i8 } |
| 126 | +%struct.SmallStruct_2b = type { i8, i8 } |
| 127 | +%struct.SmallStruct_3b = type { i8, i8, i8 } |
| 128 | +%struct.SmallStruct_4b = type { i8, i8, i8, i8 } |
| 129 | +%struct.SmallStruct_5b = type { i8, i8, i8, i8, i8 } |
| 130 | +%struct.SmallStruct_6b = type { i8, i8, i8, i8, i8, i8 } |
| 131 | +%struct.SmallStruct_7b = type { i8, i8, i8, i8, i8, i8, i8 } |
| 132 | +%struct.SmallStruct_8b = type { i8, i8, i8, i8, i8, i8, i8, i8 } |
| 133 | +%struct.SmallStruct_9b = type { i8, i8, i8, i8, i8, i8, i8, i8, i8 } |
| 134 | + |
| 135 | +@.str = private unnamed_addr constant [3 x i8] c"01\00", align 1 |
| 136 | + |
| 137 | +declare void @varArgF_SmallStruct(i8* %c, ...) |
| 138 | + |
| 139 | +define void @smallStruct_1b(%struct.SmallStruct_1b* %ss) #0 { |
| 140 | +entry: |
| 141 | + %ss.addr = alloca %struct.SmallStruct_1b*, align 8 |
| 142 | + store %struct.SmallStruct_1b* %ss, %struct.SmallStruct_1b** %ss.addr, align 8 |
| 143 | + %0 = load %struct.SmallStruct_1b** %ss.addr, align 8 |
| 144 | + %1 = bitcast %struct.SmallStruct_1b* %0 to { i8 }* |
| 145 | + %2 = getelementptr { i8 }* %1, i32 0, i32 0 |
| 146 | + %3 = load i8* %2, align 1 |
| 147 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i8 inreg %3) |
| 148 | + ret void |
| 149 | + ; CHECK-LABEL: smallStruct_1b: |
| 150 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 |
| 151 | +} |
| 152 | + |
| 153 | +define void @smallStruct_2b(%struct.SmallStruct_2b* %ss) #0 { |
| 154 | +entry: |
| 155 | + %ss.addr = alloca %struct.SmallStruct_2b*, align 8 |
| 156 | + store %struct.SmallStruct_2b* %ss, %struct.SmallStruct_2b** %ss.addr, align 8 |
| 157 | + %0 = load %struct.SmallStruct_2b** %ss.addr, align 8 |
| 158 | + %1 = bitcast %struct.SmallStruct_2b* %0 to { i16 }* |
| 159 | + %2 = getelementptr { i16 }* %1, i32 0, i32 0 |
| 160 | + %3 = load i16* %2, align 1 |
| 161 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i16 inreg %3) |
| 162 | + ret void |
| 163 | + ; CHECK-LABEL: smallStruct_2b: |
| 164 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 48 |
| 165 | +} |
| 166 | + |
| 167 | +define void @smallStruct_3b(%struct.SmallStruct_3b* %ss) #0 { |
| 168 | +entry: |
| 169 | + %ss.addr = alloca %struct.SmallStruct_3b*, align 8 |
| 170 | + %.coerce = alloca { i24 } |
| 171 | + store %struct.SmallStruct_3b* %ss, %struct.SmallStruct_3b** %ss.addr, align 8 |
| 172 | + %0 = load %struct.SmallStruct_3b** %ss.addr, align 8 |
| 173 | + %1 = bitcast { i24 }* %.coerce to i8* |
| 174 | + %2 = bitcast %struct.SmallStruct_3b* %0 to i8* |
| 175 | + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 3, i32 0, i1 false) |
| 176 | + %3 = getelementptr { i24 }* %.coerce, i32 0, i32 0 |
| 177 | + %4 = load i24* %3, align 1 |
| 178 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i24 inreg %4) |
| 179 | + ret void |
| 180 | + ; CHECK-LABEL: smallStruct_3b: |
| 181 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 40 |
| 182 | +} |
| 183 | + |
| 184 | +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1 |
| 185 | + |
| 186 | +define void @smallStruct_4b(%struct.SmallStruct_4b* %ss) #0 { |
| 187 | +entry: |
| 188 | + %ss.addr = alloca %struct.SmallStruct_4b*, align 8 |
| 189 | + store %struct.SmallStruct_4b* %ss, %struct.SmallStruct_4b** %ss.addr, align 8 |
| 190 | + %0 = load %struct.SmallStruct_4b** %ss.addr, align 8 |
| 191 | + %1 = bitcast %struct.SmallStruct_4b* %0 to { i32 }* |
| 192 | + %2 = getelementptr { i32 }* %1, i32 0, i32 0 |
| 193 | + %3 = load i32* %2, align 1 |
| 194 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 inreg %3) |
| 195 | + ret void |
| 196 | + ; CHECK-LABEL: smallStruct_4b: |
| 197 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32 |
| 198 | +} |
| 199 | + |
| 200 | +define void @smallStruct_5b(%struct.SmallStruct_5b* %ss) #0 { |
| 201 | +entry: |
| 202 | + %ss.addr = alloca %struct.SmallStruct_5b*, align 8 |
| 203 | + %.coerce = alloca { i40 } |
| 204 | + store %struct.SmallStruct_5b* %ss, %struct.SmallStruct_5b** %ss.addr, align 8 |
| 205 | + %0 = load %struct.SmallStruct_5b** %ss.addr, align 8 |
| 206 | + %1 = bitcast { i40 }* %.coerce to i8* |
| 207 | + %2 = bitcast %struct.SmallStruct_5b* %0 to i8* |
| 208 | + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 5, i32 0, i1 false) |
| 209 | + %3 = getelementptr { i40 }* %.coerce, i32 0, i32 0 |
| 210 | + %4 = load i40* %3, align 1 |
| 211 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i40 inreg %4) |
| 212 | + ret void |
| 213 | + ; CHECK-LABEL: smallStruct_5b: |
| 214 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 24 |
| 215 | +} |
| 216 | + |
| 217 | +define void @smallStruct_6b(%struct.SmallStruct_6b* %ss) #0 { |
| 218 | +entry: |
| 219 | + %ss.addr = alloca %struct.SmallStruct_6b*, align 8 |
| 220 | + %.coerce = alloca { i48 } |
| 221 | + store %struct.SmallStruct_6b* %ss, %struct.SmallStruct_6b** %ss.addr, align 8 |
| 222 | + %0 = load %struct.SmallStruct_6b** %ss.addr, align 8 |
| 223 | + %1 = bitcast { i48 }* %.coerce to i8* |
| 224 | + %2 = bitcast %struct.SmallStruct_6b* %0 to i8* |
| 225 | + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false) |
| 226 | + %3 = getelementptr { i48 }* %.coerce, i32 0, i32 0 |
| 227 | + %4 = load i48* %3, align 1 |
| 228 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i48 inreg %4) |
| 229 | + ret void |
| 230 | + ; CHECK-LABEL: smallStruct_6b: |
| 231 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 |
| 232 | +} |
| 233 | + |
| 234 | +define void @smallStruct_7b(%struct.SmallStruct_7b* %ss) #0 { |
| 235 | +entry: |
| 236 | + %ss.addr = alloca %struct.SmallStruct_7b*, align 8 |
| 237 | + %.coerce = alloca { i56 } |
| 238 | + store %struct.SmallStruct_7b* %ss, %struct.SmallStruct_7b** %ss.addr, align 8 |
| 239 | + %0 = load %struct.SmallStruct_7b** %ss.addr, align 8 |
| 240 | + %1 = bitcast { i56 }* %.coerce to i8* |
| 241 | + %2 = bitcast %struct.SmallStruct_7b* %0 to i8* |
| 242 | + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 7, i32 0, i1 false) |
| 243 | + %3 = getelementptr { i56 }* %.coerce, i32 0, i32 0 |
| 244 | + %4 = load i56* %3, align 1 |
| 245 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i56 inreg %4) |
| 246 | + ret void |
| 247 | + ; CHECK-LABEL: smallStruct_7b: |
| 248 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 8 |
| 249 | +} |
| 250 | + |
| 251 | +define void @smallStruct_8b(%struct.SmallStruct_8b* %ss) #0 { |
| 252 | +entry: |
| 253 | + %ss.addr = alloca %struct.SmallStruct_8b*, align 8 |
| 254 | + store %struct.SmallStruct_8b* %ss, %struct.SmallStruct_8b** %ss.addr, align 8 |
| 255 | + %0 = load %struct.SmallStruct_8b** %ss.addr, align 8 |
| 256 | + %1 = bitcast %struct.SmallStruct_8b* %0 to { i64 }* |
| 257 | + %2 = getelementptr { i64 }* %1, i32 0, i32 0 |
| 258 | + %3 = load i64* %2, align 1 |
| 259 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %3) |
| 260 | + ret void |
| 261 | + ; CHECK-LABEL: smallStruct_8b: |
| 262 | + ; CHECK-NOT: dsll |
| 263 | +} |
| 264 | + |
| 265 | +define void @smallStruct_9b(%struct.SmallStruct_9b* %ss) #0 { |
| 266 | +entry: |
| 267 | + %ss.addr = alloca %struct.SmallStruct_9b*, align 8 |
| 268 | + %.coerce = alloca { i64, i8 } |
| 269 | + store %struct.SmallStruct_9b* %ss, %struct.SmallStruct_9b** %ss.addr, align 8 |
| 270 | + %0 = load %struct.SmallStruct_9b** %ss.addr, align 8 |
| 271 | + %1 = bitcast { i64, i8 }* %.coerce to i8* |
| 272 | + %2 = bitcast %struct.SmallStruct_9b* %0 to i8* |
| 273 | + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 9, i32 0, i1 false) |
| 274 | + %3 = getelementptr { i64, i8 }* %.coerce, i32 0, i32 0 |
| 275 | + %4 = load i64* %3, align 1 |
| 276 | + %5 = getelementptr { i64, i8 }* %.coerce, i32 0, i32 1 |
| 277 | + %6 = load i8* %5, align 1 |
| 278 | + call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %4, i8 inreg %6) |
| 279 | + ret void |
| 280 | + ; CHECK-LABEL: smallStruct_9b: |
| 281 | + ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 |
| 282 | +} |
0 commit comments