[llvm] r236526 - [SystemZ] Mark v1i128 and v1f128 as unsupported

Ulrich Weigand ulrich.weigand at de.ibm.com
Tue May 5 12:30:06 PDT 2015


Author: uweigand
Date: Tue May  5 14:30:05 2015
New Revision: 236526

URL: http://llvm.org/viewvc/llvm-project?rev=236526&view=rev
Log:
[SystemZ] Mark v1i128 and v1f128 as unsupported

The ABI specifies that <1 x i128> and <1 x fp128> are supposed to be
passed in vector registers.  We do not yet support those types, and
some infrastructure is missing before we can do so.

In order to prevent accidentally generating code violating the ABI,
this patch adds checks to detect those types and error out if user
code attempts to use them.


Added:
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-01.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-02.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-03.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-04.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-05.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-06.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-07.ll
    llvm/trunk/test/CodeGen/SystemZ/vec-args-error-08.ll
Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp

Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=236526&r1=236525&r2=236526&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Tue May  5 14:30:05 2015
@@ -777,6 +777,24 @@ bool SystemZTargetLowering::mayBeEmitted
   return true;
 }
 
+// We do not yet support 128-bit single-element vector types.  If the user
+// attempts to use such types as function argument or return type, prefer
+// to error out instead of emitting code violating the ABI.
+static void VerifyVectorType(MVT VT, EVT ArgVT) {
+  if (ArgVT.isVector() && !VT.isVector())
+    report_fatal_error("Unsupported vector argument or return type");
+}
+
+static void VerifyVectorTypes(const SmallVectorImpl<ISD::InputArg> &Ins) {
+  for (unsigned i = 0; i < Ins.size(); ++i)
+    VerifyVectorType(Ins[i].VT, Ins[i].ArgVT);
+}
+
+static void VerifyVectorTypes(const SmallVectorImpl<ISD::OutputArg> &Outs) {
+  for (unsigned i = 0; i < Outs.size(); ++i)
+    VerifyVectorType(Outs[i].VT, Outs[i].ArgVT);
+}
+
 // Value is a value that has been passed to us in the location described by VA
 // (and so has type VA.getLocVT()).  Convert Value to VA.getValVT(), chaining
 // any loads onto Chain.
@@ -850,6 +868,10 @@ LowerFormalArguments(SDValue Chain, Call
   auto *TFL =
       static_cast<const SystemZFrameLowering *>(Subtarget.getFrameLowering());
 
+  // Detect unsupported vector argument types.
+  if (Subtarget.hasVector())
+    VerifyVectorTypes(Ins);
+
   // Assign locations to all of the incoming arguments.
   SmallVector<CCValAssign, 16> ArgLocs;
   SystemZCCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
@@ -997,6 +1019,12 @@ SystemZTargetLowering::LowerCall(CallLow
   MachineFunction &MF = DAG.getMachineFunction();
   EVT PtrVT = getPointerTy();
 
+  // Detect unsupported vector argument and return types.
+  if (Subtarget.hasVector()) {
+    VerifyVectorTypes(Outs);
+    VerifyVectorTypes(Ins);
+  }
+
   // Analyze the operands of the call, assigning locations to each operand.
   SmallVector<CCValAssign, 16> ArgLocs;
   SystemZCCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
@@ -1151,6 +1179,10 @@ SystemZTargetLowering::LowerReturn(SDVal
                                    SDLoc DL, SelectionDAG &DAG) const {
   MachineFunction &MF = DAG.getMachineFunction();
 
+  // Detect unsupported vector return types.
+  if (Subtarget.hasVector())
+    VerifyVectorTypes(Outs);
+
   // Assign locations to each returned value.
   SmallVector<CCValAssign, 16> RetLocs;
   CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, *DAG.getContext());

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-01.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-01.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-01.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-01.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,9 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+define void @foo(<1 x i128>) {
+  ret void
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-02.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-02.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-02.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-02.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,9 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+define <1 x i128> @foo() {
+  ret <1 x i128><i128 0>
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-03.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-03.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-03.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-03.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,12 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+declare void @bar(<1 x i128>)
+
+define void @foo() {
+  call void @bar (<1 x i128> <i128 0>)
+  ret void
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-04.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-04.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-04.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-04.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,12 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+declare <1 x i128> @bar()
+
+define void @foo() {
+  %res = call <1 x i128> @bar ()
+  ret void
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-05.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-05.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-05.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-05.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,9 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+define void @foo(<1 x fp128>) {
+  ret void
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-06.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-06.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-06.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-06.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,9 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+define <1 x fp128> @foo() {
+  ret <1 x fp128><fp128 0xL00000000000000000000000000000000>
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-07.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-07.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-07.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-07.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,12 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+declare void @bar(<1 x fp128>)
+
+define void @foo() {
+  call void @bar (<1 x fp128> <fp128 0xL00000000000000000000000000000000>)
+  ret void
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type

Added: llvm/trunk/test/CodeGen/SystemZ/vec-args-error-08.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/vec-args-error-08.ll?rev=236526&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/vec-args-error-08.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/vec-args-error-08.ll Tue May  5 14:30:05 2015
@@ -0,0 +1,12 @@
+; Verify that we detect unsupported single-element vector types.
+
+; RUN: not llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 2>&1 | FileCheck %s
+
+declare <1 x fp128> @bar()
+
+define void @foo() {
+  %res = call <1 x fp128> @bar ()
+  ret void
+}
+
+; CHECK: LLVM ERROR: Unsupported vector argument or return type





More information about the llvm-commits mailing list