• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686--   -mattr=+slow-3ops-lea | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=i686--   -mattr=-slow-3ops-lea | FileCheck %s --check-prefix=X86
4; RUN: llc < %s -mtriple=x86_64-- -mattr=+slow-3ops-lea | FileCheck %s --check-prefix=X64
5; RUN: llc < %s -mtriple=x86_64-- -mattr=-slow-3ops-lea | FileCheck %s --check-prefix=X64
6
7; )32-a)-b  -->  32-(a+b)  -->  -(a+b)+32  -->  -((a+b)-32)  ->  -(a+b+(-32))
8
9define i32 @t0(i32 %a, i32 %b) {
10; X86-LABEL: t0:
11; X86:       # %bb.0:
12; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
13; X86-NEXT:    addl {{[0-9]+}}(%esp), %ecx
14; X86-NEXT:    movl $32, %eax
15; X86-NEXT:    subl %ecx, %eax
16; X86-NEXT:    retl
17;
18; X64-LABEL: t0:
19; X64:       # %bb.0:
20; X64-NEXT:    addl %esi, %edi
21; X64-NEXT:    movl $32, %eax
22; X64-NEXT:    subl %edi, %eax
23; X64-NEXT:    retq
24  %t0 = sub i32 32, %a
25  %r = sub i32 %t0, %b
26  ret i32 %r
27}
28define i32 @t1(i32 %a, i32 %b) {
29; X86-LABEL: t1:
30; X86:       # %bb.0:
31; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
32; X86-NEXT:    addl {{[0-9]+}}(%esp), %ecx
33; X86-NEXT:    movl $32, %eax
34; X86-NEXT:    subl %ecx, %eax
35; X86-NEXT:    retl
36;
37; X64-LABEL: t1:
38; X64:       # %bb.0:
39; X64-NEXT:    addl %esi, %edi
40; X64-NEXT:    movl $32, %eax
41; X64-NEXT:    subl %edi, %eax
42; X64-NEXT:    retq
43  %t0 = add i32 %a, %b
44  %r = sub i32 32, %t0
45  ret i32 %r
46}
47define i32 @t2(i32 %a, i32 %b) {
48; X86-LABEL: t2:
49; X86:       # %bb.0:
50; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
51; X86-NEXT:    addl {{[0-9]+}}(%esp), %ecx
52; X86-NEXT:    movl $32, %eax
53; X86-NEXT:    subl %ecx, %eax
54; X86-NEXT:    retl
55;
56; X64-LABEL: t2:
57; X64:       # %bb.0:
58; X64-NEXT:    addl %esi, %edi
59; X64-NEXT:    movl $32, %eax
60; X64-NEXT:    subl %edi, %eax
61; X64-NEXT:    retq
62  %t0 = add i32 %a, %b
63  %t1 = sub i32 0, %t0
64  %r = add i32 %t1, 32
65  ret i32 %r
66}
67define i32 @t3(i32 %a, i32 %b) {
68; X86-LABEL: t3:
69; X86:       # %bb.0:
70; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
71; X86-NEXT:    addl {{[0-9]+}}(%esp), %ecx
72; X86-NEXT:    movl $32, %eax
73; X86-NEXT:    subl %ecx, %eax
74; X86-NEXT:    retl
75;
76; X64-LABEL: t3:
77; X64:       # %bb.0:
78; X64-NEXT:    addl %esi, %edi
79; X64-NEXT:    movl $32, %eax
80; X64-NEXT:    subl %edi, %eax
81; X64-NEXT:    retq
82  %t0 = add i32 %a, %b
83  %t1 = sub i32 %t0, 32
84  %r = sub i32 0, %t1
85  ret i32 %r
86}
87