[LLVMdev] Inline Assembly: Memory constraints with offsets

Daniel Sanders Daniel.Sanders at imgtec.com
Wed Mar 4 08:30:35 PST 2015


> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Krzysztof Parzyszek
> Sent: 03 March 2015 14:35
> To: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] Inline Assembly: Memory constraints with offsets
> 
> On 3/3/2015 6:01 AM, Daniel Sanders wrote:
> > Hi,
> >
> > I'm trying to implement the ZC inline assembly constraint for Mips. This
> > constraint is a memory constraint that expands to an address with an
> > offset (the range of the offset varies according to the subtarget), so
> > the inline assembly in:
> >
> >    int data[10];
> >
> >    void ZC(void) {
> >
> >      asm volatile ("foo %0 %1" : : "ZC"(data[1]), "ZC"(data[2]));
> >
> >    }
> >
> > Should expand to something like:
> >
> >    foo 4($2) 8($2)
> >
> > At the moment, the best I can get is something like:
> >
> >    foo 0($2) 0($3)
> >
> > with the offsets being added before the inline assembly.
> >
> > Does anyone have any suggestions as to how I can get the offset inside
> > the inline assembly?
> 
> How are you actually getting this to compile?  I just built clang and
> I'm getting an error:
> 
> clang-3.6 -target mips -S mipsa.c
> mipsa.c:4:33: error: invalid input constraint 'ZC' in asm
>    asm volatile ("foo %0 %1" : : "ZC"(data[1]), "ZC"(data[2]));
>                                  ^
> 1 error generated.
> 
> 
> It doesn't seem that the function "validateAsmConstraint" in
> tools/clang/lib/Basic/Targets.cpp handles "ZC" as a constraint.
> 
> -Krzysztof

Partial support for ZC is in my working copy at the moment. I've attached my WIP patches.
 
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-implement-ZC.patch
Type: application/octet-stream
Size: 1177 bytes
Desc: clang-implement-ZC.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150304/e20afa8e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-implement-ZC.patch
Type: application/octet-stream
Size: 975 bytes
Desc: llvm-implement-ZC.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150304/e20afa8e/attachment-0001.obj>


More information about the llvm-dev mailing list