Skip to content

Conversation

@jasondavies
Copy link
Contributor

No description provided.

@jasondavies
Copy link
Contributor Author

OK, now a new error: LLVM ERROR: Cannot select: intrinsic %llvm.arm.neon.sha1h.

This is when running TARGET=aarch64-unknown-linux-gnu cargo test.

@jasondavies
Copy link
Contributor Author

Oh wait, I probably need to set target_feature crypto.

@jasondavies
Copy link
Contributor Author

Nope, that wasn't it.

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 22, 2018

Try with RUSTFLAGS="-C target-feature=+neon", depending on the ARM target you are testing (arm vs armv7 vs armv8 vs aarch64vs.. ) you might need to enable a "baseline" feature to get these to work.

#[link_name = "llvm.aarch64.neon.fminv.f64.v2f64"]
fn vminvq_f64_(a: float64x2_t) -> f64;

#[link_name = "llvm.arm.neon.sha1h"]
Copy link
Contributor

Choose a reason for hiding this comment

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

llvm.arm.neon hints that they do belong in the coresimd/arm/neon.rs module

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, good! I wasn't sure if crypto.rs would make more sense.


/// SHA1 hash update accelerator, choose.
#[inline]
#[target_feature(enable = "neon")]
Copy link
Contributor

Choose a reason for hiding this comment

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

have you tried enabling "neon,crypto" here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

they probably just require the crypto feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, (I did #[target_feature(enable = "neon", enable = "crypto")]). No luck.

@jasondavies
Copy link
Contributor Author

RUSTFLAGS="-C target-feature=+neon"

Didn't help, unfortunately.

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 22, 2018

So I'll give these a try tomorrow (gotta sleep now), but what you can do in the meantime is check what clang does for these, in particular, clang / llvm tests, what features, or -mattr do they enable to compile the tests for these intrinsics, and try those.

@jasondavies
Copy link
Contributor Author

Turns out I should have been using llvm.aarch64.crypto.sha1h! I guess it should be in crypto.rs after all.

#[inline]
#[target_feature(enable = "crypto")]
#[cfg_attr(test, assert_instr(sha1su0))]
pub unsafe fn vsha1su0q_u32(w0_3: u32x4, w4_7: u32x4, w8_11: u32x4) -> u32x4 {
Copy link
Member

Choose a reason for hiding this comment

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

I think these should use the uint32x4_t types nowadays, right @gnzlbg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Fixed.

@alexcrichton
Copy link
Member

Thanks! Mind running rustfmt? After that I think this is good to go

@jasondavies
Copy link
Contributor Author

I also added AES for completeness. Note that there are currently no tests (other than assert_instr).

@jasondavies jasondavies changed the title Add support for AArch64 SHA extensions [WIP]. Add support for AArch64 SHA extensions. Mar 23, 2018
@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 23, 2018

@alexcrichton let's wait for the tests here :D But @jasondavies this looks really good, keep it up!

@alexcrichton
Copy link
Member

Oh oops sorry, I misread!

@jasondavies
Copy link
Contributor Author

Tests added.

let r: u8x16 = vaeseq_u8(data, key).into_bits();
assert_eq!(
r,
u8x16::new(
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: no need to do this, but if you want to manually format these next time just put them in a variable and tell rustfmt to skip these:

#[cfg_attr(rustfmt, skip)]
let r = u8x16::new(
    1, 2, 3, 4, 5, 6, 7, 8
    9, 10, 11, 12, 13, 14, 15
);

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 27, 2018

LGTM. I've restarted the SDE build bot in case the failure was spurious, and the rustfmt build bot is failing (maybe you need to rustup update to use the latest rustfmt?). Once these two are green this can be merged.

@jasondavies
Copy link
Contributor Author

Thanks, I did notice that but wasn't sure if I should be changing so many files just to satisfy rustfmt for this PR. Just pushed a commit that should fix it, after running cargo fmt.

@alexcrichton
Copy link
Member

Thanks! I think that recent nightlies have broken CI here for i128, mind removing that feature listed while you're at it?

@alexcrichton
Copy link
Member

Hm a new test is failing, I wonder if that's related to the formatting changes by accident?

@jasondavies
Copy link
Contributor Author

Maybe I should revert the rustfmt commit and see if it passes?

@alexcrichton
Copy link
Member

Sure!

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 27, 2018

Which test is failing? The Intel SDE build bot was already failing before the formatting changes, and AFAICT this PR only touches AArch64 anyways :/

@jasondavies
Copy link
Contributor Author

Yeah it was just the SDE one. I guess I should just kill the last revert commit in that case and this should be ready to merge.

@jasondavies
Copy link
Contributor Author

The formatting changes touch a whole bunch of files but I agree it would be a bit worrying if formatting changes caused any test failures.

@jasondavies
Copy link
Contributor Author

OK, done.

@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 27, 2018

This is the build bot where SDE is running without the formatting changes: https://travis-ci.org/rust-lang-nursery/stdsimd/jobs/358879191

If that still fails, let's just merge this and fix SDE afterwards. Maybe something on nightly has changed that breaks SDE, or maybe we just need to update SDE to a newer version, but none of these are this PRs fault.

@jasondavies
Copy link
Contributor Author

Looks like the SDE build with no formatting changes failed.

@gnzlbg gnzlbg merged commit ffdf2f6 into rust-lang:master Mar 27, 2018
@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 27, 2018

The last PR was 4 days ago and back then everything was green so something in the last couple of nightlies might have broken it :/

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