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

Implement __mulsi3. #251

Merged
merged 1 commit into from
Aug 3, 2018
Merged

Implement __mulsi3. #251

merged 1 commit into from
Aug 3, 2018

Conversation

dvc94ch
Copy link
Contributor

@dvc94ch dvc94ch commented Jul 27, 2018

Adds __mulsi3 intrinsic for RISCV target required when no hardware multiplication unit is available.

PR adding riscv support to rust: rust-lang/rust#52787

src/lib.rs Outdated
@@ -58,6 +58,9 @@ pub mod arm;
#[cfg(all(kernel_user_helpers, target_os = "linux", target_arch = "arm"))]
pub mod arm_linux;

#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: we'll be submitting a PR to rust-lang/rust that adds these two target architectures.

src/riscv.rs Outdated
// Implementation from gcc
// https://raw.githubusercontent.com/gcc-mirror/gcc/master/libgcc/config/epiphany/mulsi3.c
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
pub unsafe extern "C" fn __mulsi3(mut a: usize, mut b: usize) -> usize {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature should be fn(u32, u32) -> u32 to match the linked source. (iirc, "si" is used for 32-bit ops; "di" is used for 64-bit ops; etc.).

@alexcrichton
Copy link
Member

Thanks for the PR! Could this use the intrinsics! macro like other intrinsics? Other than that looks good to me!

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Aug 3, 2018

@japaric @alexcrichton Is this ok to merge? It's not required by riscv32imac-unknown-none-elf, but is if someone builds a target without the +m extension.

@alexcrichton
Copy link
Member

Thanks @dvc94ch!

@alexcrichton alexcrichton merged commit 5a7b58f into rust-lang:master Aug 3, 2018
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.

3 participants