inline static unsigned int count_leading_zeros (UTItype x) { qword c = si_clz (*(qword *) & x); qword cmp0 = si_cgti (c, 31); qword cmp1 = si_and (cmp0, si_shlqbyi (cmp0, 4)); qword cmp2 = si_and (cmp1, si_shlqbyi (cmp0, 8)); qword s = si_a (c, si_and (cmp0, si_shlqbyi (c, 4))); s = si_a (s, si_and (cmp1, si_shlqbyi (c, 8))); s = si_a (s, si_and (cmp2, si_shlqbyi (c, 12))); return si_to_uint (s); }
UTItype __udivmodti4 (UTItype num, UTItype den, UTItype * rp) { qword shift = si_from_uint (count_leading_zeros (den) - count_leading_zeros (num)); qword n0 = si_from_UTItype (num); qword d0 = si_from_UTItype (den); qword bit = si_andi (si_fsmbi (1), 1); qword r0 = si_il (0); qword m1 = si_fsmbi (0x000f); qword mask, r1, n1; d0 = si_shlqbybi (si_shlqbi (d0, shift), shift); bit = si_shlqbybi (si_shlqbi (bit, shift), shift); do { r1 = si_or (r0, bit); // n1 = n0 - d0 in TImode n1 = si_bg (d0, n0); n1 = si_shlqbyi (n1, 4); n1 = si_sf (m1, n1); n1 = si_bgx (d0, n0, n1); n1 = si_shlqbyi (n1, 4); n1 = si_sf (m1, n1); n1 = si_bgx (d0, n0, n1); n1 = si_shlqbyi (n1, 4); n1 = si_sf (m1, n1); n1 = si_sfx (d0, n0, n1); mask = si_fsm (si_cgti (n1, -1)); r0 = si_selb (r0, r1, mask); n0 = si_selb (n0, n1, mask); bit = si_rotqmbii (bit, -1); d0 = si_rotqmbii (d0, -1); } while (si_to_uint (si_orx (bit))); if (rp) *rp = si_to_UTItype (n0); return si_to_UTItype (r0); }
qword __float_unsdidf (qword DI) { qword t0, t1, t2, t3, t4, t5, t6, t7, t8; t0 = si_clz (DI); t1 = si_shl (DI, t0); t2 = si_ceqi (t0, 32); t3 = si_sf (t0, *(const qword *) __didf_scale); t4 = si_a (t1, t1); t5 = si_andc (t3, t2); t6 = si_shufb (t5, t4, *(const qword *) __didf_pat); t7 = si_shlqbii (t6, 4); t8 = si_shlqbyi (t7, 8); return si_dfa (t7, t8); }