[llvm] r317807 - [SystemZ] Add support for the "o" inline asm constraint

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 08:31:57 PST 2017


Author: uweigand
Date: Thu Nov  9 08:31:57 2017
New Revision: 317807

URL: http://llvm.org/viewvc/llvm-project?rev=317807&view=rev
Log:
[SystemZ] Add support for the "o" inline asm constraint

We don't really need any special handling of "offsettable"
memory addresses, but since some existing code uses inline
asm statements with the "o" constraint, add support for this
constraint for compatibility purposes.


Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
    llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h
    llvm/trunk/test/CodeGen/SystemZ/asm-05.ll

Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp?rev=317807&r1=317806&r2=317807&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp Thu Nov  9 08:31:57 2017
@@ -1379,8 +1379,11 @@ SelectInlineAsmMemoryOperand(const SDVal
     break;
   case InlineAsm::Constraint_T:
   case InlineAsm::Constraint_m:
+  case InlineAsm::Constraint_o:
     // Accept an address with a long displacement and an index.
     // m works the same as T, as this is the most general case.
+    // We don't really have any special handling of "offsettable"
+    // memory addresses, so just treat o the same as m.
     Form = SystemZAddressingMode::FormBDXNormal;
     DispRange = SystemZAddressingMode::Disp20Only;
     break;

Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h?rev=317807&r1=317806&r2=317807&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h Thu Nov  9 08:31:57 2017
@@ -426,6 +426,8 @@ public:
       switch(ConstraintCode[0]) {
       default:
         break;
+      case 'o':
+        return InlineAsm::Constraint_o;
       case 'Q':
         return InlineAsm::Constraint_Q;
       case 'R':

Modified: llvm/trunk/test/CodeGen/SystemZ/asm-05.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/asm-05.ll?rev=317807&r1=317806&r2=317807&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/asm-05.ll (original)
+++ llvm/trunk/test/CodeGen/SystemZ/asm-05.ll Thu Nov  9 08:31:57 2017
@@ -1,4 +1,5 @@
 ; Test the "m" asm constraint, which is equivalent to "T".
+; Likewise for the "o" asm constraint.
 ;
 ; RUN: llc < %s -mtriple=s390x-linux-gnu -no-integrated-as | FileCheck %s
 
@@ -10,3 +11,12 @@ define void @f1(i64 %base) {
   call void asm "blah $0", "=*m" (i64 *%addr)
   ret void
 }
+
+define void @f2(i64 %base) {
+; CHECK-LABEL: f2:
+; CHECK: blah 0(%r2)
+; CHECK: br %r14
+  %addr = inttoptr i64 %base to i64 *
+  call void asm "blah $0", "=*o" (i64 *%addr)
+  ret void
+}




More information about the llvm-commits mailing list