[05/10] Add handler for more i386_cpu_flags

Message ID 20221014091248.4920-6-haochen.jiang@intel.com
State Accepted
Headers
Series Add new Intel Sierra Forest, Grand Ridge, Granite Rapids Instructions |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Jiang, Haochen Oct. 14, 2022, 9:12 a.m. UTC
  From: Kong Lingling <lingling.kong@intel.com>

gas/ChangeLog:

	* config/tc-i386.c (cpu_flags_all_zero): Add new ARRAY_SIZE handle.
	(cpu_flags_equal): Ditto.
	(cpu_flags_and): Ditto.
	(cpu_flags_or): Ditto.
	(cpu_flags_and_not): Ditto.
---
 gas/config/tc-i386.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Jan Beulich Oct. 14, 2022, 1:53 p.m. UTC | #1
On 14.10.2022 11:12, Haochen Jiang wrote:
> From: Kong Lingling <lingling.kong@intel.com>
> 
> gas/ChangeLog:
> 
> 	* config/tc-i386.c (cpu_flags_all_zero): Add new ARRAY_SIZE handle.
> 	(cpu_flags_equal): Ditto.
> 	(cpu_flags_and): Ditto.
> 	(cpu_flags_or): Ditto.
> 	(cpu_flags_and_not): Ditto.
> ---
>  gas/config/tc-i386.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
> index 0d161d60ef..7045e18cff 100644
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -1618,6 +1618,10 @@ cpu_flags_all_zero (const union i386_cpu_flags *x)
>  {
>    switch (ARRAY_SIZE(x->array))
>      {
> +    case 5:
> +      if (x->array[4])
> +	return 0;
> +      /* Fall through.  */
>      case 4:
>        if (x->array[3])
>  	return 0;
> @@ -1643,6 +1647,10 @@ cpu_flags_equal (const union i386_cpu_flags *x,
>  {
>    switch (ARRAY_SIZE(x->array))
>      {
> +    case 5:
> +      if (x->array[4] != y->array[4])
> +	return 0;
> +      /* Fall through.  */
>      case 4:
>        if (x->array[3] != y->array[3])
>  	return 0;
> @@ -1675,6 +1683,9 @@ cpu_flags_and (i386_cpu_flags x, i386_cpu_flags y)
>  {
>    switch (ARRAY_SIZE (x.array))
>      {
> +    case 5:
> +      x.array [4] &= y.array [4];
> +      /* Fall through.  */
>      case 4:
>        x.array [3] &= y.array [3];
>        /* Fall through.  */
> @@ -1698,6 +1709,9 @@ cpu_flags_or (i386_cpu_flags x, i386_cpu_flags y)
>  {
>    switch (ARRAY_SIZE (x.array))
>      {
> +    case 5:
> +      x.array [4] |= y.array [4];
> +      /* Fall through.  */
>      case 4:
>        x.array [3] |= y.array [3];
>        /* Fall through.  */
> @@ -1721,6 +1735,9 @@ cpu_flags_and_not (i386_cpu_flags x, i386_cpu_flags y)
>  {
>    switch (ARRAY_SIZE (x.array))
>      {
> +    case 5:
> +      x.array [4] &= ~y.array [4];
> +      /* Fall through.  */
>      case 4:
>        x.array [3] &= ~y.array [3];
>        /* Fall through.  */

Not a request for action on your part, but it is high time for us to sort
this requirement of widening the bitmap by one bit for each and every new
ISA extension. I have some vague plan, but I need to find time to actually
try it out.

Jan
  

Patch

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0d161d60ef..7045e18cff 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1618,6 +1618,10 @@  cpu_flags_all_zero (const union i386_cpu_flags *x)
 {
   switch (ARRAY_SIZE(x->array))
     {
+    case 5:
+      if (x->array[4])
+	return 0;
+      /* Fall through.  */
     case 4:
       if (x->array[3])
 	return 0;
@@ -1643,6 +1647,10 @@  cpu_flags_equal (const union i386_cpu_flags *x,
 {
   switch (ARRAY_SIZE(x->array))
     {
+    case 5:
+      if (x->array[4] != y->array[4])
+	return 0;
+      /* Fall through.  */
     case 4:
       if (x->array[3] != y->array[3])
 	return 0;
@@ -1675,6 +1683,9 @@  cpu_flags_and (i386_cpu_flags x, i386_cpu_flags y)
 {
   switch (ARRAY_SIZE (x.array))
     {
+    case 5:
+      x.array [4] &= y.array [4];
+      /* Fall through.  */
     case 4:
       x.array [3] &= y.array [3];
       /* Fall through.  */
@@ -1698,6 +1709,9 @@  cpu_flags_or (i386_cpu_flags x, i386_cpu_flags y)
 {
   switch (ARRAY_SIZE (x.array))
     {
+    case 5:
+      x.array [4] |= y.array [4];
+      /* Fall through.  */
     case 4:
       x.array [3] |= y.array [3];
       /* Fall through.  */
@@ -1721,6 +1735,9 @@  cpu_flags_and_not (i386_cpu_flags x, i386_cpu_flags y)
 {
   switch (ARRAY_SIZE (x.array))
     {
+    case 5:
+      x.array [4] &= ~y.array [4];
+      /* Fall through.  */
     case 4:
       x.array [3] &= ~y.array [3];
       /* Fall through.  */