aarch64: Carry over zeroness in aarch64_evpc_reencode

There was a bug in aarch64_evpc_reencode which could leave zero_op0_p and
zero_op1_p of the struct "newd" uninitialized.  r16-701-gd77c3bc1c35e303 fixed
the issue by zero initializing "newd."  This patch provides an alternative fix
as suggested by Richard Sandiford based on the fact that the zeroness is
preserved by aarch64_evpc_reencode.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc (aarch64_evpc_reencode): Copy zero_op0_p and
	zero_op1_p from d to newd.

Signed-off-by: Pengxuan Zheng <quic_pzheng@quicinc.com>
This commit is contained in:
Pengxuan Zheng 2025-05-20 17:58:23 -07:00
parent dff727b2c2
commit 84c6988c02
1 changed files with 3 additions and 1 deletions

View File

@ -26327,7 +26327,7 @@ aarch64_evpc_trn (struct expand_vec_perm_d *d)
static bool
aarch64_evpc_reencode (struct expand_vec_perm_d *d)
{
expand_vec_perm_d newd = {};
expand_vec_perm_d newd;
/* The subregs that we'd create are not supported for big-endian SVE;
see aarch64_modes_compatible_p for details. */
@ -26353,6 +26353,8 @@ aarch64_evpc_reencode (struct expand_vec_perm_d *d)
newd.op1 = d->op1 ? gen_lowpart (new_mode, d->op1) : NULL;
newd.testing_p = d->testing_p;
newd.one_vector_p = d->one_vector_p;
newd.zero_op0_p = d->zero_op0_p;
newd.zero_op1_p = d->zero_op1_p;
newd.perm.new_vector (newpermindices.encoding (), newd.one_vector_p ? 1 : 2,
newpermindices.nelts_per_input ());