https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104664
--- Comment #4 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> ---
(In reply to Uroš Bizjak from comment #3)
> Reconfirmed as RA issue.
I'm afraid we'd avoid pattern like
(insn 180 179 182 2 (set (reg:V8HF 220)
(subreg:V8HF (reg:HF 221) 0)) "pr104664.c":12:7 1710 {movv8hf_internal}
since we don't have corresponding pattern with subreg. Reload might not aware
of the newly inserted regs properly, as the message shows
Set class ALL_REGS for r221
Set class ALL_REGS for r220
I'm testing
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 6cf1a0b9cb6..658516d86a2 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -14883,7 +14883,12 @@ ix86_expand_vector_init_duplicate (bool mmx_ok,
machine_mode mode,
dperm.one_operand_p = true;
if (mode == V8HFmode)
- tmp1 = lowpart_subreg (V8HFmode, force_reg (HFmode, val), HFmode);
+ {
+ tmp1 = force_reg (HFmode, val);
+ tmp2 = gen_reg_rtx (mode);
+ emit_insn (gen_vec_setv8hf_0 (tmp2, CONST0_RTX (mode), tmp1));
+ tmp1 = gen_lowpart (mode, tmp2);
+ }