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.

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 {

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.

2 participants