Skip to content

backend: Implement write_bytes intrinsic mapping to __builtin_memset#4482

Draft
Pasta-coder wants to merge 1 commit intoRust-GCC:masterfrom
Pasta-coder:gsoc_01
Draft

backend: Implement write_bytes intrinsic mapping to __builtin_memset#4482
Pasta-coder wants to merge 1 commit intoRust-GCC:masterfrom
Pasta-coder:gsoc_01

Conversation

@Pasta-coder
Copy link
Contributor

@Pasta-coder Pasta-coder commented Mar 10, 2026

This patch adds the handler to
and registers it in the map. The handler uses the visitor pattern to extract the generic type, safely casts the value argument to an , calculates the byte count using a
(), and forwards the call to
GCC's native .

This is a required dependency for lowering the crate.

gcc/rust/ChangeLog:

* backend/rust-compile-intrinsic.cc (write_bytes_handler): New function.
(generic_intrinsics): Add  to the intrinsic dispatch map.

gcc/testsuite/ChangeLog:

* rust/compile/write_bytes.rs: New test.

This patch adds the  handler to
and registers it in the  map. The handler uses the
visitor pattern to extract the generic type, safely casts the  value
argument to an , calculates the byte count using a
 (), and forwards the call to
GCC's native .

This is a required dependency for lowering the  crate.

gcc/rust/ChangeLog:

	* backend/rust-compile-intrinsic.cc (write_bytes_handler): New function.
	(generic_intrinsics): Add  to the intrinsic dispatch map.

gcc/testsuite/ChangeLog:

	* rust/compile/write_bytes.rs: New test.

Signed-off-by: jayant chauhan <0001jayant@gmail.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.

1 participant