[LLVMbugs] [Bug 2897] New: Miscompilation when SSE2 is disabled

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Oct 15 21:51:22 PDT 2008


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

           Summary: Miscompilation when SSE2 is disabled
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: andersca at mac.com
                CC: llvmbugs at cs.uiuc.edu


The following reduction:

define <4 x float> @_mm_loadh_pi(i64* %p) nounwind readonly {
entry:
        %conv2 = load i64* %p                ; <i64> [#uses=1]
        %insert = insertelement <2 x i64> undef, i64 %conv2, i32 0             
  ; <<2 x i64>> [#uses=1]
        %cast3 = bitcast <2 x i64> %insert to <4 x float>                ; <<4
x float>> [#uses=1]
        ret <4 x float> %cast3
}

is (with sse2 disabled) compiled as 

MacBook-Pro:clang andersca$ llc -mattr=-sse2 test.bc -o -


        .text
        .align        4,0x90
        .globl        __mm_loadh_pi
__mm_loadh_pi:
        subl        $36, %esp
        ## implicit-def: mm0
        movq        %mm0, 16(%esp)
        movl        40(%esp), %eax
        movl        4(%eax), %ecx
        movl        %ecx, 4(%esp)
        movl        (%eax), %eax
        movl        %eax, (%esp)
        movq        (%esp), %mm0
        movq        %mm0, 8(%esp)
        movaps        8(%esp), %xmm0
        addl        $36, %esp
        ret


and when SSE2 is enabled, compiled as

MacBook-Pro:clang andersca$ llc test.bc -o -


        .text
        .align        4,0x90
        .globl        __mm_loadh_pi
__mm_loadh_pi:
        subl        $28, %esp
        movl        32(%esp), %eax
        movl        4(%eax), %ecx
        movl        %ecx, 4(%esp)
        movl        (%eax), %eax
        movl        %eax, (%esp)
        movaps        (%esp), %xmm0
        addl        $28, %esp
        ret

        .subsections_via_symbols

Note that the second result does have no SSE2 instructions, and the first
result is also incorrect.


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