* [PATCH v2 06/11] aarch64: Fix up aarch64_print_operand xzr/wzr case
@ 2023-12-05 10:54 Alex Coplan
2023-12-05 16:13 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Alex Coplan @ 2023-12-05 10:54 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Earnshaw, Richard Sandiford, Kyrylo Tkachov
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
Hi,
This is a v2 of:
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637612.html
v1 was approved as-is, but this version pulls out the test into a helper
function which is used by later patches in the series.
Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk?
Thanks,
Alex
-- >8 --
This adjusts aarch64_print_operand to recognize zero rtxes in modes other than
VOIDmode. This allows us to use xzr/wzr for zero vectors, for example.
We extract the test into a helper function, aarch64_const_zero_rtx_p, since this
predicate is needed by later patches.
gcc/ChangeLog:
* config/aarch64/aarch64-protos.h (aarch64_const_zero_rtx_p): New.
* config/aarch64/aarch64.cc (aarch64_const_zero_rtx_p): New.
Use it ...
(aarch64_print_operand): ... here. Recognize CONST0_RTXes in
modes other than VOIDmode.
[-- Attachment #2: patch_v2.txt --]
[-- Type: text/plain, Size: 1495 bytes --]
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index d2718cc87b3..27fc6ccf098 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -773,6 +773,7 @@ bool aarch64_expand_cpymem (rtx *);
bool aarch64_expand_setmem (rtx *);
bool aarch64_float_const_zero_rtx_p (rtx);
bool aarch64_float_const_rtx_p (rtx);
+bool aarch64_const_zero_rtx_p (rtx);
bool aarch64_function_arg_regno_p (unsigned);
bool aarch64_fusion_enabled_p (enum aarch64_fusion_pairs);
bool aarch64_gen_cpymemqi (rtx *);
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index fca64daf2a0..a35c6bbe335 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -9095,6 +9095,15 @@ aarch64_float_const_zero_rtx_p (rtx x)
return real_equal (CONST_DOUBLE_REAL_VALUE (x), &dconst0);
}
+/* Return true if X is any kind of constant zero rtx. */
+
+bool
+aarch64_const_zero_rtx_p (rtx x)
+{
+ return x == CONST0_RTX (GET_MODE (x))
+ || (CONST_DOUBLE_P (x) && aarch64_float_const_zero_rtx_p (x));
+}
+
/* Return TRUE if rtx X is immediate constant that fits in a single
MOVI immediate operation. */
bool
@@ -9977,8 +9986,7 @@ aarch64_print_operand (FILE *f, rtx x, int code)
case 'w':
case 'x':
- if (x == const0_rtx
- || (CONST_DOUBLE_P (x) && aarch64_float_const_zero_rtx_p (x)))
+ if (aarch64_const_zero_rtx_p (x))
{
asm_fprintf (f, "%czr", code);
break;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2 06/11] aarch64: Fix up aarch64_print_operand xzr/wzr case
2023-12-05 10:54 [PATCH v2 06/11] aarch64: Fix up aarch64_print_operand xzr/wzr case Alex Coplan
@ 2023-12-05 16:13 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-12-05 16:13 UTC (permalink / raw)
To: Alex Coplan; +Cc: gcc-patches, Richard Earnshaw, Kyrylo Tkachov
Alex Coplan <alex.coplan@arm.com> writes:
> Hi,
>
> This is a v2 of:
>
> https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637612.html
>
> v1 was approved as-is, but this version pulls out the test into a helper
> function which is used by later patches in the series.
>
> Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk?
>
> Thanks,
> Alex
>
> -- >8 --
>
> This adjusts aarch64_print_operand to recognize zero rtxes in modes other than
> VOIDmode. This allows us to use xzr/wzr for zero vectors, for example.
>
> We extract the test into a helper function, aarch64_const_zero_rtx_p, since this
> predicate is needed by later patches.
>
> gcc/ChangeLog:
>
> * config/aarch64/aarch64-protos.h (aarch64_const_zero_rtx_p): New.
> * config/aarch64/aarch64.cc (aarch64_const_zero_rtx_p): New.
> Use it ...
> (aarch64_print_operand): ... here. Recognize CONST0_RTXes in
> modes other than VOIDmode.
>
> diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
> index d2718cc87b3..27fc6ccf098 100644
> --- a/gcc/config/aarch64/aarch64-protos.h
> +++ b/gcc/config/aarch64/aarch64-protos.h
> @@ -773,6 +773,7 @@ bool aarch64_expand_cpymem (rtx *);
> bool aarch64_expand_setmem (rtx *);
> bool aarch64_float_const_zero_rtx_p (rtx);
> bool aarch64_float_const_rtx_p (rtx);
> +bool aarch64_const_zero_rtx_p (rtx);
> bool aarch64_function_arg_regno_p (unsigned);
> bool aarch64_fusion_enabled_p (enum aarch64_fusion_pairs);
> bool aarch64_gen_cpymemqi (rtx *);
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index fca64daf2a0..a35c6bbe335 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -9095,6 +9095,15 @@ aarch64_float_const_zero_rtx_p (rtx x)
> return real_equal (CONST_DOUBLE_REAL_VALUE (x), &dconst0);
> }
>
> +/* Return true if X is any kind of constant zero rtx. */
> +
> +bool
> +aarch64_const_zero_rtx_p (rtx x)
> +{
> + return x == CONST0_RTX (GET_MODE (x))
> + || (CONST_DOUBLE_P (x) && aarch64_float_const_zero_rtx_p (x));
> +}
> +
Think this is easier to read if formatted as:
return (x == CONST0_RTX (GET_MODE (x))
|| (CONST_DOUBLE_P (x) && aarch64_float_const_zero_rtx_p (x)));
OK with that change (or as-is if you prefer). Thanks for splitting
the function out.
Richard
> /* Return TRUE if rtx X is immediate constant that fits in a single
> MOVI immediate operation. */
> bool
> @@ -9977,8 +9986,7 @@ aarch64_print_operand (FILE *f, rtx x, int code)
>
> case 'w':
> case 'x':
> - if (x == const0_rtx
> - || (CONST_DOUBLE_P (x) && aarch64_float_const_zero_rtx_p (x)))
> + if (aarch64_const_zero_rtx_p (x))
> {
> asm_fprintf (f, "%czr", code);
> break;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-05 16:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 10:54 [PATCH v2 06/11] aarch64: Fix up aarch64_print_operand xzr/wzr case Alex Coplan
2023-12-05 16:13 ` Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).