1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
3 ; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X86
5 define i128 @test_sub_i128(i128 %arg1, i128 %arg2) nounwind {
6 ; X64-LABEL: test_sub_i128:
8 ; X64-NEXT: movq %rdi, %rax
9 ; X64-NEXT: subq %rdx, %rax
10 ; X64-NEXT: sbbq %rcx, %rsi
11 ; X64-NEXT: movq %rsi, %rdx
14 ; X86-LABEL: test_sub_i128:
16 ; X86-NEXT: pushl %edi
17 ; X86-NEXT: pushl %esi
18 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
19 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
20 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
21 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
22 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
23 ; X86-NEXT: subl {{[0-9]+}}(%esp), %ecx
24 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edx
25 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %esi
26 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edi
27 ; X86-NEXT: movl %ecx, (%eax)
28 ; X86-NEXT: movl %edx, 4(%eax)
29 ; X86-NEXT: movl %esi, 8(%eax)
30 ; X86-NEXT: movl %edi, 12(%eax)
34 %ret = sub i128 %arg1, %arg2
38 define i64 @test_sub_i64(i64 %arg1, i64 %arg2) {
39 ; X64-LABEL: test_sub_i64:
41 ; X64-NEXT: movq %rdi, %rax
42 ; X64-NEXT: subq %rsi, %rax
45 ; X86-LABEL: test_sub_i64:
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
48 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
49 ; X86-NEXT: subl {{[0-9]+}}(%esp), %eax
50 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edx
52 %ret = sub i64 %arg1, %arg2
56 define i32 @test_sub_i32(i32 %arg1, i32 %arg2) {
57 ; X64-LABEL: test_sub_i32:
59 ; X64-NEXT: movl %edi, %eax
60 ; X64-NEXT: subl %esi, %eax
63 ; X86-LABEL: test_sub_i32:
65 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
66 ; X86-NEXT: subl {{[0-9]+}}(%esp), %eax
68 %ret = sub i32 %arg1, %arg2
72 define i16 @test_sub_i16(i16 %arg1, i16 %arg2) {
73 ; X64-LABEL: test_sub_i16:
75 ; X64-NEXT: movl %edi, %eax
76 ; X64-NEXT: subw %si, %ax
77 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
80 ; X86-LABEL: test_sub_i16:
82 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
83 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
84 ; X86-NEXT: subw %cx, %ax
85 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
87 %ret = sub i16 %arg1, %arg2
91 define i8 @test_sub_i8(i8 %arg1, i8 %arg2) {
92 ; X64-LABEL: test_sub_i8:
94 ; X64-NEXT: movl %edi, %eax
95 ; X64-NEXT: subb %sil, %al
96 ; X64-NEXT: # kill: def $al killed $al killed $eax
99 ; X86-LABEL: test_sub_i8:
101 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
102 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
103 ; X86-NEXT: subb %cl, %al
104 ; X86-NEXT: # kill: def $al killed $al killed $eax
106 %ret = sub i8 %arg1, %arg2
110 define i32 @test_sub_i1(i32 %arg1, i32 %arg2) {
111 ; X64-LABEL: test_sub_i1:
113 ; X64-NEXT: cmpl %esi, %edi
115 ; X64-NEXT: subb %al, %al
116 ; X64-NEXT: movzbl %al, %eax
117 ; X64-NEXT: andl $1, %eax
120 ; X86-LABEL: test_sub_i1:
122 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
123 ; X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp)
125 ; X86-NEXT: subb %al, %al
126 ; X86-NEXT: movzbl %al, %eax
127 ; X86-NEXT: andl $1, %eax
129 %c = icmp eq i32 %arg1, %arg2
131 %ret = zext i1 %x to i32