This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH], Add PowerPC ISA 3.0 vector extract support
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, gcc-patches at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Date: Wed, 29 Jun 2016 17:20:26 -0500
- Subject: Re: [PATCH], Add PowerPC ISA 3.0 vector extract support
- Authentication-results: sourceware.org; auth=none
- References: <20160629193324 dot GA7321 at ibm-tiger dot the-meissners dot org>
On Wed, Jun 29, 2016 at 03:33:24PM -0400, Michael Meissner wrote:
> Is it ok to install in the trunk?
See comments below. Okay with that taken care of.
> Ideally, I would like to also install it on the GCC 6.2 branch. Note, it
> depends on the June 15th changes to allow DImode into Altivec registers, and
> the fix for PR 71677 that was submitted on June 27th being installed before
> these patches can be applied.
Is the DImode thing not on trunk yet?
> Assuming the above patches are supplied can I back port it to the GCC 6.2 after
> a burn-in period?
Yes, thanks.
> +;; Mode attribute to give the instruction for vector extract. %3 contains the
> +;; adjusted element count.
> +(define_mode_attr VSX_EXTRACT_INSN [(V16QI "vextractub %0,%1,%3")
> + (V8HI "vextractuh %0,%1,%3")
> + (V4SI "xxextractuw %x0,%x1,%3")])
Could you use %2 instead, please? Much less surprising. And please inline
it in the one place it is used.
> +(define_insn "vsx_extract_<mode>_di"
> + [(set (match_operand:DI 0 "gpc_reg_operand" "=<VSX_EX>")
> + (zero_extend:DI
> + (vec_select:<VS_scalar>
> + (match_operand:VSX_EXTRACT_I 1 "gpc_reg_operand" "<VSX_EX>")
> + (parallel [(match_operand:QI 2 "<VSX_EXTRACT_PREDICATE>" "n")]))))]
> + "VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_VEXTRACTUB"
> +{
> + int element = INTVAL (operands[2]);
> + int unit_size = GET_MODE_UNIT_SIZE (<MODE>mode);
> + int offset = ((VECTOR_ELT_ORDER_BIG)
> + ? unit_size * element
> + : unit_size * (GET_MODE_NUNITS (<MODE>mode) - 1 - element));
> +
> + operands[3] = GEN_INT (offset);
> + return "<VSX_EXTRACT_INSN>";
> +}
So that would be
operands[2] = GEN_INT (offset);
if (unit_size == 4)
return "xxextractuw %x0,%x1,%2";
else
return "vextractu<wd> %0,%1,%2";
or such.
Segher