This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Vector shuffling
> I hope that the new version looks a little bit better.
Nearly ok. Some trivial fixes, and then please commit.
> + rtx_v0 = expand_normal (v0);
> + rtx_mask = expand_normal (mask);
> +
> + create_output_operand (&ops[0], target, mode);
> + create_input_operand (&ops[3], rtx_mask, mode);
> +
> + if (operand_equal_p (v0, v1, 0))
> + {
> + rtx_v0 = expand_normal (v0);
> + if (!insn_operand_matches(icode, 1, rtx_v0))
> + rtx_v0 = force_reg (mode, rtx_v0);
> +
> + gcc_checking_assert(insn_operand_matches(icode, 2, rtx_v0));
> +
> + create_fixed_operand (&ops[1], rtx_v0);
> + create_fixed_operand (&ops[2], rtx_v0);
> + }
> + else
> + {
> + create_input_operand (&ops[1], expand_normal (v0), mode);
> + create_input_operand (&ops[2], expand_normal (v1), mode);
> + }
The first line should be removed. Otherwise you're expanding v0 twice.
> +(define_expand "vshuffle<mode>"
> + [(match_operand:V_128 0 "register_operand" "")
> + (match_operand:V_128 1 "general_operand" "")
> + (match_operand:V_128 2 "general_operand" "")
> + (match_operand:<sseshuffint> 3 "general_operand" "")]
> + "TARGET_SSSE3 || TARGET_AVX"
> +{
> + bool ok = ix86_expand_vshuffle (operands);
> + gcc_assert (ok);
> + DONE;
> +})
Operands 1, 2, and 3 should use register_operand. That will avoid...
> + op0 = force_reg (mode, op0);
> + op1 = force_reg (mode, op0);
> + mask = force_reg (maskmode, mask);
... these lines in ix86_expand_vshuffle and the obvious typo for op1.
> + fprintf (stderr, "-- here in %s \n", __func__);
Remove the debugging lines.
r~