[PATCH] D19061: [ARM] Add support for the X asm constraint

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 10:16:48 PDT 2016


sbaranga added a comment.

In http://reviews.llvm.org/D19061#399877, @rengolin wrote:

> Hi Silviu,
>
> The documentation on the X constraint is... lacking. All it says is "Any operand whatsoever is allowed.". Sigh...


Hi Renato,

Our definition is "Allows an operand of any kind, no constraint whatsoever. Typically useful to pass a label for an asm branch or call." (LangRef.rst).
So basically we're free to choose.

FWIW, our approach is similar to the X86 one.

> So, before we get support for it, I'd like to see a few examples from user code on how people expect it to work (probably the best we can do for now).


The PR (https://llvm.org/bugs/show_bug.cgi?id=26493) text has some good pointers:
 http://www.ethernut.de/en/documents/arm-inline-asm.html

> Also, you don't seem to be testing much. I think you need to have better instructions (adds, movs, loads) to make sure we're testing the whole range of the X constraint. I'm guessing *any* operand is a bit vague, but does it support immediates, as well as registers, expressions?


I'll add more tests. I think the types of the operands in these instructions are more important than the instructions themselves.

> Maybe it'd be easier to create a bug, block PR27197 with it, and explain the expected behaviour, with reproducible C files and command lines.


The only use case of this that I'm aware of is the one from http://www.ethernut.de/en/documents/arm-inline-asm.html.

Cheers,
Silviu


================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:11450
@@ +11449,3 @@
+const char *ARMTargetLowering::LowerXConstraint(EVT ConstraintVT) const {
+  if (!Subtarget->hasNEON())
+    return "r";
----------------
rengolin wrote:
> What about VFP?
Good point.

================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:11457
@@ +11456,3 @@
+      ConstraintVT.getSizeInBits() == 128))
+    return "w";
+
----------------
rengolin wrote:
> No "t" for 32-bit FP registers?
Why "t" (wouldn't "w" be enough)? 

================
Comment at: test/CodeGen/ARM/inlineasm-X-constraint.ll:1
@@ +1,2 @@
+; RUN: llc -mtriple=armv7-none-eabi -mattr=+neon -no-integrated-as %s -o - | FileCheck %s
+
----------------
rengolin wrote:
> why do you need -no-integrated-as?
I don't, I'll just remove this.


http://reviews.llvm.org/D19061





More information about the llvm-commits mailing list