Patchwork [RFC,ARM] later split of symbol_refs

login
register
mail settings
Submitter Dmitry Melnik
Date June 29, 2012, 1:48 p.m.
Message ID <4FEDB23E.8070705@ispras.ru>
Download mbox | patch
Permalink /patch/168107/
State New
Headers show

Comments

Dmitry Melnik - June 29, 2012, 1:48 p.m.
On 06/27/2012 07:53 PM, Richard Earnshaw wrote:
> Please update the ChangeLog entry (it's not appropriate to mention
> Sourcery G++) and add a comment as Steven has suggested.
>
> Otherwise OK.
>
>

Updated.
Ok to commit now?


--
Best regards,
   Dmitry
Ramana Radhakrishnan - June 29, 2012, 2:31 p.m.
> +;; Split symbol_refs at the later stage (after cprop), instead of generating
> +;; movt/movw pair directly at expand.  Otherwise corresponding high_sum
> +;; and lo_sum would be merged back into memory load at cprop.  However,

I would rewrite part of your comment as

> +;; movt/movw is preferable, because it usually executes faster than a load

"However if the default is to prefer to use movw/movt rather than the
constant pool use that. instead of a load from the constant pool."



regards,
Ramana


>
>
> --
> Best regards,
>  Dmitry
>
Georg-Johann Lay - June 30, 2012, 9:09 a.m.
Dmitry Melnik schrieb:
> On 06/27/2012 07:53 PM, Richard Earnshaw wrote:
>> Please update the ChangeLog entry (it's not appropriate to mention
>> Sourcery G++) and add a comment as Steven has suggested.
>>
>> Otherwise OK.
>>
> 
> Updated.
> Ok to commit now?
> 
> -- 
> Best regards,
>   Dmitry
> 
> 2009-05-29  Julian Brown  <julian@codesourcery.com>
> 
> gcc/
> 	* config/arm/arm.md (movsi): Don't split symbol refs here.
> 	(define_split): New.
> 
> diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
> index 0654564..98ff382 100644
> --- a/gcc/config/arm/arm.md
> +++ b/gcc/config/arm/arm.md
> @@ -5472,14 +5472,6 @@
>  			       optimize && can_create_pseudo_p ());
>            DONE;
>          }
> -
> -      if (TARGET_USE_MOVT && !target_word_relocations
> -	  && GET_CODE (operands[1]) == SYMBOL_REF
> -	  && !flag_pic && !arm_tls_referenced_p (operands[1]))
> -	{
> -	  arm_emit_movpair (operands[0], operands[1]);
> -	  DONE;
> -	}
>      }
>    else /* TARGET_THUMB1...  */
>      {
> @@ -5588,6 +5580,23 @@
>    "
>  )
>  
> +;; Split symbol_refs at the later stage (after cprop), instead of generating
> +;; movt/movw pair directly at expand.  Otherwise corresponding high_sum
> +;; and lo_sum would be merged back into memory load at cprop.  However,
> +;; movt/movw is preferable, because it usually executes faster than a load.
> +(define_split
> +  [(set (match_operand:SI 0 "arm_general_register_operand" "")
> +       (match_operand:SI 1 "general_operand" ""))]
> +  "TARGET_32BIT
> +   && TARGET_USE_MOVT && GET_CODE (operands[1]) == SYMBOL_REF

Is there a special reason to restrict it to SYMBOL_REF?
Doesn't the same issue occur with, e.g.
(const (plus (symbol_ref const_int))) or label_ref?

Johann

> +   && !flag_pic && !target_word_relocations
> +   && !arm_tls_referenced_p (operands[1])"
> +  [(clobber (const_int 0))]
> +{
> +  arm_emit_movpair (operands[0], operands[1]);
> +  DONE;
> +})
> +
>  (define_insn "*thumb1_movsi_insn"
>    [(set (match_operand:SI 0 "nonimmediate_operand" "=l,l,l,l,l,>,l, m,*l*h*k")
>  	(match_operand:SI 1 "general_operand"      "l, I,J,K,>,l,mi,l,*l*h*k"))]
Dmitry Plotnikov - July 13, 2012, 12:29 p.m.
2012/6/30 Georg-Johann Lay <gjl@gcc.gnu.org>:
> Is there a special reason to restrict it to SYMBOL_REF?
> Doesn't the same issue occur with, e.g.
> (const (plus (symbol_ref const_int))) or label_ref?

Hi!
We have added splits for symbol_ref plus const and label_ref.  With
this patch, assembly code and oprofile data look better,
but on SPEC2K INT it's about 3% slower than with split for only symbol_refs.
We will try to find later why this happens.
For now, we commited the original patch.

Patch

2009-05-29  Julian Brown  <julian@codesourcery.com>

gcc/
	* config/arm/arm.md (movsi): Don't split symbol refs here.
	(define_split): New.

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 0654564..98ff382 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -5472,14 +5472,6 @@ 
 			       optimize && can_create_pseudo_p ());
           DONE;
         }
-
-      if (TARGET_USE_MOVT && !target_word_relocations
-	  && GET_CODE (operands[1]) == SYMBOL_REF
-	  && !flag_pic && !arm_tls_referenced_p (operands[1]))
-	{
-	  arm_emit_movpair (operands[0], operands[1]);
-	  DONE;
-	}
     }
   else /* TARGET_THUMB1...  */
     {
@@ -5588,6 +5580,23 @@ 
   "
 )
 
+;; Split symbol_refs at the later stage (after cprop), instead of generating
+;; movt/movw pair directly at expand.  Otherwise corresponding high_sum
+;; and lo_sum would be merged back into memory load at cprop.  However,
+;; movt/movw is preferable, because it usually executes faster than a load.
+(define_split
+  [(set (match_operand:SI 0 "arm_general_register_operand" "")
+       (match_operand:SI 1 "general_operand" ""))]
+  "TARGET_32BIT
+   && TARGET_USE_MOVT && GET_CODE (operands[1]) == SYMBOL_REF
+   && !flag_pic && !target_word_relocations
+   && !arm_tls_referenced_p (operands[1])"
+  [(clobber (const_int 0))]
+{
+  arm_emit_movpair (operands[0], operands[1]);
+  DONE;
+})
+
 (define_insn "*thumb1_movsi_insn"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=l,l,l,l,l,>,l, m,*l*h*k")
 	(match_operand:SI 1 "general_operand"      "l, I,J,K,>,l,mi,l,*l*h*k"))]