[PATCH, 2/2][nvptx, PR83589] Workaround for branch-around-nothing JIT bug

Jakub Jelinek jakub@redhat.com
Wed Jan 24 14:19:00 GMT 2018


On Wed, Jan 24, 2018 at 02:56:28PM +0100, Tom de Vries wrote:
> +#if WORKAROUND_PTXJIT_BUG_2
> +/* Variant of pc_set that only requires JUMP_P (INSN) if STRICT.  This variant
> +   is needed in the nvptx target because the branches generated for
> +   parititioning are NONJUMP_INSN_P, not JUMP_P.  */
> +
> +static rtx
> +nvptx_pc_set (const rtx_insn *insn, bool strict = true)
> +{
> +  rtx pat;
> +  if ((strict && !JUMP_P (insn))
> +      || (!strict && !INSN_P (insn)))
> +    return NULL_RTX;
> +  pat = PATTERN (insn);
> +
> +  /* The set is allowed to appear either as the insn pattern or
> +     the first set in a PARALLEL.  */
> +  if (GET_CODE (pat) == PARALLEL)
> +    pat = XVECEXP (pat, 0, 0);

This could have been single_set.

> +  if (!x)
> +    return NULL_RTX;
> +  x = SET_SRC (x);
> +  if (GET_CODE (x) == LABEL_REF)
> +    return x;
> +  if (GET_CODE (x) != IF_THEN_ELSE)
> +    return NULL_RTX;
> +  if (XEXP (x, 2) == pc_rtx && GET_CODE (XEXP (x, 1)) == LABEL_REF)
> +    return XEXP (x, 1);
> +  if (XEXP (x, 1) == pc_rtx && GET_CODE (XEXP (x, 2)) == LABEL_REF)
> +    return XEXP (x, 2);
> +  return NULL_RTX;

And this looks like condjump_label.  What are the nvptx conditional jumps
that aren't JUMP_INSN and why?  That looks like a bad idea.
Otherwise, there is also JUMP_LABEL (insn)...

	Jakub



More information about the Gcc-patches mailing list