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 = "udiv.ll"
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9 define i8 @test_udiv_i8(i8 %arg1, i8 %arg2) {
10 %res = udiv i8 %arg1, %arg2
14 define i16 @test_udiv_i16(i16 %arg1, i16 %arg2) {
15 %res = udiv i16 %arg1, %arg2
19 define i32 @test_udiv_i32(i32 %arg1, i32 %arg2) {
20 %res = udiv i32 %arg1, %arg2
24 define i64 @test_udiv_i64(i64 %arg1, i64 %arg2) {
25 %res = udiv 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_udiv_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 $al
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_UDIV %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_udiv_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 $ax
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_UDIV %0, %1
157 exposesReturnsTwice: false
159 regBankSelected: true
162 tracksRegLiveness: true
164 - { id: 0, class: gpr, preferred-register: '' }
165 - { id: 1, class: gpr, preferred-register: '' }
166 - { id: 2, class: gpr, preferred-register: '' }
169 isFrameAddressTaken: false
170 isReturnAddressTaken: false
179 maxCallFrameSize: 4294967295
180 hasOpaqueSPAdjustment: false
182 hasMustTailInVarArgFunc: false
193 ; CHECK-LABEL: name: test_udiv_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 $eax
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_UDIV %0, %1
214 exposesReturnsTwice: false
216 regBankSelected: true
219 tracksRegLiveness: true
221 - { id: 0, class: gpr, preferred-register: '' }
222 - { id: 1, class: gpr, preferred-register: '' }
223 - { id: 2, class: gpr, preferred-register: '' }
226 isFrameAddressTaken: false
227 isReturnAddressTaken: false
236 maxCallFrameSize: 4294967295
237 hasOpaqueSPAdjustment: false
239 hasMustTailInVarArgFunc: false
250 ; CHECK-LABEL: name: test_udiv_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 $rax
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_UDIV %0, %1