public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][optabs][ifcvt][0/3] Define negcc, notcc optabs and use for if-conversion
@ 2015-09-01 15:04 Kyrill Tkachov
  0 siblings, 0 replies; only message in thread
From: Kyrill Tkachov @ 2015-09-01 15:04 UTC (permalink / raw)
  To: GCC Patches
  Cc: Marcus Shawcroft, Richard Earnshaw, Ramana Radhakrishnan,
	James Greenhalgh

Hi all,

This patch series aims to improve the use of conditional negate and conditional
invert instructions when if-converting code of the form:
x := test ? -a : a; or x := test ? ~a : a;
I'd like to generate something like:
x := a; if (test) x := -x; where the latter if-statement can be implemented
with a conditional negate instruction like CSNEG in aarch64 (or using conditional
execution in the arm backend).
For that I'd like to introcude two new optabs: negcc and notcc which correspond
to a conditional negate and a conditional bitwise-not operation respectively.
The first patch in the series adds the optabs and uses them in a new RTL
if-conversion function that performs the above transformation.

The second and third patches implement the new optabs for the aarch64 and arm
targets accordingly. They also contain the tests that show the places where
this code triggers.

This series has been bootstrapped and tested on arm, aarch64 and x86_64.
The new functionality is supposed to trigger only on arm and aarch64 for now,
though I hope implementing the new optabs for any target that supports
these kinds of instructions should not be too hard.

The code generation on arm and aarch64 looks objectively better where it
triggers i.e. more usage of the CSNEG and CSINV aarch64 instructions rather
with no bad side-effects. On arm this also seems to benefit from performing
this kind of if-conversion early on rather than waiting for the late
conditional execution pass to have a go.

Ok for trunk?

Thanks,
Kyrill

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-01 15:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01 15:04 [PATCH][optabs][ifcvt][0/3] Define negcc, notcc optabs and use for if-conversion Kyrill Tkachov

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).