public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] S/390: Make as to accept all instructions if no -march option given
@ 2010-11-24 16:39 Andreas Krebbel
  2011-03-22 22:08 ` Matthias Klose
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Krebbel @ 2010-11-24 16:39 UTC (permalink / raw)
  To: binutils; +Cc: schwidefsky

Hi,

for S/390 currently mimics the GCC behaviour when no -march switch is
specified.  This means that it defaults to -march=g5 for -m31 and to
-march=z900 for -m64.  Due to that the vers1 testcase currently fails
when building GCC with a different default -march argument since it
relies on an "as" execution without -march accepting all valid
instructions.

The attached patch fixes this by defaulting to the highest CPU and the
most generic mode (z/Architecture mode).  For S/390 this is the most
generic instruction set containing all possible instructions.

Tested on s390 and s390x. The vers1 testcase is fixed with that change.

I'll commit the patch tomorrow if nobody objects.

Bye,

-Andreas-


2010-11-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* config/tc-s390.c (current_cpu): Initialize with latest CPU.
	(init_default_arch): Default to z/Architecture mode if CPU provides it.
	Remove the check setting the CPU default.

	
2010-11-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* opcode/s390.h (enum s390_opcode_cpu_val): Add S390_OPCODE_MAXCPU.


Index: gas/config/tc-s390.c
===================================================================
--- gas/config/tc-s390.c.orig
+++ gas/config/tc-s390.c
@@ -38,8 +38,11 @@ static char *default_arch = DEFAULT_ARCH
 /* Either 32 or 64, selects file format.  */
 static int s390_arch_size = 0;
 
+/* If no -march option was given default to the highest available CPU.
+   Since with S/390 a newer CPU always supports everything from its
+   predecessors this will accept every valid asm input.  */
+static unsigned int current_cpu = S390_OPCODE_MAXCPU - 1;
 static unsigned int current_mode_mask = 0;
-static unsigned int current_cpu = -1U;
 
 /* Whether to use user friendly register names. Default is TRUE.  */
 #ifndef TARGET_REG_NAMES_P
@@ -328,18 +331,12 @@ init_default_arch (void)
 
   if (current_mode_mask == 0)
     {
-      if (s390_arch_size == 32)
+      /* Default to z/Architecture mode if the CPU supports it.  */
+      if (current_cpu < S390_OPCODE_Z900)
 	current_mode_mask = 1 << S390_OPCODE_ESA;
       else
 	current_mode_mask = 1 << S390_OPCODE_ZARCH;
     }
-  if (current_cpu == -1U)
-    {
-      if (current_mode_mask == (1 << S390_OPCODE_ESA))
-	current_cpu = S390_OPCODE_G5;
-      else
-	current_cpu = S390_OPCODE_Z900;
-    }
 }
 
 /* Called by TARGET_FORMAT.  */
Index: include/opcode/s390.h
===================================================================
--- include/opcode/s390.h.orig
+++ include/opcode/s390.h
@@ -39,7 +39,8 @@ enum s390_opcode_cpu_val
     S390_OPCODE_Z9_109,
     S390_OPCODE_Z9_EC,
     S390_OPCODE_Z10,
-    S390_OPCODE_Z196
+    S390_OPCODE_Z196,
+    S390_OPCODE_MAXCPU
   };
 
 /* The opcode table is an array of struct s390_opcode.  */

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

* Re: [PATCH] S/390: Make as to accept all instructions if no -march option given
  2010-11-24 16:39 [PATCH] S/390: Make as to accept all instructions if no -march option given Andreas Krebbel
@ 2011-03-22 22:08 ` Matthias Klose
  2011-03-23 16:02   ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Klose @ 2011-03-22 22:08 UTC (permalink / raw)
  To: Andreas Krebbel, Tristan Gingold; +Cc: binutils, schwidefsky

