1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -global-isel -verify-machineinstrs -stop-after=irtranslator < %s | FileCheck %s 3 4%struct.A = type { i8, float, i32, i32, i32 } 5 6define void @f() { 7 ; CHECK-LABEL: name: f 8 ; CHECK: bb.1 (%ir-block.0): 9 ; CHECK: BLR8 implicit $lr8, implicit $rm 10 ret void 11} 12 13define void @foo1(i32 %x){ 14 ; CHECK-LABEL: name: foo1 15 ; CHECK: bb.1 (%ir-block.0): 16 ; CHECK: liveins: $x3 17 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 18 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 19 ; CHECK: BLR8 implicit $lr8, implicit $rm 20 ret void 21} 22 23define void @foo2(i64 %x){ 24 ; CHECK-LABEL: name: foo2 25 ; CHECK: bb.1 (%ir-block.0): 26 ; CHECK: liveins: $x3 27 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 28 ; CHECK: BLR8 implicit $lr8, implicit $rm 29 ret void 30} 31 32define void @foo3(<7 x i8> %x) { 33 ; CHECK-LABEL: name: foo3 34 ; CHECK: bb.1 (%ir-block.0): 35 ; CHECK: liveins: $x3, $x4, $x5, $x6, $x7, $x8, $x9 36 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 37 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x4 38 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x5 39 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x6 40 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $x7 41 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $x8 42 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $x9 43 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<7 x s64>) = G_BUILD_VECTOR [[COPY]](s64), [[COPY1]](s64), [[COPY2]](s64), [[COPY3]](s64), [[COPY4]](s64), [[COPY5]](s64), [[COPY6]](s64) 44 ; CHECK: [[TRUNC7:%[0-9]+]]:_(<7 x s8>) = G_TRUNC [[BUILD_VECTOR]](<7 x s64>) 45 ; CHECK: BLR8 implicit $lr8, implicit $rm 46 ret void 47} 48 49 50 51define void @foo_notrunc(<7 x i64> %x) { 52 ; CHECK-LABEL: name: foo_notrunc 53 ; CHECK: bb.1 (%ir-block.0): 54 ; CHECK: liveins: $x3, $x4, $x5, $x6, $x7, $x8, $x9 55 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 56 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x4 57 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x5 58 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x6 59 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $x7 60 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $x8 61 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $x9 62 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<7 x s64>) = G_BUILD_VECTOR [[COPY]](s64), [[COPY1]](s64), [[COPY2]](s64), [[COPY3]](s64), [[COPY4]](s64), [[COPY5]](s64), [[COPY6]](s64) 63 ; CHECK: BLR8 implicit $lr8, implicit $rm 64 ret void 65} 66 67define void @foo_pt(ptr %x) { 68 ; CHECK-LABEL: name: foo_pt 69 ; CHECK: bb.1 (%ir-block.0): 70 ; CHECK: liveins: $x3 71 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x3 72 ; CHECK: BLR8 implicit $lr8, implicit $rm 73 ret void 74} 75 76; TODO: The correct registers used to pass struct arguments in this example 77; are R3, R4 and R5. Currently, the calling convention used for GlobalISel 78; does not handle passing structs and will need to implemented at a later time. 79define dso_local void @foo_struct(%struct.A %a) #0 { 80 ; CHECK-LABEL: name: foo_struct 81 ; CHECK: bb.1.entry: 82 ; CHECK: liveins: $f1, $x3, $x5, $x6, $x7 83 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 84 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s64) 85 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $f1 86 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x5 87 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY2]](s64) 88 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x6 89 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY3]](s64) 90 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $x7 91 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY4]](s64) 92 ; CHECK: BLR8 implicit $lr8, implicit $rm 93entry: 94 ret void 95} 96 97define void @foo_int(ptr %x) { 98 ; CHECK-LABEL: name: foo_int 99 ; CHECK: bb.1 (%ir-block.0): 100 ; CHECK: liveins: $x3 101 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x3 102 ; CHECK: BLR8 implicit $lr8, implicit $rm 103 ret void 104} 105 106define void @foo(ptr %x) { 107 ; CHECK-LABEL: name: foo 108 ; CHECK: bb.1 (%ir-block.0): 109 ; CHECK: liveins: $x3 110 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x3 111 ; CHECK: BLR8 implicit $lr8, implicit $rm 112 ret void 113} 114 115define void @foo_multiple(i1 %a, i8 %b, i16 %c, i32 %d, i64 %e, i128 %f){ 116 ; CHECK-LABEL: name: foo_multiple 117 ; CHECK: bb.1 (%ir-block.0): 118 ; CHECK: liveins: $x3, $x4, $x5, $x6, $x7, $x8, $x9 119 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 120 ; CHECK: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s64) 121 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x4 122 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s64) 123 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x5 124 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[COPY2]](s64) 125 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x6 126 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY3]](s64) 127 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $x7 128 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $x8 129 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $x9 130 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[COPY5]](s64), [[COPY6]](s64) 131 ; CHECK: BLR8 implicit $lr8, implicit $rm 132 ret void 133} 134 135define void @foo_multiple_same_ty(i64 %x, i64 %y, i64 %z){ 136 ; CHECK-LABEL: name: foo_multiple_same_ty 137 ; CHECK: bb.1 (%ir-block.0): 138 ; CHECK: liveins: $x3, $x4, $x5 139 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 140 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x4 141 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x5 142 ; CHECK: BLR8 implicit $lr8, implicit $rm 143 ret void 144} 145 146define void @foo_float(float %x) { 147 ; CHECK-LABEL: name: foo_float 148 ; CHECK: bb.1 (%ir-block.0): 149 ; CHECK: liveins: $f1 150 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $f1 151 ; CHECK: BLR8 implicit $lr8, implicit $rm 152 ret void 153} 154 155define void @foo_dbl(double %x) { 156 ; CHECK-LABEL: name: foo_dbl 157 ; CHECK: bb.1 (%ir-block.0): 158 ; CHECK: liveins: $f1 159 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $f1 160 ; CHECK: BLR8 implicit $lr8, implicit $rm 161 ret void 162} 163 164define void @foo_array([7 x i8] %x) { 165 ; CHECK-LABEL: name: foo_array 166 ; CHECK: bb.1 (%ir-block.0): 167 ; CHECK: liveins: $x3, $x4, $x5, $x6, $x7, $x8, $x9 168 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x3 169 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s64) 170 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x4 171 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s64) 172 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x5 173 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[COPY2]](s64) 174 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x6 175 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[COPY3]](s64) 176 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $x7 177 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s8) = G_TRUNC [[COPY4]](s64) 178 ; CHECK: [[COPY5:%[0-9]+]]:_(s64) = COPY $x8 179 ; CHECK: [[TRUNC5:%[0-9]+]]:_(s8) = G_TRUNC [[COPY5]](s64) 180 ; CHECK: [[COPY6:%[0-9]+]]:_(s64) = COPY $x9 181 ; CHECK: [[TRUNC6:%[0-9]+]]:_(s8) = G_TRUNC [[COPY6]](s64) 182 ; CHECK: BLR8 implicit $lr8, implicit $rm 183 ret void 184} 185