Le 20/10/2021 à 21:06, Richard Henderson a écrit : > On 10/19/21 2:48 AM, Frédéric Pétrot wrote: > > Hmm. 3 * (and + shift + cmp + cmov) + 2 * (sub + or) = 16 ops. > Not horrible... > > Let's see. > > ls = sh & 63; 1 > rs = -sh & 63; 3 > hs = sh & 64; 4 > > ll = s1l << ls; 5 > h0 = s1h << ls; 6 > lr = s1l >> rs; 7 > h1 = h0 | lr; 8 > > dl = hs ? 0 : ll; 10 > dh = hs ? ll : h1; 12 > > That seems right, and would be 4 ops smaller. > Would need testing of course.
Nice ! The case when sh is 0 is specific, so we need an additional cmov, but this is still 3 ops better. Frédéric > > > r~ -- +---------------------------------------------------------------------------+ | Frédéric Pétrot, Pr. Grenoble INP-Ensimag/TIMA, Ensimag deputy director | | Mob/Pho: +33 6 74 57 99 65/+33 4 76 57 48 70 Ad augusta per angusta | | http://tima.univ-grenoble-alpes.fr frederic.pet...@univ-grenoble-alpes.fr | +---------------------------------------------------------------------------+