public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
@ 2015-09-01 12:45 David Sherwood
  0 siblings, 0 replies; 10+ messages in thread
From: David Sherwood @ 2015-09-01 12:45 UTC (permalink / raw)
  To: 'Jeff Law', Oleg Endo; +Cc: GCC Patches

Hi,

Fix/patch committed.

Tested:

x86_64-linux: bootstrap built fine, no regressions
aarch64-none-elf: no regressions
sh-elf crossbuild: builds fine

ChangeLog:

2015-09-01  David Sherwood  <david.sherwood@arm.com>

    gcc/
        * genmodes.c: Add CONST_MODE_UNIT_SIZE modifier.

Thanks,
David.

> -----Original Message-----
> From: Jeff Law [mailto:law@redhat.com]
> Sent: 01 September 2015 07:02
> To: Oleg Endo
> Cc: David Sherwood; GCC Patches
> Subject: Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and
> GET_MODE_UNIT_PRECISION
> 
> On 08/26/2015 08:53 AM, Oleg Endo wrote:
> >
> > On 26 Aug 2015, at 23:27, Oleg Endo <oleg.endo@t-online.de> wrote:
> >
> >>
> >> On 19 Aug 2015, at 22:35, Jeff Law <law@redhat.com> wrote:
> >>
> >>> On 08/19/2015 06:29 AM, David Sherwood wrote:
> >>>>> I asked Richard S. to give this a once-over which he did.  However, he
> >>>>> technically can't approve due to the way his maintainership position was
> >>>>> worded.
> >>>>>
> >>>>> The one request would be a function comment for emit_mode_unit_size and
> >>>>> emit_mode_unit_precision.  OK with that change.
> >>>> Thanks. Here's a new patch with the comments added.
> >>>>
> >>>> Good to go?
> >>>> David.
> >>>>
> >>>> ChangeLog:
> >>>>
> >>>> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
> >>>>
> >>>> 	gcc/
> >>>> 	* genmodes.c (emit_mode_unit_size_inline): New function.
> >>>> 	(emit_mode_unit_precision_inline): New function.
> >>>> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
> >>>> 	(emit_mode_unit_size): New function.
> >>>> 	(emit_mode_unit_precision): New function.
> >>>> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
> >>>> 	(emit_insn_modes_c): Emit new arrays.
> >>>> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
> >>>> 	use new inline methods.
> >>>
> >>> Thanks, this is OK for the trunk.
> >>
> >> It seems this broke sh-elf, at least when compiling on OSX with its native clang.
> >>
> >> ../../gcc-trunk/gcc/machmode.h:228:43: error: redefinition of 'mode_unit_size' with a different
type:
> >>       'const unsigned char [56]' vs 'unsigned char [56]'
> >> extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
> >>                                           ^
> >> ./insn-modes.h:417:24: note: previous definition is here
> >>   extern unsigned char mode_unit_size[NUM_MACHINE_MODES];
> >>                        ^
> >
> > This following fixes the problem for me:
> >
> > Index: gcc/genmodes.c
> > ===================================================================
> > --- gcc/genmodes.c	(revision 227221)
> > +++ gcc/genmodes.c	(working copy)
> > @@ -1063,7 +1063,7 @@
> >   unsigned char\n\
> >   mode_unit_size_inline (machine_mode mode)\n\
> >   {\n\
> > -  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
> > +  extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
> >     switch (mode)\n\
> >       {");
> OK with the usual testing.
> 
> jeff



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

* Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-26 14:54         ` Oleg Endo
  2015-08-27  7:59           ` David Sherwood
@ 2015-09-01  6:01           ` Jeff Law
  1 sibling, 0 replies; 10+ messages in thread
From: Jeff Law @ 2015-09-01  6:01 UTC (permalink / raw)
  To: Oleg Endo; +Cc: David Sherwood, GCC Patches

On 08/26/2015 08:53 AM, Oleg Endo wrote:
>
> On 26 Aug 2015, at 23:27, Oleg Endo <oleg.endo@t-online.de> wrote:
>
>>
>> On 19 Aug 2015, at 22:35, Jeff Law <law@redhat.com> wrote:
>>
>>> On 08/19/2015 06:29 AM, David Sherwood wrote:
>>>>> I asked Richard S. to give this a once-over which he did.  However, he
>>>>> technically can't approve due to the way his maintainership position was
>>>>> worded.
>>>>>
>>>>> The one request would be a function comment for emit_mode_unit_size and
>>>>> emit_mode_unit_precision.  OK with that change.
>>>> Thanks. Here's a new patch with the comments added.
>>>>
>>>> Good to go?
>>>> David.
>>>>
>>>> ChangeLog:
>>>>
>>>> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
>>>>
>>>> 	gcc/
>>>> 	* genmodes.c (emit_mode_unit_size_inline): New function.
>>>> 	(emit_mode_unit_precision_inline): New function.
>>>> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
>>>> 	(emit_mode_unit_size): New function.
>>>> 	(emit_mode_unit_precision): New function.
>>>> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
>>>> 	(emit_insn_modes_c): Emit new arrays.
>>>> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
>>>> 	use new inline methods.
>>>
>>> Thanks, this is OK for the trunk.
>>
>> It seems this broke sh-elf, at least when compiling on OSX with its native clang.
>>
>> ../../gcc-trunk/gcc/machmode.h:228:43: error: redefinition of 'mode_unit_size' with a different type:
>>       'const unsigned char [56]' vs 'unsigned char [56]'
>> extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
>>                                           ^
>> ./insn-modes.h:417:24: note: previous definition is here
>>   extern unsigned char mode_unit_size[NUM_MACHINE_MODES];
>>                        ^
>
> This following fixes the problem for me:
>
> Index: gcc/genmodes.c
> ===================================================================
> --- gcc/genmodes.c	(revision 227221)
> +++ gcc/genmodes.c	(working copy)
> @@ -1063,7 +1063,7 @@
>   unsigned char\n\
>   mode_unit_size_inline (machine_mode mode)\n\
>   {\n\
> -  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
> +  extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
>     switch (mode)\n\
>       {");
OK with the usual testing.

jeff

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

* Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-27  7:59           ` David Sherwood
@ 2015-08-27 12:26             ` Oleg Endo
  0 siblings, 0 replies; 10+ messages in thread
From: Oleg Endo @ 2015-08-27 12:26 UTC (permalink / raw)
  To: David Sherwood; +Cc: Jeff Law, GCC Patches, Richard Sandiford

Hi,

On 27 Aug 2015, at 16:58, David Sherwood <david.sherwood@arm.com> wrote:

> Hi Oleg,
> 
> Oh I'm so sorry I broke the build - I should have spotted that. Have you 
> already checked in this fix or do you want me to?

No, I haven't committed the patch.  Please do so if it's OK.

Cheers,
Oleg



>> -----Original Message-----
>> From: Oleg Endo [mailto:oleg.endo@t-online.de]
>> Sent: 26 August 2015 15:53
>> To: Jeff Law
>> Cc: David Sherwood; GCC Patches
>> Subject: Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and
>> GET_MODE_UNIT_PRECISION
>> 
>> 
>> On 26 Aug 2015, at 23:27, Oleg Endo <oleg.endo@t-online.de> wrote:
>> 
>>> 
>>> On 19 Aug 2015, at 22:35, Jeff Law <law@redhat.com> wrote:
>>> 
>>>> On 08/19/2015 06:29 AM, David Sherwood wrote:
>>>>>> I asked Richard S. to give this a once-over which he did.  However, he
>>>>>> technically can't approve due to the way his maintainership position was
>>>>>> worded.
>>>>>> 
>>>>>> The one request would be a function comment for emit_mode_unit_size and
>>>>>> emit_mode_unit_precision.  OK with that change.
>>>>> Thanks. Here's a new patch with the comments added.
>>>>> 
>>>>> Good to go?
>>>>> David.
>>>>> 
>>>>> ChangeLog:
>>>>> 
>>>>> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
>>>>> 
>>>>> 	gcc/
>>>>> 	* genmodes.c (emit_mode_unit_size_inline): New function.
>>>>> 	(emit_mode_unit_precision_inline): New function.
>>>>> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
>>>>> 	(emit_mode_unit_size): New function.
>>>>> 	(emit_mode_unit_precision): New function.
>>>>> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
>>>>> 	(emit_insn_modes_c): Emit new arrays.
>>>>> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
>>>>> 	use new inline methods.
>>>> 
>>>> Thanks, this is OK for the trunk.
>>> 
>>> It seems this broke sh-elf, at least when compiling on OSX with its native clang.
>>> 
>>> ../../gcc-trunk/gcc/machmode.h:228:43: error: redefinition of 'mode_unit_size' with a different
> type:
>>>     'const unsigned char [56]' vs 'unsigned char [56]'
>>> extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
>>>                                         ^
>>> ./insn-modes.h:417:24: note: previous definition is here
>>> extern unsigned char mode_unit_size[NUM_MACHINE_MODES];
>>>                      ^
>> 
>> This following fixes the problem for me:
>> 
>> Index: gcc/genmodes.c
>> ===================================================================
>> --- gcc/genmodes.c	(revision 227221)
>> +++ gcc/genmodes.c	(working copy)
>> @@ -1063,7 +1063,7 @@
>> unsigned char\n\
>> mode_unit_size_inline (machine_mode mode)\n\
>> {\n\
>> -  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
>> +  extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
>>   switch (mode)\n\
>>     {");
>> 
>> 
>> Cheers,
>> Oleg
> 
> 
> 

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

* RE: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-26 14:54         ` Oleg Endo
@ 2015-08-27  7:59           ` David Sherwood
  2015-08-27 12:26             ` Oleg Endo
  2015-09-01  6:01           ` Jeff Law
  1 sibling, 1 reply; 10+ messages in thread
From: David Sherwood @ 2015-08-27  7:59 UTC (permalink / raw)
  To: 'Oleg Endo', Jeff Law; +Cc: GCC Patches, Richard Sandiford

Hi Oleg,

Oh I'm so sorry I broke the build - I should have spotted that. Have you 
already checked in this fix or do you want me to?

Regards,
David.

> -----Original Message-----
> From: Oleg Endo [mailto:oleg.endo@t-online.de]
> Sent: 26 August 2015 15:53
> To: Jeff Law
> Cc: David Sherwood; GCC Patches
> Subject: Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and
> GET_MODE_UNIT_PRECISION
> 
> 
> On 26 Aug 2015, at 23:27, Oleg Endo <oleg.endo@t-online.de> wrote:
> 
> >
> > On 19 Aug 2015, at 22:35, Jeff Law <law@redhat.com> wrote:
> >
> >> On 08/19/2015 06:29 AM, David Sherwood wrote:
> >>>> I asked Richard S. to give this a once-over which he did.  However, he
> >>>> technically can't approve due to the way his maintainership position was
> >>>> worded.
> >>>>
> >>>> The one request would be a function comment for emit_mode_unit_size and
> >>>> emit_mode_unit_precision.  OK with that change.
> >>> Thanks. Here's a new patch with the comments added.
> >>>
> >>> Good to go?
> >>> David.
> >>>
> >>> ChangeLog:
> >>>
> >>> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
> >>>
> >>> 	gcc/
> >>> 	* genmodes.c (emit_mode_unit_size_inline): New function.
> >>> 	(emit_mode_unit_precision_inline): New function.
> >>> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
> >>> 	(emit_mode_unit_size): New function.
> >>> 	(emit_mode_unit_precision): New function.
> >>> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
> >>> 	(emit_insn_modes_c): Emit new arrays.
> >>> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
> >>> 	use new inline methods.
> >>
> >> Thanks, this is OK for the trunk.
> >
> > It seems this broke sh-elf, at least when compiling on OSX with its native clang.
> >
> > ../../gcc-trunk/gcc/machmode.h:228:43: error: redefinition of 'mode_unit_size' with a different
type:
> >      'const unsigned char [56]' vs 'unsigned char [56]'
> > extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
> >                                          ^
> > ./insn-modes.h:417:24: note: previous definition is here
> >  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];
> >                       ^
> 
> This following fixes the problem for me:
> 
> Index: gcc/genmodes.c
> ===================================================================
> --- gcc/genmodes.c	(revision 227221)
> +++ gcc/genmodes.c	(working copy)
> @@ -1063,7 +1063,7 @@
>  unsigned char\n\
>  mode_unit_size_inline (machine_mode mode)\n\
>  {\n\
> -  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
> +  extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
>    switch (mode)\n\
>      {");
> 
> 
> Cheers,
> Oleg



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

* Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-26 14:34       ` Oleg Endo
@ 2015-08-26 14:54         ` Oleg Endo
  2015-08-27  7:59           ` David Sherwood
  2015-09-01  6:01           ` Jeff Law
  0 siblings, 2 replies; 10+ messages in thread
From: Oleg Endo @ 2015-08-26 14:54 UTC (permalink / raw)
  To: Jeff Law; +Cc: David Sherwood, GCC Patches


On 26 Aug 2015, at 23:27, Oleg Endo <oleg.endo@t-online.de> wrote:

> 
> On 19 Aug 2015, at 22:35, Jeff Law <law@redhat.com> wrote:
> 
>> On 08/19/2015 06:29 AM, David Sherwood wrote:
>>>> I asked Richard S. to give this a once-over which he did.  However, he
>>>> technically can't approve due to the way his maintainership position was
>>>> worded.
>>>> 
>>>> The one request would be a function comment for emit_mode_unit_size and
>>>> emit_mode_unit_precision.  OK with that change.
>>> Thanks. Here's a new patch with the comments added.
>>> 
>>> Good to go?
>>> David.
>>> 
>>> ChangeLog:
>>> 
>>> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
>>> 
>>> 	gcc/
>>> 	* genmodes.c (emit_mode_unit_size_inline): New function.
>>> 	(emit_mode_unit_precision_inline): New function.
>>> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
>>> 	(emit_mode_unit_size): New function.
>>> 	(emit_mode_unit_precision): New function.
>>> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
>>> 	(emit_insn_modes_c): Emit new arrays.
>>> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
>>> 	use new inline methods.
>> 
>> Thanks, this is OK for the trunk.
> 
> It seems this broke sh-elf, at least when compiling on OSX with its native clang.
> 
> ../../gcc-trunk/gcc/machmode.h:228:43: error: redefinition of 'mode_unit_size' with a different type:
>      'const unsigned char [56]' vs 'unsigned char [56]'
> extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
>                                          ^
> ./insn-modes.h:417:24: note: previous definition is here
>  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];
>                       ^

This following fixes the problem for me:

Index: gcc/genmodes.c
===================================================================
--- gcc/genmodes.c	(revision 227221)
+++ gcc/genmodes.c	(working copy)
@@ -1063,7 +1063,7 @@
 unsigned char\n\
 mode_unit_size_inline (machine_mode mode)\n\
 {\n\
-  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
+  extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
   switch (mode)\n\
     {");


Cheers,
Oleg

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

* Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-19 13:41     ` Jeff Law
@ 2015-08-26 14:34       ` Oleg Endo
  2015-08-26 14:54         ` Oleg Endo
  0 siblings, 1 reply; 10+ messages in thread
From: Oleg Endo @ 2015-08-26 14:34 UTC (permalink / raw)
  To: Jeff Law; +Cc: David Sherwood, GCC Patches


On 19 Aug 2015, at 22:35, Jeff Law <law@redhat.com> wrote:

> On 08/19/2015 06:29 AM, David Sherwood wrote:
>>> I asked Richard S. to give this a once-over which he did.  However, he
>>> technically can't approve due to the way his maintainership position was
>>> worded.
>>> 
>>> The one request would be a function comment for emit_mode_unit_size and
>>> emit_mode_unit_precision.  OK with that change.
>> Thanks. Here's a new patch with the comments added.
>> 
>> Good to go?
>> David.
>> 
>> ChangeLog:
>> 
>> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
>> 
>> 	gcc/
>> 	* genmodes.c (emit_mode_unit_size_inline): New function.
>> 	(emit_mode_unit_precision_inline): New function.
>> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
>> 	(emit_mode_unit_size): New function.
>> 	(emit_mode_unit_precision): New function.
>> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
>> 	(emit_insn_modes_c): Emit new arrays.
>> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
>> 	use new inline methods.
> 
> Thanks, this is OK for the trunk.

It seems this broke sh-elf, at least when compiling on OSX with its native clang.

../../gcc-trunk/gcc/machmode.h:228:43: error: redefinition of 'mode_unit_size' with a different type:
      'const unsigned char [56]' vs 'unsigned char [56]'
extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
                                          ^
./insn-modes.h:417:24: note: previous definition is here
  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];
                       ^
Cheers,
Oleg

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

* Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-19 12:35   ` David Sherwood
@ 2015-08-19 13:41     ` Jeff Law
  2015-08-26 14:34       ` Oleg Endo
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Law @ 2015-08-19 13:41 UTC (permalink / raw)
  To: David Sherwood; +Cc: GCC Patches

On 08/19/2015 06:29 AM, David Sherwood wrote:
>> I asked Richard S. to give this a once-over which he did.  However, he
>> technically can't approve due to the way his maintainership position was
>> worded.
>>
>> The one request would be a function comment for emit_mode_unit_size and
>> emit_mode_unit_precision.  OK with that change.
> Thanks. Here's a new patch with the comments added.
>
> Good to go?
> David.
>
> ChangeLog:
>
> 2015-08-19  David Sherwood  <david.sherwood@arm.com>
>
> 	gcc/
> 	* genmodes.c (emit_mode_unit_size_inline): New function.
> 	(emit_mode_unit_precision_inline): New function.
> 	(emit_insn_modes_h): Emit new #define.  Emit new functions.
> 	(emit_mode_unit_size): New function.
> 	(emit_mode_unit_precision): New function.
> 	(emit_mode_adjustments): Add mode_unit_size adjustments.
> 	(emit_insn_modes_c): Emit new arrays.
> 	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
> 	use new inline methods.

Thanks, this is OK for the trunk.

jeff

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

* RE: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-18 19:26 ` Jeff Law
@ 2015-08-19 12:35   ` David Sherwood
  2015-08-19 13:41     ` Jeff Law
  0 siblings, 1 reply; 10+ messages in thread
From: David Sherwood @ 2015-08-19 12:35 UTC (permalink / raw)
  To: 'Jeff Law'; +Cc: GCC Patches

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

> I asked Richard S. to give this a once-over which he did.  However, he
> technically can't approve due to the way his maintainership position was
> worded.
> 
> The one request would be a function comment for emit_mode_unit_size and
> emit_mode_unit_precision.  OK with that change.
Thanks. Here's a new patch with the comments added.

Good to go?
David.

ChangeLog:

2015-08-19  David Sherwood  <david.sherwood@arm.com>

	gcc/
	* genmodes.c (emit_mode_unit_size_inline): New function.
	(emit_mode_unit_precision_inline): New function.
	(emit_insn_modes_h): Emit new #define.  Emit new functions.
	(emit_mode_unit_size): New function.
	(emit_mode_unit_precision): New function.
	(emit_mode_adjustments): Add mode_unit_size adjustments.
	(emit_insn_modes_c): Emit new arrays.
	* machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
	use new inline methods.


[-- Attachment #2: mode_inner4a.patch --]
[-- Type: application/octet-stream, Size: 6466 bytes --]

diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index f4db427..065ca54 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -1047,6 +1047,79 @@ mode_inner_inline (machine_mode mode)\n\
 }\n");
 }
 
