public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT
@ 2010-06-30  8:51 Jie Zhang
  2010-06-30 17:01 ` Richard Earnshaw
       [not found] ` <1277915471.3358.65.camel@e102346-lin.cambridge.arm.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Jie Zhang @ 2010-06-30  8:51 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

I just found that the length attribute of neon_mov<mode> pattern for 
VSTRUCT is not calculated correctly. This patch should fix it. Testing 
on arm-none-eabi for NEON has no regressions. Is it OK to commit?


Regards,
--
Jie
CodeSourcery

[-- Attachment #2: gcc-arm-neon-mov-vstruct-fix-length-attr.diff --]
[-- Type: text/x-patch, Size: 3261 bytes --]


	* config/arm/arm.c (arm_attr_length_move_neon): New.
	* config/arm/arm-protos.h (arm_attr_length_move_neon): Declare.
	* config/arm/neon.md (define_mode_attr V_slen): Remove.
	(neon_mov<mode> for VSTRUCT): Use arm_attr_length_move_neon
	to compute length attribute.

Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 161525)
+++ config/arm/arm.c	(working copy)
@@ -12698,6 +12698,57 @@ output_move_neon (rtx *operands)
   return "";
 }
 
+/* Compute and return the length of neon_mov<mode>, where <mode> is
+   one of VSTRUCT modes: EI, OI, CI or XI.  */
+int
+arm_attr_length_move_neon (rtx insn)
+{
+  rtx reg, mem, addr;
+  int regno, load;
+  enum machine_mode mode;
+
+  extract_insn_cached (insn);
+
+  if (REG_P (recog_data.operand[0]) && REG_P (recog_data.operand[1]))
+    {
+      mode = GET_MODE (recog_data.operand[0]);
+      switch (mode)
+	{
+	case EImode:
+	case OImode:
+	  return 8;
+	case CImode:
+	  return 12;
+	case XImode:
+	  return 16;
+	default:
+	  gcc_unreachable ();
+	}
+    }
+
+  load = REG_P (recog_data.operand[0]);
+  reg = recog_data.operand[!load];
+  mem = recog_data.operand[load];
+
+  gcc_assert (MEM_P (mem));
+
+  mode = GET_MODE (reg);
+  regno = REGNO (reg);
+  addr = XEXP (mem, 0);
+
+  /* Strip off const from addresses like (const (plus (...))).  */
+  if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS)
+    addr = XEXP (addr, 0);
+
+  if (GET_CODE (addr) == LABEL_REF || GET_CODE (addr) == PLUS)
+    {
+      int insns = HARD_REGNO_NREGS (REGNO (reg), mode) / 2;
+      return insns * 4;
+    }
+  else
+    return 4;
+}
+
 /* Output an ADD r, s, #n where n may be too big for one instruction.
    If adding zero to one register, output nothing.  */
 const char *
Index: config/arm/arm-protos.h
===================================================================
--- config/arm/arm-protos.h	(revision 161525)
+++ config/arm/arm-protos.h	(working copy)
@@ -131,6 +131,7 @@ extern const char *output_move_double (r
 extern const char *output_move_quad (rtx *);
 extern const char *output_move_vfp (rtx *operands);
 extern const char *output_move_neon (rtx *operands);
+extern int arm_attr_length_move_neon (rtx);
 extern const char *output_add_immediate (rtx *);
 extern const char *arithmetic_instr (rtx, int);
 extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
Index: config/arm/neon.md
===================================================================
--- config/arm/neon.md	(revision 161525)
+++ config/arm/neon.md	(working copy)
@@ -185,9 +185,6 @@
 ;; Opaque structure types wider than TImode.
 (define_mode_iterator VSTRUCT [EI OI CI XI])
 
-;; Number of instructions needed to load/store struct elements. FIXME!
-(define_mode_attr V_slen [(EI "2") (OI "2") (CI "3") (XI "4")])
-
 ;; Opaque structure types used in table lookups (except vtbl1/vtbx1).
 (define_mode_iterator VTAB [TI EI OI])
 
@@ -587,7 +584,7 @@
     }
 }
   [(set_attr "neon_type" "neon_int_1,neon_stm_2,neon_ldm_2")
-   (set_attr "length" "<V_slen>,<V_slen>,<V_slen>")])
+   (set (attr "length") (symbol_ref "arm_attr_length_move_neon (insn)"))])
 
 (define_split
   [(set (match_operand:EI 0 "s_register_operand" "")


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

* Re: [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT
  2010-06-30  8:51 [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT Jie Zhang
@ 2010-06-30 17:01 ` Richard Earnshaw
       [not found] ` <1277915471.3358.65.camel@e102346-lin.cambridge.arm.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Earnshaw @ 2010-06-30 17:01 UTC (permalink / raw)
  To: Jie Zhang; +Cc: gcc-patches

On Wed, 2010-06-30 at 13:05 +0800, Jie Zhang wrote:
> I just found that the length attribute of neon_mov<mode> pattern for 
> VSTRUCT is not calculated correctly. This patch should fix it. Testing 
> on arm-none-eabi for NEON has no regressions. Is it OK to commit?
> 

I *think* this is OK (my one area of concern is whether or not we can
still have subreg(mem) at the time that arm_attr_length_move_neon is
called).

Please wait 24 hours; if nobody says, "yes, you can have such beasts" in
that time, then you can check this in.

R.


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

* Re: [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT
       [not found] ` <1277915471.3358.65.camel@e102346-lin.cambridge.arm.com>
@ 2010-07-03 16:51   ` Jie Zhang
  2010-07-05  8:52     ` Richard Earnshaw
  0 siblings, 1 reply; 5+ messages in thread
From: Jie Zhang @ 2010-07-03 16:51 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: gcc-patches

On 07/01/2010 12:31 AM, Richard Earnshaw wrote:
>
> On Wed, 2010-06-30 at 13:05 +0800, Jie Zhang wrote:
>> I just found that the length attribute of neon_mov<mode>  pattern for
>> VSTRUCT is not calculated correctly. This patch should fix it. Testing
>> on arm-none-eabi for NEON has no regressions. Is it OK to commit?
>>
>
> I *think* this is OK (my one area of concern is whether or not we can
> still have subreg(mem) at the time that arm_attr_length_move_neon is
> called).
>
> Please wait 24 hours; if nobody says, "yes, you can have such beasts" in
> that time, then you can check this in.
>
Thanks. Now I have committed it on trunk. OK for 4.5 branch, too?

-- 
Jie Zhang
CodeSourcery

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

* Re: [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT
  2010-07-03 16:51   ` Jie Zhang
@ 2010-07-05  8:52     ` Richard Earnshaw
  2010-07-05 12:48       ` Jie Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2010-07-05  8:52 UTC (permalink / raw)
  To: Jie Zhang; +Cc: gcc-patches


On Sun, 2010-07-04 at 00:50 +0800, Jie Zhang wrote:
> On 07/01/2010 12:31 AM, Richard Earnshaw wrote:
> >
> > On Wed, 2010-06-30 at 13:05 +0800, Jie Zhang wrote:
> >> I just found that the length attribute of neon_mov<mode>  pattern for
> >> VSTRUCT is not calculated correctly. This patch should fix it. Testing
> >> on arm-none-eabi for NEON has no regressions. Is it OK to commit?
> >>
> >
> > I *think* this is OK (my one area of concern is whether or not we can
> > still have subreg(mem) at the time that arm_attr_length_move_neon is
> > called).
> >
> > Please wait 24 hours; if nobody says, "yes, you can have such beasts" in
> > that time, then you can check this in.
> >
> Thanks. Now I have committed it on trunk. OK for 4.5 branch, too?

Yes.
R.

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

* Re: [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT
  2010-07-05  8:52     ` Richard Earnshaw
@ 2010-07-05 12:48       ` Jie Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Jie Zhang @ 2010-07-05 12:48 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: gcc-patches

On 07/05/2010 04:52 PM, Richard Earnshaw wrote:
>
> On Sun, 2010-07-04 at 00:50 +0800, Jie Zhang wrote:
>> On 07/01/2010 12:31 AM, Richard Earnshaw wrote:
>>>
>>> On Wed, 2010-06-30 at 13:05 +0800, Jie Zhang wrote:
>>>> I just found that the length attribute of neon_mov<mode>   pattern for
>>>> VSTRUCT is not calculated correctly. This patch should fix it. Testing
>>>> on arm-none-eabi for NEON has no regressions. Is it OK to commit?
>>>>
>>>
>>> I *think* this is OK (my one area of concern is whether or not we can
>>> still have subreg(mem) at the time that arm_attr_length_move_neon is
>>> called).
>>>
>>> Please wait 24 hours; if nobody says, "yes, you can have such beasts" in
>>> that time, then you can check this in.
>>>
>> Thanks. Now I have committed it on trunk. OK for 4.5 branch, too?
>
> Yes.

Thanks. Committed on 4.5 branch with Mikael's fix.

-- 
Jie Zhang
CodeSourcery

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

end of thread, other threads:[~2010-07-05 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30  8:51 [ARM] Fix length attribute for neon_mov<mode> of VSTRUCT Jie Zhang
2010-06-30 17:01 ` Richard Earnshaw
     [not found] ` <1277915471.3358.65.camel@e102346-lin.cambridge.arm.com>
2010-07-03 16:51   ` Jie Zhang
2010-07-05  8:52     ` Richard Earnshaw
2010-07-05 12:48       ` Jie Zhang

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).