Could this be applied to the 2.21 branch? Doesn't accept all instructions if no
-march option given and breaks the glibc build if -march is not explicitly
specified (Debian #618751).

Thank, Matthias

On 24.11.2010 17:39, Andreas Krebbel wrote:
> Hi,
> 
> for S/390 currently mimics the GCC behaviour when no -march switch is
> specified.  This means that it defaults to -march=g5 for -m31 and to
> -march=z900 for -m64.  Due to that the vers1 testcase currently fails
> when building GCC with a different default -march argument since it
> relies on an "as" execution without -march accepting all valid
> instructions.
> 
> The attached patch fixes this by defaulting to the highest CPU and the
> most generic mode (z/Architecture mode).  For S/390 this is the most
> generic instruction set containing all possible instructions.
> 
> Tested on s390 and s390x. The vers1 testcase is fixed with that change.
> 
> I'll commit the patch tomorrow if nobody objects.
> 
> Bye,
> 
> -Andreas-
> 
> 
> 2010-11-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
> 
> 	* config/tc-s390.c (current_cpu): Initialize with latest CPU.
> 	(init_default_arch): Default to z/Architecture mode if CPU provides it.
> 	Remove the check setting the CPU default.
> 
> 	
> 2010-11-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
> 
> 	* opcode/s390.h (enum s390_opcode_cpu_val): Add S390_OPCODE_MAXCPU.
> 
> 
> Index: gas/config/tc-s390.c
> ===================================================================
> --- gas/config/tc-s390.c.orig
> +++ gas/config/tc-s390.c
> @@ -38,8 +38,11 @@ static char *default_arch = DEFAULT_ARCH
>  /* Either 32 or 64, selects file format.  */
>  static int s390_arch_size = 0;
>  
> +/* If no -march option was given default to the highest available CPU.
> +   Since with S/390 a newer CPU always supports everything from its
> +   predecessors this will accept every valid asm input.  */
> +static unsigned int current_cpu = S390_OPCODE_MAXCPU - 1;
>  static unsigned int current_mode_mask = 0;
> -static unsigned int current_cpu = -1U;
>  
>  /* Whether to use user friendly register names. Default is TRUE.  */
>  #ifndef TARGET_REG_NAMES_P
> @@ -328,18 +331,12 @@ init_default_arch (void)
>  
>    if (current_mode_mask == 0)
>      {
> -      if (s390_arch_size == 32)
> +      /* Default to z/Architecture mode if the CPU supports it.  */
> +      if (current_cpu < S390_OPCODE_Z900)
>  	current_mode_mask = 1 << S390_OPCODE_ESA;
>        else
>  	current_mode_mask = 1 << S390_OPCODE_ZARCH;
>      }
> -  if (current_cpu == -1U)
> -    {
> -      if (current_mode_mask == (1 << S390_OPCODE_ESA))
> -	current_cpu = S390_OPCODE_G5;
> -      else
> -	current_cpu = S390_OPCODE_Z900;
> -    }
>  }
>  
>  /* Called by TARGET_FORMAT.  */
> Index: include/opcode/s390.h
> ===================================================================
> --- include/opcode/s390.h.orig
> +++ include/opcode/s390.h
> @@ -39,7 +39,8 @@ enum s390_opcode_cpu_val
>      S390_OPCODE_Z9_109,
>      S390_OPCODE_Z9_EC,
>      S390_OPCODE_Z10,
> -    S390_OPCODE_Z196
> +    S390_OPCODE_Z196,
> +    S390_OPCODE_MAXCPU
>    };
>  
>  /* The opcode table is an array of struct s390_opcode.  */

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

* Re: [PATCH] S/390: Make as to accept all instructions if no -march option given
  2011-03-22 22:08 ` Matthias Klose
@ 2011-03-23 16:02   ` Tristan Gingold
  0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2011-03-23 16:02 UTC (permalink / raw)
  To: Matthias Klose; +Cc: Andreas Krebbel, binutils, schwidefsky


On Mar 22, 2011, at 11:07 PM, Matthias Klose wrote:

