public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [AArch64] Some aarch64-builtins.c cleanup.
@ 2014-08-04 10:14 James Greenhalgh
  2014-08-05  9:30 ` Richard Earnshaw
  0 siblings, 1 reply; 2+ messages in thread
From: James Greenhalgh @ 2014-08-04 10:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: marcus.shawcroft, richard.earnshaw

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


This patch removes the aarch64_simd_builtin_type enum. This is only really
used for indexing in to an array of strings and an array of machine_mode.

We don't need that. Given all the macro pasting we presently do in this
file, just add another. Then we can store a proper machine_mode for each
builtin and save the headache of keeping everything in sync.

Regression tested for aarch64-none-elf.

OK?

Thanks,
James

---
gcc/

2014-08-04  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64-builtins.c
	(aarch64_simd_builtin_type_mode): Delete.
	(v8qi_UP): Remap to V8QImode.
	(v4hi_UP): Remap to V4HImode.
	(v2si_UP): Remap to V2SImode.
	(v2sf_UP): Remap to V2SFmode.
	(v1df_UP): Remap to V1DFmode.
	(di_UP): Remap to DImode.
	(df_UP): Remap to DFmode.
	(v16qi_UP):V16QImode.
	(v8hi_UP): Remap to V8HImode.
	(v4si_UP): Remap to V4SImode.
	(v4sf_UP): Remap to V4SFmode.
	(v2di_UP): Remap to V2DImode.
	(v2df_UP): Remap to V2DFmode.
	(ti_UP): Remap to TImode.
	(ei_UP): Remap to EImode.
	(oi_UP): Remap to OImode.
	(ci_UP): Map to CImode.
	(xi_UP): Remap to XImode.
	(si_UP): Remap to SImode.
	(sf_UP): Remap to SFmode.
	(hi_UP): Remap to HImode.
	(qi_UP): Remap to QImode.
	(aarch64_simd_builtin_datum): Make mode a machine_mode.
	(VAR1): Build builtin name.
	(aarch64_init_simd_builtins): Remove dead code.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-AArch64-Some-aarch64-builtins.c-cleanup.patch --]
[-- Type: text/x-patch;  name=0001-AArch64-Some-aarch64-builtins.c-cleanup.patch, Size: 4304 bytes --]

diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 58db77e..ba58a99 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -47,54 +47,28 @@
 #include "gimple.h"
 #include "gimple-iterator.h"
 
-enum aarch64_simd_builtin_type_mode
-{
-  T_V8QI,
-  T_V4HI,
-  T_V2SI,
-  T_V2SF,
-  T_V1DF,
-  T_DI,
-  T_DF,
-  T_V16QI,
-  T_V8HI,
-  T_V4SI,
-  T_V4SF,
-  T_V2DI,
-  T_V2DF,
-  T_TI,
-  T_EI,
-  T_OI,
-  T_XI,
-  T_SI,
-  T_SF,
-  T_HI,
-  T_QI,
-  T_MAX
-};
-
-#define v8qi_UP  T_V8QI
-#define v4hi_UP  T_V4HI
-#define v2si_UP  T_V2SI
-#define v2sf_UP  T_V2SF
-#define v1df_UP  T_V1DF
-#define di_UP    T_DI
-#define df_UP    T_DF
-#define v16qi_UP T_V16QI
-#define v8hi_UP  T_V8HI
-#define v4si_UP  T_V4SI
-#define v4sf_UP  T_V4SF
-#define v2di_UP  T_V2DI
-#define v2df_UP  T_V2DF
-#define ti_UP	 T_TI
-#define ei_UP	 T_EI
-#define oi_UP	 T_OI
-#define xi_UP	 T_XI
-#define si_UP    T_SI
-#define sf_UP    T_SF
-#define hi_UP    T_HI
-#define qi_UP    T_QI
-
+#define v8qi_UP  V8QImode
+#define v4hi_UP  V4HImode
+#define v2si_UP  V2SImode
+#define v2sf_UP  V2SFmode
+#define v1df_UP  V1DFmode
+#define di_UP    DImode
+#define df_UP    DFmode
+#define v16qi_UP V16QImode
+#define v8hi_UP  V8HImode
+#define v4si_UP  V4SImode
+#define v4sf_UP  V4SFmode
+#define v2di_UP  V2DImode
+#define v2df_UP  V2DFmode
+#define ti_UP	 TImode
+#define ei_UP	 EImode
+#define oi_UP	 OImode
+#define ci_UP	 CImode
+#define xi_UP	 XImode
+#define si_UP    SImode
+#define sf_UP    SFmode
+#define hi_UP    HImode
+#define qi_UP    QImode
 #define UP(X) X##_UP
 
 #define SIMD_MAX_BUILTIN_ARGS 5
@@ -134,7 +108,7 @@ enum aarch64_type_qualifiers
 typedef struct
 {
   const char *name;
-  enum aarch64_simd_builtin_type_mode mode;
+  enum machine_mode mode;
   const enum insn_code code;
   unsigned int fcode;
   enum aarch64_type_qualifiers *qualifiers;
@@ -288,7 +262,7 @@ aarch64_types_storestruct_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS]
 #define CF10(N, X) CODE_FOR_##N##X
 
 #define VAR1(T, N, MAP, A) \
-  {#N, UP (A), CF##MAP (N, A), 0, TYPES_##T},
+  {#N #A, UP (A), CF##MAP (N, A), 0, TYPES_##T},
 #define VAR2(T, N, MAP, A, B) \
   VAR1 (T, N, MAP, A) \
   VAR1 (T, N, MAP, B)
@@ -731,25 +705,10 @@ aarch64_init_simd_builtins (void)
       bool print_type_signature_p = false;
       char type_signature[SIMD_MAX_BUILTIN_ARGS] = { 0 };
       aarch64_simd_builtin_datum *d = &aarch64_simd_builtin_data[i];
-      const char *const modenames[] =
-	{
-	  "v8qi", "v4hi", "v2si", "v2sf", "v1df", "di", "df",
-	  "v16qi", "v8hi", "v4si", "v4sf", "v2di", "v2df",
-	  "ti", "ei", "oi", "xi", "si", "sf", "hi", "qi"
-	};
-      const enum machine_mode modes[] =
-	{
-	  V8QImode, V4HImode, V2SImode, V2SFmode, V1DFmode, DImode, DFmode,
-	  V16QImode, V8HImode, V4SImode, V4SFmode, V2DImode,
-	  V2DFmode, TImode, EImode, OImode, XImode, SImode,
-	  SFmode, HImode, QImode
-	};
       char namebuf[60];
       tree ftype = NULL;
       tree fndecl = NULL;
 
-      gcc_assert (ARRAY_SIZE (modenames) == T_MAX);
-
       d->fcode = fcode;
 
       /* We must track two variables here.  op_num is
@@ -797,7 +756,7 @@ aarch64_init_simd_builtins (void)
 	  /* Some builtins have different user-facing types
 	     for certain arguments, encoded in d->mode.  */
 	  if (qualifiers & qualifier_map_mode)
-	      op_mode = modes[d->mode];
+	      op_mode = d->mode;
 
 	  /* For pointers, we want a pointer to the basic type
 	     of the vector.  */
@@ -829,11 +788,11 @@ aarch64_init_simd_builtins (void)
       gcc_assert (ftype != NULL);
 
       if (print_type_signature_p)
-	snprintf (namebuf, sizeof (namebuf), "__builtin_aarch64_%s%s_%s",
-		  d->name, modenames[d->mode], type_signature);
+	snprintf (namebuf, sizeof (namebuf), "__builtin_aarch64_%s_%s",
+		  d->name, type_signature);
       else
-	snprintf (namebuf, sizeof (namebuf), "__builtin_aarch64_%s%s",
-		  d->name, modenames[d->mode]);
+	snprintf (namebuf, sizeof (namebuf), "__builtin_aarch64_%s",
+		  d->name);
 
       fndecl = add_builtin_function (namebuf, ftype, fcode, BUILT_IN_MD,
 				     NULL, NULL_TREE);

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

* Re: [AArch64] Some aarch64-builtins.c cleanup.
  2014-08-04 10:14 [AArch64] Some aarch64-builtins.c cleanup James Greenhalgh
@ 2014-08-05  9:30 ` Richard Earnshaw
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2014-08-05  9:30 UTC (permalink / raw)
  To: James Greenhalgh; +Cc: gcc-patches, Marcus Shawcroft

On 04/08/14 11:13, James Greenhalgh wrote:
> 
> This patch removes the aarch64_simd_builtin_type enum. This is only really
> used for indexing in to an array of strings and an array of machine_mode.
> 
> We don't need that. Given all the macro pasting we presently do in this
> file, just add another. Then we can store a proper machine_mode for each
> builtin and save the headache of keeping everything in sync.
> 
> Regression tested for aarch64-none-elf.
> 
> OK?
> 

OK.

R.


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

end of thread, other threads:[~2014-08-05  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04 10:14 [AArch64] Some aarch64-builtins.c cleanup James Greenhalgh
2014-08-05  9:30 ` Richard Earnshaw

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