1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/CodeGen/SystemZ/alloca-03.ll
Roman Lebedev fff3d4d729 [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-30 20:37:18 +00:00

128 lines
3.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
; Allocate 8 bytes, no need to align stack.
define void @f0() {
; CHECK-LABEL: f0:
; CHECK: # %bb.0:
; CHECK-NEXT: aghi %r15, -168
; CHECK-NEXT: .cfi_def_cfa_offset 328
; CHECK-NEXT: mvghi 160(%r15), 10
; CHECK-NEXT: aghi %r15, 168
; CHECK-NEXT: br %r14
%x = alloca i64
store volatile i64 10, i64* %x
ret void
}
; Allocate %len * 8, no need to align stack.
define void @f1(i64 %len) {
; CHECK-LABEL: f1:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: lgr %r1, %r15
; CHECK-NEXT: sllg %r0, %r2, 3
; CHECK-NEXT: sgr %r1, %r0
; CHECK-NEXT: la %r2, 160(%r1)
; CHECK-NEXT: lgr %r15, %r1
; CHECK-NEXT: mvghi 0(%r2), 10
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%x = alloca i64, i64 %len
store volatile i64 10, i64* %x
ret void
}
; Static alloca, align 128.
define void @f2() {
; CHECK-LABEL: f2:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: lgr %r1, %r15
; CHECK-NEXT: aghi %r1, -128
; CHECK-NEXT: la %r2, 280(%r1)
; CHECK-NEXT: nill %r2, 65408
; CHECK-NEXT: lgr %r15, %r1
; CHECK-NEXT: mvghi 0(%r2), 10
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%x = alloca i64, i64 1, align 128
store volatile i64 10, i64* %x, align 128
ret void
}
; Dynamic alloca, align 128.
define void @f3(i64 %len) {
; CHECK-LABEL: f3:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: lgr %r1, %r15
; CHECK-NEXT: sllg %r0, %r2, 3
; CHECK-NEXT: sgr %r1, %r0
; CHECK-NEXT: lay %r15, -120(%r1)
; CHECK-NEXT: la %r1, 160(%r1)
; CHECK-NEXT: nill %r1, 65408
; CHECK-NEXT: mvghi 0(%r1), 10
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%x = alloca i64, i64 %len, align 128
store volatile i64 10, i64* %x, align 128
ret void
}
; Static alloca w/out alignment - part of frame.
define void @f4() {
; CHECK-LABEL: f4:
; CHECK: # %bb.0:
; CHECK-NEXT: aghi %r15, -168
; CHECK-NEXT: .cfi_def_cfa_offset 328
; CHECK-NEXT: mvhi 164(%r15), 10
; CHECK-NEXT: aghi %r15, 168
; CHECK-NEXT: br %r14
%x = alloca i32
store volatile i32 10, i32* %x
ret void
}
; Static alloca of one i32, aligned by 128.
define void @f5() {
; CHECK-LABEL: f5:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: lgr %r1, %r15
; CHECK-NEXT: aghi %r1, -128
; CHECK-NEXT: la %r2, 280(%r1)
; CHECK-NEXT: nill %r2, 65408
; CHECK-NEXT: lgr %r15, %r1
; CHECK-NEXT: mvhi 0(%r2), 10
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%x = alloca i32, i64 1, align 128
store volatile i32 10, i32* %x
ret void
}