From 82ace96a30933c2ded81521de51774d406aba3b1 Mon Sep 17 00:00:00 2001 From: James Molloy Date: Mon, 26 Oct 2015 10:04:52 +0000 Subject: [PATCH] [ARM] Handle the inline asm constraint type 'o' This means "memory with offset" and requires very little plumbing to get working. This fixes PR25317. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251280 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMISelDAGToDAG.cpp | 1 + lib/Target/ARM/ARMISelLowering.h | 2 ++ test/CodeGen/ARM/pr25317.ll | 11 +++++++++++ 3 files changed, 14 insertions(+) create mode 100644 test/CodeGen/ARM/pr25317.ll diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index dc9eefe6ade..cd73021dfc6 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -3924,6 +3924,7 @@ SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID, // be an immediate and not a memory constraint. // Fallthrough. case InlineAsm::Constraint_m: + case InlineAsm::Constraint_o: case InlineAsm::Constraint_Q: case InlineAsm::Constraint_Um: case InlineAsm::Constraint_Un: diff --git a/lib/Target/ARM/ARMISelLowering.h b/lib/Target/ARM/ARMISelLowering.h index 1c260f253ec..e4b8891728b 100644 --- a/lib/Target/ARM/ARMISelLowering.h +++ b/lib/Target/ARM/ARMISelLowering.h @@ -348,6 +348,8 @@ namespace llvm { getInlineAsmMemConstraint(StringRef ConstraintCode) const override { if (ConstraintCode == "Q") return InlineAsm::Constraint_Q; + else if (ConstraintCode == "o") + return InlineAsm::Constraint_o; else if (ConstraintCode.size() == 2) { if (ConstraintCode[0] == 'U') { switch(ConstraintCode[1]) { diff --git a/test/CodeGen/ARM/pr25317.ll b/test/CodeGen/ARM/pr25317.ll new file mode 100644 index 00000000000..6770c6f84ec --- /dev/null +++ b/test/CodeGen/ARM/pr25317.ll @@ -0,0 +1,11 @@ +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "armv7--linux-gnueabihf" + +; CHECK-LABEL: f: +; CHECK: str lr, [r0] +define void @f(i32* %p) { + call void asm sideeffect "str lr, $0", "=*o"(i32* %p) + ret void +} \ No newline at end of file -- 2.11.0