public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/4] [ARM] Add attribute/pragma target fpu=
@ 2015-09-14  9:39 Christian Bruel
  2015-09-14 15:50 ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Bruel @ 2015-09-14  9:39 UTC (permalink / raw)
  To: kyrylo.tkachov, Ramana.Radhakrishnan; +Cc: gcc-patches

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

Hi,

This patch moves the FPU flags settings and checks to the attribute 
hooks. .e.g neon must be checked in arm_option_check_internal. FPU name 
is emitted before each function and arm_fpu_index is Saved to be handled 
by the cl_target_option_save/restore functions.

Christian

[-- Attachment #2: p1.patch --]
[-- Type: text/x-patch, Size: 3968 bytes --]

 2015-09-14  Christian Bruel  <christian.bruel@st.com>

	PR target/65837
	* config/arm/arm.c (arm_option_override): Move NEON check...
	(arm_option_check_internal): here
	(arm_file_start): Move .fpu print...
	(arm_declare_function_name): here
	(arm_option_print): Dump current fpu name.
	* config/arm/arm.opt (arm_fpu_index): Mark Save.
	
diff -ruN gnu_trunk.p0/gcc/gcc/config/arm/arm.c gnu_trunk.p1/gcc/gcc/config/arm/arm.c
--- gnu_trunk.p0/gcc/gcc/config/arm/arm.c	2015-09-10 14:27:28.931847219 +0200
+++ gnu_trunk.p1/gcc/gcc/config/arm/arm.c	2015-09-11 14:53:45.388771537 +0200
@@ -2713,6 +2713,12 @@
 arm_option_check_internal (struct gcc_options *opts)
 {
   int flags = opts->x_target_flags;
+  const struct arm_fpu_desc *fpu_desc = &all_fpus[opts->x_arm_fpu_index];
+
+  /* iWMMXt and NEON are incompatible.  */
+    if (TARGET_IWMMXT && TARGET_VFP  
+      && ARM_FPU_FSET_HAS (fpu_desc->features, FPU_FL_NEON))
+    error ("iWMMXt `and NEON are incompatible");
 
   /* Make sure that the processor choice does not conflict with any of the
      other command line choices.  */
@@ -3145,10 +3151,6 @@
 	  error ("AAPCS does not support -mcallee-super-interworking");
     }
 
-  /* iWMMXt and NEON are incompatible.  */
-  if (TARGET_IWMMXT && TARGET_NEON)
-    error ("iWMMXt and NEON are incompatible");
-
   /* __fp16 support currently assumes the core has ldrh.  */
   if (!arm_arch4 && arm_fp16_format != ARM_FP16_FORMAT_NONE)
     sorry ("__fp16 and no ldrh");
@@ -25634,7 +25636,6 @@
 
   if (TARGET_BPABI)
     {
-      const char *fpu_name;
       if (arm_selected_arch)
         {
 	  /* armv7ve doesn't support any extensions.  */
@@ -25678,23 +25679,14 @@
       if (print_tune_info)
 	arm_print_tune_info ();
 
-      if (TARGET_SOFT_FLOAT)
+      if (! TARGET_SOFT_FLOAT && arm_fpu_desc->model == ARM_FP_MODEL_VFP)
 	{
-	  fpu_name = "softvfp";
-	}
-      else
-	{
-	  fpu_name = arm_fpu_desc->name;
-	  if (arm_fpu_desc->model == ARM_FP_MODEL_VFP)
-	    {
-	      if (TARGET_HARD_FLOAT && TARGET_VFP_SINGLE)
-		arm_emit_eabi_attribute ("Tag_ABI_HardFP_use", 27, 1);
+	  if (TARGET_HARD_FLOAT && TARGET_VFP_SINGLE)
+	    arm_emit_eabi_attribute ("Tag_ABI_HardFP_use", 27, 1);
 
-	      if (TARGET_HARD_FLOAT_ABI)
-		arm_emit_eabi_attribute ("Tag_ABI_VFP_args", 28, 1);
-	    }
+	  if (TARGET_HARD_FLOAT_ABI)
+	    arm_emit_eabi_attribute ("Tag_ABI_VFP_args", 28, 1);
 	}
-      asm_fprintf (asm_out_file, "\t.fpu %s\n", fpu_name);
 
       /* Some of these attributes only apply when the corresponding features
          are used.  However we don't have any easy way of figuring this out.
@@ -29493,11 +29485,14 @@
 arm_option_print (FILE *file, int indent, struct cl_target_option *ptr)
 {
   int flags = ptr->x_target_flags;
+  const struct arm_fpu_desc *fpu_desc = &all_fpus[ptr->x_arm_fpu_index];
 
   fprintf (file, "%*sselected arch %s\n", indent, "",
 	   TARGET_THUMB2_P (flags) ? "thumb2" :
 	   TARGET_THUMB_P (flags) ? "thumb1" :
 	   "arm");
+
+  fprintf (file, "%*sselected fpu %s\n", indent, "", fpu_desc->name);
 }
 
 /* Hook to determine if one function can safely inline another.  */
@@ -29691,6 +29686,9 @@
   else
     fprintf (stream, "\t.arm\n");
 
+  asm_fprintf (asm_out_file, "\t.fpu %s\n", TARGET_SOFT_FLOAT
+	       ? "softvfp" : arm_fpu_desc->name);
+
   if (TARGET_POKE_FUNCTION_NAME)
     arm_poke_function_name (stream, (const char *) name);
 }
diff -ruN gnu_trunk.p0/gcc/gcc/config/arm/arm.opt gnu_trunk.p1/gcc/gcc/config/arm/arm.opt
--- gnu_trunk.p0/gcc/gcc/config/arm/arm.opt	2015-09-10 13:10:29.401420437 +0200
+++ gnu_trunk.p1/gcc/gcc/config/arm/arm.opt	2015-09-11 15:21:56.164436135 +0200
@@ -144,7 +144,7 @@
 Enum(arm_fp16_format_type) String(alternative) Value(ARM_FP16_FORMAT_ALTERNATIVE)
 
 mfpu=
-Target RejectNegative Joined Enum(arm_fpu) Var(arm_fpu_index)
+Target RejectNegative Joined Enum(arm_fpu) Var(arm_fpu_index) Save
 Specify the name of the target floating point hardware/format
 
 mhard-float

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

* Re: [PATCH 1/4] [ARM] Add attribute/pragma target fpu=
  2015-09-14  9:39 [PATCH 1/4] [ARM] Add attribute/pragma target fpu= Christian Bruel
@ 2015-09-14 15:50 ` Bernhard Reutner-Fischer
  2015-09-16  9:34   ` Christian Bruel
  0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2015-09-14 15:50 UTC (permalink / raw)
  To: Christian Bruel, kyrylo.tkachov, Ramana.Radhakrishnan; +Cc: gcc-patches

On September 14, 2015 11:36:13 AM GMT+02:00, Christian Bruel <christian.bruel@st.com> wrote:
>Hi,
>
>This patch moves the FPU flags settings and checks to the attribute 
>hooks. .e.g neon must be checked in arm_option_check_internal. FPU name
>
>is emitted before each function and arm_fpu_index is Saved to be
>handled 
>by the cl_target_option_save/restore functions.

diff -ruN gnu_trunk.p0/gcc/gcc/config/arm/arm.c gnu_trunk.p1/gcc/gcc/config/arm/arm.c
--- gnu_trunk.p0/gcc/gcc/config/arm/arm.c	2015-09-10 14:27:28.931847219 +0200
+++ gnu_trunk.p1/gcc/gcc/config/arm/arm.c	2015-09-11 14:53:45.388771537 +0200
@@ -2713,6 +2713,12 @@
 arm_option_check_internal (struct gcc_options *opts)
 {
   int flags = opts->x_target_flags;
+  const struct arm_fpu_desc *fpu_desc = &all_fpus[opts->x_arm_fpu_index];
+
+  /* iWMMXt and NEON are incompatible.  */
+    if (TARGET_IWMMXT && TARGET_VFP  
+      && ARM_FPU_FSET_HAS (fpu_desc->features, FPU_FL_NEON))
+    error ("iWMMXt `and NEON are incompatible");

Maybe there is just dirt on my screen or my graphic-memory is broken, but I see an odd character between iWMMXt and and?

I keep forgetting if it's a capital W or a lowercase one but you'll know.
Thanks,


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

* Re: [PATCH 1/4] [ARM] Add attribute/pragma target fpu=
  2015-09-14 15:50 ` Bernhard Reutner-Fischer
@ 2015-09-16  9:34   ` Christian Bruel
  2015-10-05 10:54     ` Kyrill Tkachov
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Bruel @ 2015-09-16  9:34 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer, kyrylo.tkachov, Ramana.Radhakrishnan
  Cc: gcc-patches

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



> Maybe there is just dirt on my screen or my graphic-memory is broken, but I see an odd character between iWMMXt and and?

Thanks Bernhard,

Resent to remove this malicious sneaky ` character in the string error 
message.

>
> I keep forgetting if it's a capital W or a lowercase one but you'll know.
> Thanks,
>

I don't know. iWMMXt is also referenced with a capital W in the other 
parts of the compiler.

Christian

[-- Attachment #2: p11.patch --]
[-- Type: text/x-patch, Size: 3962 bytes --]

 2015-09-14  Christian Bruel  <christian.bruel@st.com>

	PR target/65837
	* config/arm/arm.c (arm_option_override): Move NEON check...
	(arm_option_check_internal): here
	(arm_file_start): Move .fpu print...
	(arm_declare_function_name): here
	(arm_option_print): Dump current fpu name.
	* config/arm/arm.opt (arm_fpu_index): Mark Save.

diff -ru gnu_trunk.p0/gcc/gcc/config/arm/arm.c gnu_trunk.p1/gcc/gcc/config/arm/arm.c
--- gnu_trunk.p0/gcc/gcc/config/arm/arm.c	2015-09-16 10:49:26.693018760 +0200
+++ gnu_trunk.p1/gcc/gcc/config/arm/arm.c	2015-09-16 10:52:44.065449166 +0200
@@ -2713,6 +2713,12 @@
 arm_option_check_internal (struct gcc_options *opts)
 {
   int flags = opts->x_target_flags;
+  const struct arm_fpu_desc *fpu_desc = &all_fpus[opts->x_arm_fpu_index];
+
+  /* iWMMXt and NEON are incompatible.  */
+    if (TARGET_IWMMXT && TARGET_VFP
+      && ARM_FPU_FSET_HAS (fpu_desc->features, FPU_FL_NEON))
+    error ("iWMMXt and NEON are incompatible");
 
   /* Make sure that the processor choice does not conflict with any of the
      other command line choices.  */
@@ -3145,10 +3151,6 @@
 	  error ("AAPCS does not support -mcallee-super-interworking");
     }
 
-  /* iWMMXt and NEON are incompatible.  */
-  if (TARGET_IWMMXT && TARGET_NEON)
-    error ("iWMMXt and NEON are incompatible");
-
   /* __fp16 support currently assumes the core has ldrh.  */
   if (!arm_arch4 && arm_fp16_format != ARM_FP16_FORMAT_NONE)
     sorry ("__fp16 and no ldrh");
@@ -25634,7 +25636,6 @@
 
   if (TARGET_BPABI)
     {
-      const char *fpu_name;
       if (arm_selected_arch)
         {
 	  /* armv7ve doesn't support any extensions.  */
@@ -25678,23 +25679,14 @@
       if (print_tune_info)
 	arm_print_tune_info ();
 
-      if (TARGET_SOFT_FLOAT)
+      if (! TARGET_SOFT_FLOAT && arm_fpu_desc->model == ARM_FP_MODEL_VFP)
 	{
-	  fpu_name = "softvfp";
-	}
-      else
-	{
-	  fpu_name = arm_fpu_desc->name;
-	  if (arm_fpu_desc->model == ARM_FP_MODEL_VFP)
-	    {
-	      if (TARGET_HARD_FLOAT && TARGET_VFP_SINGLE)
-		arm_emit_eabi_attribute ("Tag_ABI_HardFP_use", 27, 1);
+	  if (TARGET_HARD_FLOAT && TARGET_VFP_SINGLE)
+	    arm_emit_eabi_attribute ("Tag_ABI_HardFP_use", 27, 1);
 
-	      if (TARGET_HARD_FLOAT_ABI)
-		arm_emit_eabi_attribute ("Tag_ABI_VFP_args", 28, 1);
-	    }
+	  if (TARGET_HARD_FLOAT_ABI)
+	    arm_emit_eabi_attribute ("Tag_ABI_VFP_args", 28, 1);
 	}
-      asm_fprintf (asm_out_file, "\t.fpu %s\n", fpu_name);
 
       /* Some of these attributes only apply when the corresponding features
          are used.  However we don't have any easy way of figuring this out.
@@ -29493,11 +29485,14 @@
 arm_option_print (FILE *file, int indent, struct cl_target_option *ptr)
 {
   int flags = ptr->x_target_flags;
+  const struct arm_fpu_desc *fpu_desc = &all_fpus[ptr->x_arm_fpu_index];
 
   fprintf (file, "%*sselected arch %s\n", indent, "",
 	   TARGET_THUMB2_P (flags) ? "thumb2" :
 	   TARGET_THUMB_P (flags) ? "thumb1" :
 	   "arm");
+
+  fprintf (file, "%*sselected fpu %s\n", indent, "", fpu_desc->name);
 }
 
 /* Hook to determine if one function can safely inline another.  */
@@ -29691,6 +29686,9 @@
   else
     fprintf (stream, "\t.arm\n");
 
+  asm_fprintf (asm_out_file, "\t.fpu %s\n", TARGET_SOFT_FLOAT
+	       ? "softvfp" : arm_fpu_desc->name);
+
   if (TARGET_POKE_FUNCTION_NAME)
     arm_poke_function_name (stream, (const char *) name);
 }
diff -ru gnu_trunk.p0/gcc/gcc/config/arm/arm.opt gnu_trunk.p1/gcc/gcc/config/arm/arm.opt
--- gnu_trunk.p0/gcc/gcc/config/arm/arm.opt	2015-09-16 10:49:26.697018769 +0200
+++ gnu_trunk.p1/gcc/gcc/config/arm/arm.opt	2015-09-16 10:52:22.441401984 +0200
@@ -144,7 +144,7 @@
 Enum(arm_fp16_format_type) String(alternative) Value(ARM_FP16_FORMAT_ALTERNATIVE)
 
 mfpu=
-Target RejectNegative Joined Enum(arm_fpu) Var(arm_fpu_index)
+Target RejectNegative Joined Enum(arm_fpu) Var(arm_fpu_index) Save
 Specify the name of the target floating point hardware/format
 
 mhard-float

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

* Re: [PATCH 1/4] [ARM] Add attribute/pragma target fpu=
  2015-09-16  9:34   ` Christian Bruel
@ 2015-10-05 10:54     ` Kyrill Tkachov
  0 siblings, 0 replies; 4+ messages in thread
From: Kyrill Tkachov @ 2015-10-05 10:54 UTC (permalink / raw)
  To: Christian Bruel, Bernhard Reutner-Fischer, Ramana Radhakrishnan
  Cc: gcc-patches


On 16/09/15 10:29, Christian Bruel wrote:
>
>> Maybe there is just dirt on my screen or my graphic-memory is broken, but I see an odd character between iWMMXt and and?
> Thanks Bernhard,
>
> Resent to remove this malicious sneaky ` character in the string error
> message.
>
>> I keep forgetting if it's a capital W or a lowercase one but you'll know.
>> Thanks,
>>
> I don't know. iWMMXt is also referenced with a capital W in the other
> parts of the compiler.

Let's go with what's in the compiler already.

@@ -25678,23 +25679,14 @@
        if (print_tune_info)
  	arm_print_tune_info ();
  
-      if (TARGET_SOFT_FLOAT)
+      if (! TARGET_SOFT_FLOAT && arm_fpu_desc->model == ARM_FP_MODEL_VFP)
  	{

Can use TARGET_VFP here?

Ok with that change.
Kyrill

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

end of thread, other threads:[~2015-10-05 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14  9:39 [PATCH 1/4] [ARM] Add attribute/pragma target fpu= Christian Bruel
2015-09-14 15:50 ` Bernhard Reutner-Fischer
2015-09-16  9:34   ` Christian Bruel
2015-10-05 10:54     ` Kyrill Tkachov

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