1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s 3 4--- | 5 ; ModuleID = 'srem.ll' 6 source_filename = "srem.ll" 7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 8 9 define i8 @test_srem_i8(i8 %arg1, i8 %arg2) { 10 %res = srem i8 %arg1, %arg2 11 ret i8 %res 12 } 13 14 define i16 @test_srem_i16(i16 %arg1, i16 %arg2) { 15 %res = srem i16 %arg1, %arg2 16 ret i16 %res 17 } 18 19 define i32 @test_srem_i32(i32 %arg1, i32 %arg2) { 20 %res = srem i32 %arg1, %arg2 21 ret i32 %res 22 } 23 24 define i64 @test_srem_i64(i64 %arg1, i64 %arg2) { 25 %res = srem i64 %arg1, %arg2 26 ret i64 %res 27 } 28 29... 30--- 31name: test_srem_i8 32alignment: 16 33exposesReturnsTwice: false 34legalized: true 35regBankSelected: true 36selected: false 37failedISel: false 38tracksRegLiveness: true 39registers: 40 - { id: 0, class: gpr, preferred-register: '' } 41 - { id: 1, class: gpr, preferred-register: '' } 42 - { id: 2, class: gpr, preferred-register: '' } 43 - { id: 3, class: gpr, preferred-register: '' } 44 - { id: 4, class: gpr, preferred-register: '' } 45liveins: 46frameInfo: 47 isFrameAddressTaken: false 48 isReturnAddressTaken: false 49 hasStackMap: false 50 hasPatchPoint: false 51 stackSize: 0 52 offsetAdjustment: 0 53 maxAlignment: 0 54 adjustsStack: false 55 hasCalls: false 56 stackProtector: '' 57 maxCallFrameSize: 4294967295 58 hasOpaqueSPAdjustment: false 59 hasVAStart: false 60 hasMustTailInVarArgFunc: false 61 localFrameSize: 0 62 savePoint: '' 63 restorePoint: '' 64fixedStack: 65stack: 66constants: 67body: | 68 bb.1 (%ir-block.0): 69 liveins: $edi, $esi 70 71 ; CHECK-LABEL: name: test_srem_i8 72 ; CHECK: liveins: $edi, $esi 73 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 74 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit 75 ; CHECK: [[COPY2:%[0-9]+]]:gr32 = COPY $esi 76 ; CHECK: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY2]].sub_8bit 77 ; CHECK: $ax = MOVSX16rr8 [[COPY1]] 78 ; CHECK: IDIV8r [[COPY3]], implicit-def $al, implicit-def $ah, implicit-def $eflags, implicit $ax 79 ; CHECK: [[COPY4:%[0-9]+]]:gr8 = COPY $ah 80 ; CHECK: $al = COPY [[COPY4]] 81 ; CHECK: RET 0, implicit $al 82 %2:gpr(s32) = COPY $edi 83 %0:gpr(s8) = G_TRUNC %2(s32) 84 %3:gpr(s32) = COPY $esi 85 %1:gpr(s8) = G_TRUNC %3(s32) 86 %4:gpr(s8) = G_SREM %0, %1 87 $al = COPY %4(s8) 88 RET 0, implicit $al 89 90... 91--- 92name: test_srem_i16 93alignment: 16 94exposesReturnsTwice: false 95legalized: true 96regBankSelected: true 97selected: false 98failedISel: false 99tracksRegLiveness: true 100registers: 101 - { id: 0, class: gpr, preferred-register: '' } 102 - { id: 1, class: gpr, preferred-register: '' } 103 - { id: 2, class: gpr, preferred-register: '' } 104 - { id: 3, class: gpr, preferred-register: '' } 105 - { id: 4, class: gpr, preferred-register: '' } 106liveins: 107frameInfo: 108 isFrameAddressTaken: false 109 isReturnAddressTaken: false 110 hasStackMap: false 111 hasPatchPoint: false 112 stackSize: 0 113 offsetAdjustment: 0 114 maxAlignment: 0 115 adjustsStack: false 116 hasCalls: false 117 stackProtector: '' 118 maxCallFrameSize: 4294967295 119 hasOpaqueSPAdjustment: false 120 hasVAStart: false 121 hasMustTailInVarArgFunc: false 122 localFrameSize: 0 123 savePoint: '' 124 restorePoint: '' 125fixedStack: 126stack: 127constants: 128body: | 129 bb.1 (%ir-block.0): 130 liveins: $edi, $esi 131 132 ; CHECK-LABEL: name: test_srem_i16 133 ; CHECK: liveins: $edi, $esi 134 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 135 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit 136 ; CHECK: [[COPY2:%[0-9]+]]:gr32 = COPY $esi 137 ; CHECK: [[COPY3:%[0-9]+]]:gr16 = COPY [[COPY2]].sub_16bit 138 ; CHECK: $ax = COPY [[COPY1]] 139 ; CHECK: CWD implicit-def $ax, implicit-def $dx, implicit $ax 140 ; CHECK: IDIV16r [[COPY3]], implicit-def $ax, implicit-def $dx, implicit-def $eflags, implicit $ax, implicit $dx 141 ; CHECK: [[COPY4:%[0-9]+]]:gr16 = COPY $dx 142 ; CHECK: $ax = COPY [[COPY4]] 143 ; CHECK: RET 0, implicit $ax 144 %2:gpr(s32) = COPY $edi 145 %0:gpr(s16) = G_TRUNC %2(s32) 146 %3:gpr(s32) = COPY $esi 147 %1:gpr(s16) = G_TRUNC %3(s32) 148 %4:gpr(s16) = G_SREM %0, %1 149 $ax = COPY %4(s16) 150 RET 0, implicit $ax 151 152... 153--- 154name: test_srem_i32 155alignment: 16 156exposesReturnsTwice: false 157legalized: true 158regBankSelected: true 159selected: false 160failedISel: false 161tracksRegLiveness: true 162registers: 163 - { id: 0, class: gpr, preferred-register: '' } 164 - { id: 1, class: gpr, preferred-register: '' } 165 - { id: 2, class: gpr, preferred-register: '' } 166liveins: 167frameInfo: 168 isFrameAddressTaken: false 169 isReturnAddressTaken: false 170 hasStackMap: false 171 hasPatchPoint: false 172 stackSize: 0 173 offsetAdjustment: 0 174 maxAlignment: 0 175 adjustsStack: false 176 hasCalls: false 177 stackProtector: '' 178 maxCallFrameSize: 4294967295 179 hasOpaqueSPAdjustment: false 180 hasVAStart: false 181 hasMustTailInVarArgFunc: false 182 localFrameSize: 0 183 savePoint: '' 184 restorePoint: '' 185fixedStack: 186stack: 187constants: 188body: | 189 bb.1 (%ir-block.0): 190 liveins: $edi, $esi 191 192 ; CHECK-LABEL: name: test_srem_i32 193 ; CHECK: liveins: $edi, $esi 194 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 195 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi 196 ; CHECK: $eax = COPY [[COPY]] 197 ; CHECK: CDQ implicit-def $eax, implicit-def $edx, implicit $eax 198 ; CHECK: IDIV32r [[COPY1]], implicit-def $eax, implicit-def $edx, implicit-def $eflags, implicit $eax, implicit $edx 199 ; CHECK: [[COPY2:%[0-9]+]]:gr32 = COPY $edx 200 ; CHECK: $eax = COPY [[COPY2]] 201 ; CHECK: RET 0, implicit $eax 202 %0:gpr(s32) = COPY $edi 203 %1:gpr(s32) = COPY $esi 204 %2:gpr(s32) = G_SREM %0, %1 205 $eax = COPY %2(s32) 206 RET 0, implicit $eax 207 208... 209--- 210name: test_srem_i64 211alignment: 16 212exposesReturnsTwice: false 213legalized: true 214regBankSelected: true 215selected: false 216failedISel: false 217tracksRegLiveness: true 218registers: 219 - { id: 0, class: gpr, preferred-register: '' } 220 - { id: 1, class: gpr, preferred-register: '' } 221 - { id: 2, class: gpr, preferred-register: '' } 222liveins: 223frameInfo: 224 isFrameAddressTaken: false 225 isReturnAddressTaken: false 226 hasStackMap: false 227 hasPatchPoint: false 228 stackSize: 0 229 offsetAdjustment: 0 230 maxAlignment: 0 231 adjustsStack: false 232 hasCalls: false 233 stackProtector: '' 234 maxCallFrameSize: 4294967295 235 hasOpaqueSPAdjustment: false 236 hasVAStart: false 237 hasMustTailInVarArgFunc: false 238 localFrameSize: 0 239 savePoint: '' 240 restorePoint: '' 241fixedStack: 242stack: 243constants: 244body: | 245 bb.1 (%ir-block.0): 246 liveins: $rdi, $rsi 247 248 ; CHECK-LABEL: name: test_srem_i64 249 ; CHECK: liveins: $rdi, $rsi 250 ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi 251 ; CHECK: [[COPY1:%[0-9]+]]:gr64 = COPY $rsi 252 ; CHECK: $rax = COPY [[COPY]] 253 ; CHECK: CQO implicit-def $rax, implicit-def $rdx, implicit $rax 254 ; CHECK: IDIV64r [[COPY1]], implicit-def $rax, implicit-def $rdx, implicit-def $eflags, implicit $rax, implicit $rdx 255 ; CHECK: [[COPY2:%[0-9]+]]:gr64 = COPY $rdx 256 ; CHECK: $rax = COPY [[COPY2]] 257 ; CHECK: RET 0, implicit $rax 258 %0:gpr(s64) = COPY $rdi 259 %1:gpr(s64) = COPY $rsi 260 %2:gpr(s64) = G_SREM %0, %1 261 $rax = COPY %2(s64) 262 RET 0, implicit $rax 263 264... 265