[Frontend] Remove unused includes (NFC) (#116927)
[llvm-project.git] / llvm / test / CodeGen / X86 / isel-srem.ll
blob56716e10a9d99614b1ab190bce425796c39b1307
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,SDAG-X64
3 ; RUN: llc < %s -fast-isel -fast-isel-abort=1     -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,FAST-X64
4 ; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,GISEL-X64
5 ; RUN: llc < %s -global-isel=0                    -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86,SDAG-X86
6 ; RUN: llc < %s -fast-isel -fast-isel-abort=1     -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86,FAST-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_srem_i8(i8 %arg1, i8 %arg2) nounwind {
10 ; SDAG-X64-LABEL: test_srem_i8:
11 ; SDAG-X64:       # %bb.0:
12 ; SDAG-X64-NEXT:    movsbl %dil, %eax
13 ; SDAG-X64-NEXT:    idivb %sil
14 ; SDAG-X64-NEXT:    movsbl %ah, %eax
15 ; SDAG-X64-NEXT:    # kill: def $al killed $al killed $eax
16 ; SDAG-X64-NEXT:    retq
18 ; FAST-X64-LABEL: test_srem_i8:
19 ; FAST-X64:       # %bb.0:
20 ; FAST-X64-NEXT:    movsbl %dil, %eax
21 ; FAST-X64-NEXT:    idivb %sil
22 ; FAST-X64-NEXT:    shrw $8, %ax
23 ; FAST-X64-NEXT:    # kill: def $al killed $al killed $ax
24 ; FAST-X64-NEXT:    retq
26 ; GISEL-X64-LABEL: test_srem_i8:
27 ; GISEL-X64:       # %bb.0:
28 ; GISEL-X64-NEXT:    movsbl %dil, %eax
29 ; GISEL-X64-NEXT:    idivb %sil
30 ; GISEL-X64-NEXT:    shrw $8, %ax
31 ; GISEL-X64-NEXT:    # kill: def $al killed $al killed $ax
32 ; GISEL-X64-NEXT:    retq
34 ; SDAG-X86-LABEL: test_srem_i8:
35 ; SDAG-X86:       # %bb.0:
36 ; SDAG-X86-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
37 ; SDAG-X86-NEXT:    idivb {{[0-9]+}}(%esp)
38 ; SDAG-X86-NEXT:    movsbl %ah, %eax
39 ; SDAG-X86-NEXT:    # kill: def $al killed $al killed $eax
40 ; SDAG-X86-NEXT:    retl
42 ; FAST-X86-LABEL: test_srem_i8:
43 ; FAST-X86:       # %bb.0:
44 ; FAST-X86-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
45 ; FAST-X86-NEXT:    idivb {{[0-9]+}}(%esp)
46 ; FAST-X86-NEXT:    movb %ah, %al
47 ; FAST-X86-NEXT:    retl
49 ; GISEL-X86-LABEL: test_srem_i8:
50 ; GISEL-X86:       # %bb.0:
51 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
52 ; GISEL-X86-NEXT:    cbtw
53 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
54 ; GISEL-X86-NEXT:    idivb %cl
55 ; GISEL-X86-NEXT:    movb %ah, %al
56 ; GISEL-X86-NEXT:    retl
57   %ret = srem i8 %arg1, %arg2
58   ret i8 %ret
61 define i16 @test_srem_i16(i16 %arg1, i16 %arg2) nounwind {
62 ; X64-LABEL: test_srem_i16:
63 ; X64:       # %bb.0:
64 ; X64-NEXT:    movl %edi, %eax
65 ; X64-NEXT:    # kill: def $ax killed $ax killed $eax
66 ; X64-NEXT:    cwtd
67 ; X64-NEXT:    idivw %si
68 ; X64-NEXT:    movl %edx, %eax
69 ; X64-NEXT:    retq
71 ; DAG-X86-LABEL: test_srem_i16:
72 ; DAG-X86:       # %bb.0:
73 ; DAG-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
74 ; DAG-X86-NEXT:    cwtd
75 ; DAG-X86-NEXT:    idivw {{[0-9]+}}(%esp)
76 ; DAG-X86-NEXT:    movl %edx, %eax
77 ; DAG-X86-NEXT:    retl
79 ; GISEL-X86-LABEL: test_srem_i16:
80 ; GISEL-X86:       # %bb.0:
81 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
82 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
83 ; GISEL-X86-NEXT:    # kill: def $ax killed $ax killed $eax
84 ; GISEL-X86-NEXT:    cwtd
85 ; GISEL-X86-NEXT:    idivw %cx
86 ; GISEL-X86-NEXT:    movl %edx, %eax
87 ; GISEL-X86-NEXT:    retl
88   %ret = srem i16 %arg1, %arg2
89   ret i16 %ret
92 define i32 @test_srem_i32(i32 %arg1, i32 %arg2) nounwind {
93 ; X64-LABEL: test_srem_i32:
94 ; X64:       # %bb.0:
95 ; X64-NEXT:    movl %edi, %eax
96 ; X64-NEXT:    cltd
97 ; X64-NEXT:    idivl %esi
98 ; X64-NEXT:    movl %edx, %eax
99 ; X64-NEXT:    retq
101 ; X86-LABEL: test_srem_i32:
102 ; X86:       # %bb.0:
103 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
104 ; X86-NEXT:    cltd
105 ; X86-NEXT:    idivl {{[0-9]+}}(%esp)
106 ; X86-NEXT:    movl %edx, %eax
107 ; X86-NEXT:    retl
108   %ret = srem i32 %arg1, %arg2
109   ret i32 %ret
112 define i64 @test_srem_i64(i64 %arg1, i64 %arg2) nounwind {
113 ; X64-LABEL: test_srem_i64:
114 ; X64:       # %bb.0:
115 ; X64-NEXT:    movq %rdi, %rax
116 ; X64-NEXT:    cqto
117 ; X64-NEXT:    idivq %rsi
118 ; X64-NEXT:    movq %rdx, %rax
119 ; X64-NEXT:    retq
121 ; DAG-X86-LABEL: test_srem_i64:
122 ; DAG-X86:       # %bb.0:
123 ; DAG-X86-NEXT:    subl $12, %esp
124 ; DAG-X86-NEXT:    pushl {{[0-9]+}}(%esp)
125 ; DAG-X86-NEXT:    pushl {{[0-9]+}}(%esp)
126 ; DAG-X86-NEXT:    pushl {{[0-9]+}}(%esp)
127 ; DAG-X86-NEXT:    pushl {{[0-9]+}}(%esp)
128 ; DAG-X86-NEXT:    calll __moddi3
129 ; DAG-X86-NEXT:    addl $28, %esp
130 ; DAG-X86-NEXT:    retl
132 ; GISEL-X86-LABEL: test_srem_i64:
133 ; GISEL-X86:       # %bb.0:
134 ; GISEL-X86-NEXT:    pushl %esi
135 ; GISEL-X86-NEXT:    subl $24, %esp
136 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
137 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
138 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
139 ; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
140 ; GISEL-X86-NEXT:    movl %eax, (%esp)
141 ; GISEL-X86-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
142 ; GISEL-X86-NEXT:    movl %edx, {{[0-9]+}}(%esp)
143 ; GISEL-X86-NEXT:    movl %esi, {{[0-9]+}}(%esp)
144 ; GISEL-X86-NEXT:    calll __moddi3
145 ; GISEL-X86-NEXT:    addl $24, %esp
146 ; GISEL-X86-NEXT:    popl %esi
147 ; GISEL-X86-NEXT:    retl
148   %ret = srem i64 %arg1, %arg2
149   ret i64 %ret