2013/1/24 Georg-Johann Lay <a...@gjlay.de>: > This patch adds the absolute value functions to stdfix.h. > > DEF_BUILTIN gets one more argument LIBNAME that sets the library name. If no > folding is found, for some builtins it's more convenient to call libgcc > support > directly instead of expanding to an insn. > > gcc's folding is not very good, thus implement our own. > > > Ok for trunk? > > Johann > > > > gcc/ > PR target/54222 > * config/avr/builtins.def (DEF_BUILTIN): Add LIBNAME argument. > Add NULL LIBNAME argument to existing definitions. > (ABSHR, ABSR, ABSLR, ABSLLR, ABSHK, ABSK, ABSLK, ABSLLK): New. > * config/avr/avr-c.c (DEF_BUILTIN): Add LIBNAME argument. > * config/avr/avr.c (DEF_BUILTIN): Same. > (avr_init_builtins): Pass down LIBNAME to add_builtin_function. > (avr_expand_builtin): Expand to a vanilla call if a libgcc > implementation is available (DECL_ASSEMBLER_NAME is set). > (avr_fold_absfx): New static function. > (avr_fold_builtin): Use it to handle: AVR_BUILTIN_ABSHR, > AVR_BUILTIN_ABSR, AVR_BUILTIN_ABSLR, AVR_BUILTIN_ABSLLR, > AVR_BUILTIN_ABSHK, AVR_BUILTIN_ABSK, AVR_BUILTIN_ABSLK, > AVR_BUILTIN_ABSLLK. > * config/avr/stdfix.h (abshr, absr, abslr, absllr) > (abshk, absk, abslk, absllk): Provide as static inline functions. > > gcc/testsuite/ > PR target/54222 > * gcc.target/avr/torture/builtins-3-absfx.c: New test. > >
Approved. Denis.