[LLVMdev] broken LLVM-MC?

Demikhovsky, Elena elena.demikhovsky at intel.com
Mon Dec 16 00:12:59 PST 2013


Hi,

I changed llvm-mc in my commit 197041. The change is for AVX-512 only.
Now you should invoke -mcpu=knl when you what to assemble any AVX-512 instruction.

echo vinserti32x4 \$1, %xmm21, %zmm5, %zmm17 |./Debug+Asserts/bin/llvm-mc -assemble -arch=x86-64 -show-encoding -x86-asm-syntax=att -mcpu=knl
	.text
	vinserti32x4	$1, %xmm21, %zmm5, %zmm17 # encoding: [0x62,0xa3,0x55,0x48,0x38,0xcd,0x01]

I did this because AVX and AVX-512 have collisions in mnemonics of scalar FP operations, VSQRTSS or VMOVSS for example.

I did not touch other architectures, so 3DNow should work as is.
echo "pavgusb %mm2, %mm1"|./Debug+Asserts/bin/llvm-mc -assemble -arch=x86-64 -show-encoding -x86-asm-syntax=att
	.text
	pavgusb	%mm2, %mm1              # encoding: [0x0f,0x0f,0xca,0xbf]

As far as "-disassemble" flag, you are absolutely right, it is a bug and Alexey Bader will take care. He will also and add more disassembly tests.
Thank you for catching this.

-  Elena

-----Original Message-----
From: Jim Grosbach [mailto:grosbach at apple.com] 
Sent: Friday, December 13, 2013 20:27
To: Jun Koi; Demikhovsky, Elena
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] broken LLVM-MC?

Well, you'll probably need to specify which CPU for the instructions to be recognized as valid encodings. -mcpu=knl doesn't seem sufficient, though, so there's probably something more going on.

Elena, do you know what's happening here? It's important that the disassembler work with the new instructions as well as the assembler. I looked but didn't see any disassembler tests for avx512.

-Jim

On Dec 12, 2013, at 7:32 PM, Jun Koi <junkoi2004 at gmail.com> wrote:

> Hi,
> 
> It seems LLVM-MC is broken with Avx512?
> 
> 
> $ echo "vinserti32x4 \$1, %xmm21, %zmm5, %zmm17"|./Release+Asserts/bin/llvm-mc -assemble -arch=x86-64 -show-encoding -x86-asm-syntax=att
>     .text
>     vinserti32x4    $1, %xmm21, %zmm5, %zmm17 # encoding: [0x62,0xa3,0x55,0x48,0x38,0xcd,0x01]
> 
> $ echo "0x62,0xa3,0x55,0x48,0x38,0xcd,0x01" |./Release+Asserts/bin/llvm-mc -disassemble -arch=x86-64
> <stdin>:1:1: warning: invalid instruction encoding
> 
> 
> Similarly, 3DNow seems broken, too.
> 
> 
> $ echo "pavgusb %mm2, %mm1"|./Release+Asserts/bin/llvm-mc -assemble -arch=x86-64 -show-encoding -x86-asm-syntax=att
>     .text
>     pavgusb    %mm2, %mm1              # encoding: [0x0f,0x0f,0xca,0xbf]
> 
> $ echo "0x0f,0x0f,0xca,0xbf" |./Release+Asserts/bin/llvm-mc -disassemble -arch=x86-64
> <stdin>:1:1: warning: invalid instruction encoding
> 
> 
> 
> 
> Or I did not use LLVM-MC properly? Any idea??
> 
> Thank you,
> Jun
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-dev mailing list