$OpenBSD: patch-lib_Target_Sparc_SparcISelDAGToDAG_cpp,v 1.3 2018/04/28 15:04:29 ajacoutot Exp $

[Sparc] Fix addressing mode when using 64-bit values in inline assembly

Summary:
If a 64-bit register is used as an operand in inline assembly together
with a memory reference, the memory addressing will be wrong. The
addressing will be a single reg, instead of reg+reg or reg+imm. This
will generate a bad offset value or an exception in printMemOperand().

Index: lib/Target/Sparc/SparcISelDAGToDAG.cpp
--- lib/Target/Sparc/SparcISelDAGToDAG.cpp.orig
+++ lib/Target/Sparc/SparcISelDAGToDAG.cpp
@@ -311,6 +311,8 @@ bool SparcDAGToDAGISel::tryInlineAsm(SDNode *N){
   if (!Changed)
     return false;
 
+  SelectInlineAsmMemoryOperands(AsmNodeOperands, SDLoc(N));
+
   SDValue New = CurDAG->getNode(ISD::INLINEASM, SDLoc(N),
       CurDAG->getVTList(MVT::Other, MVT::Glue), AsmNodeOperands);
   New->setNodeId(-1);
