Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/int any size #5

Closed
wants to merge 18 commits into from
Closed

Feature/int any size #5

wants to merge 18 commits into from

Conversation

antoyo
Copy link

@antoyo antoyo commented Oct 20, 2021

No description provided.

antoyo and others added 18 commits May 23, 2021 12:45
2021-05-20  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/96089
            * docs/topics/compatibility.rst (LIBGCCJIT_ABI_19): New ABI
            tag.
            * docs/topics/expressions.rst: Add documentation for the
            function gcc_jit_global_set_initializer_value.
            * jit-playback.c: New function (new_global_with_value).
            * jit-playback.h: New function (new_global_with_value).
            * jit-recording.c: Add support for setting a value to a
            global variable.
            * jit-recording.h: New function (set_initializer_value) and
            new field m_initializer_value.
            * libgccjit.c: New macro RETURN_IF_FAIL_PRINTF5 and new
            function (gcc_jit_global_set_initializer_value).
            * libgccjit.h: New function (gcc_jit_global_set_initializer_value).
            * libgccjit.map (LIBGCCJIT_ABI_19): New ABI tag.

    gcc/testsuite/
            PR target/96089
            * jit.dg/test-global-set-initializer.c: Add test for the new
            function (gcc_jit_global_set_initializer_value).

Signed-off-by: Antoni Boucher <[email protected]>
2021-05-19  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/100688
            * docs/topics/compatibility.rst (LIBGCCJIT_ABI_18): New ABI
            tag.
            * docs/topics/expressions.rst: Add documentation for the
            function gcc_jit_lvalue_set_link_section.
            * jit-playback.h: New function (set_link_section) and
            rvalue::m_inner protected.
            * jit-recording.c: New function (set_link_section) and
            support for setting the link section.
            * jit-recording.h: New function (set_link_section) and new
            field m_link_section.
            * libgccjit.c: New function (gcc_jit_lvalue_set_link_section).
            * libgccjit.h: New function (gcc_jit_lvalue_set_link_section).
            * libgccjit.map (LIBGCCJIT_ABI_18): New ABI tag.

    gcc/testsuite/
            PR target/100688
            * jit.dg/all-non-failing-tests.h: Add test-link-section.c.
            * jit.dg/test-link_section.c: New test.

Signed-off-by: Antoni Boucher <[email protected]>
…325]

2021-05-18  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/95325
            * docs/topics/types.rst: Add documentation for the new types
            GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T,
            GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T,
            GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T,
            GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T.
            * jit-playback.c: Add support for the sized integer types.
            * jit-recording.c: Add support for the sized integer types.
            * libgccjit.h (GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T,
            GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T,
            GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T,
            GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T):
            New enum variants for gcc_jit_types.
    gcc/testsuite/
            PR target/95325
            * jit.dg/test-types.c: Add tests for sized integer types.

Signed-off-by: Antoni Boucher <[email protected]>
2021-05-18  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/95415
            * docs/topics/compatibility.rst (LIBGCCJIT_ABI_17): New ABI
            tag.
            * docs/topics/expressions.rst: Add document for the function
            gcc_jit_lvalue_set_tls_model.
            * jit-playback.h: New function (set_tls_model) and make
            rvalue::m_inner public.
            * jit-recording.c: New function (set_tls_model), new
            variables (tls_models and tls_model_enum_strings) and support
            for setting the tls model.
            * jit-recording.h: New function (set_tls_model) and new
            field m_tls_model.
            * libgccjit.c: New function (gcc_jit_lvalue_set_tls_model).
            * libgccjit.h: New function (gcc_jit_lvalue_set_tls_model)
            and new enum (gcc_jit_tls_model).
            * libgccjit.map (LIBGCCJIT_ABI_17): New ABI tag.

    gcc/testsuite/
            PR target/95415
            * jit.dg/all-non-failing-tests.h: Add test-tls.c.
            * jit.dg/test-tls.c: New test.

