]> git.ipfire.org Git - thirdparty/gcc.git/commit
Merge aarch64-cc-fusion into late-combine
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 20 Aug 2025 12:20:02 +0000 (13:20 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 20 Aug 2025 12:20:02 +0000 (13:20 +0100)
commit724d88900b7aa8f249b737a33e9b11eedf48ebae
tree12d18630c279106a50e5912e69adc2c9c2984c03
parent481f96296e87b42b7f25944edd627cc9211dd803
Merge aarch64-cc-fusion into late-combine

I'd added the aarch64-specific CC fusion pass to fold a PTEST
instruction into the instruction that feeds the PTEST, in cases
where the latter instruction can set the appropriate flags as a
side-effect.

Combine does the same optimisation.  However, as explained in the
comments, the PTEST case often has:

  A: set predicate P based on inputs X
  B: clobber X
  C: test P

and so the fusion is only possible if we move C before B.
That's something that combine currently can't do (for the cases
that we needed).

The optimisation was never really AArch64-specific.  It's just that,
in an all-too-familiar fashion, we needed it in stage 3, when it was
too late to add something target-independent.

late-combine adds a convenient place to do the optimisation in a
target-independent way, just as combine is a convenient place to
do its related optimisation.

gcc/
* config.gcc (aarch64*-*-*): Remove aarch64-cc-fusion.o from
extra_objs.
* config/aarch64/aarch64-passes.def (pass_cc_fusion): Delete.
* config/aarch64/aarch64-protos.h (make_pass_cc_fusion): Delete.
* config/aarch64/t-aarch64 (aarch64-cc-fusion.o): Delete.
* config/aarch64/aarch64-cc-fusion.cc: Delete.
* late-combine.cc (late_combine::optimizable_set): Take a set_info *
rather than an insn_info * and move destination tests from...
(late_combine::combine_into_uses): ...here. Take a set_info * rather
an insn_info *.  Take the rtx set.
(late_combine::parallelize_insns, late_combine::combine_cc_setter)
(late_combine::combine_insn): New member functions.
(late_combine::m_parallel): New member variable.
* rtlanal.cc (pattern_cost): Handle sets of CC registers in the
same way as comparisons.
gcc/config.gcc
gcc/config/aarch64/aarch64-cc-fusion.cc [deleted file]
gcc/config/aarch64/aarch64-passes.def
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/t-aarch64
gcc/late-combine.cc
gcc/rtlanal.cc