diff options
author | Andrew Pinski <apinski@marvell.com> | 2023-04-28 12:45:19 -0700 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2023-05-02 14:46:39 -0700 |
commit | 078339fc04f5de59e55de8c54f4504b7672d60d0 (patch) | |
tree | 23ac947f8b12a33527454d1094d81d97e5aaff88 /gcc | |
parent | 8702ab1456eee07d07ac1a8bc005c690cf6dbcf0 (diff) | |
download | gcc-078339fc04f5de59e55de8c54f4504b7672d60d0.zip gcc-078339fc04f5de59e55de8c54f4504b7672d60d0.tar.gz gcc-078339fc04f5de59e55de8c54f4504b7672d60d0.tar.bz2 |
MATCH: Port CLRSB part of builtin_zero_pattern
This ports the clrsb builtin part of builtin_zero_pattern
to match.pd. A simple pattern to port.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
* match.pd (a != 0 ? CLRSB(a) : CST -> CLRSB(a)): New
pattern.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/match.pd | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index b14b701..08a4f8e 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -7787,6 +7787,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cond (ne @0 integer_zerop@1) (func@3 (convert? @0)) integer_zerop@2) @3)) +/* a != 0 ? FUN(a) : CST -> Fun(a) for some CLRSB builtins + where CST is precision-1. */ +(for func (CLRSB) + (simplify + (cond (ne @0 integer_zerop@1) (func@4 (convert?@3 @0)) INTEGER_CST@2) + (if (wi::to_widest (@2) == TYPE_PRECISION (TREE_TYPE (@3)) - 1) + @4))) + #if GIMPLE /* a != 0 ? CLZ(a) : CST -> .CLZ(a) where CST is the result of the internal function for 0. */ (for func (CLZ) |