1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64
3 ; RUN: llc -mtriple=i386-linux-gnu -global-isel -global-isel-abort=2 -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X32
5 define i64 @test_add_i64(i64 %arg1, i64 %arg2) {
6 ; X64-LABEL: test_add_i64:
8 ; X64-NEXT: leaq (%rsi,%rdi), %rax
11 ; X32-LABEL: test_add_i64:
13 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
14 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
15 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
16 ; X32-NEXT: adcl {{[0-9]+}}(%esp), %edx
18 %ret = add i64 %arg1, %arg2
22 define i32 @test_add_i32(i32 %arg1, i32 %arg2) {
23 ; X64-LABEL: test_add_i32:
25 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
26 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
27 ; X64-NEXT: leal (%rsi,%rdi), %eax
30 ; X32-LABEL: test_add_i32:
32 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
33 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
35 %ret = add i32 %arg1, %arg2
39 define i16 @test_add_i16(i16 %arg1, i16 %arg2) {
40 ; X64-LABEL: test_add_i16:
42 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
43 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
44 ; X64-NEXT: leal (%rsi,%rdi), %eax
45 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
48 ; X32-LABEL: test_add_i16:
50 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
51 ; X32-NEXT: addw {{[0-9]+}}(%esp), %ax
53 %ret = add i16 %arg1, %arg2
57 define i8 @test_add_i8(i8 %arg1, i8 %arg2) {
58 ; X64-LABEL: test_add_i8:
60 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
61 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
62 ; X64-NEXT: leal (%rsi,%rdi), %eax
63 ; X64-NEXT: # kill: def $al killed $al killed $eax
66 ; X32-LABEL: test_add_i8:
68 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
69 ; X32-NEXT: addb {{[0-9]+}}(%esp), %al
71 %ret = add i8 %arg1, %arg2
75 define i32 @test_add_i1(i32 %arg1, i32 %arg2) {
76 ; X64-LABEL: test_add_i1:
78 ; X64-NEXT: cmpl %esi, %edi
80 ; X64-NEXT: addb %al, %al
81 ; X64-NEXT: movzbl %al, %eax
82 ; X64-NEXT: andl $1, %eax
85 ; X32-LABEL: test_add_i1:
87 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
88 ; X32-NEXT: cmpl %eax, {{[0-9]+}}(%esp)
90 ; X32-NEXT: addb %al, %al
91 ; X32-NEXT: movzbl %al, %eax
92 ; X32-NEXT: andl $1, %eax
94 %c = icmp eq i32 %arg1, %arg2
96 %ret = zext i1 %x to i32