Skip to content

Conversation

FractalFir
Copy link

This patch adds gcc_jit_context_new_rvalue_from_int128, gcc_jit_context_new_rvalue_from_char, gcc_jit_context_new_rvalue_from_short and gcc_jit_context_new_rvalue_from_float .

This should hopefully allow us to create constant 128 bit ints more easily. The other functions are there for potential memory savings - rvalues backed by char's / shorts / floats instead of the larger types could be a bit smaller than their larger counterparts.

antoyo and others added 30 commits June 10, 2025 09:12
gcc/jit/ChangeLog:

	* jit-playback.cc (add_error, add_error_va): Send DK_ERROR to
	add_error_va.
	(add_diagnostic): Call add_diagnostic instead of add_error.
	* jit-recording.cc (DEFINE_DIAGNOSTIC_KIND): New define.
	(recording::context::add_diagnostic): New function.
	(recording::context::add_error): Send DK_ERROR to add_error_va.
	(recording::context::add_error_va): New parameter diagnostic_kind.
	* jit-recording.h (add_diagnostic): New function.
	(add_error_va): New parameter diagnostic_kind.
	* libgccjit.cc (jit_error): Send DK_ERROR to add_error_va.

gcc/testsuite/ChangeLog:

	* jit.dg/test-error-array-bounds.c: Fix test.
Including:
1. field
2. function
3. rvalue
Fix _Float16 and __float128 support for jit. Add _Float32 and _Float64 support for jit

Add Float32 and Float54, update test-types.c
Update path: disable 128 bit integers for testing purposes

Target info extended with supported target dependent types

update patches

Replace unordered_map with unordered_set

update patches
For gcc_jit_type_is_float() add unit tests and function description

Rename gcc_jit_type_is_float to gcc_jit_type_is_floating

improve description

Remove unecessary spaces
Related to PR d/110516 but for libgccjit.

2024-01-03  Martin Rodriguez Reboredo  <[email protected]>

gcc/jit/
	* jit-playback.cc: Append TREE_THIS_VOLATILE and TREE_SIDE_EFFECTS to
	a dereference if underlying type is volatile.

Signed-off-by: Martin Rodriguez Reboredo <[email protected]>
gcc/jit/ChangeLog:

	* jit-recording.h: Remove memento_of_get_const::accepts_writes_from,
	memento_of_get_type::is_same_type_as: new method.

gcc/testsuite/ChangeLog:

	* jit.dg/all-non-failing-tests.h: Add test-const-pointer-argument.c.
	* jit.dg/test-const-pointer-argument.c: New test.
This issue happened when compiling rustc with rustc_codegen_gcc, more
specifically when compiling its rustc_parse crate.

gcc/jit/
	PR target/105827
	* dummy-frontend.cc: Fix lang_tree_node.
	* jit-common.h: New function (jit_tree_chain_next) used by
	lang_tree_node.
Copy link

@antoyo antoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

Could you please add some tests around here.

I have some concerns especially about 128-bit integers: they seem to be handled differently in GCC.
For these tests, you will need the #ifdef __SIZEOF_INT128__.

@@ -2058,7 +2087,20 @@ gcc_jit_context_new_rvalue_from_long (gcc_jit_context *ctxt,
return ((gcc_jit_rvalue *)ctxt
->new_rvalue_from_const <long> (numeric_type, value));
}
#ifdef __SIZEOF_INT128__
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the way we should handle the case where 128-bit integers are not supported is by adding an error and returning NULL: so the function would still be defined on targets that don't support them.

@@ -2111,6 +2153,18 @@ gcc_jit_context_new_rvalue_from_double (gcc_jit_context *ctxt,
return ((gcc_jit_rvalue *)ctxt
->new_rvalue_from_const <double> (numeric_type, value));
}
gcc_jit_rvalue *
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gcc_jit_rvalue *
gcc_jit_rvalue *

@@ -373,3 +373,10 @@ LIBGCCJIT_ABI_42 {
global:
gcc_jit_lvalue_add_attribute;
} LIBGCCJIT_ABI_41;
LIBGCCJIT_ABI_43 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LIBGCCJIT_ABI_43 {
LIBGCCJIT_ABI_43 {

@antoyo antoyo force-pushed the master branch 2 times, most recently from 2ae4b0e to 4a8c8ec Compare August 28, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants