https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117562

--- Comment #7 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---

> Huh.  It looks like this is from a V4SF -> 2xV2DF extension via
> vec_unpack_{hi,lo}_expr.
> 
> Originally this is
> 
> (insn 1161 1160 1162 58 (set (reg:V4SF 853)
>         (vec_select:V4SF (vec_concat:V8SF (reg:V4SF 853)
>                 (reg:V4SF 566 [ vect__811.229 ]))
>             (parallel [
>                     (const_int 6 [0x6])
>                     (const_int 7 [0x7])
>                     (const_int 2 [0x2])
>                     (const_int 3 [0x3])
>                 ]))) "cont_mgau.c":157:9 5181 {sse_movhlps}
>      (expr_list:REG_DEAD (reg:V4SF 566 [ vect__811.229 ])
>         (nil)))
> 
vec_unpacks_hi_v4sf create an unintialized (reg:V4SF 853), I guess it may
confuse LRA to allocate a mem for it.

10413(define_expand "vec_unpacks_hi_v4sf"
10414  [(set (match_dup 2)
10415   (vec_select:V4SF
10416     (vec_concat:V8SF
10417       (match_dup 2)   ------------ here, use without initialization.
10418       (match_operand:V4SF 1 "vector_operand"))
10419     (parallel [(const_int 6) (const_int 7)
10420                (const_int 2) (const_int 3)])))
10421  (set (match_operand:V2DF 0 "register_operand")
10422   (float_extend:V2DF
10423     (vec_select:V2SF
10424       (match_dup 2)
10425       (parallel [(const_int 0) (const_int 1)]))))]
10426  "TARGET_SSE2"
10427  "operands[2] = gen_reg_rtx (V4SFmode);")



Explicitly initialize the operands[2] with 0, the spill is gone, Could you try
below patch to see if it also fixed ths issue?

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index e50355f4839..e1ee688d5e4 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -10500,7 +10500,10 @@ (define_expand "vec_unpacks_hi_v4sf"
        (match_dup 2)
        (parallel [(const_int 0) (const_int 1)]))))]
   "TARGET_SSE2"
-  "operands[2] = gen_reg_rtx (V4SFmode);")
+{
+  operands[2] = gen_reg_rtx (V4SFmode);
+  emit_move_insn (operands[2], CONST0_RTX (V4SFmode));
+})

 (define_expand "vec_unpacks_hi_v8sf"
   [(set (match_dup 2)

Reply via email to