Re: [patch, avr] PR119421: Optimize more bit operations

2025-03-22 Thread Denis Chertykov
Georg-Johann Lay writes: > There are occasions where knowledge about nonzero bits makes some > optimizations possible. For example, > >Rd |= Rn << Off > > can be implemented as > >SBRC Rn, 0 >ORI Rd, 1 << Off > > when Rn in { 0, 1 }, i.e. nonzero_bits (Rn) == 1. This patch adds som

[patch, avr] PR119421: Optimize more bit operations

2025-03-21 Thread Georg-Johann Lay
There are occasions where knowledge about nonzero bits makes some optimizations possible. For example, Rd |= Rn << Off can be implemented as SBRC Rn, 0 ORI Rd, 1 << Off when Rn in { 0, 1 }, i.e. nonzero_bits (Rn) == 1. This patch adds some patterns that exploit nonzero_bits() in so

Re: [patch, avr] PR119421: Optimize more bit operations

2025-03-21 Thread Jeff Law
On 3/21/25 2:59 PM, Georg-Johann Lay wrote: There are occasions where knowledge about nonzero bits makes some optimizations possible.  For example,    Rd |= Rn << Off can be implemented as    SBRC Rn, 0    ORI  Rd, 1 << Off when Rn in { 0, 1 }, i.e. nonzero_bits (Rn) == 1.  This patch a