Patchwork ARM: Emit conditions in push_multi

login
register
mail settings
Submitter Bernd Schmidt
Date Sept. 7, 2011, 7:23 p.m.
Message ID <4E67C4B8.7070703@codesourcery.com>
Download mbox | patch
Permalink /patch/113815/
State New
Headers show

Comments

Bernd Schmidt - Sept. 7, 2011, 7:23 p.m.
On 09/07/11 10:28, Ramana Radhakrishnan wrote:
> On 2 September 2011 12:42, Bernd Schmidt <bernds@codesourcery.com> wrote:
>> On 09/02/11 12:35, Ramana Radhakrishnan wrote:
>>> On 1 September 2011 12:50, Bernd Schmidt <bernds@codesourcery.com> wrote:
>>>> Shrink-wrapping tests on ARM had one additional failure, which I could
>>>> track down to a stmfd instruction being emitted where an stmhifd was
>>>> intended. The following patch fixes the testcase; full tests running
>>>> now. Ok?
>>>
>>> IIUC this should have been a result of conditionalizing the prologue
>>> saves by the CCFSM state machine in ARM state
>>
>> Correct.
>>
>>> given that the push
>>> instruction below doesn't have the conditional markers.
>>
>> Although I'm not sure how you arrived at this? Thumb insns can't be
>> conditional anyway?
> 
> IT blocks in Thumb2 and the predicable attribute means we can generate
> some amount of conditional instruction in T2 state.

Oh, and the insns are output as conditional in addition to the it
instruction - half a year of hardly doing anything with ARM and I'd
forgotten about this :(

New patch below. Tested on arm-eabi sim with a few multilibs.


Bernd
* config/arm/arm.md (push_multi): Emit predicates.
	(push_fp_multi): Likewise.
	* config/arm/arm.c (vfp_output_fstmd): Likewise.
Ramana Radhakrishnan - Sept. 8, 2011, 7:47 a.m.
> New patch below. Tested on arm-eabi sim with a few multilibs.

OK.

Ramana

Patch

Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 178596)
+++ gcc/config/arm/arm.c	(working copy)
@@ -13084,7 +13084,7 @@  vfp_output_fstmd (rtx * operands)
   int base;
   int i;
 
-  strcpy (pattern, "fstmfdd\t%m0!, {%P1");
+  strcpy (pattern, "fstmfdd%?\t%m0!, {%P1");
   p = strlen (pattern);
 
   gcc_assert (GET_CODE (operands[1]) == REG);
Index: gcc/config/arm/arm.md
===================================================================
--- gcc/config/arm/arm.md	(revision 178596)
+++ gcc/config/arm/arm.md	(working copy)
@@ -10581,14 +10581,16 @@  (define_insn "*push_multi"
        In Thumb mode always use push, and the assembler will pick
        something appropriate.  */
     if (num_saves == 1 && TARGET_ARM)
-      output_asm_insn (\"str\\t%1, [%m0, #-4]!\", operands);
+      output_asm_insn (\"str%?\\t%1, [%m0, #-4]!\", operands);
     else
       {
 	int i;
 	char pattern[100];
 
 	if (TARGET_ARM)
-	    strcpy (pattern, \"stmfd\\t%m0!, {%1\");
+	    strcpy (pattern, \"stm%(fd%)\\t%m0!, {%1\");
+	else if (TARGET_THUMB2)
+	    strcpy (pattern, \"push%?\\t{%1\");
 	else
 	    strcpy (pattern, \"push\\t{%1\");
 
@@ -10631,7 +10633,7 @@  (define_insn "*push_fp_multi"
   {
     char pattern[100];
 
-    sprintf (pattern, \"sfmfd\\t%%1, %d, [%%m0]!\", XVECLEN (operands[2], 0));
+    sprintf (pattern, \"sfm%(fd%)\\t%%1, %d, [%%m0]!\", XVECLEN (operands[2], 0));
     output_asm_insn (pattern, operands);
     return \"\";
   }"