https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109855
--- Comment #6 from ktkachov at gcc dot gnu.org --- (In reply to ktkachov from comment #5) > (In reply to rsand...@gcc.gnu.org from comment #4) > > I guess the problem is that the define_subst output template has: > > > > (match_operand:<VDBL> 0) > > > > which creates a new operand 0 with an empty predicate and constraint, > > as opposed to a (match_dup 0), which would be substituted with the > > original operand 0. Unfortunately > > > > (match_dup:<VDBL> 0) > > > > doesn't work as a way of inserting the original destination with > > a different mode, since the :<VDBL> is ignored. Perhaps we should > > “fix” that. Alternatively: > > > > (match_operand:<VDBL> 0 "register_operand" "=w") > > > > should work, but probably locks us into using patterns that have one > > alternative only. > > I think this approach is the most promising and probably okay for the vast > majority of cases we want to handle with these substs. Interestingly, it does seem to do the right thing for multi-alternative patterns too. For example: (define_insn ("aarch64_cmltv4hf_vec_concatz_le") [ (set (match_operand:V8HI 0 ("register_operand") ("=w,w")) (vec_concat:V8HI (neg:V4HI (lt:V4HI (match_operand:V4HF 1 ("register_operand") ("w,w")) (match_operand:V4HF 2 ("aarch64_simd_reg_or_zero") ("w,YDz")))) (match_operand:V4HI 3 ("aarch64_simd_or_scalar_imm_zero") ("")))) ] ("(!BYTES_BIG_ENDIAN) && ((TARGET_SIMD) && (TARGET_SIMD_F16INST))") ("@ fcmgt\t%0.4h, %2.4h, %1.4h fcmlt\t%0.4h, %1.4h, 0") [ (set_attr ("type") ("neon_fp_compare_s")) (set_attr ("add_vec_concat_subst_le") ("no")) ])