Signed-off-by: Antoni Boucher <[email protected]>
2021-05-17  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/PR96066
            PR target/PR96067
            * jit-builtins.c: Implement missing types for builtins.
            * jit-recording.c:: Allow sending a volatile const void * as
            argument.
    gcc/testsuite/
            PR target/PR96066
            PR target/PR96067
            * jit.dg/all-non-failing-tests.h: Add test-builtin-types.c.
            * jit.dg/test-builtin-types.c

Signed-off-by: Antoni Boucher <[email protected]>
2020-09-1  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/96889
            * docs/topics/compatibility.rst (LIBGCCJIT_ABI_16): New ABI tag.
            * docs/topics/functions.rst: Add documentation for the
            functions gcc_jit_function_get_return_type and
            gcc_jit_function_get_param_count
            * docs/topics/types.rst: Add documentation for the functions
            gcc_jit_function_type_get_return_type,
            gcc_jit_function_type_get_param_count,
            gcc_jit_function_type_get_param_type,
            gcc_jit_type_unqualified, gcc_jit_type_is_array,
            gcc_jit_type_is_bool,
            gcc_jit_type_is_function_ptr_type,
            gcc_jit_type_is_integral, gcc_jit_type_is_pointer,
            gcc_jit_type_is_vector,
            gcc_jit_vector_type_get_element_type,
            gcc_jit_vector_type_get_num_units,
            gcc_jit_struct_get_field, gcc_jit_type_is_struct,
            and gcc_jit_struct_get_field_count
            * libgccjit.c:
            (gcc_jit_function_get_return_type, gcc_jit_function_get_param_count,
            gcc_jit_function_type_get_return_type,
            gcc_jit_function_type_get_param_count,
            gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified,
            gcc_jit_type_is_array, gcc_jit_type_is_bool,
            gcc_jit_type_is_function_ptr_type, gcc_jit_type_is_integral,
            gcc_jit_type_is_pointer, gcc_jit_type_is_vector,
            gcc_jit_vector_type_get_element_type,
            gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field,
            gcc_jit_type_is_struct, gcc_jit_struct_get_field_count): New
            functions.
            (struct gcc_jit_function_type, struct gcc_jit_vector_type):
            New types.
            * libgccjit.h:
            (gcc_jit_function_get_return_type, gcc_jit_function_get_param_count,
            gcc_jit_function_type_get_return_type,
            gcc_jit_function_type_get_param_count,
            gcc_jit_function_type_get_param_type, gcc_jit_type_unqualified,
            gcc_jit_type_is_array, gcc_jit_type_is_bool,
            gcc_jit_type_is_function_ptr_type, gcc_jit_type_is_integral,
            gcc_jit_type_is_pointer, gcc_jit_type_is_vector,
            gcc_jit_vector_type_get_element_type,
            gcc_jit_vector_type_get_num_units, gcc_jit_struct_get_field,
            gcc_jit_type_is_struct, gcc_jit_struct_get_field_count): New
            function declarations.
            (struct gcc_jit_function_type, struct gcc_jit_vector_type):
            New types.
            * jit-recording.h: New functions (is_struct and is_vector)
            * libgccjit.map (LIBGCCJIT_ABI_16): New ABI tag.

    gcc/testsuite/
            PR target/96889
            * jit.dg/all-non-failing-tests.h: Add test-reflection.c.
            * jit.dg/test-reflection.c: New test.

Signed-off-by: Antoni Boucher <[email protected]>
2020-07-12  Antoni Boucher  <[email protected]>

gcc/jit/
	PR target/95498
	* jit-playback.c: Add support to handle truncation and extension
	in the convert function.

gcc/testsuite/
	PR target/95498
	* jit.dg/all-non-failing-tests.h: New test.
	* jit.dg/test-cast.c: New test.

Signed-off-by: Antoni Boucher <[email protected]>
Build and upload artifact on GitHub Actions
…325]

