This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Fix builtins-18.c and builtins-20.c on arm-none-elf

On Tue, 23 Dec 2003, Mark Mitchell wrote:
> The first problem was that expand_call was not creating useful
> REG_RETVAL notes for calls to sqrt.  It was doing like so:
>     (insn_list:REG_RETVAL 39 (expr_list:REG_EQUAL (expr_list (symbol_ref:SI ("sqrt") <function_decl 0x4037bca8 __builtin_sqrt>)
> rather than the much more useful version generated for a libcall to an
> addition routine:
>     (insn_list:REG_RETVAL 29 (expr_list:REG_EQUAL (plus:DF (reg:DF 77)
>                 (reg:DF 79))

This REG_EQUAL note is supposed to be added by the code at the bottom of
expand_builtin_mathfn, see just below the comment:

  /* If this is a sqrt operation and we don't care about errno, try to
     attach a REG_EQUAL note with a SQRT rtx to the emitted libcall.
     This allows the semantics of the libcall to be visible to the RTL
     optimizers.  */

Perhaps it would be better to find out why this code isn't triggering.

> A second problem was that these tests omit certain features on systems
> that do not have full C99 support.  One of the tests was not correctly
> omitting tests for float variants of library functions on non-C99
> systems.  Neither test was correctly recognizing that newlib is not a
> C99 library.
> Really, these tests are misdesigned; the C99 bits should be split out
> into separate tests.

Agreed.  Indeed after these testcases were applied I submitted a
patch to split them up correctly, that alas was never approved.

> (I was also amused while playing with these tests to realize that on
> x86 Red Hat 8.0 include <math.h> causes GCC to generate worse code for
> these tests; the inline versions of the math functions do not permit
> the same simplifications as the builtins.  Hopefully the glibc people
> will remove the inline math functions, if they have not already done
> so.)


Sorry for the inconvenience,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]