"Kewen.Lin" <li...@linux.ibm.com> writes:
> @@ -2497,6 +2499,9 @@ expand_mask_load_optab_fn (internal_fn, gcall *stmt, 
> convert_optab optab)
>  
>    if (optab == vec_mask_load_lanes_optab)
>      icode = get_multi_vector_move (type, optab);
> +  else if (optab == lenload_optab)
> +    icode = convert_optab_handler (optab, TYPE_MODE (type),
> +                                targetm.vectorize.length_mode);
>    else
>      icode = convert_optab_handler (optab, TYPE_MODE (type),
>                                  TYPE_MODE (TREE_TYPE (maskt)));

I think lenload_optab should just be a direct optab, based only on
the vector mode.  It seems unlikely that targets would provide the
“same” load with different length modes.

> @@ -2507,15 +2512,20 @@ expand_mask_load_optab_fn (internal_fn, gcall *stmt, 
> convert_optab optab)
>    target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
>    create_output_operand (&ops[0], target, TYPE_MODE (type));
>    create_fixed_operand (&ops[1], mem);
> -  create_input_operand (&ops[2], mask, TYPE_MODE (TREE_TYPE (maskt)));
> +  if (optab == lenload_optab)
> +    create_convert_operand_from (&ops[2], mask, 
> targetm.vectorize.length_mode,
> +                              TYPE_UNSIGNED (TREE_TYPE (maskt)));

The mode argument should be TYPE_MODE (TREE_TYPE (maskt)) -- i.e. the
arguments should specify the precision and signedness of the existing rtx.

Hopefully this means that we don't need the target hook at all.

Thanks,
Richard

Reply via email to