2021-05-18  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/95325
            * docs/topics/types.rst: Add documentation for the new types
            GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T,
            GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T,
            GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T,
            GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T.
            * jit-builtins.c: Add support for BT_UINT128.
            * jit-playback.c: Add support for the sized integer types.
            * jit-recording.c: Add support for the sized integer types.
            * libgccjit.h (GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T,
            GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T,
            GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T,
            GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T):
            New enum variants for gcc_jit_types.
    gcc/testsuite/
            PR target/95325
            * jit.dg/test-types.c: Add tests for sized integer types.

Signed-off-by: Antoni Boucher <[email protected]>
TODO: fail if global kind is imported
TODO: doc

2021-05-20  Antoni Boucher  <[email protected]>

    gcc/jit/
            PR target/96089
            * docs/topics/compatibility.rst (LIBGCCJIT_ABI_19): New ABI
            tag.
            * docs/topics/expressions.rst: Add documentation for the
            function gcc_jit_global_set_initializer_value.
            * jit-playback.c: New functions (new_global_with_value,
            set_global_initial_value, new_rvalue_from_struct, new_rvalue_from_array).
            * jit-playback.h: New functions (new_global_with_value,
            set_global_initial_value, new_rvalue_from_struct, new_rvalue_from_array).
            * jit-recording.c: Add support for setting a value to a
            global variable and new methods
            (global_initializer::write_reproducer,
            global_initializer::make_debug_string,
            global_initializer::write_to_dump,
            global_initializer::replay_into,
            context::new_global_value_initializer,
            memento_of_new_rvalue_from_struct::write_reproducer,
            memento_of_new_rvalue_from_struct::make_debug_string,
            memento_of_new_rvalue_from_struct::visit_children,
            memento_of_new_rvalue_from_struct::replay_into,
            memento_of_new_rvalue_from_struct::
              memento_of_new_rvalue_from_struct,
            context::new_rvalue_from_struct,
            memento_of_new_rvalue_from_array::write_reproducer,
            memento_of_new_rvalue_from_array::make_debug_string,
            memento_of_new_rvalue_from_array::visit_children,
            memento_of_new_rvalue_from_array::replay_into,
            memento_of_new_rvalue_from_array::
              memento_of_new_rvalue_from_array,
            new_rvalue_from_array).
            * jit-recording.h: New functions (set_initializer_value,
            new_global_value_initializer, new_rvalue_from_struct, new_rvalue_from_array),
            new field m_initializer_value and new classes (global_initializer,
            memento_of_new_rvalue_from_struct, memento_of_new_rvalue_from_array).
            * libgccjit.c: New macro RETURN_IF_FAIL_PRINTF5 and new
            functions (gcc_jit_global_set_initializer_value,
            gcc_jit_context_new_rvalue_from_struct,
            gcc_jit_context_new_rvalue_from_array).
            * libgccjit.h: New functions (gcc_jit_global_set_initializer_value,
            gcc_jit_context_new_rvalue_from_struct,
            gcc_jit_context_new_rvalue_from_array).
            * libgccjit.map (LIBGCCJIT_ABI_19): New ABI tag.

    gcc/testsuite/
            PR target/96089
            * jit.dg/test-global-set-initializer.c: Add test for the new
            function (gcc_jit_global_set_initializer_value).
@antoyo antoyo closed this Mar 29, 2022
antoyo pushed a commit that referenced this pull request Apr 13, 2022
Here we weren't respecting SFINAE when evaluating a call to a consteval
function, which caused us to reject the new testcase below.  This patch
fixes this by making build_over_call use the SFINAE-friendly version of
cxx_constant_value.

This change causes us to no longer diagnose ahead of time a couple of
non-constant non-dependent consteval calls in consteval-if2.C with
-fchecking=2.  These errors were apparently coming from the call to
fold_non_dependent_expr in build_non_dependent_expr (for the RHS of the +=)
despite complain=tf_none being passed.  Now that build_over_call respects
the value of complain during constant evaluation of a consteval call,
the errors are gone.

That the errors are also gone without -fchecking=2 is a regression caused
by r12-7264-gc19f317a78c0e4 and is the subject of PR104620.  As described
in comment #5, I think it's basically an accident that we were diagnosing
these two calls correctly before r12-7264, so perhaps we can live without
these errors for GCC 12.  Thus this patch just XFAILs the two tests.

	PR c++/104620

