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 = 'urem.ll' 6 source_filename = "urem.ll" 7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 8 9 define i8 @test_urem_i8(i8 %arg1, i8 %arg2) { 10 %res = urem i8 %arg1, %arg2 11 ret i8 %res 12 } 13 14 define i16 @test_urem_i16(i16 %arg1, i16 %arg2) { 15 %res = urem i16 %arg1, %arg2 16 ret i16 %res 17 } 18 19 define i32 @test_urem_i32(i32 %arg1, i32 %arg2) { 20 %res = urem i32 %arg1, %arg2 21 ret i32 %res 22 } 23 24 define i64 @test_urem_i64(i64 %arg1, i64 %arg2) { 25 %res = urem i64 %arg1, %arg2 26 ret i64 %res 27 } 28 29... 30--- 31name: test_urem_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_urem_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 = MOVZX16rr8 [[COPY1]] 78 ; CHECK: DIV8r [[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_UREM %0, %1 87 $al = COPY %4(s8) 88 RET 0, implicit $al 89 90... 91--- 92name: test_urem_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_urem_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: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def $eflags 140 ; CHECK: $dx = COPY [[MOV32r0_]].sub_16bit 141 ; CHECK: DIV16r [[COPY3]], implicit-def $ax, implicit-def $dx, implicit-def $eflags, implicit $ax, implicit $dx 142 ; CHECK: [[COPY4:%[0-9]+]]:gr16 = COPY $dx 143 ; CHECK: $ax = COPY [[COPY4]] 144 ; CHECK: RET 0, implicit $ax 145 %2:gpr(s32) = COPY $edi 146 %0:gpr(s16) = G_TRUNC %2(s32) 147 %3:gpr(s32) = COPY $esi 148 %1:gpr(s16) = G_TRUNC %3(s32) 149 %4:gpr(s16) = G_UREM %0, %1 150 $ax = COPY %4(s16) 151 RET 0, implicit $ax 152 153... 154--- 155name: test_urem_i32 156alignment: 16 157exposesReturnsTwice: false 158legalized: true 159regBankSelected: true 160selected: false 161failedISel: false 162tracksRegLiveness: true 163registers: 164 - { id: 0, class: gpr, preferred-register: '' } 165 - { id: 1, class: gpr, preferred-register: '' } 166 - { id: 2, class: gpr, preferred-register: '' } 167liveins: 168frameInfo: 169 isFrameAddressTaken: false 170 isReturnAddressTaken: false 171 hasStackMap: false 172 hasPatchPoint: false 173 stackSize: 0 174 offsetAdjustment: 0 175 maxAlignment: 0 176 adjustsStack: false 177 hasCalls: false 178 stackProtector: '' 179 maxCallFrameSize: 4294967295 180 hasOpaqueSPAdjustment: false 181 hasVAStart: false 182 hasMustTailInVarArgFunc: false 183 localFrameSize: 0 184 savePoint: '' 185 restorePoint: '' 186fixedStack: 187stack: 188constants: 189body: | 190 bb.1 (%ir-block.0): 191 liveins: $edi, $esi 192 193 ; CHECK-LABEL: name: test_urem_i32 194 ; CHECK: liveins: $edi, $esi 195 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 196 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi 197 ; CHECK: $eax = COPY [[COPY]] 198 ; CHECK: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def $eflags 199 ; CHECK: $edx = COPY [[MOV32r0_]] 200 ; CHECK: DIV32r [[COPY1]], implicit-def $eax, implicit-def $edx, implicit-def $eflags, implicit $eax, implicit $edx 201 ; CHECK: [[COPY2:%[0-9]+]]:gr32 = COPY $edx 202 ; CHECK: $eax = COPY [[COPY2]] 203 ; CHECK: RET 0, implicit $eax 204 %0:gpr(s32) = COPY $edi 205 %1:gpr(s32) = COPY $esi 206 %2:gpr(s32) = G_UREM %0, %1 207 $eax = COPY %2(s32) 208 RET 0, implicit $eax 209 210... 211--- 212name: test_urem_i64 213alignment: 16 214exposesReturnsTwice: false 215legalized: true 216regBankSelected: true 217selected: false 218failedISel: false 219tracksRegLiveness: true 220registers: 221 - { id: 0, class: gpr, preferred-register: '' } 222 - { id: 1, class: gpr, preferred-register: '' } 223 - { id: 2, class: gpr, preferred-register: '' } 224liveins: 225frameInfo: 226 isFrameAddressTaken: false 227 isReturnAddressTaken: false 228 hasStackMap: false 229 hasPatchPoint: false 230 stackSize: 0 231 offsetAdjustment: 0 232 maxAlignment: 0 233 adjustsStack: false 234 hasCalls: false 235 stackProtector: '' 236 maxCallFrameSize: 4294967295 237 hasOpaqueSPAdjustment: false 238 hasVAStart: false 239 hasMustTailInVarArgFunc: false 240 localFrameSize: 0 241 savePoint: '' 242 restorePoint: '' 243fixedStack: 244stack: 245constants: 246body: | 247 bb.1 (%ir-block.0): 248 liveins: $rdi, $rsi 249 250 ; CHECK-LABEL: name: test_urem_i64 251 ; CHECK: liveins: $rdi, $rsi 252 ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi 253 ; CHECK: [[COPY1:%[0-9]+]]:gr64 = COPY $rsi 254 ; CHECK: $rax = COPY [[COPY]] 255 ; CHECK: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def $eflags 256 ; CHECK: $rdx = SUBREG_TO_REG 0, [[MOV32r0_]], %subreg.sub_32bit 257 ; CHECK: DIV64r [[COPY1]], implicit-def $rax, implicit-def $rdx, implicit-def $eflags, implicit $rax, implicit $rdx 258 ; CHECK: [[COPY2:%[0-9]+]]:gr64 = COPY $rdx 259 ; CHECK: $rax = COPY [[COPY2]] 260 ; CHECK: RET 0, implicit $rax 261 %0:gpr(s64) = COPY $rdi 262 %1:gpr(s64) = COPY $rsi 263 %2:gpr(s64) = G_UREM %0, %1 264 $rax = COPY %2(s64) 265 RET 0, implicit $rax 266 267... 268