------- Comment #4 from ubizjak at gmail dot com 2007-07-10 10:36 ------- (In reply to comment #0)
> long2vector() should use a simple MOVQ instruction the way int2vector() uses > MOVD. It appears that the reason for the stack access is that the original > code > used a reg64->mem->mm->xmm path, which the optimizer partly noticed; > gcc-4.3-20070617 leaves the full path in place. > > Also, do the vector2<X>() functions really need to access the stack? Stack access is the remain of partially implemented TARGET_INTER_UNIT_MOVES, and this was fully fixed in 4.3. The fact that gcc-4.3 leaves full path in place is due to missing pattern for vec_concat:V2DI (implemented in the patch below) where 64bit registers can be concatenated with zero (for 64bit targets) using movq instruction. With attached patch, 4.3 generates: long2vector: .LFB4: movq %rdi, %xmm0 ret .LFE4: for -march=core2 (TARGET_INTER_UNIT_MOVES allowed) and long2vector: .LFB4: movq %rdi, -8(%rsp) movq -8(%rsp), %xmm0 ret .LFE4: for -march=k8 (no TARGET_INTER_UNIT_MOVES allowed). > Finally, I've noticed several places where instructions involving 64-bit > values > use the "d/l" suffix (e.g. "long i = 0" ==> "xorl %eax, %eax"), or 32-bit > operations that use 64-bit registers (e.g. "movd %xmm0, %rax" above). Are > those > generally features, bugs, or a "who cares?" These are "who cares", produced by reload to satisfy register constraints (i.e. certain alternatives missing as an attempt to solve INTER_UNIT_MOVES requirements). They are harmles. Index: sse.md =================================================================== --- sse.md (revision 126510) +++ sse.md (working copy) @@ -4717,7 +4717,7 @@ (vec_concat:V2DI (match_operand:DI 1 "nonimmediate_operand" " m,*y ,0 ,0,0,m") (match_operand:DI 2 "vector_move_operand" " C, C,Yt,x,m,0")))] - "TARGET_SSE" + "!TARGET_64BIT && TARGET_SSE" "@ movq\t{%1, %0|%0, %1} movq2dq\t{%1, %0|%0, %1} @@ -4728,6 +4728,23 @@ [(set_attr "type" "ssemov,ssemov,sselog,ssemov,ssemov,ssemov") (set_attr "mode" "TI,TI,TI,V4SF,V2SF,V2SF")]) +(define_insn "*vec_concatv2di_rex" + [(set (match_operand:V2DI 0 "register_operand" "=Yt,Yi,!Yt,Yt,x,x,x") + (vec_concat:V2DI + (match_operand:DI 1 "nonimmediate_operand" " m,r ,*y ,0 ,0,0,m") + (match_operand:DI 2 "vector_move_operand" " C,C ,C ,Yt,x,m,0")))] + "TARGET_64BIT" + "@ + movq\t{%1, %0|%0, %1} + movq\t{%1, %0|%0, %1} + movq2dq\t{%1, %0|%0, %1} + punpcklqdq\t{%2, %0|%0, %2} + movlhps\t{%2, %0|%0, %2} + movhps\t{%2, %0|%0, %2} + movlps\t{%1, %0|%0, %1}" + [(set_attr "type" "ssemov,ssemov,ssemov,sselog,ssemov,ssemov,ssemov") + (set_attr "mode" "TI,TI,TI,TI,V4SF,V2SF,V2SF")]) + (define_expand "vec_setv2di" [(match_operand:V2DI 0 "register_operand" "") (match_operand:DI 1 "register_operand" "") -- ubizjak at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |ubizjak at gmail dot com |dot org | Status|NEW |ASSIGNED Last reconfirmed|2007-07-10 09:14:14 |2007-07-10 10:36:00 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32708