llvm.org GIT mirror llvm / 2c2a6f8
[X86] Add test cases for PR42998. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369862 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 28 days ago
1 changed file(s) with 73 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefixes=CHECK,FAST-INCDEC
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=goldmont | FileCheck %s --check-prefixes=CHECK,SLOW-INCDEC
3
4 define i64 @imm1_Oz(i32 %x, i32 %y) minsize nounwind {
5 ; CHECK-LABEL: imm1_Oz:
6 ; CHECK: # %bb.0:
7 ; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
8 ; CHECK-NEXT: pushq $1
9 ; CHECK-NEXT: popq %rax
10 ; CHECK-NEXT: leal (%rdi,%rax), %ecx
11 ; CHECK-NEXT: addl %esi, %eax
12 ; CHECK-NEXT: addq %rcx, %rax
13 ; CHECK-NEXT: retq
14 %x1 = add i32 %x, 1
15 %y1 = add i32 %y, 1
16 %x1z = zext i32 %x1 to i64
17 %y1z = zext i32 %y1 to i64
18 %r = add i64 %x1z, %y1z
19 ret i64 %r
20 }
21
22 define i64 @imm1_Os(i32 %x, i32 %y) optsize nounwind {
23 ; FAST-INCDEC-LABEL: imm1_Os:
24 ; FAST-INCDEC: # %bb.0:
25 ; FAST-INCDEC-NEXT: # kill: def $edi killed $edi def $rdi
26 ; FAST-INCDEC-NEXT: movl $1, %eax
27 ; FAST-INCDEC-NEXT: leal (%rdi,%rax), %ecx
28 ; FAST-INCDEC-NEXT: addl %esi, %eax
29 ; FAST-INCDEC-NEXT: addq %rcx, %rax
30 ; FAST-INCDEC-NEXT: retq
31 ;
32 ; SLOW-INCDEC-LABEL: imm1_Os:
33 ; SLOW-INCDEC: # %bb.0:
34 ; SLOW-INCDEC-NEXT: movl $1, %eax
35 ; SLOW-INCDEC-NEXT: # kill: def $edi killed $edi def $rdi
36 ; SLOW-INCDEC-NEXT: leal (%rdi,%rax), %ecx
37 ; SLOW-INCDEC-NEXT: addl %esi, %eax
38 ; SLOW-INCDEC-NEXT: addq %rcx, %rax
39 ; SLOW-INCDEC-NEXT: retq
40 %x1 = add i32 %x, 1
41 %y1 = add i32 %y, 1
42 %x1z = zext i32 %x1 to i64
43 %y1z = zext i32 %y1 to i64
44 %r = add i64 %x1z, %y1z
45 ret i64 %r
46 }
47
48 define i64 @imm1_O2(i32 %x, i32 %y) nounwind {
49 ; FAST-INCDEC-LABEL: imm1_O2:
50 ; FAST-INCDEC: # %bb.0:
51 ; FAST-INCDEC-NEXT: # kill: def $esi killed $esi def $rsi
52 ; FAST-INCDEC-NEXT: # kill: def $edi killed $edi def $rdi
53 ; FAST-INCDEC-NEXT: leal 1(%rdi), %eax
54 ; FAST-INCDEC-NEXT: incl %esi
55 ; FAST-INCDEC-NEXT: addq %rsi, %rax
56 ; FAST-INCDEC-NEXT: retq
57 ;
58 ; SLOW-INCDEC-LABEL: imm1_O2:
59 ; SLOW-INCDEC: # %bb.0:
60 ; SLOW-INCDEC-NEXT: # kill: def $esi killed $esi def $rsi
61 ; SLOW-INCDEC-NEXT: # kill: def $edi killed $edi def $rdi
62 ; SLOW-INCDEC-NEXT: leal 1(%rdi), %eax
63 ; SLOW-INCDEC-NEXT: addl $1, %esi
64 ; SLOW-INCDEC-NEXT: addq %rsi, %rax
65 ; SLOW-INCDEC-NEXT: retq
66 %x1 = add i32 %x, 1
67 %y1 = add i32 %y, 1
68 %x1z = zext i32 %x1 to i64
69 %y1z = zext i32 %y1 to i64
70 %r = add i64 %x1z, %y1z
71 ret i64 %r
72 }