https://gcc.gnu.org/g:4e05b180bb45b2ab95df18c1919c808cdace213e
commit 4e05b180bb45b2ab95df18c1919c808cdace213e Author: Michael Meissner <[email protected]> Date: Thu Jun 25 15:34:29 2026 -0400 PR target/117251: Improve vector fusion #2 See the following post for a complete explanation of what the patches for PR target/117251: * https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686474.html This is patch #2 of 45 to generate the 'XXEVAL' instruction on power10 and power11 instead of using the Altivec 'VANDC' instruction feeding into 'VAND'. The 'XXEVAL' instruction can use all 64 vector registers, instead of the 32 registers that traditional Altivec vector instructions use. By allowing all of the vector registers to be used, it reduces the amount of spilling that a large benchmark generated. For vectors such as: vector int a, b, c, d; This patch will generate a call to xxeval if any of the registers are allocated to traditional floating point registers: Code: Old: New: ===== ==== ==== a = (c & ~ d) & b; vandc t,c,d xxeval a,b,c,d,2 vand a,t,b a = (c ^ d) & b; vxor t,c,d xxeval a,b,c,d,6 vand a,t,b a = (c | d) & b; vor t,c,d xxeval a,b,c,d,7 vand a,t,b a = (~ (c | d)) & b; vnor t,c,d xxeval a,b,c,d,8 vand a,t,b a = (~ (c ^ d)) & b; veqv t,c,d xxeval a,b,c,d,9 vand a,t,b a = (c | ~ d) & b; vorc t,c,d xxeval a,b,c,d,11 vand a,t,b a = (c & ~ d) & ~ b; vandc t,c,d xxeval a,b,c,d,13 vandc a,t,b a = (~ (c & d)) & b; vnand t,c,d xxeval a,b,c,d,14 vand a,t,b Since fusion using 2 Altivec instructions is slightly faster than using the 'XXEVAL' instruction we prefer to generate the Altivec instructions if we can. In addition, because 'XXEVAL' is a prefixed instruction, it possibly might generate an extra NOP instruction to align the 'XXEVAL' instruction. I have tested these patches on both big endian and little endian PowerPC servers, with no regressions. Can I check these patchs into the trunk? 2026-06-25 Michael Meissner <[email protected]> gcc/ PR target/117251 * config/rs6000/fusion.md: Regenerate. * config/rs6000/genfusion.pl (gen_logical_addsubf): Add support to generate vector/vector fusion if XXEVAL is supported. Diff: --- gcc/config/rs6000/genfusion.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index 3fc14e6d5eb7..bdbe798de055 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -259,7 +259,7 @@ sub gen_logical_addsubf "vxor_vnand" => 249, "vandc_vnand" => 253, "vand_vnand" => 254, - ); +y ); KIND: foreach $kind ('scalar','vector') { @outer_ops = @logicals;
