http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50413
Uros Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2011-09-15 13:29:23 UTC --- (In reply to comment #0) > 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 You are wrong. The code above describes shift of two 64bit elements, each by one, so psrlq [1] is correct. [1] http://www.rz.uni-karlsruhe.de/rz/docs/VTune/reference/vc259.htm