1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -global-isel=0 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64
3 ; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64
4 ; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64
5 ; RUN: llc < %s -global-isel=0 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86
6 ; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86
7 ; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,GISEL-X86
9 define i8 @test_sdiv_i8(i8 %arg1, i8 %arg2) nounwind {
10 ; X64-LABEL: test_sdiv_i8:
12 ; X64-NEXT: movsbl %dil, %eax
13 ; X64-NEXT: idivb %sil
16 ; DAG-X86-LABEL: test_sdiv_i8:
18 ; DAG-X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
19 ; DAG-X86-NEXT: idivb {{[0-9]+}}(%esp)
22 ; GISEL-X86-LABEL: test_sdiv_i8:
24 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
25 ; GISEL-X86-NEXT: cbtw
26 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
27 ; GISEL-X86-NEXT: idivb %cl
28 ; GISEL-X86-NEXT: retl
29 %ret = sdiv i8 %arg1, %arg2
33 define i16 @test_sdiv_i16(i16 %arg1, i16 %arg2) nounwind {
34 ; X64-LABEL: test_sdiv_i16:
36 ; X64-NEXT: movl %edi, %eax
37 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
42 ; DAG-X86-LABEL: test_sdiv_i16:
44 ; DAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
46 ; DAG-X86-NEXT: idivw {{[0-9]+}}(%esp)
49 ; GISEL-X86-LABEL: test_sdiv_i16:
51 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
52 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
53 ; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
54 ; GISEL-X86-NEXT: cwtd
55 ; GISEL-X86-NEXT: idivw %cx
56 ; GISEL-X86-NEXT: retl
57 %ret = sdiv i16 %arg1, %arg2
61 define i32 @test_sdiv_i32(i32 %arg1, i32 %arg2) nounwind {
62 ; X64-LABEL: test_sdiv_i32:
64 ; X64-NEXT: movl %edi, %eax
66 ; X64-NEXT: idivl %esi
69 ; X86-LABEL: test_sdiv_i32:
71 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
73 ; X86-NEXT: idivl {{[0-9]+}}(%esp)
75 %ret = sdiv i32 %arg1, %arg2
79 define i64 @test_sdiv_i64(i64 %arg1, i64 %arg2) nounwind {
80 ; X64-LABEL: test_sdiv_i64:
82 ; X64-NEXT: movq %rdi, %rax
84 ; X64-NEXT: idivq %rsi
87 ; DAG-X86-LABEL: test_sdiv_i64:
89 ; DAG-X86-NEXT: subl $12, %esp
90 ; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)
91 ; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)
92 ; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)
93 ; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)
94 ; DAG-X86-NEXT: calll __divdi3
95 ; DAG-X86-NEXT: addl $28, %esp
98 ; GISEL-X86-LABEL: test_sdiv_i64:
100 ; GISEL-X86-NEXT: pushl %esi
101 ; GISEL-X86-NEXT: subl $24, %esp
102 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
103 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
104 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
105 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi
106 ; GISEL-X86-NEXT: movl %eax, (%esp)
107 ; GISEL-X86-NEXT: movl %ecx, {{[0-9]+}}(%esp)
108 ; GISEL-X86-NEXT: movl %edx, {{[0-9]+}}(%esp)
109 ; GISEL-X86-NEXT: movl %esi, {{[0-9]+}}(%esp)
110 ; GISEL-X86-NEXT: calll __divdi3
111 ; GISEL-X86-NEXT: addl $24, %esp
112 ; GISEL-X86-NEXT: popl %esi
113 ; GISEL-X86-NEXT: retl
114 %ret = sdiv i64 %arg1, %arg2