http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50413

             Bug #: 50413
           Summary: Incorrect instruction is used to shift value of 128
                    bit xmm0 registrer
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: aries....@gmail.com


After compilation an attached code with -O2 and -ftree-vectorize flags, it
doesn't work properly.

Assembler code shows that G++ tries to replace the following code 

  V.uint128.uint64_lower = (V.uint128.uint64_lower >> 1);
  V.bitmap.b63 = V.bitmap.b64;
  V.uint128.uint64_upper = (V.uint128.uint64_upper >> 1);

with SSE instructions:

  400a10:   movdqa 0x103d8(%rip),%xmm0        # 410df0 <V>
  400a17:   and    $0x1,%edi
  400a1b:   psrlq  $0x1,%xmm0
  400a20:   movdqa %xmm0,0x103c8(%rip)        # 410df0 <V>


But psrlq shifts 64 bit value, it's necessary to use psrldq here

Reply via email to