Skip to content

Commit ce4c109

Browse files
committedMay 5, 2015
[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
1 parent a8b04e1 commit ce4c109

File tree

95 files changed

+10849
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+10849
-146
lines changed
 

‎llvm/lib/Target/SystemZ/SystemZ.h

+7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ const unsigned IPM_CC = 28;
8787
const unsigned PFD_READ = 1;
8888
const unsigned PFD_WRITE = 2;
8989

90+
// Number of bits in a vector register.
91+
const unsigned VectorBits = 128;
92+
93+
// Number of bytes in a vector register (and consequently the number of
94+
// bytes in a general permute vector).
95+
const unsigned VectorBytes = VectorBits / 8;
96+
9097
// Return true if Val fits an LLILL operand.
9198
static inline bool isImmLL(uint64_t Val) {
9299
return (Val & ~0x000000000000ffffULL) == 0;

‎llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) {
151151
LoweredMI = lowerRIEfLow(MI, SystemZ::RISBLG);
152152
break;
153153

154+
case SystemZ::VLVGP32:
155+
LoweredMI = MCInstBuilder(SystemZ::VLVGP)
156+
.addReg(MI->getOperand(0).getReg())
157+
.addReg(SystemZMC::getRegAsGR64(MI->getOperand(1).getReg()))
158+
.addReg(SystemZMC::getRegAsGR64(MI->getOperand(2).getReg()));
159+
break;
160+
154161
#define LOWER_LOW(NAME) \
155162
case SystemZ::NAME##64: LoweredMI = lowerRILow(MI, SystemZ::NAME); break
156163

0 commit comments

Comments
 (0)