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_add_i128(i128 %arg1, i128 %arg2) nounwind {
6 ; X64-LABEL: test_add_i128:
8 ; X64-NEXT: movq %rdx, %rax
9 ; X64-NEXT: addq %rdi, %rax
10 ; X64-NEXT: adcq %rsi, %rcx
11 ; X64-NEXT: movq %rcx, %rdx
14 ; X86-LABEL: test_add_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: addl {{[0-9]+}}(%esp), %ecx
24 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
25 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %esi
26 ; X86-NEXT: adcl {{[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 = add i128 %arg1, %arg2
38 define i64 @test_add_i64(i64 %arg1, i64 %arg2) {
39 ; X64-LABEL: test_add_i64:
41 ; X64-NEXT: leaq (%rsi,%rdi), %rax
44 ; X86-LABEL: test_add_i64:
46 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
48 ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
49 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
51 %ret = add i64 %arg1, %arg2
55 define i32 @test_add_i32(i32 %arg1, i32 %arg2) {
56 ; X64-LABEL: test_add_i32:
58 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
59 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
60 ; X64-NEXT: leal (%rsi,%rdi), %eax
63 ; X86-LABEL: test_add_i32:
65 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
66 ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
68 %ret = add i32 %arg1, %arg2
72 define i16 @test_add_i16(i16 %arg1, i16 %arg2) {
73 ; X64-LABEL: test_add_i16:
75 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
76 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
77 ; X64-NEXT: leal (%rsi,%rdi), %eax
78 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
81 ; X86-LABEL: test_add_i16:
83 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
84 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
85 ; X86-NEXT: addw %cx, %ax
86 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
88 %ret = add i16 %arg1, %arg2
92 define i8 @test_add_i8(i8 %arg1, i8 %arg2) {
93 ; X64-LABEL: test_add_i8:
95 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
96 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
97 ; X64-NEXT: leal (%rsi,%rdi), %eax
98 ; X64-NEXT: # kill: def $al killed $al killed $eax
101 ; X86-LABEL: test_add_i8:
103 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
104 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
105 ; X86-NEXT: addb %cl, %al
106 ; X86-NEXT: # kill: def $al killed $al killed $eax
108 %ret = add i8 %arg1, %arg2
112 define i32 @test_add_i1(i32 %arg1, i32 %arg2) {
113 ; X64-LABEL: test_add_i1:
115 ; X64-NEXT: cmpl %esi, %edi
117 ; X64-NEXT: addb %al, %al
118 ; X64-NEXT: movzbl %al, %eax
119 ; X64-NEXT: andl $1, %eax
122 ; X86-LABEL: test_add_i1:
124 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
125 ; X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp)
127 ; X86-NEXT: addb %al, %al
128 ; X86-NEXT: movzbl %al, %eax
129 ; X86-NEXT: andl $1, %eax
131 %c = icmp eq i32 %arg1, %arg2
133 %ret = zext i1 %x to i32