Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 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_1b1s { |
| 9 | ; char x1; |
| 10 | ; short x2; |
| 11 | ; }; |
| 12 | ; |
| 13 | ; struct SmallStruct_1b1i { |
| 14 | ; char x1; |
| 15 | ; int x2; |
| 16 | ; }; |
| 17 | ; |
| 18 | ; struct SmallStruct_1b1s1b { |
| 19 | ; char x1; |
| 20 | ; short x2; |
| 21 | ; char x3; |
| 22 | ; }; |
| 23 | ; |
| 24 | ; struct SmallStruct_1s1i { |
| 25 | ; short x1; |
| 26 | ; int x2; |
| 27 | ; }; |
| 28 | ; |
| 29 | ; struct SmallStruct_3b1s { |
| 30 | ; char x1; |
| 31 | ; char x2; |
| 32 | ; char x3; |
| 33 | ; short x4; |
| 34 | ; }; |
| 35 | ; |
| 36 | ; void varArgF_SmallStruct(char* c, ...); |
| 37 | ; |
| 38 | ; void smallStruct_1b1s(struct SmallStruct_1b1s* ss) |
| 39 | ; { |
| 40 | ; varArgF_SmallStruct("", *ss); |
| 41 | ; } |
| 42 | ; |
| 43 | ; void smallStruct_1b1i(struct SmallStruct_1b1i* ss) |
| 44 | ; { |
| 45 | ; varArgF_SmallStruct("", *ss); |
| 46 | ; } |
| 47 | ; |
| 48 | ; void smallStruct_1b1s1b(struct SmallStruct_1b1s1b* ss) |
| 49 | ; { |
| 50 | ; varArgF_SmallStruct("", *ss); |
| 51 | ; } |
| 52 | ; |
| 53 | ; void smallStruct_1s1i(struct SmallStruct_1s1i* ss) |
| 54 | ; { |
| 55 | ; varArgF_SmallStruct("", *ss); |
| 56 | ; } |
| 57 | ; |
| 58 | ; void smallStruct_3b1s(struct SmallStruct_3b1s* ss) |
| 59 | ; { |
| 60 | ; varArgF_SmallStruct("", *ss); |
| 61 | ; } |
| 62 | |
| 63 | %struct.SmallStruct_1b1s = type { i8, i16 } |
| 64 | %struct.SmallStruct_1b1i = type { i8, i32 } |
| 65 | %struct.SmallStruct_1b1s1b = type { i8, i16, i8 } |
| 66 | %struct.SmallStruct_1s1i = type { i16, i32 } |
| 67 | %struct.SmallStruct_3b1s = type { i8, i8, i8, i16 } |
| 68 | |
| 69 | @.str = private unnamed_addr constant [3 x i8] c"01\00", align 1 |
| 70 | |
| 71 | declare void @varArgF_SmallStruct(i8* %c, ...) |
| 72 | |
| 73 | define void @smallStruct_1b1s(%struct.SmallStruct_1b1s* %ss) #0 { |
| 74 | entry: |
| 75 | %ss.addr = alloca %struct.SmallStruct_1b1s*, align 8 |
| 76 | store %struct.SmallStruct_1b1s* %ss, %struct.SmallStruct_1b1s** %ss.addr, align 8 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 77 | %0 = load %struct.SmallStruct_1b1s*, %struct.SmallStruct_1b1s** %ss.addr, align 8 |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 78 | %1 = bitcast %struct.SmallStruct_1b1s* %0 to { i32 }* |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 79 | %2 = getelementptr { i32 }, { i32 }* %1, i32 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 80 | %3 = load i32, i32* %2, align 1 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 81 | call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i32 inreg %3) |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 82 | ret void |
| 83 | ; CHECK-LABEL: smallStruct_1b1s: |
| 84 | ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32 |
| 85 | } |
| 86 | |
| 87 | define void @smallStruct_1b1i(%struct.SmallStruct_1b1i* %ss) #0 { |
| 88 | entry: |
| 89 | %ss.addr = alloca %struct.SmallStruct_1b1i*, align 8 |
| 90 | store %struct.SmallStruct_1b1i* %ss, %struct.SmallStruct_1b1i** %ss.addr, align 8 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 91 | %0 = load %struct.SmallStruct_1b1i*, %struct.SmallStruct_1b1i** %ss.addr, align 8 |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 92 | %1 = bitcast %struct.SmallStruct_1b1i* %0 to { i64 }* |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 93 | %2 = getelementptr { i64 }, { i64 }* %1, i32 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 94 | %3 = load i64, i64* %2, align 1 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 95 | call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 inreg %3) |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 96 | ret void |
| 97 | ; CHECK-LABEL: smallStruct_1b1i: |
| 98 | ; CHECK-NOT: dsll |
| 99 | } |
| 100 | |
| 101 | define void @smallStruct_1b1s1b(%struct.SmallStruct_1b1s1b* %ss) #0 { |
| 102 | entry: |
| 103 | %ss.addr = alloca %struct.SmallStruct_1b1s1b*, align 8 |
| 104 | %.coerce = alloca { i48 } |
| 105 | store %struct.SmallStruct_1b1s1b* %ss, %struct.SmallStruct_1b1s1b** %ss.addr, align 8 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 106 | %0 = load %struct.SmallStruct_1b1s1b*, %struct.SmallStruct_1b1s1b** %ss.addr, align 8 |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 107 | %1 = bitcast { i48 }* %.coerce to i8* |
| 108 | %2 = bitcast %struct.SmallStruct_1b1s1b* %0 to i8* |
Pete Cooper | 67cf9a7 | 2015-11-19 05:56:52 +0000 | [diff] [blame] | 109 | call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false) |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 110 | %3 = getelementptr { i48 }, { i48 }* %.coerce, i32 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 111 | %4 = load i48, i48* %3, align 1 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 112 | call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i48 inreg %4) |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 113 | ret void |
| 114 | ; CHECK-LABEL: smallStruct_1b1s1b: |
| 115 | ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 |
| 116 | } |
| 117 | |
Pete Cooper | 67cf9a7 | 2015-11-19 05:56:52 +0000 | [diff] [blame] | 118 | declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1 |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 119 | |
| 120 | define void @smallStruct_1s1i(%struct.SmallStruct_1s1i* %ss) #0 { |
| 121 | entry: |
| 122 | %ss.addr = alloca %struct.SmallStruct_1s1i*, align 8 |
| 123 | store %struct.SmallStruct_1s1i* %ss, %struct.SmallStruct_1s1i** %ss.addr, align 8 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 124 | %0 = load %struct.SmallStruct_1s1i*, %struct.SmallStruct_1s1i** %ss.addr, align 8 |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 125 | %1 = bitcast %struct.SmallStruct_1s1i* %0 to { i64 }* |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 126 | %2 = getelementptr { i64 }, { i64 }* %1, i32 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 127 | %3 = load i64, i64* %2, align 1 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 128 | call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 inreg %3) |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 129 | ret void |
| 130 | ; CHECK-LABEL: smallStruct_1s1i: |
| 131 | ; CHECK-NOT: dsll |
| 132 | } |
| 133 | |
| 134 | define void @smallStruct_3b1s(%struct.SmallStruct_3b1s* %ss) #0 { |
| 135 | entry: |
| 136 | %ss.addr = alloca %struct.SmallStruct_3b1s*, align 8 |
| 137 | %.coerce = alloca { i48 } |
| 138 | store %struct.SmallStruct_3b1s* %ss, %struct.SmallStruct_3b1s** %ss.addr, align 8 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 139 | %0 = load %struct.SmallStruct_3b1s*, %struct.SmallStruct_3b1s** %ss.addr, align 8 |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 140 | %1 = bitcast { i48 }* %.coerce to i8* |
| 141 | %2 = bitcast %struct.SmallStruct_3b1s* %0 to i8* |
Pete Cooper | 67cf9a7 | 2015-11-19 05:56:52 +0000 | [diff] [blame] | 142 | call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false) |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 143 | %3 = getelementptr { i48 }, { i48 }* %.coerce, i32 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 144 | %4 = load i48, i48* %3, align 1 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 145 | call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i48 inreg %4) |
Petar Jovanovic | 90ec1b1 | 2015-02-26 18:35:15 +0000 | [diff] [blame] | 146 | ret void |
| 147 | ; CHECK-LABEL: smallStruct_3b1s: |
| 148 | ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 |
| 149 | } |