[LLVMbugs] [Bug 12295] New: Incorrect code generated transferring 64bit values from xmm to regular registers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 17 11:44:10 PDT 2012


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

             Bug #: 12295
           Summary: Incorrect code generated transferring 64bit values
                    from xmm to regular registers
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sroland at vmware.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


It seems sometimes a movd is used instead of a movq when using vector
extraction. When it's not the first element extracted though the code always
shows pextrq so only the first element is a problem.

define i32 @simplecast(<4 x i32> %inval) {
entry:
  %0 = bitcast <4 x i32> %inval to <2 x i64>
  %1 = extractelement <2 x i64> %0, i32 0
  %2 = icmp ne i64 %1, 0
  %3 = sext i1 %2 to i32
  ret i32 %3
}

This generates
        movd    %xmm0, %rax
        cmpq    $1, %rax
        sbbl    %eax, %eax
        notl    %eax
        ret

note the movd %xmm0, %rax.
I'm not actually 100% certain that this does the wrong thing (as movd and %rax
don't quite go well together, and the difference between movd/movq is just the
rex.w prefix) -  If I figure out how to actually generate machine code from
such snippets I could tell for sure... If it's doing the right thing this is
just stylistic inconvenience but otherwise this is definitely a serious issue
(I've seen this on 2.8, 3.0 and trunk).

-- 
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