[PATCH] Further rs6000 asm modifier tweaks (PR target/88188)

Segher Boessenkool segher@kernel.crashing.org
Tue Dec 4 15:32:00 GMT 2018


Hi Jakub,

On Tue, Dec 04, 2018 at 09:56:45AM +0100, Jakub Jelinek wrote:
> This patch adds further tweaks discussed in the last PR88188 mail.

Thanks for doing this :-)

> ccr_bit now returns -1 instead of failing assertions, so that the caller
> can decide what to do with it (fail assertion or output_operand_lossage
> with some reasonable diagnostics.

(And all callers already test for that).

> For D and t it now requires CR_REGNO_P, so that it doesn't print completely
> meaningless numbers if used with other registers.
> And use REG_P macros a little bit.


> 2018-12-04  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/88188
> 	* config/rs6000/rs6000.c (ccr_bit): Return -1 instead of assertion
> 	failures.
> 	(print_operand): Use REG_P instead of GET_CODE == REG.
> 	<case 'D', case 't'>: Also check CR_REGNO_P (REGNO (x)).
> 	* config/rs6000/rs6000.md (scc patterns): Assert ccr_bit didn't
> 	return -1.
> 
> 	* gcc.target/powerpc/pr88188-2.c: New test.

> @@ -20754,7 +20765,7 @@ print_operand (FILE *file, rtx x, int co
>  
>      case 'D':
>        /* Like 'J' but get to the GT bit only.  */
> -      if (!REG_P (x))
> +      if (! REG_P (x) || ! CR_REGNO_P (REGNO (x)))

No space after ! please.  I know surrounding code does it, but how will
we ever get rid of that otherwise :-)

> @@ -21014,7 +21025,7 @@ print_operand (FILE *file, rtx x, int co
>  
>      case 't':
>        /* Like 'J' but get to the OVERFLOW/UNORDERED bit.  */
> -      if (!REG_P (x) || GET_MODE (x) != CCmode)
> +      if (! REG_P (x) || GET_MODE (x) != CCmode || ! CR_REGNO_P (REGNO (x)))

Strange that this one uses GET_MODE, all the rest do not.  Since you add
the CR_REGNO test now, the mode test is obviously superfluous, so you
can delete it?

Okay for trunk, with or without those extra tweaks.  Thanks!


Segher



More information about the Gcc-patches mailing list