hexagon: Add scalar DSP intrinsics#2072
Conversation
|
r? @Amanieu rustbot has assigned @Amanieu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Should the scalar intrinsics have cfg_attr like HVX intrinsics have? For example: The generator could generate those lines. |
Some of them do have a dependency, yes. I'll add this. |
b9092c4 to
585b548
Compare
What about assert_instr? |
yeah - we need that. Will fix it. And we need target features to gate some of these intrinsic too, I'll fix the compiler to provide those. |
|
585b548 to
b3237e2
Compare
This comment has been minimized.
This comment has been minimized.
Now using the target features and static assertions regarding immediate value ranges. |
Improve the scalar intrinsic generator with three changes: - Immediate operands now use const generics with static assertions (static_assert_uimm_bits!/static_assert_simm_bits!) so out-of-range values and runtime variables are rejected at compile time. Unsigned immediates use u32, signed use i32, matching the LoongArch convention. rustc_legacy_const_generics preserves positional call syntax: Q6_R_add_RI(rs, 42) rather than Q6_R_add_RI::<42>(rs). - Fix missing assert_instr on void-returning instructions (dmlink, dmresume, dmstart) whose assembly syntax has no assignment operator. extract_instr_name now falls back to extract_leading_mnemonic for function-call-style syntax. - Hoist regex compilation out of parse_prototype (called ~900x) into parse_header where they are compiled once and passed by reference.
b3237e2 to
c6fe937
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| # - name: Check hexagon scalar | ||
| # run: | | ||
| # cargo run -p stdarch-gen-hexagon-scalar --release | ||
| # git diff --exit-code |
There was a problem hiding this comment.
Why is this being added here if it is just commented out?
There was a problem hiding this comment.
Sorry! Should've made a comment about that one.
rust-lang/rust#154686 caused CI failures here and was still pending the fix.
IIUC rust-lang/rust#155332 landed the libc fix just recently. So on one hand, it might make sense to enable this CI. OTOH, there was some discussion regarding "does it make sense to have a tier 3 target in stdarch CI?" and I suspect that maybe the conclusion was "no"? @folkertdev
In the short term, maybe we'll omit hexagon build/test from stdarch CI. In the coming ~weeks I will make an MCP to promote hexagon-unknown-linux-musl to tier 2. I imagine that will take some time to converge, after that we could revisit this.
So, with respect to .github/workflows/main.yml -- I'll just remove the commented-out changes for now so there's no confusion?
Add scalar (non-HVX) intrinsic wrappers for Hexagon DSP operations covering arithmetic, multiply, shift, saturate, compare, and floating-point instructions, mapping to llvm.hexagon.* LLVM builtins.
Includes the stdarch-gen-hexagon-scalar code generator crate which produces scalar.rs from the LLVM hexagon_protos.h header file, and a CI step to verify the generated output stays in sync.