950-Don-t-allow-mcompact-casesi-for-ARCv2.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. From 09463827001a7b8094f4b9460514370a1876d908 Mon Sep 17 00:00:00 2001
  2. From: Claudiu Zissulescu <claziss@synopsys.com>
  3. Date: Wed, 20 Jan 2016 16:32:40 +0100
  4. Subject: [PATCH] Don't allow mcompact-casesi for ARCv2
  5. The compact casesi is not working for arcv2 processors family as it
  6. makes use of the add_s rx,rx,pcl instruction which is only valid for
  7. arc6xx and arc700 processors. Also not having this instruction makes
  8. no much sens to change the compact-casesi pattern to use normal add
  9. instructions as it nullifies the advantage of short instruction use.
  10. The default casesi pattern betters suits the arcv2 architecture.
  11. The fix is done in development tree: [arc-4.8-dev 0946382]
  12. and will be a part of the next release of ARC GNU tools.
  13. Once that new release happens this patch must be removed.
  14. gcc/
  15. 2016-01-20 Claudiu Zissulescu <claziss@synopsys.com>
  16. * common/config/arc/arc-common.c (arc_option_optimization_table):
  17. Remove mcompact-casesi option.
  18. * config/arc/arc.c (arc_override_options): Use compact-casesi only
  19. for arcv1.
  20. * config/arc/arc.md (casesi_load): Use short instructions.
  21. ---
  22. gcc/common/config/arc/arc-common.c | 1 -
  23. gcc/config/arc/arc.c | 9 +++++----
  24. gcc/config/arc/arc.md | 10 ++++++++--
  25. 3 files changed, 13 insertions(+), 7 deletions(-)
  26. * config/arc/arc.c (arc_legitimize_pic_address): Handle MINUS
  27. diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
  28. index e2e36fa..310bc80 100644
  29. --- a/gcc/common/config/arc/arc-common.c
  30. +++ b/gcc/common/config/arc/arc-common.c
  31. @@ -58,7 +58,6 @@ static const struct default_options arc_option_optimization_table[] =
  32. { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
  33. { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
  34. { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
  35. - { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
  36. { OPT_LEVELS_NONE, 0, NULL, 0 }
  37. };
  38. diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
  39. index 18d88a3..f828398 100644
  40. --- a/gcc/config/arc/arc.c
  41. +++ b/gcc/config/arc/arc.c
  42. @@ -1151,6 +1151,11 @@ arc_override_options (void)
  43. if (arc_size_opt_level == 3)
  44. optimize_size = 1;
  45. + if (TARGET_V2)
  46. + TARGET_COMPACT_CASESI = 0;
  47. + else if (optimize_size == 1)
  48. + TARGET_COMPACT_CASESI = 1;
  49. +
  50. if (flag_pic)
  51. target_flags |= MASK_NO_SDATA_SET;
  52. @@ -1163,10 +1168,6 @@ arc_override_options (void)
  53. if (!TARGET_Q_CLASS)
  54. TARGET_COMPACT_CASESI = 0;
  55. - /* For the time being don't support COMPACT_CASESI for ARCv2. */
  56. - if (TARGET_V2)
  57. - TARGET_COMPACT_CASESI = 0;
  58. -
  59. if (TARGET_COMPACT_CASESI)
  60. TARGET_CASE_VECTOR_PC_RELATIVE = 1;
  61. diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
  62. index bc4ac38..ba7c8bc 100644
  63. --- a/gcc/config/arc/arc.md
  64. +++ b/gcc/config/arc/arc.md
  65. @@ -3837,14 +3837,20 @@
  66. switch (GET_MODE (diff_vec))
  67. {
  68. case SImode:
  69. - return \"ld.as %0,[%1,%2]%&\";
  70. + if ((which_alternative == 0) && TARGET_CODE_DENSITY)
  71. + return \"ld_s.as %0,[%1,%2]%&\";
  72. + else
  73. + return \"ld.as %0,[%1,%2]%&\";
  74. case HImode:
  75. if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
  76. return \"ldw.as %0,[%1,%2]\";
  77. return \"ldw.x.as %0,[%1,%2]\";
  78. case QImode:
  79. if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
  80. - return \"ldb%? %0,[%1,%2]%&\";
  81. + if (which_alternative == 0)
  82. + return \"ldb_s %0,[%1,%2]%&\";
  83. + else
  84. + return \"ldb %0,[%1,%2]%&\";
  85. return \"ldb.x %0,[%1,%2]\";
  86. default:
  87. gcc_unreachable ();
  88. --
  89. 2.5.0