[PATCH v2 10/12] soft-fp: Add the lack of implementation for 128 bit

Richard Henderson rth@twiddle.net
Tue Jul 17 18:20:00 GMT 2018


On 07/16/2018 10:07 PM, Zong Li wrote:
> +#define _FP_FRAC_ADD_8(R, X, Y)                                 \
> +  __FP_FRAC_ADD_8 (R##_f[7], R##_f[6], R##_f[5], R##_f[4],      \
> +                   R##_f[3], R##_f[2], R##_f[1], R##_f[0],      \
> +                   X##_f[7], X##_f[6], X##_f[5], X##_f[4],      \
> +                   X##_f[3], X##_f[2], X##_f[1], X##_f[0],      \
> +                   Y##_f[7], Y##_f[6], Y##_f[5], Y##_f[4],      \
> +                   Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])

I don't think there's a need for the intermediate macro.
I think it would be better to use a loop for these.  E.g.

#define _FP_FRAC_ADD_8(R, X, Y)                               \
  do                                                          \
    {                                                         \
      _FP_W_TYPE fa8_c = 0;                                   \
      for (int fa8_i = 0; fa8_i < 8; ++fa8_i)                 \
        {                                                     \
          _FP_W_TYPE fa8_x = X##_f[fa8_i];                    \
          _FP_W_TYPE fa8_r = fa8_x + Y##_f[fa8_i] + fa8_c;    \
          fa8_c = (fa8_c ? fa8_r <= fa8_x : fa8_r < fa8_x);   \
        }                                                     \
    }                                                         \
  while (0)


> +#define _FP_FRAC_SUB_8(R, X, Y)                                 \

Likewise.

> +#define _FP_FRAC_CLZ_8(R, X)                    \

Likewise.

Otherwise, LGTM.


r~



More information about the Libc-alpha mailing list