2019-05-22 21:04:34 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2013-11-25 01:41:41 +08:00
|
|
|
; RUN: llc -march=sparc < %s | FileCheck %s --check-prefix=V8
|
|
|
|
; RUN: llc -march=sparcv9 < %s | FileCheck %s --check-prefix=SPARC64
|
|
|
|
|
2016-10-26 06:13:28 +08:00
|
|
|
; (this should ideally be doing "add 4+7; and -8", instead of
|
|
|
|
; "add 7; and -8; add 8"; see comments in LowerDYNAMIC_STACKALLOC)
|
2013-05-17 23:14:34 +08:00
|
|
|
|
|
|
|
define void @variable_alloca_with_adj_call_stack(i32 %num) {
|
2019-05-22 21:04:34 +08:00
|
|
|
; V8-LABEL: variable_alloca_with_adj_call_stack:
|
|
|
|
; V8: .cfi_startproc
|
|
|
|
; V8-NEXT: ! %bb.0: ! %entry
|
|
|
|
; V8-NEXT: save %sp, -96, %sp
|
|
|
|
; V8-NEXT: .cfi_def_cfa_register %fp
|
|
|
|
; V8-NEXT: .cfi_window_save
|
2020-02-25 22:01:26 +08:00
|
|
|
; V8-NEXT: .cfi_register %o7, %i7
|
2019-05-22 21:04:34 +08:00
|
|
|
; V8-NEXT: add %i0, 7, %i0
|
|
|
|
; V8-NEXT: and %i0, -8, %i0
|
|
|
|
; V8-NEXT: sub %sp, %i0, %i0
|
[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C) -> (y - x) - C fold. Try 3
Summary:
Direct sibling of D62223 patch.
While i don't have a direct motivational pattern for this,
it would seem to make sense to handle both patterns (or none),
for symmetry?
The aarch64 changes look neutral;
sparc and systemz look like improvement (one less instruction each);
x86 changes - 32bit case improves, 64bit case shows that LEA no longer
gets constructed, which may be because that whole test is `-mattr=+slow-lea,+slow-3ops-lea`
https://rise4fun.com/Alive/ffh
This is a recommit, originally committed in rL361852, but reverted
to investigate test-suite compile-time hangs, and then reverted in
rL362109 to fix missing constant folds that were causing
endless combine loops.
Reviewers: RKSimon, craig.topper, spatel, t.p.northover
Reviewed By: t.p.northover
Subscribers: t.p.northover, jyknight, javed.absar, kristof.beyls, fedor.sergeev, jrtc27, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62252
llvm-svn: 362143
2019-05-31 04:37:18 +08:00
|
|
|
; V8-NEXT: add %i0, -8, %sp
|
|
|
|
; V8-NEXT: add %i0, 88, %o0
|
2019-05-22 21:04:34 +08:00
|
|
|
; V8-NEXT: add %sp, -16, %sp
|
|
|
|
; V8-NEXT: st %o0, [%sp+104]
|
|
|
|
; V8-NEXT: st %o0, [%sp+100]
|
|
|
|
; V8-NEXT: st %o0, [%sp+96]
|
|
|
|
; V8-NEXT: st %o0, [%sp+92]
|
|
|
|
; V8-NEXT: mov %o0, %o1
|
|
|
|
; V8-NEXT: mov %o0, %o2
|
|
|
|
; V8-NEXT: mov %o0, %o3
|
|
|
|
; V8-NEXT: mov %o0, %o4
|
|
|
|
; V8-NEXT: call foo
|
|
|
|
; V8-NEXT: mov %o0, %o5
|
|
|
|
; V8-NEXT: add %sp, 16, %sp
|
|
|
|
; V8-NEXT: ret
|
|
|
|
; V8-NEXT: restore
|
|
|
|
;
|
|
|
|
; SPARC64-LABEL: variable_alloca_with_adj_call_stack:
|
|
|
|
; SPARC64: .cfi_startproc
|
|
|
|
; SPARC64-NEXT: ! %bb.0: ! %entry
|
|
|
|
; SPARC64-NEXT: save %sp, -128, %sp
|
|
|
|
; SPARC64-NEXT: .cfi_def_cfa_register %fp
|
|
|
|
; SPARC64-NEXT: .cfi_window_save
|
2020-02-25 22:01:26 +08:00
|
|
|
; SPARC64-NEXT: .cfi_register %o7, %i7
|
2019-05-22 21:04:34 +08:00
|
|
|
; SPARC64-NEXT: srl %i0, 0, %i0
|
|
|
|
; SPARC64-NEXT: add %i0, 15, %i0
|
|
|
|
; SPARC64-NEXT: sethi 4194303, %i1
|
|
|
|
; SPARC64-NEXT: or %i1, 1008, %i1
|
|
|
|
; SPARC64-NEXT: sethi 0, %i2
|
|
|
|
; SPARC64-NEXT: or %i2, 1, %i2
|
|
|
|
; SPARC64-NEXT: sllx %i2, 32, %i2
|
|
|
|
; SPARC64-NEXT: or %i2, %i1, %i1
|
|
|
|
; SPARC64-NEXT: and %i0, %i1, %i0
|
|
|
|
; SPARC64-NEXT: sub %sp, %i0, %i0
|
|
|
|
; SPARC64-NEXT: add %i0, 2175, %o0
|
|
|
|
; SPARC64-NEXT: mov %i0, %sp
|
|
|
|
; SPARC64-NEXT: add %sp, -80, %sp
|
|
|
|
; SPARC64-NEXT: stx %o0, [%sp+2247]
|
|
|
|
; SPARC64-NEXT: stx %o0, [%sp+2239]
|
|
|
|
; SPARC64-NEXT: stx %o0, [%sp+2231]
|
|
|
|
; SPARC64-NEXT: stx %o0, [%sp+2223]
|
|
|
|
; SPARC64-NEXT: mov %o0, %o1
|
|
|
|
; SPARC64-NEXT: mov %o0, %o2
|
|
|
|
; SPARC64-NEXT: mov %o0, %o3
|
|
|
|
; SPARC64-NEXT: mov %o0, %o4
|
|
|
|
; SPARC64-NEXT: call foo
|
|
|
|
; SPARC64-NEXT: mov %o0, %o5
|
|
|
|
; SPARC64-NEXT: add %sp, 80, %sp
|
|
|
|
; SPARC64-NEXT: ret
|
|
|
|
; SPARC64-NEXT: restore
|
2013-05-17 23:14:34 +08:00
|
|
|
entry:
|
|
|
|
%0 = alloca i8, i32 %num, align 8
|
|
|
|
call void @foo(i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i8* %0)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-10-26 06:13:28 +08:00
|
|
|
declare void @foo(i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*);
|