public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [ARC] Fix emitting jump tables for ARCv2
@ 2016-04-26 11:30 Claudiu Zissulescu
  2016-06-15  7:07 ` Claudiu Zissulescu
  2016-09-27 14:57 ` Andrew Burgess
  0 siblings, 2 replies; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-04-26 11:30 UTC (permalink / raw)
  To: gcc-patches; +Cc: Claudiu.Zissulescu, gnu, Francois.Bedard, jeremy.bennett

The compact casesi option only make sens for ARCv1 cores. For ARCv2 cores we
use the regular expansion.

OK to apply?
Claudiu

gcc/
2016-04-26  Claudiu Zissulescu  <claziss@synopsys.com>

	* common/config/arc/arc-common.c (arc_option_optimization_table):
	Disable compact casesi as default option.
	* config/arc/arc.c (arc_override_options): Enable compact casesi
	option for non-ARCv2 cores.
	* config/arc/arc.md (movsi_insn): Use @pcl relocation.
	(movsi_ne): Update assembly printing pattern.
	(casesi_load): Use short ld instruction.
---
 gcc/common/config/arc/arc-common.c |  1 -
 gcc/config/arc/arc.c               |  7 +++++++
 gcc/config/arc/arc.md              | 11 +++++++----
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
index 64fb053..17cc1bd 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
     { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
-    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 6f2136e..be55c99 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -812,6 +812,13 @@ arc_override_options (void)
   if (arc_size_opt_level == 3)
     optimize_size = 1;
 
+  /* Compact casesi is not a valid option for ARCv2 family, disable
+     it.  */
+  if (TARGET_V2)
+    TARGET_COMPACT_CASESI = 0;
+  else if (optimize_size == 1)
+    TARGET_COMPACT_CASESI = 1;
+
   if (flag_pic)
     target_flags |= MASK_NO_SDATA_SET;
 
diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
index 718443b..aec4b37 100644
--- a/gcc/config/arc/arc.md
+++ b/gcc/config/arc/arc.md
@@ -713,7 +713,7 @@
    ror %0,((%1*2+1) & 0x3f) ;6
    mov%? %0,%1		;7
    add %0,%S1		;8
-   * return arc_get_unalign () ? \"add %0,pcl,%1-.+2\" : \"add %0,pcl,%1-.\";
+   add %0,pcl,%1@pcl
    mov%? %0,%S1%&	;10
    mov%? %0,%S1		;11
    ld%?%U1 %0,%1%&	;12
@@ -3467,8 +3467,8 @@
   ""
   "@
 	* current_insn_predicate = 0; return \"sub%?.ne %0,%0,%0%&\";
-        mov_s.ne %0,%1
-        mov_s.ne %0,%1
+        * current_insn_predicate = 0; return \"mov%?.ne %0,%1\";
+        * current_insn_predicate = 0; return \"mov%?.ne %0,%1\";
 	mov.ne %0,%1
 	mov.ne %0,%S1"
   [(set_attr "type" "cmove")
@@ -3777,7 +3777,10 @@
   switch (GET_MODE (diff_vec))
     {
     case SImode:
-      return \"ld.as %0,[%1,%2]%&\";
+      if ((which_alternative == 0) && TARGET_CODE_DENSITY)
+	return \"ld_s.as %0,[%1,%2]%&\";
+      else
+	return \"ld.as %0,[%1,%2]%&\";
     case HImode:
       if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
 	return \"ld%_.as %0,[%1,%2]\";
-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] [ARC] Fix emitting jump tables for ARCv2
  2016-04-26 11:30 [PATCH] [ARC] Fix emitting jump tables for ARCv2 Claudiu Zissulescu
@ 2016-06-15  7:07 ` Claudiu Zissulescu
  2016-09-27 14:57 ` Andrew Burgess
  1 sibling, 0 replies; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-06-15  7:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: gnu, Francois.Bedard

PING

> -----Original Message-----
> From: Claudiu Zissulescu
> Sent: Tuesday, April 26, 2016 1:29 PM
> To: gcc-patches@gcc.gnu.org
> Cc: Claudiu Zissulescu <claziss@synopsys.com>; gnu@amylaar.uk;
> Francois.Bedard@synopsys.com; jeremy.bennett@embecosm.com
> Subject: [PATCH] [ARC] Fix emitting jump tables for ARCv2
> 
> The compact casesi option only make sens for ARCv1 cores. For ARCv2 cores
> we
> use the regular expansion.
> 
> OK to apply?
> Claudiu
> 
> gcc/
> 2016-04-26  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* common/config/arc/arc-common.c
> (arc_option_optimization_table):
> 	Disable compact casesi as default option.
> 	* config/arc/arc.c (arc_override_options): Enable compact casesi
> 	option for non-ARCv2 cores.
> 	* config/arc/arc.md (movsi_insn): Use @pcl relocation.
> 	(movsi_ne): Update assembly printing pattern.
> 	(casesi_load): Use short ld instruction.
> ---
>  gcc/common/config/arc/arc-common.c |  1 -
>  gcc/config/arc/arc.c               |  7 +++++++
>  gcc/config/arc/arc.md              | 11 +++++++----
>  3 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/gcc/common/config/arc/arc-common.c
> b/gcc/common/config/arc/arc-common.c
> index 64fb053..17cc1bd 100644
> --- a/gcc/common/config/arc/arc-common.c
> +++ b/gcc/common/config/arc/arc-common.c
> @@ -56,7 +56,6 @@ static const struct default_options
> arc_option_optimization_table[] =
>      { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
> -    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
>      { OPT_LEVELS_NONE, 0, NULL, 0 }
>    };
> 
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 6f2136e..be55c99 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -812,6 +812,13 @@ arc_override_options (void)
>    if (arc_size_opt_level == 3)
>      optimize_size = 1;
> 
> +  /* Compact casesi is not a valid option for ARCv2 family, disable
> +     it.  */
> +  if (TARGET_V2)
> +    TARGET_COMPACT_CASESI = 0;
> +  else if (optimize_size == 1)
> +    TARGET_COMPACT_CASESI = 1;
> +
>    if (flag_pic)
>      target_flags |= MASK_NO_SDATA_SET;
> 
> diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
> index 718443b..aec4b37 100644
> --- a/gcc/config/arc/arc.md
> +++ b/gcc/config/arc/arc.md
> @@ -713,7 +713,7 @@
>     ror %0,((%1*2+1) & 0x3f) ;6
>     mov%? %0,%1		;7
>     add %0,%S1		;8
> -   * return arc_get_unalign () ? \"add %0,pcl,%1-.+2\" : \"add %0,pcl,%1-.\";
> +   add %0,pcl,%1@pcl
>     mov%? %0,%S1%&	;10
>     mov%? %0,%S1		;11
>     ld%?%U1 %0,%1%&	;12
> @@ -3467,8 +3467,8 @@
>    ""
>    "@
>  	* current_insn_predicate = 0; return \"sub%?.ne %0,%0,%0%&\";
> -        mov_s.ne %0,%1
> -        mov_s.ne %0,%1
> +        * current_insn_predicate = 0; return \"mov%?.ne %0,%1\";
> +        * current_insn_predicate = 0; return \"mov%?.ne %0,%1\";
>  	mov.ne %0,%1
>  	mov.ne %0,%S1"
>    [(set_attr "type" "cmove")
> @@ -3777,7 +3777,10 @@
>    switch (GET_MODE (diff_vec))
>      {
>      case SImode:
> -      return \"ld.as %0,[%1,%2]%&\";
> +      if ((which_alternative == 0) && TARGET_CODE_DENSITY)
> +	return \"ld_s.as %0,[%1,%2]%&\";
> +      else
> +	return \"ld.as %0,[%1,%2]%&\";
>      case HImode:
>        if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
>  	return \"ld%_.as %0,[%1,%2]\";
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [ARC] Fix emitting jump tables for ARCv2
  2016-04-26 11:30 [PATCH] [ARC] Fix emitting jump tables for ARCv2 Claudiu Zissulescu
  2016-06-15  7:07 ` Claudiu Zissulescu
@ 2016-09-27 14:57 ` Andrew Burgess
  2016-09-28  9:28   ` Claudiu Zissulescu
  2016-09-29  9:00   ` [PATCH] Disable compact casesi patterns for arcv2 Claudiu Zissulescu
  1 sibling, 2 replies; 10+ messages in thread
From: Andrew Burgess @ 2016-09-27 14:57 UTC (permalink / raw)
  To: Claudiu Zissulescu; +Cc: gcc-patches, gnu, Francois.Bedard, jeremy.bennett

* Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> [2016-04-26 13:28:58 +0200]:

> The compact casesi option only make sens for ARCv1 cores. For ARCv2 cores we
> use the regular expansion.
> 
> OK to apply?

Claudiu,

Could you rebase this onto the current head please.  I couldn't get
this to merge cleanly.

Thanks,
Andrew


> Claudiu
> 
> gcc/
> 2016-04-26  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* common/config/arc/arc-common.c (arc_option_optimization_table):
> 	Disable compact casesi as default option.
> 	* config/arc/arc.c (arc_override_options): Enable compact casesi
> 	option for non-ARCv2 cores.
> 	* config/arc/arc.md (movsi_insn): Use @pcl relocation.
> 	(movsi_ne): Update assembly printing pattern.
> 	(casesi_load): Use short ld instruction.
> ---
>  gcc/common/config/arc/arc-common.c |  1 -
>  gcc/config/arc/arc.c               |  7 +++++++
>  gcc/config/arc/arc.md              | 11 +++++++----
>  3 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
> index 64fb053..17cc1bd 100644
> --- a/gcc/common/config/arc/arc-common.c
> +++ b/gcc/common/config/arc/arc-common.c
> @@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
>      { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
> -    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
>      { OPT_LEVELS_NONE, 0, NULL, 0 }
>    };
>  
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 6f2136e..be55c99 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -812,6 +812,13 @@ arc_override_options (void)
>    if (arc_size_opt_level == 3)
>      optimize_size = 1;
>  
> +  /* Compact casesi is not a valid option for ARCv2 family, disable
> +     it.  */
> +  if (TARGET_V2)
> +    TARGET_COMPACT_CASESI = 0;
> +  else if (optimize_size == 1)
> +    TARGET_COMPACT_CASESI = 1;
> +
>    if (flag_pic)
>      target_flags |= MASK_NO_SDATA_SET;
>  
> diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
> index 718443b..aec4b37 100644
> --- a/gcc/config/arc/arc.md
> +++ b/gcc/config/arc/arc.md
> @@ -713,7 +713,7 @@
>     ror %0,((%1*2+1) & 0x3f) ;6
>     mov%? %0,%1		;7
>     add %0,%S1		;8
> -   * return arc_get_unalign () ? \"add %0,pcl,%1-.+2\" : \"add %0,pcl,%1-.\";
> +   add %0,pcl,%1@pcl
>     mov%? %0,%S1%&	;10
>     mov%? %0,%S1		;11
>     ld%?%U1 %0,%1%&	;12
> @@ -3467,8 +3467,8 @@
>    ""
>    "@
>  	* current_insn_predicate = 0; return \"sub%?.ne %0,%0,%0%&\";
> -        mov_s.ne %0,%1
> -        mov_s.ne %0,%1
> +        * current_insn_predicate = 0; return \"mov%?.ne %0,%1\";
> +        * current_insn_predicate = 0; return \"mov%?.ne %0,%1\";
>  	mov.ne %0,%1
>  	mov.ne %0,%S1"
>    [(set_attr "type" "cmove")
> @@ -3777,7 +3777,10 @@
>    switch (GET_MODE (diff_vec))
>      {
>      case SImode:
> -      return \"ld.as %0,[%1,%2]%&\";
> +      if ((which_alternative == 0) && TARGET_CODE_DENSITY)
> +	return \"ld_s.as %0,[%1,%2]%&\";
> +      else
> +	return \"ld.as %0,[%1,%2]%&\";
>      case HImode:
>        if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
>  	return \"ld%_.as %0,[%1,%2]\";
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] [ARC] Fix emitting jump tables for ARCv2
  2016-09-27 14:57 ` Andrew Burgess
@ 2016-09-28  9:28   ` Claudiu Zissulescu
  2016-09-29  9:00   ` [PATCH] Disable compact casesi patterns for arcv2 Claudiu Zissulescu
  1 sibling, 0 replies; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-09-28  9:28 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gcc-patches, gnu, Francois.Bedard, jeremy.bennett

 
> Could you rebase this onto the current head please.  I couldn't get
> this to merge cleanly.
> 
Sure, I will come back to you asap.

//Claudiu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Disable compact casesi patterns for arcv2
  2016-09-27 14:57 ` Andrew Burgess
  2016-09-28  9:28   ` Claudiu Zissulescu
@ 2016-09-29  9:00   ` Claudiu Zissulescu
  2016-09-29 19:45     ` Andrew Burgess
  1 sibling, 1 reply; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-09-29  9:00 UTC (permalink / raw)
  To: gcc-patches, andrew.burgess; +Cc: Claudiu.Zissulescu

Here it is.  The previous version had more mods which should be in a different patch.

Please let me know if you still have issues with it,
Claudiu

gcc/
2016-05-09  Claudiu Zissulescu  <claziss@synopsys.com>

	* common/config/arc/arc-common.c (arc_option_optimization_table):
	Remove compact casesi option.
	* config/arc/arc.c (arc_override_options): Use compact casesi
	option only for pre-ARCv2 cores.
---
 gcc/common/config/arc/arc-common.c | 1 -
 gcc/config/arc/arc.c               | 7 +++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
index f5b9c6d..5b687fb 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
     { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
-    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 2b25b0b..825bccf 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -858,6 +858,13 @@ arc_override_options (void)
   if (arc_size_opt_level == 3)
     optimize_size = 1;
 
+  /* Compact casesi is not a valid option for ARCv2 family, disable
+     it.  */
+  if (TARGET_V2)
+    TARGET_COMPACT_CASESI = 0;
+  else if (optimize_size == 1)
+    TARGET_COMPACT_CASESI = 1;
+
   if (flag_pic)
     target_flags |= MASK_NO_SDATA_SET;
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Disable compact casesi patterns for arcv2
  2016-09-29  9:00   ` [PATCH] Disable compact casesi patterns for arcv2 Claudiu Zissulescu
@ 2016-09-29 19:45     ` Andrew Burgess
  2016-09-30  8:43       ` Claudiu Zissulescu
  2016-09-30 14:36       ` Re:[PATCH] [ARC] " Claudiu Zissulescu
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Burgess @ 2016-09-29 19:45 UTC (permalink / raw)
  To: Claudiu Zissulescu; +Cc: gcc-patches

* Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> [2016-09-29 10:41:02 +0200]:

> Here it is.  The previous version had more mods which should be in a different patch.
> 
> Please let me know if you still have issues with it,
> Claudiu
> 
> gcc/
> 2016-05-09  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* common/config/arc/arc-common.c (arc_option_optimization_table):
> 	Remove compact casesi option.
> 	* config/arc/arc.c (arc_override_options): Use compact casesi
> 	option only for pre-ARCv2 cores.
> ---
>  gcc/common/config/arc/arc-common.c | 1 -
>  gcc/config/arc/arc.c               | 7 +++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
> index f5b9c6d..5b687fb 100644
> --- a/gcc/common/config/arc/arc-common.c
> +++ b/gcc/common/config/arc/arc-common.c
> @@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
>      { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
> -    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
>      { OPT_LEVELS_NONE, 0, NULL, 0 }
>    };
>  
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 2b25b0b..825bccf 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -858,6 +858,13 @@ arc_override_options (void)
>    if (arc_size_opt_level == 3)
>      optimize_size = 1;
>  
> +  /* Compact casesi is not a valid option for ARCv2 family, disable
> +     it.  */
> +  if (TARGET_V2)
> +    TARGET_COMPACT_CASESI = 0;
> +  else if (optimize_size == 1)
> +    TARGET_COMPACT_CASESI = 1;
> +
>    if (flag_pic)
>      target_flags |= MASK_NO_SDATA_SET;

I wonder if we should warn for the TARGET_V2 case?  Currently if the
option is supplied on an ARCv2 (-mcompact-casesi) then the option is
silently ignored.  This might confuse some users.

In the non TARGET_V2 case I notice that the option is _always_
enabled, with no option of disabling the option.  If we add a check of
global_options_set then we can make this smarter, default on, but can
still be tuned off if a user ever wants to.  The alternative would be
to entirely remove the TARGET_COMPACT_CASESI flag altogether?

While I was thinking about this I wrote the code below, it probably
needs polishing, but gives an idea of what I have in mind.  What do
you think?

Thanks,
Andrew

---

diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
index f5b9c6d..5b687fb 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
     { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
-    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 2b25b0b..65a5c10 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -858,6 +858,18 @@ arc_override_options (void)
   if (arc_size_opt_level == 3)
     optimize_size = 1;
 
+  /* Compact casesi is not a valid option for ARCv2 family.  */
+  if (TARGET_V2
+      && global_options_set.x_TARGET_COMPACT_CASESI
+      && global_options.x_TARGET_COMPACT_CASESI)
+    {
+      warning (0, "compact-casesi is not applicable to arc-v2");
+      TARGET_COMPACT_CASESI = 0;
+    }
+  else if (optimize_size == 1
+	   && !global_options_set.x_TARGET_COMPACT_CASESI)
+    TARGET_COMPACT_CASESI = 1;
+
   if (flag_pic)
     target_flags |= MASK_NO_SDATA_SET;
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] Disable compact casesi patterns for arcv2
  2016-09-29 19:45     ` Andrew Burgess
@ 2016-09-30  8:43       ` Claudiu Zissulescu
  2016-09-30 14:36       ` Re:[PATCH] [ARC] " Claudiu Zissulescu
  1 sibling, 0 replies; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-09-30  8:43 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gcc-patches

 
> I wonder if we should warn for the TARGET_V2 case?  Currently if the
> option is supplied on an ARCv2 (-mcompact-casesi) then the option is
> silently ignored.  This might confuse some users.

Good idea, I will update the docs accordingly.

> 
> In the non TARGET_V2 case I notice that the option is _always_
> enabled, with no option of disabling the option.  If we add a check of
> global_options_set then we can make this smarter, default on, but can
> still be tuned off if a user ever wants to.  The alternative would be
> to entirely remove the TARGET_COMPACT_CASESI flag altogether?

I would prefer to remove compact_casesi feature entirely as it is a trouble maker rather than a helper. 

> 
> While I was thinking about this I wrote the code below, it probably
> needs polishing, but gives an idea of what I have in mind.  What do
> you think?

It looks good, I will add the docs update. Coming back to u asap.
Claudiu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:[PATCH] [ARC] Disable compact casesi patterns for arcv2
  2016-09-29 19:45     ` Andrew Burgess
  2016-09-30  8:43       ` Claudiu Zissulescu
@ 2016-09-30 14:36       ` Claudiu Zissulescu
  2016-10-06 23:08         ` [PATCH] " Andrew Burgess
  1 sibling, 1 reply; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-09-30 14:36 UTC (permalink / raw)
  To: gcc-patches, andrew.burgess; +Cc: Claudiu.Zissulescu

Please find the updated patch,
Claudiu

gcc/
2016-05-09  Claudiu Zissulescu  <claziss@synopsys.com>

	* common/config/arc/arc-common.c (arc_option_optimization_table):
	Remove compact casesi option.
	* config/arc/arc.c (arc_override_options): Use compact casesi
	option only for pre-ARCv2 cores.
	* doc/invoke.texi (mcompact-casesi): Update text.
---
 gcc/common/config/arc/arc-common.c |  1 -
 gcc/config/arc/arc.c               | 11 +++++++++++
 gcc/doc/invoke.texi                |  4 ++--
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
index f5b9c6d..5b687fb 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
     { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
     { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
-    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 2b25b0b..5e8d6b4 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -858,6 +858,17 @@ arc_override_options (void)
   if (arc_size_opt_level == 3)
     optimize_size = 1;
 
+  /* Compact casesi is not a valid option for ARCv2 family.  */
+  if (TARGET_V2
+      && TARGET_COMPACT_CASESI)
+    {
+      warning (0, "compact-casesi is not applicable to ARCv2");
+      TARGET_COMPACT_CASESI = 0;
+    }
+  else if (optimize_size == 1
+	   && !global_options_set.x_TARGET_COMPACT_CASESI)
+    TARGET_COMPACT_CASESI = 1;
+
   if (flag_pic)
     target_flags |= MASK_NO_SDATA_SET;
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6767462..05f565d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14255,8 +14255,8 @@ This is the default for @option{-Os}.
 
 @item -mcompact-casesi
 @opindex mcompact-casesi
-Enable compact casesi pattern.
-This is the default for @option{-Os}.
+Enable compact casesi pattern.  This is the default for @option{-Os},
+and only available for ARCv1 cores.
 
 @item -mno-cond-exec
 @opindex mno-cond-exec
-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [ARC] Disable compact casesi patterns for arcv2
  2016-09-30 14:36       ` Re:[PATCH] [ARC] " Claudiu Zissulescu
@ 2016-10-06 23:08         ` Andrew Burgess
  2016-10-10 11:42           ` Claudiu Zissulescu
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Burgess @ 2016-10-06 23:08 UTC (permalink / raw)
  To: Claudiu Zissulescu; +Cc: gcc-patches

* Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> [2016-09-30 15:52:03 +0200]:

> Please find the updated patch,
> Claudiu
> 
> gcc/
> 2016-05-09  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* common/config/arc/arc-common.c (arc_option_optimization_table):
> 	Remove compact casesi option.
> 	* config/arc/arc.c (arc_override_options): Use compact casesi
> 	option only for pre-ARCv2 cores.
> 	* doc/invoke.texi (mcompact-casesi): Update text.

Looks good to me.

Thanks,
Andrew



> ---
>  gcc/common/config/arc/arc-common.c |  1 -
>  gcc/config/arc/arc.c               | 11 +++++++++++
>  gcc/doc/invoke.texi                |  4 ++--
>  3 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
> index f5b9c6d..5b687fb 100644
> --- a/gcc/common/config/arc/arc-common.c
> +++ b/gcc/common/config/arc/arc-common.c
> @@ -56,7 +56,6 @@ static const struct default_options arc_option_optimization_table[] =
>      { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
>      { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
> -    { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
>      { OPT_LEVELS_NONE, 0, NULL, 0 }
>    };
>  
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 2b25b0b..5e8d6b4 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -858,6 +858,17 @@ arc_override_options (void)
>    if (arc_size_opt_level == 3)
>      optimize_size = 1;
>  
> +  /* Compact casesi is not a valid option for ARCv2 family.  */
> +  if (TARGET_V2
> +      && TARGET_COMPACT_CASESI)
> +    {
> +      warning (0, "compact-casesi is not applicable to ARCv2");
> +      TARGET_COMPACT_CASESI = 0;
> +    }
> +  else if (optimize_size == 1
> +	   && !global_options_set.x_TARGET_COMPACT_CASESI)
> +    TARGET_COMPACT_CASESI = 1;
> +
>    if (flag_pic)
>      target_flags |= MASK_NO_SDATA_SET;
>  
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 6767462..05f565d 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -14255,8 +14255,8 @@ This is the default for @option{-Os}.
>  
>  @item -mcompact-casesi
>  @opindex mcompact-casesi
> -Enable compact casesi pattern.
> -This is the default for @option{-Os}.
> +Enable compact casesi pattern.  This is the default for @option{-Os},
> +and only available for ARCv1 cores.
>  
>  @item -mno-cond-exec
>  @opindex mno-cond-exec
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] [ARC] Disable compact casesi patterns for arcv2
  2016-10-06 23:08         ` [PATCH] " Andrew Burgess
@ 2016-10-10 11:42           ` Claudiu Zissulescu
  0 siblings, 0 replies; 10+ messages in thread
From: Claudiu Zissulescu @ 2016-10-10 11:42 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gcc-patches, Francois Bedard


> > gcc/
> > 2016-05-09  Claudiu Zissulescu  <claziss@synopsys.com>
> >
> > 	* common/config/arc/arc-common.c
> (arc_option_optimization_table):
> > 	Remove compact casesi option.
> > 	* config/arc/arc.c (arc_override_options): Use compact casesi
> > 	option only for pre-ARCv2 cores.
> > 	* doc/invoke.texi (mcompact-casesi): Update text.
> 
> Looks good to me.
> 

Committed r240916.

Thank you for your review,
Claudiu

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-10-10 11:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-26 11:30 [PATCH] [ARC] Fix emitting jump tables for ARCv2 Claudiu Zissulescu
2016-06-15  7:07 ` Claudiu Zissulescu
2016-09-27 14:57 ` Andrew Burgess
2016-09-28  9:28   ` Claudiu Zissulescu
2016-09-29  9:00   ` [PATCH] Disable compact casesi patterns for arcv2 Claudiu Zissulescu
2016-09-29 19:45     ` Andrew Burgess
2016-09-30  8:43       ` Claudiu Zissulescu
2016-09-30 14:36       ` Re:[PATCH] [ARC] " Claudiu Zissulescu
2016-10-06 23:08         ` [PATCH] " Andrew Burgess
2016-10-10 11:42           ` Claudiu Zissulescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).