Tejas Joshi <tejasjoshi9...@gmail.com> writes:
> Hello.
> I have added fadd variants in builtins.def. For fadd and faddl
> variants, I had to introduce builtin function types in
> builtin-types.def :
>
> +DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_DOUBLE_DOUBLE,
> +                    BT_FLOAT, BT_DOUBLE, BT_DOUBLE)
> +DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_LONGDOUBLE_LONGDOUBLE,
> +                    BT_FLOAT, BT_LONGDOUBLE, BT_LONGDOUBLE)
>
> and used them to define function in builtins.def. At this point, only
> faddf variant is getting called by test program :
>
> int main ()
> {
>     double z = __builtin_faddf (3.5, 1.4);
> }
> faddf variant is using BT_FN_FLOAT_FLOAT_FLOAT which is already
> defined in builtin-types.def means I need not to introduce it. Why
> fadd and faddl are not getting called in this patch? I don't find any
> other place where these function types needs to be added.

This is because of:

  if (mode == arg0_mode
      && real_cst_p (arg0)
      && real_cst_p (arg1))

in fold_const_call_1.  The reason for that check is that usually
the format passed in to fold_const_call_sss applies to both arguments
and the return type.  There's already an exception for CASE_CFN_NEXTTOWARD
though.  I guess you'll need something similar here.

Thanks,
Richard

Reply via email to