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 = "sdiv.ll"
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9 define i8 @test_sdiv_i8(i8 %arg1, i8 %arg2) {
10 %res = sdiv i8 %arg1, %arg2
14 define i16 @test_sdiv_i16(i16 %arg1, i16 %arg2) {
15 %res = sdiv i16 %arg1, %arg2
19 define i32 @test_sdiv_i32(i32 %arg1, i32 %arg2) {
20 %res = sdiv i32 %arg1, %arg2
30 tracksRegLiveness: true
32 - { id: 0, class: gpr }
33 - { id: 1, class: gpr }
34 - { id: 2, class: gpr }
35 - { id: 3, class: gpr }
36 - { id: 4, class: gpr }
41 ; CHECK-LABEL: name: test_sdiv_i8
42 ; CHECK: liveins: $edi, $esi
43 ; CHECK: [[COPY:%[0-9]+]]:gr32_abcd = COPY $edi
44 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
45 ; CHECK: [[COPY2:%[0-9]+]]:gr32_abcd = COPY $esi
46 ; CHECK: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY2]].sub_8bit
47 ; CHECK: $ax = MOVSX16rr8 [[COPY1]]
48 ; CHECK: IDIV8r [[COPY3]], implicit-def $al, implicit-def $ah, implicit-def $eflags, implicit $ax
49 ; CHECK: [[COPY4:%[0-9]+]]:gr8 = COPY $al
50 ; CHECK: $al = COPY [[COPY4]]
51 ; CHECK: RET 0, implicit $al
52 %2:gpr(s32) = COPY $edi
53 %0:gpr(s8) = G_TRUNC %2(s32)
54 %3:gpr(s32) = COPY $esi
55 %1:gpr(s8) = G_TRUNC %3(s32)
56 %4:gpr(s8) = G_SDIV %0, %1
66 tracksRegLiveness: true
68 - { id: 0, class: gpr }
69 - { id: 1, class: gpr }
70 - { id: 2, class: gpr }
71 - { id: 3, class: gpr }
72 - { id: 4, class: gpr }
77 ; CHECK-LABEL: name: test_sdiv_i16
78 ; CHECK: liveins: $edi, $esi
79 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
80 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
81 ; CHECK: [[COPY2:%[0-9]+]]:gr32 = COPY $esi
82 ; CHECK: [[COPY3:%[0-9]+]]:gr16 = COPY [[COPY2]].sub_16bit
83 ; CHECK: $ax = COPY [[COPY1]]
84 ; CHECK: CWD implicit-def $ax, implicit-def $dx, implicit $ax
85 ; CHECK: IDIV16r [[COPY3]], implicit-def $ax, implicit-def $dx, implicit-def $eflags, implicit $ax, implicit $dx
86 ; CHECK: [[COPY4:%[0-9]+]]:gr16 = COPY $ax
87 ; CHECK: $ax = COPY [[COPY4]]
88 ; CHECK: RET 0, implicit $ax
89 %2:gpr(s32) = COPY $edi
90 %0:gpr(s16) = G_TRUNC %2(s32)
91 %3:gpr(s32) = COPY $esi
92 %1:gpr(s16) = G_TRUNC %3(s32)
93 %4:gpr(s16) = G_SDIV %0, %1
102 regBankSelected: true
103 tracksRegLiveness: true
105 - { id: 0, class: gpr }
106 - { id: 1, class: gpr }
107 - { id: 2, class: gpr }
112 ; CHECK-LABEL: name: test_sdiv_i32
113 ; CHECK: liveins: $edi, $esi
114 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
115 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
116 ; CHECK: $eax = COPY [[COPY]]
117 ; CHECK: CDQ implicit-def $eax, implicit-def $edx, implicit $eax
118 ; CHECK: IDIV32r [[COPY1]], implicit-def $eax, implicit-def $edx, implicit-def $eflags, implicit $eax, implicit $edx
119 ; CHECK: [[COPY2:%[0-9]+]]:gr32 = COPY $eax
120 ; CHECK: $eax = COPY [[COPY2]]
121 ; CHECK: RET 0, implicit $eax
122 %0:gpr(s32) = COPY $edi
123 %1:gpr(s32) = COPY $esi
124 %2:gpr(s32) = G_SDIV %0, %1