https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98799
--- Comment #2 from David Edelsohn <dje at gcc dot gnu.org> --- As with vector_extract, the P8 version requires TARGET_DIRECT_MOVE_64BIT. I think that this needs something like the following: --- rs6000.c 2021-01-22 11:45:39.000000000 -0500 +++ cc.c 2021-01-23 14:55:25.000000000 -0500 @@ -6993,9 +6993,14 @@ rs6000_expand_vector_set (rtx target, rt if (VECTOR_MEM_VSX_P (mode)) { - if (!CONST_INT_P (elt_rtx)) + if (!CONST_INT_P (elt_rtx) + && (TARGET_P9_VECTOR || TARGET_DIRECT_MOVE_64BIT)) { - rs6000_expand_vector_set_var (target, val, elt_rtx); + if (TARGET_P9_VECTOR + || GET_MODE_SIZE (GET_MODE_INNER (GET_MODE (target))) == 8) + rs6000_expand_vector_set_var_p9 (target, val, idx); + else + rs6000_expand_vector_set_var_p8 (target, val, idx); return; } @@ -7235,19 +7240,6 @@ gen_vector_select_v16qi (target_v16qi, target_v16qi, val_perm, mask_perm)); } -/* Insert VAL into IDX of TARGET, VAL size is same of the vector element, IDX - is variable and also counts by vector element size. */ - -void -rs6000_expand_vector_set_var (rtx target, rtx val, rtx idx) -{ - machine_mode mode = GET_MODE (target); - machine_mode inner_mode = GET_MODE_INNER (mode); - if (TARGET_P9_VECTOR || GET_MODE_SIZE (inner_mode) == 8) - rs6000_expand_vector_set_var_p9 (target, val, idx); - else - rs6000_expand_vector_set_var_p8 (target, val, idx); -} /* Extract field ELT from VEC into TARGET. */ I also don't see the purpose of rs6000_expand_vector_set_var() helper function, especially not as a global function.