+/* Emit mode_unit_size_inline routine into insn-modes.h header.  */
+static void
+emit_mode_unit_size_inline (void)
+{
+  int c;
+  struct mode_data *m;
+
+  puts ("\
+#ifdef __cplusplus\n\
+inline __attribute__((__always_inline__))\n\
+#else\n\
+extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
+#endif\n\
+unsigned char\n\
+mode_unit_size_inline (machine_mode mode)\n\
+{\n\
+  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
+  switch (mode)\n\
+    {");
+
+  for_all_modes (c, m)
+    {
+      const char *name = m->name;
+      struct mode_data *m2 = m;
+      if (c != MODE_PARTIAL_INT && m2->component)
+	m2 = m2->component;
+      if (!m2->need_bytesize_adj)
+	printf ("    case %smode: return %u;\n", name, m2->bytesize);
+    }
+
+  puts ("\
+    default: return mode_unit_size[mode];\n\
+    }\n\
+}\n");
+}
+
+/* Emit mode_unit_precision_inline routine into insn-modes.h header.  */
+static void
+emit_mode_unit_precision_inline (void)
+{
+  int c;
+  struct mode_data *m;
+
+  puts ("\
+#ifdef __cplusplus\n\
+inline __attribute__((__always_inline__))\n\
+#else\n\
+extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
+#endif\n\
+unsigned short\n\
+mode_unit_precision_inline (machine_mode mode)\n\
+{\n\
+  extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES];\n\
+  switch (mode)\n\
+    {");
+
+  for_all_modes (c, m)
+    {
+      struct mode_data *m2
+	= (c != MODE_PARTIAL_INT && m->component) ? m->component : m;
+      if (m2->precision != (unsigned int)-1)
+	printf ("    case %smode: return %u;\n", m->name, m2->precision);
+      else
+	printf ("    case %smode: return %u*BITS_PER_UNIT;\n",
+		m->name, m2->bytesize);
+    }
+
+  puts ("\
+    default: return mode_unit_precision[mode];\n\
+    }\n\
+}\n");
+}
+
 static void
 emit_insn_modes_h (void)
 {
@@ -1107,6 +1180,7 @@ enum machine_mode\n{");
 
   /* I can't think of a better idea, can you?  */
   printf ("#define CONST_MODE_SIZE%s\n", adj_bytesize ? "" : " const");
+  printf ("#define CONST_MODE_UNIT_SIZE%s\n", adj_bytesize ? "" : " const");
   printf ("#define CONST_MODE_BASE_ALIGN%s\n", adj_alignment ? "" : " const");
 #if 0 /* disabled for backward compatibility, temporary */
   printf ("#define CONST_REAL_FORMAT_FOR_MODE%s\n", adj_format ? "" :" const");
@@ -1125,6 +1199,8 @@ enum machine_mode\n{");
   emit_mode_size_inline ();
   emit_mode_nunits_inline ();
   emit_mode_inner_inline ();
+  emit_mode_unit_size_inline ();
+  emit_mode_unit_precision_inline ();
   puts ("#endif /* GCC_VERSION >= 4001 */");
 
   puts ("\
@@ -1344,6 +1420,47 @@ emit_mode_inner (void)
   print_closer ();
 }
 
+/* Emit mode_unit_size array into insn-modes.c file.  */
+static void
+emit_mode_unit_size (void)
+{
+  int c;
+  struct mode_data *m;
+
+  print_maybe_const_decl ("%sunsigned char", "mode_unit_size",
+			  "NUM_MACHINE_MODES", bytesize);
+
+  for_all_modes (c, m)
+    tagged_printf ("%u",
+		   c != MODE_PARTIAL_INT && m->component
+		   ? m->component->bytesize : m->bytesize, m->name);
+
+  print_closer ();
+}
+
+/* Emit mode_unit_precision array into insn-modes.c file.  */
+static void
+emit_mode_unit_precision (void)
+{
+  int c;
+  struct mode_data *m;
+
+  print_decl ("unsigned short", "mode_unit_precision", "NUM_MACHINE_MODES");
+
+  for_all_modes (c, m)
+    {
+      struct mode_data *m2 = (c != MODE_PARTIAL_INT && m->component) ?
+			     m->component : m;
+      if (m2->precision != (unsigned int)-1)
+	tagged_printf ("%u", m2->precision, m->name);
+      else
+	tagged_printf ("%u*BITS_PER_UNIT", m2->bytesize, m->name);
+    }
+
+  print_closer ();
+}
+
+
 static void
 emit_mode_base_align (void)
 {
@@ -1439,6 +1556,7 @@ emit_mode_adjustments (void)
       printf ("\n  /* %s:%d */\n  s = %s;\n",
 	      a->file, a->line, a->adjustment);
       printf ("  mode_size[%smode] = s;\n", a->mode->name);
+      printf ("  mode_unit_size[%smode] = s;\n", a->mode->name);
       printf ("  mode_base_align[%smode] = s & (~s + 1);\n",
 	      a->mode->name);
 
@@ -1449,6 +1567,7 @@ emit_mode_adjustments (void)
 	    case MODE_COMPLEX_INT:
 	    case MODE_COMPLEX_FLOAT:
 	      printf ("  mode_size[%smode] = 2*s;\n", m->name);
+	      printf ("  mode_unit_size[%smode] = s;\n", m->name);
 	      printf ("  mode_base_align[%smode] = s & (~s + 1);\n",
 		      m->name);
 	      break;
@@ -1461,6 +1580,7 @@ emit_mode_adjustments (void)
 	    case MODE_VECTOR_UACCUM:
 	      printf ("  mode_size[%smode] = %d*s;\n",
 		      m->name, m->ncomponents);
+	      printf ("  mode_unit_size[%smode] = s;\n", m->name);
 	      printf ("  mode_base_align[%smode] = (%d*s) & (~(%d*s)+1);\n",
 		      m->name, m->ncomponents, m->ncomponents);
 	      break;
@@ -1626,6 +1746,8 @@ emit_insn_modes_c (void)
   emit_mode_wider ();
   emit_mode_mask ();
   emit_mode_inner ();
+  emit_mode_unit_size ();
+  emit_mode_unit_precision ();
   emit_mode_base_align ();
   emit_class_narrowest_mode ();
   emit_real_format_for_mode ();
diff --git a/gcc/machmode.h b/gcc/machmode.h
index 66ac7c0..5de1634 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -225,12 +225,28 @@ extern const unsigned char mode_inner[NUM_MACHINE_MODES];
 /* Get the size in bytes or bits of the basic parts of an
    object of mode MODE.  */
 
-#define GET_MODE_UNIT_SIZE(MODE) GET_MODE_SIZE (GET_MODE_INNER (MODE))
+extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
+#if GCC_VERSION >= 4001
+#define GET_MODE_UNIT_SIZE(MODE) \
+  ((unsigned char) (__builtin_constant_p (MODE) \
+		   ? mode_unit_size_inline (MODE) : mode_unit_size[MODE]))
+#else
+#define GET_MODE_UNIT_SIZE(MODE) mode_unit_size[MODE]
+#endif
 
 #define GET_MODE_UNIT_BITSIZE(MODE) \
   ((unsigned short) (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT))
 
-#define GET_MODE_UNIT_PRECISION(MODE) GET_MODE_PRECISION (GET_MODE_INNER (MODE))
+extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES];
+#if GCC_VERSION >= 4001
+#define GET_MODE_UNIT_PRECISION(MODE) \
+  ((unsigned short) (__builtin_constant_p (MODE) \
+		    ? mode_unit_precision_inline (MODE)\
+		    : mode_unit_precision[MODE]))
+#else
+#define GET_MODE_UNIT_PRECISION(MODE) mode_unit_precision[MODE]
+#endif
+
 
 /* Get the number of units in the object.  */
 

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

* Re: [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
  2015-08-17 11:52 David Sherwood
@ 2015-08-18 19:26 ` Jeff Law
  2015-08-19 12:35   ` David Sherwood
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Law @ 2015-08-18 19:26 UTC (permalink / raw)
  To: David Sherwood, GCC Patches

On 08/17/2015 05:38 AM, David Sherwood wrote:
> Hi,
>
> This is the last patch in the series. It follows on from:
>
> [PATCH][3/N] Replace the pattern GET_MODE_BITSIZE (GET_MODE_INNER (m))
> with GET_MODE_UNIT_BITSIZE (m)
>
> As a simple optimisation, introduce new inline functions for GET_MODE_UNIT_SIZE
> and GET_MODE_UNIT_PRECISION in machmode.h so that we can reduce two inline
> calls, i.e. GET_MODE_INNER and GET_MODE_SIZE, into one.
>
> Tested:
> aarch64 and aarch64_be - no regressions in gcc testsuite
> x86_64 - bootstrap build, no testsuite regressions
> arm-none-eabi - no regressions in gcc testsuite
>
> Good to go?
> David.
>
> ChangeLog:
>
> 2015-07-17  David Sherwood  <david.sherwood@arm.com>
>
>      gcc/
>          * genmodes.c (emit_mode_unit_size_inline): New function.
>          (emit_mode_unit_precision_inline): New function.
>          (emit_insn_modes_h): Emit new #define.  Emit new functions.
>          (emit_mode_unit_size): New function.
>          (emit_mode_unit_precision): New function.
>          (emit_mode_adjustments): Add mode_unit_size adjustments.
>          (emit_insn_modes_c): Emit new arrays.
>          * machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
>          use new inline methods.
I asked Richard S. to give this a once-over which he did.  However, he 
technically can't approve due to the way his maintainership position was 
worded.

The one request would be a function comment for emit_mode_unit_size and 
emit_mode_unit_precision.  OK with that change.

Thanks,
Jeff

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

* [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION
@ 2015-08-17 11:52 David Sherwood
  2015-08-18 19:26 ` Jeff Law
  0 siblings, 1 reply; 10+ messages in thread
From: David Sherwood @ 2015-08-17 11:52 UTC (permalink / raw)
  To: GCC Patches

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

Hi,

This is the last patch in the series. It follows on from:

[PATCH][3/N] Replace the pattern GET_MODE_BITSIZE (GET_MODE_INNER (m))
with GET_MODE_UNIT_BITSIZE (m)

As a simple optimisation, introduce new inline functions for GET_MODE_UNIT_SIZE
and GET_MODE_UNIT_PRECISION in machmode.h so that we can reduce two inline
calls, i.e. GET_MODE_INNER and GET_MODE_SIZE, into one.

Tested:
aarch64 and aarch64_be - no regressions in gcc testsuite
x86_64 - bootstrap build, no testsuite regressions
arm-none-eabi - no regressions in gcc testsuite

Good to go?
David.

ChangeLog:

2015-07-17  David Sherwood  <david.sherwood@arm.com>

    gcc/
        * genmodes.c (emit_mode_unit_size_inline): New function.
        (emit_mode_unit_precision_inline): New function.
        (emit_insn_modes_h): Emit new #define.  Emit new functions.
        (emit_mode_unit_size): New function.
        (emit_mode_unit_precision): New function.
        (emit_mode_adjustments): Add mode_unit_size adjustments.
        (emit_insn_modes_c): Emit new arrays.
        * machmode.h (GET_MODE_UNIT_SIZE, GET_MODE_UNIT_PRECISION): Update to
        use new inline methods.

[-- Attachment #2: mode_inner4.patch --]
[-- Type: application/octet-stream, Size: 6336 bytes --]

diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index f4db427..a633f67 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -1047,6 +1047,79 @@ mode_inner_inline (machine_mode mode)\n\
 }\n");
 }
 
+/* Emit mode_unit_size_inline routine into insn-modes.h header.  */
+static void
+emit_mode_unit_size_inline (void)
+{
+  int c;
+  struct mode_data *m;
+
+  puts ("\
+#ifdef __cplusplus\n\
+inline __attribute__((__always_inline__))\n\
+#else\n\
+extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
+#endif\n\
+unsigned char\n\
+mode_unit_size_inline (machine_mode mode)\n\
+{\n\
+  extern unsigned char mode_unit_size[NUM_MACHINE_MODES];\n\
+  switch (mode)\n\
+    {");
+
+  for_all_modes (c, m)
+    {
+      const char *name = m->name;
+      struct mode_data *m2 = m;
+      if (c != MODE_PARTIAL_INT && m2->component)
+	m2 = m2->component;
+      if (!m2->need_bytesize_adj)
+	printf ("    case %smode: return %u;\n", name, m2->bytesize);
+    }
+
+  puts ("\
+    default: return mode_unit_size[mode];\n\
+    }\n\
+}\n");
+}
+
+/* Emit mode_unit_precision_inline routine into insn-modes.h header.  */
+static void
+emit_mode_unit_precision_inline (void)
+{
+  int c;
+  struct mode_data *m;
+
+  puts ("\
+#ifdef __cplusplus\n\
+inline __attribute__((__always_inline__))\n\
+#else\n\
+extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
+#endif\n\
+unsigned short\n\
+mode_unit_precision_inline (machine_mode mode)\n\
+{\n\
+  extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES];\n\
+  switch (mode)\n\
+    {");
+
+  for_all_modes (c, m)
+    {
+      struct mode_data *m2
+	= (c != MODE_PARTIAL_INT && m->component) ? m->component : m;
+      if (m2->precision != (unsigned int)-1)
+	printf ("    case %smode: return %u;\n", m->name, m2->precision);
+      else
+	printf ("    case %smode: return %u*BITS_PER_UNIT;\n",
+		m->name, m2->bytesize);
+    }
+
+  puts ("\
+    default: return mode_unit_precision[mode];\n\
+    }\n\
+}\n");
+}
+
 static void
 emit_insn_modes_h (void)
 {
@@ -1107,6 +1180,7 @@ enum machine_mode\n{");
 
   /* I can't think of a better idea, can you?  */
   printf ("#define CONST_MODE_SIZE%s\n", adj_bytesize ? "" : " const");
+  printf ("#define CONST_MODE_UNIT_SIZE%s\n", adj_bytesize ? "" : " const");
   printf ("#define CONST_MODE_BASE_ALIGN%s\n", adj_alignment ? "" : " const");
 #if 0 /* disabled for backward compatibility, temporary */
   printf ("#define CONST_REAL_FORMAT_FOR_MODE%s\n", adj_format ? "" :" const");
@@ -1125,6 +1199,8 @@ enum machine_mode\n{");
   emit_mode_size_inline ();
   emit_mode_nunits_inline ();
   emit_mode_inner_inline ();
+  emit_mode_unit_size_inline ();
+  emit_mode_unit_precision_inline ();
   puts ("#endif /* GCC_VERSION >= 4001 */");
 
   puts ("\
@@ -1345,6 +1421,45 @@ emit_mode_inner (void)
 }
 
 static void
+emit_mode_unit_size (void)
+{
+  int c;
+  struct mode_data *m;
+
+  print_maybe_const_decl ("%sunsigned char", "mode_unit_size",
+			  "NUM_MACHINE_MODES", bytesize);
+
+  for_all_modes (c, m)
+    tagged_printf ("%u",
+		   c != MODE_PARTIAL_INT && m->component
+		   ? m->component->bytesize : m->bytesize, m->name);
+
+  print_closer ();
+}
+
+static void
+emit_mode_unit_precision (void)
+{
+  int c;
+  struct mode_data *m;
+
+  print_decl ("unsigned short", "mode_unit_precision", "NUM_MACHINE_MODES");
+
+  for_all_modes (c, m)
+    {
+      struct mode_data *m2 = (c != MODE_PARTIAL_INT && m->component) ?
+			     m->component : m;
+      if (m2->precision != (unsigned int)-1)
+	tagged_printf ("%u", m2->precision, m->name);
+      else
+	tagged_printf ("%u*BITS_PER_UNIT", m2->bytesize, m->name);
+    }
+
+  print_closer ();
+}
+
+
+static void
 emit_mode_base_align (void)
 {
   int c;
@@ -1439,6 +1554,7 @@ emit_mode_adjustments (void)
       printf ("\n  /* %s:%d */\n  s = %s;\n",
 	      a->file, a->line, a->adjustment);
       printf ("  mode_size[%smode] = s;\n", a->mode->name);
+      printf ("  mode_unit_size[%smode] = s;\n", a->mode->name);
       printf ("  mode_base_align[%smode] = s & (~s + 1);\n",
 	      a->mode->name);
 
@@ -1449,6 +1565,7 @@ emit_mode_adjustments (void)
 	    case MODE_COMPLEX_INT:
 	    case MODE_COMPLEX_FLOAT:
 	      printf ("  mode_size[%smode] = 2*s;\n", m->name);
+	      printf ("  mode_unit_size[%smode] = s;\n", m->name);
 	      printf ("  mode_base_align[%smode] = s & (~s + 1);\n",
 		      m->name);
 	      break;
@@ -1461,6 +1578,7 @@ emit_mode_adjustments (void)
 	    case MODE_VECTOR_UACCUM:
 	      printf ("  mode_size[%smode] = %d*s;\n",
 		      m->name, m->ncomponents);
+	      printf ("  mode_unit_size[%smode] = s;\n", m->name);
 	      printf ("  mode_base_align[%smode] = (%d*s) & (~(%d*s)+1);\n",
 		      m->name, m->ncomponents, m->ncomponents);
 	      break;
@@ -1626,6 +1744,8 @@ emit_insn_modes_c (void)
   emit_mode_wider ();
   emit_mode_mask ();
   emit_mode_inner ();
+  emit_mode_unit_size ();
+  emit_mode_unit_precision ();
   emit_mode_base_align ();
   emit_class_narrowest_mode ();
   emit_real_format_for_mode ();
diff --git a/gcc/machmode.h b/gcc/machmode.h
index c6b4064..49a01fc 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -223,12 +223,28 @@ extern const unsigned char mode_inner[NUM_MACHINE_MODES];
 /* Get the size in bytes or bites of the basic parts of an
    object of mode MODE.  */
 
-#define GET_MODE_UNIT_SIZE(MODE) GET_MODE_SIZE (GET_MODE_INNER (MODE))
+extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
+#if GCC_VERSION >= 4001
+#define GET_MODE_UNIT_SIZE(MODE) \
+  ((unsigned char) (__builtin_constant_p (MODE) \
+		   ? mode_unit_size_inline (MODE) : mode_unit_size[MODE]))
+#else
+#define GET_MODE_UNIT_SIZE(MODE) mode_unit_size[MODE]
+#endif
 
 #define GET_MODE_UNIT_BITSIZE(MODE) \
   ((unsigned short) (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT))
 
-#define GET_MODE_UNIT_PRECISION(MODE) GET_MODE_PRECISION (GET_MODE_INNER (MODE))
+extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES];
+#if GCC_VERSION >= 4001
+#define GET_MODE_UNIT_PRECISION(MODE) \
+  ((unsigned short) (__builtin_constant_p (MODE) \
+		    ? mode_unit_precision_inline (MODE)\
+		    : mode_unit_precision[MODE]))
+#else
+#define GET_MODE_UNIT_PRECISION(MODE) mode_unit_precision[MODE]
+#endif
+
 
 /* Get the number of units in the object.  */
 

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

end of thread, other threads:[~2015-09-01 12:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01 12:45 [PATCH][4/N] Introduce new inline functions for GET_MODE_UNIT_SIZE and GET_MODE_UNIT_PRECISION David Sherwood
  -- strict thread matches above, loose matches on Subject: below --
2015-08-17 11:52 David Sherwood
2015-08-18 19:26 ` Jeff Law
2015-08-19 12:35   ` David Sherwood
2015-08-19 13:41     ` Jeff Law
2015-08-26 14:34       ` Oleg Endo
2015-08-26 14:54         ` Oleg Endo
2015-08-27  7:59           ` David Sherwood
2015-08-27 12:26             ` Oleg Endo
2015-09-01  6:01           ` Jeff Law

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