-
Notifications
You must be signed in to change notification settings - Fork 288
[arm] bitwise manipulation instructions #29
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
c9bcaca
to
483ca25
Compare
483ca25
to
4c54e9c
Compare
The code-gen tests for abm, bmi and bmi2 where failing so i've fixed those here. |
I don't have llc for arm installed, could somebody run: llc -march=arm -mattr=help
llc -march=armv7 -mattr=help
llc -march=aarch64 -mattr=help and post the output here? I don't know if its possible to use |
@alexcrichton the tests are failing on travis, but they pass on my machine (MacOSX). Could we also test on Mac? The problem seems to be, that on linux the assembler emits, for example, |
4c54e9c
to
799b92c
Compare
The last commit truncates the instructions in the assert-instr macro with the length of the expected instruction to omit the |
2666dd1
to
75c9e0e
Compare
When comparing the assembly instructions against the expected instruction, depending on the platform, we might end up with `tzcntl != tzcnt`. This commit truncates the instructions to the length of the expected instruction, such that `tzcntl => tzcnt` and the comparison succeeds.
75c9e0e
to
52fb0e4
Compare
Were they working on windows before? |
I agree that CI for this is important. The now removed python script used to do CI for ARM by cross-compiling to arm archs and verifying the assembly. IIUC @alexcrichton will look into improving the codegen testing macros to test the codegen for arm features via cross-compiling from all hosts (even if one cannot run the run-time tests, this is better than nothing). I wanted to look next into using I think that for these three things (improving the code gen testing macros), using |
Ah yeah good point! I can be sold on that. I think I would like to make sure the CI we do have is green though. I thought Windows was green at one point? Let's wait to hear from @alexcrichton (or I can look into it, but might be a bit). |
@alexcrichton this is the backtrace on appveyor: ---- x86::bmi::assert_instr__mm_tzcnt_u64 stdout ----
thread 'x86::bmi::assert_instr__mm_tzcnt_u64' panicked at 'failed to find disassembly of stdsimd::x86::bmi::_tzcnt_u64', src\libcore\option.rs:839:4
stack backtrace:
---- x86::bmi::assert_instr__tzcnt_u32 stdout ----
thread 'x86::bmi::assert_instr__tzcnt_u32' panicked at 'failed to get symbol of function pointer: 140698179428704', assert-instr\src\lib.rs:233:16
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys_common::backtrace::_print
at C:\projects\rust\src\libstd\sys_common\backtrace.rs:94
1: std::panicking::default_hook::{{closure}}
at C:\projects\rust\src\libstd\panicking.rs:380
2: std::panicking::default_hook
at C:\projects\rust\src\libstd\panicking.rs:391
3: std::panicking::rust_panic_with_hook
at C:\projects\rust\src\libstd\panicking.rs:577
4: std::panicking::begin_panic<alloc::string::String>
at C:\projects\rust\src\libstd\panicking.rs:538
5: std::panicking::begin_panic_fmt
at C:\projects\rust\src\libstd\panicking.rs:522
6: assert_instr::assert
at .\assert-instr\src\lib.rs:233
7: test::{{impl}}::call_box<(),closure>
at C:\projects\rust\src\libtest\lib.rs:141
8: panic_unwind::__rust_maybe_catch_panic
at C:\projects\rust\src\libpanic_unwind\lib.rs:99
---- x86::bmi::assert_instr__tzcnt_u64 stdout ---- It seems that |
b2e7cc6
to
f765407
Compare
@BurntSushi appveyor seems to be broken on master as well, I've enabled backtraces on appveyor for now, maybe we should do the same on travis. |
assert-instr/src/lib.rs
Outdated
return | ||
// Truncates the instruction with the length of the expected | ||
// instruction: tzcntl => tzcnt and compares that. | ||
if let Some(part) = part.get(0..expected.len()) { |
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 think this could be part.starts_with(expected)
(also thanksfor doing this!)
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.
Thanks! I looked a lot for something like that (or contains
) in the docs but couldn't find it so thought it maybe wasn't part of std
. I am learning a lot with your code reviews, thank you!
Hm windows is indeed previously green |
That is weird.
…On Thu 21. Sep 2017 at 16:19, Alex Crichton ***@***.***> wrote:
Hm windows is indeed previously green
<https://ci.appveyor.com/project/rust-lang-libs/stdsimd/build/1.0.13>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3NpsHqF18Mwdpr-ktXfZMDBxMtrHYNks5sknBegaJpZM4PdqMe>
.
|
3750fa6
to
d116aea
Compare
Ok with the most recent logs it looks like:
Testing more... |
@BurntSushi also yeah I'll work on ARM CI once we get this merged, it'll be helpful to have a few examples locally to test with |
Alright all green now! I'll add some comments then merge |
Pass the `/OPT:NOICF` flag to the linker to ensure that all functions don't get eliminated (somethign we don't want in this scenario)
7b68771
to
4fe06c1
Compare
# We don't want to do identical comdat folding as it messes up the ability to | ||
# generate lossless backtraces in some cases. This is enabled by rustc by | ||
# default so pass a flag to disable it to ensure our tests work ok. | ||
RUSTFLAGS: -Clink-args=/OPT:NOICF |
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 would have never thought of this.
This adds ARM's
rev
,rbit
,clz
andcls
intrinsics.The
cls
intrinsic currently generates bad code due to an LLVM bug, I've filled issue #30 to track it.Closes #35 .