xtensa: Add some dedicated patterns that correspond to GIMPLE canonicalizations
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Tue, 14 Jun 2022 03:37:54 +0000 (12:37 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Wed, 15 Jun 2022 23:55:36 +0000 (16:55 -0700)
commitc95e307e3a978166cd5d6817ec9d8293825ff3fb
treea46f88caa9faa71f07424a32391b8585d577f401
parent43b0c56fda4bc990e8ee8d6a0b376de7b663bb06
xtensa: Add some dedicated patterns that correspond to GIMPLE canonicalizations

This patch offers better RTL representations against straightforward
derivations from some tree optimizers' canonicalized forms.

- rounding up to even, such as '(x + (x & 1))', is canonicalized to
  '((x + 1) & -2)', but the former is one instruction less than the latter
  in Xtensa ISA.
- signed greater or equal to zero as logical value '((signed)x >= 0)',
  is canonicalized to '((unsigned)(x ^ -1) >> 31)', but the equivalent
  '(((signed)x >> 31) + 1)' is one instruction less.

gcc/ChangeLog:

* config/xtensa/xtensa.md (*round_up_to_even):
New insn-and-split pattern.
(*signed_ge_zero): Ditto.
gcc/config/xtensa/xtensa.md