Patchwork [RFC,ARM] later split of symbol_refs

login
register
mail settings
Submitter Dmitry Melnik
Date July 4, 2012, 2:47 p.m.
Message ID <4FF45778.3030000@ispras.ru>
Download mbox | patch
Permalink /patch/168993/
State New
Headers show

Comments

Dmitry Melnik - July 4, 2012, 2:47 p.m.
On 06/29/2012 06:31 PM, Ramana Radhakrishnan wrote:

Ok with this comment?

+;; 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,
+;; if the default is to prefer movt/movw rather than a load from the 
constant
+;; pool, the performance is usually better.


>> +;; 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."

--
Best regards,
    Dmitry

Patch

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

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

--- 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,24 @@ 
   "
 )
 
+;; 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,
+;; if the default is to prefer movt/movw rather than a load from the constant
+;; pool, the performance is usually better.
+(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"))]