Intrinsic: Add ctlz and ctlz_nonzero intrinsics#4467
Open
moabo3li wants to merge 3 commits intoRust-GCC:masterfrom
Open
Intrinsic: Add ctlz and ctlz_nonzero intrinsics#4467moabo3li wants to merge 3 commits intoRust-GCC:masterfrom
ctlz and ctlz_nonzero intrinsics#4467moabo3li wants to merge 3 commits intoRust-GCC:masterfrom
Conversation
Contributor
Author
|
cc @P-E-P |
ff9b24e to
a80240c
Compare
This commit introduces the `ctlz` and `ctlz_nonzero` intrinsics for counting leading zeros in integer types. The implementation includes handlers for both intrinsics, which validate input types and utilize GCC built-ins for the actual computation. Addresses: Rust-GCC#658 gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: Register ctlz and ctlz_nonzero intrinsics. * backend/rust-intrinsic-handlers.cc (ctlz_handler): Implement ctlz_handler. (ctlz_nonzero_handler): Implement ctlz_nonzero_handler. * backend/rust-intrinsic-handlers.h (ctlz_handler): Add decl for ctlz_handler. (ctlz_nonzero_handler): Add decl for ctlz_nonzero_handler. * util/rust-intrinsic-values.h: map ctlz_nonzero to its name. gcc/testsuite/ChangeLog: * rust/compile/ctlz.rs: New test. * rust/compile/ctlz_nonzero.rs: New test. * rust/execute/torture/ctlz.rs: New test. * rust/execute/torture/ctlz_nonzero.rs: New test. Signed-off-by: Mohamed Ali <mohmedali1462005@gmail.com>
gcc/testsuite/ChangeLog: * rust/execute/torture/ctlz_i16.rs: New test. * rust/execute/torture/ctlz_i32.rs: New test. * rust/execute/torture/ctlz_i64.rs: New test. * rust/execute/torture/ctlz_i8.rs: New test. * rust/execute/torture/ctlz_nonzero_i16.rs: New test. * rust/execute/torture/ctlz_nonzero_i32.rs: New test. * rust/execute/torture/ctlz_nonzero_i64.rs: New test. * rust/execute/torture/ctlz_nonzero_i8.rs: New test. * rust/execute/torture/ctlz_nonzero_u16.rs: New test. * rust/execute/torture/ctlz_nonzero_u32.rs: New test. * rust/execute/torture/ctlz_nonzero_u64.rs: New test. * rust/execute/torture/ctlz_nonzero_u8.rs: New test. * rust/execute/torture/ctlz_u16.rs: New test. * rust/execute/torture/ctlz_u32.rs: New test. * rust/execute/torture/ctlz_u64.rs: New test. * rust/execute/torture/ctlz_u8.rs: New test. Signed-off-by: Mohamed Ali <mohmedali1462005@gmail.com>
gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::parse_non_decimal_int_literal): strtoull insted strtol Signed-off-by: Mohamed Ali <mohmedali1462005@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces the
ctlzandctlz_nonzerointrinsics for counting leading zeros in integer types.The implementation includes handlers for both intrinsics, which validate input types and utilize GCC built-ins for the actual computation.
Addresses: #658
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: