-
Notifications
You must be signed in to change notification settings - Fork 288
[mips/mips64: msa] add add_a_b intrinsic #365
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! My main comment is to try to reduce the amount of #[cfg]
as it looks like it'd be pretty difficult to otherwise maintain over time
.travis.yml
Outdated
- ci/run-docker.sh $TARGET $FEATURES | ||
- | | ||
if [ "$NORUN" == "1" ]; then | ||
cd crates/stdsimd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this use the -p
argument to avoid changing the cwd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing.
stdsimd/arch/detect/linux/auxvec.rs
Outdated
use core::mem; | ||
use _std::prelude::v1::*; | ||
use _std::fs::File; | ||
use _std::io::Read; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unfortunately will cause some problems when building in libstd itself as this doens't exist, but could this continue to use the same strategy as before?
stdsimd/arch/detect/arm.rs
Outdated
} | ||
|
||
#[cfg(not(target_os = "linux"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally not a huge fan of #[cfg]
as it can make already complicated code even more complicated, so could this continue to compile on all platforms and just statically return an error on the "wrong" platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the problem here was that the auxvec/cpuinfo modules are only available on some oses (currently only linux), but these functions should be available on all OSes and just return nothing on linux.
So IMO the entanglement here is that we have target_os modules (e.g. linux) and arch modules (e.g. aarch64) and a mixture of archs and target_oses on both. I'll try to think of something better here.
stdsimd/arch/detect/linux/auxvec.rs
Outdated
use _std::fs::File; | ||
use _std::io::Read; | ||
|
||
#[cfg(not(all(target_os = "linux", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps cfg_if!
could be used to simplify this? That could be added as a dependency and it's available in libstd as well
stdsimd/arch/detect/linux/auxvec.rs
Outdated
target_arch = "mips64"))] | ||
pub hwcap: usize, | ||
#[cfg(any(target_arch = "arm", target_arch = "powerpc64"))] | ||
pub hwcap2: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could both fields be perhaps unconditionally included to avoid the extra #[cfg]
traffic?
stdsimd/arch/detect/linux/mod.rs
Outdated
|
||
#[cfg(any(target_arch = "aarch64", target_arch = "arm", | ||
target_arch = "powerpc64", target_arch = "mips", | ||
target_arch = "mips64"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I'd prefer to avoid the #[cfg]
here, it becomes a pretty big burden to maintain over time :(
.travis.yml
Outdated
- ci/run-docker.sh $TARGET $FEATURES | ||
- | | ||
if [ "$NORUN" == "1" ]; then | ||
cd -p crates/stdsimd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry I meant -p
arguments to the cargo
commands :)
@alexcrichton So I think I managed to clean up
I don't think this is great, but I think it is better than what we had. Now, |
Alright looks good to me, thanks! We can always of course continue to tweak this over time |
Yes we will need to do so to add windows on arm support.
…On Sat 10. Mar 2018 at 19:23, Alex Crichton ***@***.***> wrote:
Alright looks good to me, thanks! We can always of course continue to
tweak this over time
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#365 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3Npo8ZPBn1KcLSM9jzJkSOAw6bNDumks5tdBoNgaJpZM4SkamW>
.
|
This PR adds a single
mips::msa
intrinsic (add_a_b
: vector add absolute values).It adds all the scaffolding for adding more mips/mips64 intrinsics "easily" in the future.
arch::mips64
modulemips
/mips64
mips
/mips64
(auxiliary vectors only)simd_test
support formips
/mips64
(requires parsing instructions as expressions instead of identifiers becauseadd_a.b
is a valid MIPS64 instruction name)The following issues are left for future PRs:
@alexcrichton I cleaned up the run-time feature detection on linux a bit because it was getting out-of-hand. I have no idea whether this might break rustc builds or not. Is there a way for me to test this? If these changes break some build bots there, we should add these build bots to our CI as well.
cc @jcowgill