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
6 source_filename = "srem.ll"
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9 define i8 @test_srem_i8(i8 %arg1, i8 %arg2) {
10 %res = srem i8 %arg1, %arg2
14 define i16 @test_srem_i16(i16 %arg1, i16 %arg2) {
15 %res = srem i16 %arg1, %arg2
19 define i32 @test_srem_i32(i32 %arg1, i32 %arg2) {
20 %res = srem i32 %arg1, %arg2
24 define i64 @test_srem_i64(i64 %arg1, i64 %arg2) {
25 %res = srem i64 %arg1, %arg2
33 exposesReturnsTwice: false
38 tracksRegLiveness: true
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: '' }
47 isFrameAddressTaken: false
48 isReturnAddressTaken: false
57 maxCallFrameSize: 4294967295
58 hasOpaqueSPAdjustment: false
60 hasMustTailInVarArgFunc: false
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
94 exposesReturnsTwice: false
99 tracksRegLiveness: true
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: '' }
108 isFrameAddressTaken: false
109 isReturnAddressTaken: false
118 maxCallFrameSize: 4294967295
119 hasOpaqueSPAdjustment: false
121 hasMustTailInVarArgFunc: false
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
156 exposesReturnsTwice: false
158 regBankSelected: true
161 tracksRegLiveness: true
163 - { id: 0, class: gpr, preferred-register: '' }
164 - { id: 1, class: gpr, preferred-register: '' }
165 - { id: 2, class: gpr, preferred-register: '' }
168 isFrameAddressTaken: false
169 isReturnAddressTaken: false
178 maxCallFrameSize: 4294967295
179 hasOpaqueSPAdjustment: false
181 hasMustTailInVarArgFunc: false
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
212 exposesReturnsTwice: false
214 regBankSelected: true
217 tracksRegLiveness: true
219 - { id: 0, class: gpr, preferred-register: '' }
220 - { id: 1, class: gpr, preferred-register: '' }
221 - { id: 2, class: gpr, preferred-register: '' }
224 isFrameAddressTaken: false
225 isReturnAddressTaken: false
234 maxCallFrameSize: 4294967295
235 hasOpaqueSPAdjustment: false
237 hasMustTailInVarArgFunc: false
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