> Could this be applied to the 2.21 branch? Doesn't accept all instructions if no
> -march option given and breaks the glibc build if -march is not explicitly
> specified (Debian #618751).

Done.

> 
> Thank, Matthias
> 
> On 24.11.2010 17:39, Andreas Krebbel wrote:
>> Hi,
>> 
>> for S/390 currently mimics the GCC behaviour when no -march switch is
>> specified.  This means that it defaults to -march=g5 for -m31 and to
>> -march=z900 for -m64.  Due to that the vers1 testcase currently fails
>> when building GCC with a different default -march argument since it
>> relies on an "as" execution without -march accepting all valid
>> instructions.
>> 
>> The attached patch fixes this by defaulting to the highest CPU and the
>> most generic mode (z/Architecture mode).  For S/390 this is the most
>> generic instruction set containing all possible instructions.
>> 
>> Tested on s390 and s390x. The vers1 testcase is fixed with that change.
>> 
>> I'll commit the patch tomorrow if nobody objects.
>> 
>> Bye,
>> 
>> -Andreas-
>> 
>> 
>> 2010-11-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
>> 
>> 	* config/tc-s390.c (current_cpu): Initialize with latest CPU.
>> 	(init_default_arch): Default to z/Architecture mode if CPU provides it.
>> 	Remove the check setting the CPU default.
>> 
>> 	
>> 2010-11-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
>> 
>> 	* opcode/s390.h (enum s390_opcode_cpu_val): Add S390_OPCODE_MAXCPU.
>> 
>> 
>> Index: gas/config/tc-s390.c
>> ===================================================================
>> --- gas/config/tc-s390.c.orig
>> +++ gas/config/tc-s390.c
>> @@ -38,8 +38,11 @@ static char *default_arch = DEFAULT_ARCH
>> /* Either 32 or 64, selects file format.  */
>> static int s390_arch_size = 0;
>> 
>> +/* If no -march option was given default to the highest available CPU.
>> +   Since with S/390 a newer CPU always supports everything from its
>> +   predecessors this will accept every valid asm input.  */
>> +static unsigned int current_cpu = S390_OPCODE_MAXCPU - 1;
>> static unsigned int current_mode_mask = 0;
>> -static unsigned int current_cpu = -1U;
>> 
>> /* Whether to use user friendly register names. Default is TRUE.  */
>> #ifndef TARGET_REG_NAMES_P
>> @@ -328,18 +331,12 @@ init_default_arch (void)
>> 
>>   if (current_mode_mask == 0)
>>     {
>> -      if (s390_arch_size == 32)
>> +      /* Default to z/Architecture mode if the CPU supports it.  */
>> +      if (current_cpu < S390_OPCODE_Z900)
>> 	current_mode_mask = 1 << S390_OPCODE_ESA;
>>       else
>> 	current_mode_mask = 1 << S390_OPCODE_ZARCH;
>>     }
>> -  if (current_cpu == -1U)
>> -    {
>> -      if (current_mode_mask == (1 << S390_OPCODE_ESA))
>> -	current_cpu = S390_OPCODE_G5;
>> -      else
>> -	current_cpu = S390_OPCODE_Z900;
>> -    }
>> }
>> 
>> /* Called by TARGET_FORMAT.  */
>> Index: include/opcode/s390.h
>> ===================================================================
>> --- include/opcode/s390.h.orig
>> +++ include/opcode/s390.h
>> @@ -39,7 +39,8 @@ enum s390_opcode_cpu_val
>>     S390_OPCODE_Z9_109,
>>     S390_OPCODE_Z9_EC,
>>     S390_OPCODE_Z10,
>> -    S390_OPCODE_Z196
>> +    S390_OPCODE_Z196,
>> +    S390_OPCODE_MAXCPU
>>   };
>> 
>> /* The opcode table is an array of struct s390_opcode.  */
> 

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

end of thread, other threads:[~2011-03-23 16:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-24 16:39 [PATCH] S/390: Make as to accept all instructions if no -march option given Andreas Krebbel
2011-03-22 22:08 ` Matthias Klose
2011-03-23 16:02   ` Tristan Gingold

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