Patchwork [ARM] Validate that target really supports LDRD/STRD before use

login
register
mail settings
Submitter Richard Earnshaw
Date Sept. 18, 2013, 2:02 p.m.
Message ID <5239B25F.9050608@arm.com>
Download mbox | patch
Permalink /patch/275741/
State New
Headers show

Comments

Richard Earnshaw - Sept. 18, 2013, 2:02 p.m.
On 18/09/13 15:00, Richard Earnshaw wrote:
> On ARM targets that normally support LDRD/STRD there are tuning
> parameters that express the preference for using these instructions over
> LDM/STM.  However, that's only a preference and when the architecture
> and tuning options differ (for example, tuning for Cortex-A15 but using
> the ARMv5 ISA) then it is essential to ensure that the architecture also
> has the instructions.
> 
> R.
> 
> 2013-09-18  Richard Earnshaw  <rearnsha@arm.com>
> 
> 	* arm.c (arm_get_frame_offsets): Validate architecture supports
> 	LDRD/STRD before accepting the tuning preference.
> 	(arm_expand_prologue): Likewise.
> 	(arm_expand_epilogue): Likewise.
> 
> Committed to trunk.  A 4.8 back-port will follow.
> 
> R.
> 
> 

And this time with the patch...

R.

Patch

--- arm.c	(revision 202671)
+++ arm.c	(local)
@@ -17955,7 +17956,8 @@  arm_get_frame_offsets (void)
           if (! any_sibcall_could_use_r3 ()
 	      && arm_size_return_regs () <= 12
 	      && (offsets->saved_regs_mask & (1 << 3)) == 0
-              && (TARGET_THUMB2 || !current_tune->prefer_ldrd_strd))
+              && (TARGET_THUMB2
+		  || !(TARGET_LDRD && current_tune->prefer_ldrd_strd)))
 	    {
 	      reg = 3;
 	    }
@@ -18380,7 +18382,8 @@  arm_expand_prologue (void)
 	    }
 	}
 
-      if (current_tune->prefer_ldrd_strd
+      if (TARGET_LDRD
+	  && current_tune->prefer_ldrd_strd
           && !optimize_function_for_size_p (cfun))
         {
           if (TARGET_THUMB2)
@@ -24649,7 +24652,8 @@  arm_expand_epilogue (bool really_return)
         }
       else
         {
-          if (current_tune->prefer_ldrd_strd
+          if (TARGET_LDRD
+	      && current_tune->prefer_ldrd_strd
               && !optimize_function_for_size_p (cfun))
             {
               if (TARGET_THUMB2)