Add is_pow2() to test if a pseudo is a power of 2. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/simplify.c b/simplify.c index d729b390ae76..0d9391e21a56 100644 --- a/simplify.c +++ b/simplify.c @@ -52,6 +52,15 @@ // Utilities // ^^^^^^^^^ +/// +// check if a pseudo is a power of 2 +static inline bool is_pow2(pseudo_t src) +{ + if (src->type != PSEUDO_VAL) + return false; + return is_power_of_2(src->value); +} + /// // find the trivial parent for a phi-source static struct basic_block *phi_parent(struct basic_block *source, pseudo_t pseudo) -- 2.29.2