Implement Intel HLE and RTM intrinsics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 694
- Forks
- 336
- Avg merge
- 5d 14h
- Merged PRs (30d)
- 9
Description
@mtak- mentioned _xbegin recently, we should probably expose them all via core::arch.
The Intel RTM (Restricted Transactional Memory) intrinsics (Intel Intrinsic Guide, clang header, CPUID: RTM, EAX=7, ECX=0: Extended Features, EBX=11):
void _xabort (const unsigned int imm8)(assert_instr(xabort), `llvm.x86.xabort)unsigned int _xbegin (void)(assert_instr(xbegin), llvm.x86.xbegin, note: can return multiple times)void _xend (void)(assert_instr(xend), llvm.x86.xend)unsigned char _xtest (void)(assert_instr(xtest), llvm.x86.xtest)
We'd need to whitelist the rtm feature in rust-lang/rust as part of this.
I've asked on the LLVM bugzilla whether xbegin needs to be marked returns_twice: https://bugs.llvm.org/show_bug.cgi?id=41493, Craig Topper suggested on IRC to submit an LLVM patch to mark this intrinsic / clang intrinsic as returns_twice (cc @ctopper - hope I get the github id right), but @tnorthover mentioned that this might not be necessary or enough. We don't have to figure this out for the initial implementation, as @mtack- mentions, clang does not do this, but we should not forget about this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Intel Intrinsic Guide and clang's rtmintrin.h to compare the four RTM intrinsics and their LLVM mappings. Check the referenced LLVM Bugzilla discussion about xbegin and returns_twice, then locate the core::arch implementation and Rust feature whitelist. Done means the RTM intrinsics are exposed with instruction tests and the rtm feature is accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100