Skip to content

Improve handling of function inlining a bit more - #32

Open
GuillaumeGomez wants to merge 59 commits into
rust-lang:masterfrom
GuillaumeGomez:fn-inline
Open

Improve handling of function inlining a bit more#32
GuillaumeGomez wants to merge 59 commits into
rust-lang:masterfrom
GuillaumeGomez:fn-inline

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

No description provided.

antoyo and others added 30 commits January 7, 2023 09:45
… when generating some code using target-specific builtins
gcc/config/i386:
	PR jit/TODO
	* i386-builtins.cc: New function (clear_builtin_types).

gcc/jit:
	PR jit/TODO
	* dummy-frontend.cc: Include headers target.h, jit-recording.h,
	unordered_map and string, new variables (target_function_types, and
	target_builtins_ctxt), new function (tree_type_to_jit_type).
	* jit-builtins.cc: Specify that the function types are not from
	target builtins.
	* jit-playback.cc: New argument is_target_builtin to new_function.
	* jit-playback.h
	* jit-recording.cc
	* jit-recording.h
	* libgccjit.cc
	* libgccjit.h
	* libgccjit.map

gcc/testsuite/jit.dg:
	PR jit/TODO
	* all-non-failing-tests.h
	* test-target-builtins.c
Fix compilation error when bfloat is unsupported
Add test for cold attribute in libgccjit
fixup! WIP: Add support for function attributes
Add support for returns_twice attribute in libgccjit
@antoyo
antoyo force-pushed the master branch 3 times, most recently from 5de134e to ec8ae43 Compare November 21, 2024 16:03
@antoyo
antoyo force-pushed the master branch 3 times, most recently from b8f4bbf to 04ce66d Compare April 30, 2025 16:36
@antoyo
antoyo force-pushed the master branch 2 times, most recently from 2ae4b0e to 4a8c8ec Compare August 28, 2025 15:44
@antoyo
antoyo force-pushed the master branch 5 times, most recently from 839fe51 to 28b84db Compare October 10, 2025 01:38
@antoyo
antoyo force-pushed the master branch 4 times, most recently from 7103c89 to 8cdf7b8 Compare October 28, 2025 18:15
@antoyo
antoyo force-pushed the master branch 2 times, most recently from 8960457 to efdd0a7 Compare January 30, 2026 14:46
@antoyo
antoyo force-pushed the master branch 2 times, most recently from 338d3f3 to 2e6a09a Compare February 25, 2026 14:57
@antoyo
antoyo force-pushed the master branch 4 times, most recently from f217927 to 248e431 Compare July 14, 2026 01:42
GuillaumeGomez pushed a commit to GuillaumeGomez/gcc that referenced this pull request Sep 1, 2026
…26597]

aarch64_expand_vec_perm_const_1 normalizes a permutation whose first index
selects the second operand by rotating the indices and swapping op0 and op1.
It left zero_op0_p and zero_op1_p pointing at the old operands, so the later
recognizers that consult them, aarch64_evpc_and and aarch64_evpc_tbl, read
the wrong vector.

Swap the two flags together with the operands.

For

	typedef int v4si __attribute__ ((vector_size (16)));
	v4si f (v4si x)
	{
	  const v4si m = { 4, 1, 2, 3 };
	  return __builtin_shuffle (x, (v4si) { 0, 0, 0, 0 }, m);
	}

at -O0 the AND was applied to the all-zero operand, so the function returned
{0,0,0,0} instead of {0,x1,x2,x3}:

	sub	sp, sp, rust-lang#32
	str	q0, [sp]
	adrp	x0, .LC0
	add	x0, x0, :lo12:.LC0
	ldr	q31, [x0]
	str	q31, [sp, 16]
	movi	v31.4s, 0
	fmov	s31, s31
	mov	v0.16b, v31.16b
	add	sp, sp, 32
	ret

With the fix the AND is applied to the incoming vector:

	sub	sp, sp, rust-lang#32
	str	q0, [sp]
	adrp	x0, .LC0
	add	x0, x0, :lo12:.LC0
	ldr	q31, [x0]
	str	q31, [sp, 16]
	ldr	q30, [sp]
	adrp	x0, .LC1
	add	x0, x0, :lo12:.LC1
	ldr	q31, [x0]
	and	v31.16b, v30.16b, v31.16b
	mov	v0.16b, v31.16b
	add	sp, sp, 32
	ret

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

gcc/ChangeLog:

	PR target/126597
	* config/aarch64/aarch64.cc (aarch64_expand_vec_perm_const_1): Swap
	zero_op0_p and zero_op1_p along with the operands.

gcc/testsuite/ChangeLog:

	PR target/126597
	* gcc.target/aarch64/pr126597.c: New test.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
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.

4 participants