1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple=i386-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-p:32:32-f64:32:64-f80:32-n8:16:32-S128" 8 target triple = "i386--linux-gnu" 9 10 define i8 @test_srem_i8(i8 %arg1, i8 %arg2) { 11 %res = srem i8 %arg1, %arg2 12 ret i8 %res 13 } 14 15 define i16 @test_srem_i16(i16 %arg1, i16 %arg2) { 16 %res = srem i16 %arg1, %arg2 17 ret i16 %res 18 } 19 20 define i32 @test_srem_i32(i32 %arg1, i32 %arg2) { 21 %res = srem i32 %arg1, %arg2 22 ret i32 %res 23 } 24 25... 26--- 27name: test_srem_i8 28alignment: 16 29exposesReturnsTwice: false 30legalized: true 31regBankSelected: true 32selected: false 33failedISel: false 34tracksRegLiveness: true 35registers: 36 - { id: 0, class: gpr, preferred-register: '' } 37 - { id: 1, class: gpr, preferred-register: '' } 38 - { id: 2, class: gpr, preferred-register: '' } 39 - { id: 3, class: gpr, preferred-register: '' } 40 - { id: 4, class: gpr, preferred-register: '' } 41liveins: 42frameInfo: 43 isFrameAddressTaken: false 44 isReturnAddressTaken: false 45 hasStackMap: false 46 hasPatchPoint: false 47 stackSize: 0 48 offsetAdjustment: 0 49 maxAlignment: 4 50 adjustsStack: false 51 hasCalls: false 52 stackProtector: '' 53 maxCallFrameSize: 4294967295 54 hasOpaqueSPAdjustment: false 55 hasVAStart: false 56 hasMustTailInVarArgFunc: false 57 localFrameSize: 0 58 savePoint: '' 59 restorePoint: '' 60fixedStack: 61 - { id: 0, type: default, offset: 4, size: 1, alignment: 4, stack-id: default, 62 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 63 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 64 - { id: 1, type: default, offset: 0, size: 1, alignment: 16, stack-id: default, 65 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 66 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 67stack: 68constants: 69body: | 70 bb.1 (%ir-block.0): 71 ; CHECK-LABEL: name: test_srem_i8 72 ; CHECK: [[MOV8rm:%[0-9]+]]:gr8 = MOV8rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 1 from %fixed-stack.0, align 16) 73 ; CHECK: [[MOV8rm1:%[0-9]+]]:gr8 = MOV8rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 1 from %fixed-stack.1, align 4) 74 ; CHECK: $ax = MOVSX16rr8 [[MOV8rm]] 75 ; CHECK: IDIV8r [[MOV8rm1]], implicit-def $al, implicit-def $ah, implicit-def $eflags, implicit $ax 76 ; CHECK: [[COPY:%[0-9]+]]:gr8 = COPY $ah 77 ; CHECK: $al = COPY [[COPY]] 78 ; CHECK: RET 0, implicit $al 79 %2:gpr(p0) = G_FRAME_INDEX %fixed-stack.1 80 %0:gpr(s8) = G_LOAD %2(p0) :: (invariant load 1 from %fixed-stack.1, align 16) 81 %3:gpr(p0) = G_FRAME_INDEX %fixed-stack.0 82 %1:gpr(s8) = G_LOAD %3(p0) :: (invariant load 1 from %fixed-stack.0, align 4) 83 %4:gpr(s8) = G_SREM %0, %1 84 $al = COPY %4(s8) 85 RET 0, implicit $al 86 87... 88--- 89name: test_srem_i16 90alignment: 16 91exposesReturnsTwice: false 92legalized: true 93regBankSelected: true 94selected: false 95failedISel: false 96tracksRegLiveness: true 97registers: 98 - { id: 0, class: gpr, preferred-register: '' } 99 - { id: 1, class: gpr, preferred-register: '' } 100 - { id: 2, class: gpr, preferred-register: '' } 101 - { id: 3, class: gpr, preferred-register: '' } 102 - { id: 4, class: gpr, preferred-register: '' } 103liveins: 104frameInfo: 105 isFrameAddressTaken: false 106 isReturnAddressTaken: false 107 hasStackMap: false 108 hasPatchPoint: false 109 stackSize: 0 110 offsetAdjustment: 0 111 maxAlignment: 4 112 adjustsStack: false 113 hasCalls: false 114 stackProtector: '' 115 maxCallFrameSize: 4294967295 116 hasOpaqueSPAdjustment: false 117 hasVAStart: false 118 hasMustTailInVarArgFunc: false 119 localFrameSize: 0 120 savePoint: '' 121 restorePoint: '' 122fixedStack: 123 - { id: 0, type: default, offset: 4, size: 2, alignment: 4, stack-id: default, 124 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 125 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 126 - { id: 1, type: default, offset: 0, size: 2, alignment: 16, stack-id: default, 127 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 128 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 129stack: 130constants: 131body: | 132 bb.1 (%ir-block.0): 133 ; CHECK-LABEL: name: test_srem_i16 134 ; CHECK: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 2 from %fixed-stack.0, align 16) 135 ; CHECK: [[MOV16rm1:%[0-9]+]]:gr16 = MOV16rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 2 from %fixed-stack.1, align 4) 136 ; CHECK: $ax = COPY [[MOV16rm]] 137 ; CHECK: CWD implicit-def $ax, implicit-def $dx, implicit $ax 138 ; CHECK: IDIV16r [[MOV16rm1]], implicit-def $ax, implicit-def $dx, implicit-def $eflags, implicit $ax, implicit $dx 139 ; CHECK: [[COPY:%[0-9]+]]:gr16 = COPY $dx 140 ; CHECK: $ax = COPY [[COPY]] 141 ; CHECK: RET 0, implicit $ax 142 %2:gpr(p0) = G_FRAME_INDEX %fixed-stack.1 143 %0:gpr(s16) = G_LOAD %2(p0) :: (invariant load 2 from %fixed-stack.1, align 16) 144 %3:gpr(p0) = G_FRAME_INDEX %fixed-stack.0 145 %1:gpr(s16) = G_LOAD %3(p0) :: (invariant load 2 from %fixed-stack.0, align 4) 146 %4:gpr(s16) = G_SREM %0, %1 147 $ax = COPY %4(s16) 148 RET 0, implicit $ax 149 150... 151--- 152name: test_srem_i32 153alignment: 16 154exposesReturnsTwice: false 155legalized: true 156regBankSelected: true 157selected: false 158failedISel: false 159tracksRegLiveness: true 160registers: 161 - { id: 0, class: gpr, preferred-register: '' } 162 - { id: 1, class: gpr, preferred-register: '' } 163 - { id: 2, class: gpr, preferred-register: '' } 164 - { id: 3, class: gpr, preferred-register: '' } 165 - { id: 4, 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: 4 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: 186 - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default, 187 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 188 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 189 - { id: 1, type: default, offset: 0, size: 4, alignment: 16, stack-id: default, 190 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 191 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 192stack: 193constants: 194body: | 195 bb.1 (%ir-block.0): 196 ; CHECK-LABEL: name: test_srem_i32 197 ; CHECK: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16) 198 ; CHECK: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1) 199 ; CHECK: $eax = COPY [[MOV32rm]] 200 ; CHECK: CDQ implicit-def $eax, implicit-def $edx, implicit $eax 201 ; CHECK: IDIV32r [[MOV32rm1]], implicit-def $eax, implicit-def $edx, implicit-def $eflags, implicit $eax, implicit $edx 202 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edx 203 ; CHECK: $eax = COPY [[COPY]] 204 ; CHECK: RET 0, implicit $eax 205 %2:gpr(p0) = G_FRAME_INDEX %fixed-stack.1 206 %0:gpr(s32) = G_LOAD %2(p0) :: (invariant load 4 from %fixed-stack.1, align 16) 207 %3:gpr(p0) = G_FRAME_INDEX %fixed-stack.0 208 %1:gpr(s32) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 4) 209 %4:gpr(s32) = G_SREM %0, %1 210 $eax = COPY %4(s32) 211 RET 0, implicit $eax 212 213... 214