• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4define i64 @test_sub_i64(i64 %arg1, i64 %arg2) {
5; X64-LABEL: test_sub_i64:
6; X64:       # %bb.0:
7; X64-NEXT:    subq %rsi, %rdi
8; X64-NEXT:    movq %rdi, %rax
9; X64-NEXT:    retq
10  %ret = sub i64 %arg1, %arg2
11  ret i64 %ret
12}
13
14define i32 @test_sub_i32(i32 %arg1, i32 %arg2) {
15; X64-LABEL: test_sub_i32:
16; X64:       # %bb.0:
17; X64-NEXT:    subl %esi, %edi
18; X64-NEXT:    movl %edi, %eax
19; X64-NEXT:    retq
20  %ret = sub i32 %arg1, %arg2
21  ret i32 %ret
22}
23
24define i16 @test_sub_i16(i16 %arg1, i16 %arg2) {
25; X64-LABEL: test_sub_i16:
26; X64:       # %bb.0:
27; X64-NEXT:    subw %si, %di
28; X64-NEXT:    movl %edi, %eax
29; X64-NEXT:    retq
30  %ret = sub i16 %arg1, %arg2
31  ret i16 %ret
32}
33
34define i8 @test_sub_i8(i8 %arg1, i8 %arg2) {
35; X64-LABEL: test_sub_i8:
36; X64:       # %bb.0:
37; X64-NEXT:    subb %sil, %dil
38; X64-NEXT:    movl %edi, %eax
39; X64-NEXT:    retq
40  %ret = sub i8 %arg1, %arg2
41  ret i8 %ret
42}
43
44define i32 @test_sub_i1(i32 %arg1, i32 %arg2) {
45; X64-LABEL: test_sub_i1:
46; X64:       # %bb.0:
47; X64-NEXT:    subb %sil, %dil
48; X64-NEXT:    movzbl %dil, %eax
49; X64-NEXT:    andl $1, %eax
50; X64-NEXT:    retq
51  %a1 = trunc i32 %arg1 to i1
52  %a2 = trunc i32 %arg2 to i1
53  %x = sub i1 %a1 , %a2
54  %ret = zext i1 %x to i32
55  ret i32 %ret
56}
57