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

            Bug ID: 22788
           Summary: Redundant zeroing of high vector elements for scalar
                    SSE/AVX instructions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Using scalar x86 intrinsics results in IR similar to this:

define void @foo(double* %p, double* %q, <2 x double>* %r) {
  %v = load double, double* %p, align 16
  %w = load double, double* %q, align 16
  %mul = fmul double %v, %w
  %vec = insertelement <2 x double> <double undef, double 0.000000e+00>, double
%mul, i32 0
  store <2 x double> %vec, <2 x double>* %r, align 16
  ret void
}

This gets lowered into:
movsd   (%rcx), %xmm0           # xmm0 = mem[0],zero
mulsd   (%rdx), %xmm0
movq    %xmm0, %xmm0            # xmm0 = xmm0[0],zero
movdqa  %xmm0, (%r8)

The movq is redundant - movsd from memory zeroes the high element, and mulsd
preserves it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to