Hi, On 2020/9/1 00:47, will schmidt wrote: >> + tmode = TYPE_MODE (TREE_TYPE (arg0)); >> + mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0))); >> + mode2 = TYPE_MODE ((TREE_TYPE (arg2))); >> + gcc_assert (VECTOR_MODE_P (tmode)); >> + >> + op0 = expand_expr (arg0, NULL_RTX, tmode, EXPAND_NORMAL); >> + op1 = expand_expr (arg1, NULL_RTX, mode1, EXPAND_NORMAL); >> + op2 = expand_expr (arg2, NULL_RTX, mode2, EXPAND_NORMAL); >> + >> + if (GET_MODE (op1) != mode1 && GET_MODE (op1) != VOIDmode) >> + op1 = convert_modes (mode1, GET_MODE (op1), op1, true); >> + >> + op0 = force_reg (tmode, op0); >> + op1 = force_reg (mode1, op1); >> + op2 = force_reg (mode2, op2); >> + >> + target = gen_reg_rtx (V16QImode); > Should that be tmode, or is V16QImode always correct here?
Thanks for the review. Yes, the target should be TImode here, but the followed call rs6000_expand_vector_insert needs a lot of emit_insns in it, using V16QI could reuse most of patterns in existed md files, after returning from this function, there will be a convert from V16QImode to TImode to make the type same: expr.c: convert_move (target, temp, TYPE_UNSIGNED (TREE_TYPE (exp))); and I've tested this with V2DI, V2DF V4SI, V4SF, V8HI, V16QI on Power9-LE and Power8-BE, the result correctness is ensured. Other comments are modified. Will update it later if no disagreements about the implementation. Thanks, Xionghu > >> + rs6000_expand_vector_insert (target, op0, op1, op2); >> + >> + return target; >> +}