[LLVMbugs] [Bug 10626] New: [AVX] encoding issue with vmaskmovps?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 9 16:27:02 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10626

           Summary: [AVX] encoding issue with vmaskmovps?
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matt at pharr.org
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=7044)
 --> (http://llvm.org/bugs/attachment.cgi?id=7044)
reproduction case

(The context is that I'm starting to dig into some crashes when running AVX
code.  I'm still learning how to decipher the AVX instruction encoding, so
forgive me if there is an error in this bug report.)

Given the attached LLVM assembly file, running llc x.ll -mattr=+avx -o - gives
the following text output, which looks right:

    .section    __TEXT,__text,regular,pure_instructions
    .globl    "_f_f___REFUf[]REFUf[]"
    .align    4, 0x90
"_f_f___REFUf[]REFUf[]":                ## @"f_f___REFUf[]REFUf[]"
## BB#0:                                ## %allocas
    vmovmskps    %ymm0, %eax
    cmpl    $255, %eax
    jne    LBB0_2
## BB#1:                                ## %cif_test_all
    vpcmpeqd    %xmm0, %xmm0, %xmm0
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    vmovaps    %ymm0, (%rdi)
    ret
LBB0_2:                                 ## %cif_mixed_test_all
    vmaskmovps    (%rsi), %ymm0, %ymm1
    vaddps    %ymm1, %ymm1, %ymm1
    vmaskmovps    %ymm1, %ymm0, (%rdi)
    ret

However, if I run llc x.ll -mattr=+avx -filetype=obj -o x.o, I run into two
problems.

First, if I run llvm-objdump on the output, I get a crash:

% llvm-objdump -disassemble x.o 
Unknown Object File Type
UNREACHABLE executed at ObjectFile.cpp:62!
0  llvm-objdump      0x0000000100aae292
1  llvm-objdump      0x0000000100aaf0e3
2  libsystem_c.dylib 0x00007fff86a09cfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff5fbff240 _sigtramp + 18446744073057293664
4  llvm-objdump      0x0000000100aae6b6
5  llvm-objdump      0x0000000100a9aefd
6  llvm-objdump      0x000000010001cf18
7  llvm-objdump      0x0000000100017556
8  llvm-objdump      0x000000010001713b
9  llvm-objdump      0x0000000100016d24
10 llvm-objdump      0x0000000000000003
Stack dump:
0.    Program arguments: llvm-objdump -disassemble x.o 
[1]    39093 illegal hardware instruction  llvm-objdump -disassemble x.o

If I run the nasm disassembler on the object file, skipping over the ELF
headers, I get the following.  Note that the vmaskmovps has a strange value for
the last parameter, and then the vaddps instruction has been sucked up,
presumably because of a misencoding of vmaskmovps.

(Note that it's possible that this is a bug in the nasm disassembler, but the
llvm-objdump crash maskes me suspicious.)

% ndisasm -e 288 x.o
00000000  C5FC50C0          vmovmskps eax,ymm0
00000004  3DFF00            cmp ax,0xff
00000007  0000              add [bx+si],al
00000009  750F              jnz 0x1a
0000000B  C5F976C0          vpcmpeqd xmm0,xmm0,xmm0
0000000F  C4E37D18C001      vinsertf128 ymm0,ymm0,xmm0,byte 0x1
00000015  C5FC2907          vmovaps yword [bx],ymm0
00000019  C3                ret
0000001A  C4E27D2C0EC5F4    vmaskmovps ymm1,ymm0,yword [0xf4c5]
00000021  58                pop ax
00000022  C9                leave
00000023  C4E27D2E0F        vmaskmovps yword [bx],xmm0,xmm1
00000028  C3                ret

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list