rs6000: clz/ctz/ffs improvement (PR78683)
commit824e9f2e51a5f5536577bc7aa595d3262b442300
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Dec 2016 19:31:06 +0000 (9 19:31 +0000)
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Dec 2016 19:31:06 +0000 (9 19:31 +0000)
tree025154146b8b80c430204be6d22a894a97eea00f
parentb317b227cbb1f2bec8c2b1421bd0e6d6d467d1d1
rs6000: clz/ctz/ffs improvement (PR78683)

On CPUs that implement popcnt[wd] but not cnttz[wd] we can do better for
the ctz sequences than we do today.

CL[TZ]_DEFINED_VALUE_AT_ZERO can return 2, since we always return the
same fixed value (only dependent on TARGET_* options).

PR target/78683
* config/rs6000/rs6000.h (CLZ_DEFINED_VALUE_AT_ZERO): Use
GET_MODE_BITSIZE.  Return 2.
(CTZ_DEFINED_VALUE_AT_ZERO): Use GET_MODE_BITSIZE.  Return 2.  Handle
TARGET_POPCNTD the same as TARGET_CTZ.
* config/rs6000/rs6000.md (ctz<mode>2): Reimplement.
(ffs<mode>2): Reimplement.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243499 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/rs6000.md