public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989]
@ 2023-08-09 18:19 Jakub Jelinek
  2023-08-23 15:00 ` Patch ping " Jakub Jelinek
  2023-08-23 15:06 ` Uros Bizjak
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2023-08-09 18:19 UTC (permalink / raw)
  To: Uros Bizjak, hjl.tools; +Cc: gcc-patches

Hi!

The following patch enables _BitInt support on x86-64, the only
target which has _BitInt specified in psABI.

2023-08-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/102989
	* config/i386/i386.cc (classify_argument): Handle BITINT_TYPE.
	(ix86_bitint_type_info): New function.
	(TARGET_C_BITINT_TYPE_INFO): Redefine.

--- gcc/config/i386/i386.cc.jj	2023-08-08 15:55:05.627176766 +0200
+++ gcc/config/i386/i386.cc	2023-08-08 16:12:02.308940091 +0200
@@ -2121,7 +2121,8 @@ classify_argument (machine_mode mode, co
 	return 0;
     }
 
-  if (type && AGGREGATE_TYPE_P (type))
+  if (type && (AGGREGATE_TYPE_P (type)
+	       || (TREE_CODE (type) == BITINT_TYPE && words > 1)))
     {
       int i;
       tree field;
@@ -2270,6 +2271,14 @@ classify_argument (machine_mode mode, co
 	    }
 	  break;
 
+	case BITINT_TYPE:
+	  /* _BitInt(N) for N > 64 is passed as structure containing
+	     (N + 63) / 64 64-bit elements.  */
+	  if (words > 2)
+	    return 0;
+	  classes[0] = classes[1] = X86_64_INTEGER_CLASS;
+	  return 2;
+
 	default:
 	  gcc_unreachable ();
 	}
@@ -24842,6 +24851,26 @@ ix86_get_excess_precision (enum excess_p
   return FLT_EVAL_METHOD_UNPREDICTABLE;
 }
 
