aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlex Coplan <alex.coplan@arm.com>2023-11-02 22:53:44 +0000
committerAlex Coplan <alex.coplan@arm.com>2023-12-15 19:59:59 +0000
commit94415eb7a464e855c37ab01ab300fa5e87e4c4a3 (patch)
treefdadf6ae295f5fd9d9c7220a04b59b7856f48ac7 /gcc
parent0bd6f7a7496a78832624713f3df64ad17fa0f841 (diff)
downloadgcc-94415eb7a464e855c37ab01ab300fa5e87e4c4a3.zip
gcc-94415eb7a464e855c37ab01ab300fa5e87e4c4a3.tar.gz
gcc-94415eb7a464e855c37ab01ab300fa5e87e4c4a3.tar.bz2
aarch64: Fix up aarch64_print_operand xzr/wzr case
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/aarch64/aarch64-protos.h1
-rw-r--r--gcc/config/aarch64/aarch64.cc12
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 88e5942..8d6ea73 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -774,6 +774,7 @@ bool aarch64_expand_cpymem (rtx *, bool);
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 190608d..6d973b3 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -10851,6 +10851,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
@@ -12054,8 +12063,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;