m68k-coldfire-pr68467.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. diff -Nur gcc-7.2.0.orig/gcc/config/m68k/m68k.c gcc-7.2.0/gcc/config/m68k/m68k.c
  2. --- gcc-7.2.0.orig/gcc/config/m68k/m68k.c 2017-04-03 22:30:56.274463000 +0000
  3. +++ gcc-7.2.0/gcc/config/m68k/m68k.c 2018-01-27 02:16:53.779367849 +0000
  4. @@ -182,6 +182,8 @@
  5. const_tree, bool);
  6. static bool m68k_cannot_force_const_mem (machine_mode mode, rtx x);
  7. static bool m68k_output_addr_const_extra (FILE *, rtx);
  8. +static machine_mode m68k_promote_function_mode (const_tree, machine_mode,
  9. + int *, const_tree, int);
  10. static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
  11. static enum flt_eval_method
  12. m68k_excess_precision (enum excess_precision_type);
  13. @@ -332,6 +334,9 @@
  14. #undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
  15. #define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128
  16. +#undef TARGET_PROMOTE_FUNCTION_MODE
  17. +#define TARGET_PROMOTE_FUNCTION_MODE m68k_promote_function_mode
  18. +
  19. static const struct attribute_spec m68k_attribute_table[] =
  20. {
  21. /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
  22. @@ -6571,4 +6576,20 @@
  23. return FLT_EVAL_METHOD_UNPREDICTABLE;
  24. }
  25. +/* Implement TARGET_PROMOTE_FUNCTION_MODE. */
  26. +
  27. +static machine_mode
  28. +m68k_promote_function_mode (const_tree type, machine_mode mode,
  29. + int *punsignedp ATTRIBUTE_UNUSED,
  30. + const_tree fntype ATTRIBUTE_UNUSED,
  31. + int for_return)
  32. +{
  33. + /* Promote libcall arguments narrower than int to match the normal C
  34. + ABI (for which promotions are handled via
  35. + TARGET_PROMOTE_PROTOTYPES). */
  36. + if (type == NULL_TREE && !for_return && (mode == QImode || mode == HImode))
  37. + return SImode;
  38. + return mode;
  39. +}
  40. +
  41. #include "gt-m68k.h"