+/* Return true if _BitInt(N) is supported and fill details about it into
+   *INFO.  */
+bool
+ix86_bitint_type_info (int n, struct bitint_info *info)
+{
+  if (!TARGET_64BIT)
+    return false;
+  if (n <= 8)
+    info->limb_mode = QImode;
+  else if (n <= 16)
+    info->limb_mode = HImode;
+  else if (n <= 32)
+    info->limb_mode = SImode;
+  else
+    info->limb_mode = DImode;
+  info->big_endian = false;
+  info->extended = false;
+  return true;
+}
+
 /* Implement PUSH_ROUNDING.  On 386, we have pushw instruction that
    decrements by exactly 2 no matter what the position was, there is no pushb.
 
@@ -25446,6 +25475,8 @@ ix86_run_selftests (void)
 
 #undef TARGET_C_EXCESS_PRECISION
 #define TARGET_C_EXCESS_PRECISION ix86_get_excess_precision
+#undef TARGET_C_BITINT_TYPE_INFO
+#define TARGET_C_BITINT_TYPE_INFO ix86_bitint_type_info
 #undef TARGET_PROMOTE_PROTOTYPES
 #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
 #undef TARGET_PUSH_ARGUMENT

	Jakub


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

* Patch ping Re: [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989]
  2023-08-09 18:19 [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989] Jakub Jelinek
@ 2023-08-23 15:00 ` Jakub Jelinek
  2023-08-23 15:06 ` Uros Bizjak
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2023-08-23 15:00 UTC (permalink / raw)
  To: Uros Bizjak, hjl.tools, gcc-patches

Hi!

Now that Richi has acked all the middle-end _BitInt patches (but am
deferring committing those until also the C FE and libgcc patches are
approved), I'd like to ping this patch.

Thanks!

On Wed, Aug 09, 2023 at 08:19:41PM +0200, Jakub Jelinek via Gcc-patches wrote:
> The following patch enables _BitInt support on x86-64, the only
> target which has _BitInt specified in psABI.
> 
> 2023-08-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c/102989
> 	* config/i386/i386.cc (classify_argument): Handle BITINT_TYPE.
> 	(ix86_bitint_type_info): New function.
> 	(TARGET_C_BITINT_TYPE_INFO): Redefine.

	Jakub


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

* Re: [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989]
  2023-08-09 18:19 [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989] Jakub Jelinek
  2023-08-23 15:00 ` Patch ping " Jakub Jelinek
@ 2023-08-23 15:06 ` Uros Bizjak
  1 sibling, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2023-08-23 15:06 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: hjl.tools, gcc-patches

On Wed, Aug 9, 2023 at 8:19 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> The following patch enables _BitInt support on x86-64, the only
> target which has _BitInt specified in psABI.
>
> 2023-08-09  Jakub Jelinek  <jakub@redhat.com>
>
>         PR c/102989
>         * config/i386/i386.cc (classify_argument): Handle BITINT_TYPE.
>         (ix86_bitint_type_info): New function.
>         (TARGET_C_BITINT_TYPE_INFO): Redefine.

LGTM, with a nit.

Thanks,
Uros.

>
> --- gcc/config/i386/i386.cc.jj  2023-08-08 15:55:05.627176766 +0200
> +++ gcc/config/i386/i386.cc     2023-08-08 16:12:02.308940091 +0200
> @@ -2121,7 +2121,8 @@ classify_argument (machine_mode mode, co
>         return 0;
>      }
>
> -  if (type && AGGREGATE_TYPE_P (type))
> +  if (type && (AGGREGATE_TYPE_P (type)
> +              || (TREE_CODE (type) == BITINT_TYPE && words > 1)))
>      {
>        int i;
>        tree field;
> @@ -2270,6 +2271,14 @@ classify_argument (machine_mode mode, co
>             }
>           break;
>
> +       case BITINT_TYPE:
> +         /* _BitInt(N) for N > 64 is passed as structure containing
> +            (N + 63) / 64 64-bit elements.  */
> +         if (words > 2)
> +           return 0;
> +         classes[0] = classes[1] = X86_64_INTEGER_CLASS;
> +         return 2;
> +
>         default:
>           gcc_unreachable ();
>         }
> @@ -24842,6 +24851,26 @@ ix86_get_excess_precision (enum excess_p
>    return FLT_EVAL_METHOD_UNPREDICTABLE;
>  }
>
> +/* Return true if _BitInt(N) is supported and fill details about it into
> +   *INFO.  */

The above comment should fit into one line.

> +bool
> +ix86_bitint_type_info (int n, struct bitint_info *info)
> +{
> +  if (!TARGET_64BIT)
> +    return false;
> +  if (n <= 8)
> +    info->limb_mode = QImode;
> +  else if (n <= 16)
> +    info->limb_mode = HImode;
> +  else if (n <= 32)
> +    info->limb_mode = SImode;
> +  else
> +    info->limb_mode = DImode;
> +  info->big_endian = false;
> +  info->extended = false;
> +  return true;
> +}
> +
>  /* Implement PUSH_ROUNDING.  On 386, we have pushw instruction that
>     decrements by exactly 2 no matter what the position was, there is no pushb.
>
> @@ -25446,6 +25475,8 @@ ix86_run_selftests (void)
>
>  #undef TARGET_C_EXCESS_PRECISION
>  #define TARGET_C_EXCESS_PRECISION ix86_get_excess_precision
> +#undef TARGET_C_BITINT_TYPE_INFO
> +#define TARGET_C_BITINT_TYPE_INFO ix86_bitint_type_info
>  #undef TARGET_PROMOTE_PROTOTYPES
>  #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
>  #undef TARGET_PUSH_ARGUMENT
>
>         Jakub
>

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

end of thread, other threads:[~2023-08-23 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 18:19 [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989] Jakub Jelinek
2023-08-23 15:00 ` Patch ping " Jakub Jelinek
2023-08-23 15:06 ` Uros Bizjak

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