1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/CodeGen/SystemZ/vec-args-02.ll
Ulrich Weigand 938ff50eda [SystemZ] Add CodeGen support for integer vector types
This the first of a series of patches to add CodeGen support exploiting
the instructions of the z13 vector facility.  This patch adds support
for the native integer vector types (v16i8, v8i16, v4i32, v2i64).

When the vector facility is present, we default to the new vector ABI.
This is characterized by two major differences:
- Vector types are passed/returned in vector registers
  (except for unnamed arguments of a variable-argument list function).
- Vector types are at most 8-byte aligned.

The reason for the choice of 8-byte vector alignment is that the hardware
is able to efficiently load vectors at 8-byte alignment, and the ABI only
guarantees 8-byte alignment of the stack pointer, so requiring any higher
alignment for vectors would require dynamic stack re-alignment code.

However, for compatibility with old code that may use vector types, when
*not* using the vector facility, the old alignment rules (vector types
are naturally aligned) remain in use.

These alignment rules are not only implemented at the C language level
(implemented in clang), but also at the LLVM IR level.  This is done
by selecting a different DataLayout string depending on whether the
vector ABI is in effect or not.

Based on a patch by Richard Sandiford.

llvm-svn: 236521
2015-05-05 19:25:42 +00:00

32 lines
1.1 KiB
LLVM

; Test the handling of unnamed vector arguments.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s -check-prefix=CHECK-VEC
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s -check-prefix=CHECK-STACK
; This routine is called with two named vector argument (passed
; in %v24 and %v26) and two unnamed vector arguments (passed
; in the double-wide stack slots at 160 and 176).
declare void @bar(<4 x i32>, <4 x i32>, ...)
define void @foo() {
; CHECK-VEC-LABEL: foo:
; CHECK-VEC-DAG: vrepif %v24, 1
; CHECK-VEC-DAG: vrepif %v26, 2
; CHECK-VEC: brasl %r14, bar@PLT
;
; CHECK-STACK-LABEL: foo:
; CHECK-STACK: aghi %r15, -192
; CHECK-STACK-DAG: vrepif [[REG1:%v[0-9]+]], 3
; CHECK-STACK-DAG: vst [[REG1]], 160(%r15)
; CHECK-STACK-DAG: vrepif [[REG2:%v[0-9]+]], 4
; CHECK-STACK-DAG: vst [[REG2]], 176(%r15)
; CHECK-STACK: brasl %r14, bar@PLT
call void (<4 x i32>, <4 x i32>, ...) @bar
(<4 x i32> <i32 1, i32 1, i32 1, i32 1>,
<4 x i32> <i32 2, i32 2, i32 2, i32 2>,
<4 x i32> <i32 3, i32 3, i32 3, i32 3>,
<4 x i32> <i32 4, i32 4, i32 4, i32 4>)
ret void
}