public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgccjit: Add count zeroes builtins to ensure_optimization_builtins_exist
@ 2024-02-15 16:32 Antoni Boucher
  2024-02-15 16:56 ` David Malcolm
  0 siblings, 1 reply; 2+ messages in thread
From: Antoni Boucher @ 2024-02-15 16:32 UTC (permalink / raw)
  To: gcc-patches, jit; +Cc: David Malcolm

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

Hi.
This patch adds some missing builtins that can be generated by
optimizations.
I'm not sure how to add a test for this one.
Do you know the C code that can be optimized to a builtin_clz?
Thanks for the review.

[-- Attachment #2: 0001-libgccjit-Add-count-zeroes-builtins-to-ensure_optimi.patch --]
[-- Type: text/x-patch, Size: 1189 bytes --]

From 578cb40bd333abf57e5b3b08d3453bdcf7ad80b5 Mon Sep 17 00:00:00 2001
From: Antoni Boucher <bouanto@zoho.com>
Date: Thu, 8 Feb 2024 21:48:27 -0500
Subject: [PATCH] libgccjit: Add count zeroes builtins to
 ensure_optimization_builtins_exist

gcc/jit/ChangeLog:

	* jit-builtins.cc (ensure_optimization_builtins_exist): Add
	missing builtins.
---
 gcc/jit/jit-builtins.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/jit/jit-builtins.cc b/gcc/jit/jit-builtins.cc
index e0bb24738dd..0c13c8db586 100644
--- a/gcc/jit/jit-builtins.cc
+++ b/gcc/jit/jit-builtins.cc
@@ -612,6 +612,12 @@ builtins_manager::ensure_optimization_builtins_exist ()
   (void)get_builtin_function_by_id (BUILT_IN_POPCOUNT);
   (void)get_builtin_function_by_id (BUILT_IN_POPCOUNTL);
   (void)get_builtin_function_by_id (BUILT_IN_POPCOUNTLL);
+  (void)get_builtin_function_by_id (BUILT_IN_CLZ);
+  (void)get_builtin_function_by_id (BUILT_IN_CTZ);
+  (void)get_builtin_function_by_id (BUILT_IN_CLZL);
+  (void)get_builtin_function_by_id (BUILT_IN_CTZL);
+  (void)get_builtin_function_by_id (BUILT_IN_CLZLL);
+  (void)get_builtin_function_by_id (BUILT_IN_CTZLL);
 }
 
 /* Playback support.  */
-- 
2.43.0


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

* Re: [PATCH] libgccjit: Add count zeroes builtins to ensure_optimization_builtins_exist
  2024-02-15 16:32 [PATCH] libgccjit: Add count zeroes builtins to ensure_optimization_builtins_exist Antoni Boucher
@ 2024-02-15 16:56 ` David Malcolm
  0 siblings, 0 replies; 2+ messages in thread
From: David Malcolm @ 2024-02-15 16:56 UTC (permalink / raw)
  To: Antoni Boucher, gcc-patches, jit

On Thu, 2024-02-15 at 11:32 -0500, Antoni Boucher wrote:
> Hi.
> This patch adds some missing builtins that can be generated by
> optimizations.
> I'm not sure how to add a test for this one.
> Do you know the C code that can be optimized to a builtin_clz?

I don't.  Given a reproducer we could probably figure it out, but it's
probably not worth bothering.

> Thanks for the review.

Thanks, looks good to me for trunk.

Dave


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

end of thread, other threads:[~2024-02-15 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 16:32 [PATCH] libgccjit: Add count zeroes builtins to ensure_optimization_builtins_exist Antoni Boucher
2024-02-15 16:56 ` David Malcolm

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