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_udiv_i8(i8 %arg1, i8 %arg2) nounwind {
10 ; X64-LABEL: test_udiv_i8:
12 ; X64-NEXT: movzbl %dil, %eax
16 ; DAG-X86-LABEL: test_udiv_i8:
18 ; DAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
19 ; DAG-X86-NEXT: divb {{[0-9]+}}(%esp)
22 ; GISEL-X86-LABEL: test_udiv_i8:
24 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
25 ; GISEL-X86-NEXT: movzbl %al, %eax
26 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
27 ; GISEL-X86-NEXT: divb %cl
28 ; GISEL-X86-NEXT: retl
29 %ret = udiv i8 %arg1, %arg2
33 define i16 @test_udiv_i16(i16 %arg1, i16 %arg2) nounwind {
34 ; X64-LABEL: test_udiv_i16:
36 ; X64-NEXT: movl %edi, %eax
37 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
38 ; X64-NEXT: xorl %edx, %edx
42 ; DAG-X86-LABEL: test_udiv_i16:
44 ; DAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
45 ; DAG-X86-NEXT: xorl %edx, %edx
46 ; DAG-X86-NEXT: divw {{[0-9]+}}(%esp)
49 ; GISEL-X86-LABEL: test_udiv_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: xorl %edx, %edx
55 ; GISEL-X86-NEXT: divw %cx
56 ; GISEL-X86-NEXT: retl
57 %ret = udiv i16 %arg1, %arg2
61 define i32 @test_udiv_i32(i32 %arg1, i32 %arg2) nounwind {
62 ; X64-LABEL: test_udiv_i32:
64 ; X64-NEXT: movl %edi, %eax
65 ; X64-NEXT: xorl %edx, %edx
69 ; X86-LABEL: test_udiv_i32:
71 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
72 ; X86-NEXT: xorl %edx, %edx
73 ; X86-NEXT: divl {{[0-9]+}}(%esp)
75 %ret = udiv i32 %arg1, %arg2
79 define i64 @test_udiv_i64(i64 %arg1, i64 %arg2) nounwind {
80 ; X64-LABEL: test_udiv_i64:
82 ; X64-NEXT: movq %rdi, %rax
83 ; X64-NEXT: xorl %edx, %edx
87 ; DAG-X86-LABEL: test_udiv_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 __udivdi3
95 ; DAG-X86-NEXT: addl $28, %esp
98 ; GISEL-X86-LABEL: test_udiv_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 __udivdi3
111 ; GISEL-X86-NEXT: addl $24, %esp
112 ; GISEL-X86-NEXT: popl %esi
113 ; GISEL-X86-NEXT: retl
114 %ret = udiv i64 %arg1, %arg2