gcc/cp/ChangeLog:

	* call.cc (build_over_call): Use cxx_constant_value_sfinae
	instead of cxx_constant_value to evaluate a consteval call.
	* constexpr.cc (cxx_constant_value_sfinae): Add decl parameter
	and pass it to cxx_eval_outermost_constant_expr.
	* cp-tree.h (cxx_constant_value_sfinae): Add decl parameter.
	* pt.cc (fold_targs_r): Pass NULL_TREE as decl parameter to
	cxx_constant_value_sfinae.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/consteval-if2.C: XFAIL two dg-error tests where
	the argument to the non-constant non-dependent consteval call is
	wrapped by NON_DEPENDENT_EXPR.
	* g++.dg/cpp2a/consteval30.C: New test.
antoyo pushed a commit that referenced this pull request Nov 21, 2024
This patch folds svindex with constant arguments into a vector series.
We implemented this in svindex_impl::fold using the function build_vec_series.
For example,
svuint64_t f1 ()
{
  return svindex_u642 (10, 3);
}
compiled with -O2 -march=armv8.2-a+sve, is folded to {10, 13, 16, ...}
in the gimple pass lower.
This optimization benefits cases where svindex is used in combination with
other gimple-level optimizations.
For example,
svuint64_t f2 ()
{
    return svmul_x (svptrue_b64 (), svindex_u64 (10, 3), 5);
}
has previously been compiled to
f2:
        index   z0.d, #10, #3
        mul     z0.d, z0.d, #5
        ret
Now, it is compiled to
f2:
        mov     x0, 50
        index   z0.d, x0, #15
        ret

We added test cases checking
- the application of the transform during gimple for constant arguments,
- the interaction with another gimple-level optimization.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Jennifer Schmitz <[email protected]>

gcc/
	* config/aarch64/aarch64-sve-builtins-base.cc
	(svindex_impl::fold): Add constant folding.

gcc/testsuite/
	* gcc.target/aarch64/sve/index_const_fold.c: New test.
antoyo pushed a commit that referenced this pull request Nov 21, 2024
We can make use of the integrated rotate step of the XAR instruction
to implement most vector integer rotates, as long we zero out one
of the input registers for it.  This allows for a lower-latency sequence
than the fallback SHL+USRA, especially when we can hoist the zeroing operation
away from loops and hot parts.  This should be safe to do for 64-bit vectors
as well even though the XAR instructions operate on 128-bit values, as the
bottom 64-bit results is later accessed through the right subregs.

This strategy is used whenever we have XAR instructions, the logic
in aarch64_emit_opt_vec_rotate is adjusted to resort to
expand_rotate_as_vec_perm only when it's expected to generate a single REV*
instruction or when XAR instructions are not present.

With this patch we can gerate for the input:
v4si
G1 (v4si r)
{
    return (r >> 23) | (r << 9);
}

v8qi
G2 (v8qi r)
{
  return (r << 3) | (r >> 5);
}
the assembly for +sve2:
G1:
        movi    v31.4s, 0
        xar     z0.s, z0.s, z31.s, #23
        ret

G2:
        movi    v31.4s, 0
        xar     z0.b, z0.b, z31.b, #5
        ret

instead of the current:
G1:
        shl     v31.4s, v0.4s, 9
        usra    v31.4s, v0.4s, 23
        mov     v0.16b, v31.16b
        ret
G2:
        shl     v31.8b, v0.8b, 3
        usra    v31.8b, v0.8b, 5
        mov     v0.8b, v31.8b
        ret

Bootstrapped and tested on aarch64-none-linux-gnu.

Signed-off-by: Kyrylo Tkachov <[email protected]>

gcc/

	* config/aarch64/aarch64.cc (aarch64_emit_opt_vec_rotate): Add
	generation of XAR sequences when possible.

gcc/testsuite/

	* gcc.target/aarch64/rotate_xar_1.c: New test.
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.

1 participant