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
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"
10 define i8 @test_srem_i8(i8 %arg1, i8 %arg2) {
11 %res = srem i8 %arg1, %arg2
15 define i16 @test_srem_i16(i16 %arg1, i16 %arg2) {
16 %res = srem i16 %arg1, %arg2
20 define i32 @test_srem_i32(i32 %arg1, i32 %arg2) {
21 %res = srem i32 %arg1, %arg2
29 exposesReturnsTwice: false
34 tracksRegLiveness: true
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: '' }
43 isFrameAddressTaken: false
44 isReturnAddressTaken: false
53 maxCallFrameSize: 4294967295
54 hasOpaqueSPAdjustment: false
56 hasMustTailInVarArgFunc: false
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: '' }
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
91 exposesReturnsTwice: false
96 tracksRegLiveness: true
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: '' }
105 isFrameAddressTaken: false
106 isReturnAddressTaken: false
115 maxCallFrameSize: 4294967295
116 hasOpaqueSPAdjustment: false
118 hasMustTailInVarArgFunc: false
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: '' }
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
154 exposesReturnsTwice: false
156 regBankSelected: true
159 tracksRegLiveness: true
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: '' }
168 isFrameAddressTaken: false
169 isReturnAddressTaken: false
178 maxCallFrameSize: 4294967295
179 hasOpaqueSPAdjustment: false
181 hasMustTailInVarArgFunc: false
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: '' }
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