[LLVMdev] LLVMdev Digest, Vol 98, Issue 33

Wei-zhi Liao giggle at zillians.com
Sun Dec 16 23:01:11 PST 2012


Hey Cameron,

Sorry to reply this mail so late.

Recently, I tried to understand what's the impact of the warning message
(Warning: stand-alone `data16' prefix)

And in binutils (gas/config/tc-i386.c), I found:

if (!quiet_warnings)
{
      .....

      if (t->opcode_modifier.isprefix
      && t->opcode_modifier.ignoresize)
      {
      /* Warn them that a data or address size prefix doesn't
         affect assembly of the next line of code.  */
      as_warn (_("stand-alone `%s' prefix"), t->name);
      }
}

It looks like the `data16' does not have any influence on the instructions
followed.
My opinion is to safely ignore this warning :=D

-- Giggle (giggling)

On Sat, Aug 18, 2012 at 1:00 AM, <llvmdev-request at cs.uiuc.edu> wrote:

> Send LLVMdev mailing list submissions to
>         llvmdev at cs.uiuc.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> or, via email, send a message with subject or body 'help' to
>         llvmdev-request at cs.uiuc.edu
>
> You can reach the person managing the list at
>         llvmdev-owner at cs.uiuc.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of LLVMdev digest..."
>
>
> Today's Topics:
>
>    1. Generate data16 assembly instruction for TLS with PIC
>       (Wei-zhi Liao)
>    2. Re: Generate data16 assembly instruction for TLS with PIC
>       (Cameron McInally)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 18 Aug 2012 00:27:22 +0800
> From: Wei-zhi Liao <giggle at zillians.com>
> Subject: [LLVMdev] Generate data16 assembly instruction for TLS with
>         PIC
> To: llvmdev at cs.uiuc.edu
> Message-ID:
>         <
> CAASwg9gTqU-fDDFKwWvYdCZaEW2pyP2G544vHtguFYyV3D6zdw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> System: x86-64 ubuntu 11.04
> LLVM: 3.0
> gcc: 4.5.2
>
> I declare a thread_local global variable and access it in a function in
> llvm IR.
> for example,
>
> @my_value = linkonce thread_local global %dummy* null
>
> define void @test1()  {
> entry:
>     %load_my_value = load %dummy** @my_value
>     ....
> }
>
> After that, I use the following command:
>
> bash$ llc -relocation-model=pic test.ll
>
> And I have test.s which is an assembly file.
>
> I tried to build it with gcc, but I have the following warning
>
> bash$ gcc -c test.s
> test.s: Assembler messages:
> test.s:43: Warning: stand-alone `data16' prefix
>
> I just wonder why I have data16 instruction in my assembly file.
> (ps. If I build it with "llc test.ll", the assembly file will not have
> data16 instruction)
>
> I search the llvm project and find some clues in this
> file: lib/Target/X86/X86MCInstLower.cpp
> static void LowerTlsAddr(...)
> {
>     bool is64Bits = MI.getOpcode() == X86::TLS_addr64;
>     ....
>     if (is64Bits) {
>         MCInst prefix;
>         prefix.setOpcode(X86::DATA16_PREFIX);
>         ....
>     }
>     ....
> }
>
> I think it is the logic to generate data16 instruction, but I wonder why
> gcc report warning. Is it a LLVM's bug?
> Thanks for your time in advance :D
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/attachments/20120818/d2f80ca6/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Fri, 17 Aug 2012 12:40:09 -0400
> From: Cameron McInally <cameron.mcinally at nyu.edu>
> Subject: Re: [LLVMdev] Generate data16 assembly instruction for TLS
>         with PIC
> To: Wei-zhi Liao <giggle at zillians.com>
> Cc: llvmdev at cs.uiuc.edu
> Message-ID:
>         <CAKs25gOyDpP=
> UwBJn7e9NBuie+Tu09wfnVmtrNVPbMesHc1y3g at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hey Wei-zhi,
>
> I also had this issue with the X86 backend. And, unfortunately, searching
> for the warning did not turn up too much information. My solution was to
> emit a raw 0x66 byte in place of the data16 prefix. I believe those are
> equivalent and the assembler is much happier about it...
>
> > #if LLVM_31_MERGE
> >    SmallString<11> byte;
> >    byte = "\t.byte 0x66";
> >    OutStreamer.EmitRawText(byte);
> >#else /* LLVM_31_MERGE */
> >    prefix.setOpcode(X86::DATA16_PREFIX);
> >    OutStreamer.EmitInstruction(prefix);
> >#endif /* LLVM_31_MERGE */
>
> -Cameron
>
> On Fri, Aug 17, 2012 at 12:27 PM, Wei-zhi Liao <giggle at zillians.com>
> wrote:
> ...
> >
> > I think it is the logic to generate data16 instruction, but I wonder why
> > gcc report warning. Is it a LLVM's bug?
> > Thanks for your time in advance :D
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/attachments/20120817/93d75f02/attachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> LLVMdev mailing list
> LLVMdev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
> End of LLVMdev Digest, Vol 98, Issue 33
> ***************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/86cbf3a3/attachment.html>


More information about the llvm-dev mailing list