Skip to content
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

rustc_target: Add more RISC-V vector-related features and use zvl*b target features in vector ABI check #138742

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Mar 20, 2025

Currently, we have only unstable v target feature, but RISC-V have more vector-related extensions. The first commit of this PR adds them to unstable riscv_target_feature.

  • unaligned-vector-mem: Has reasonably performant unaligned vector
    • LLVM definition
    • Similar to currently unstable unaligned-scalar-mem target feature, but for vector instructions.
  • zvfh: Vector Extension for Half-Precision Floating-Point
  • zvfhmin: Vector Extension for Minimal Half-Precision Floating-Point
  • zve32x, zve32f, zve64x, zve64f, zve64d: Vector Extensions for Embedded Processors
    • ISA Manual
    • LLVM definitions
    • zve32x implies zvl32b
    • zve32f implies zve32x and f
    • zve64x implies zve32x and zvl64b
    • zve64f implies zve32f and zve64x
    • zve64d implies zve64f and d
    • v implies zve64d
  • zvl*b: Minimum Vector Length Standard Extensions
  • Vector Cryptography and Bit-manipulation Extensions
    • ISA Manual
    • LLVM definitions
    • zvkb: Vector Bit-manipulation used in Cryptography
      • This implies zve32x
    • zvbb: Vector basic bit-manipulation instructions
      • This implies zvkb
    • zvbc: Vector Carryless Multiplication
      • This implies zve64x
    • zvkg: Vector GCM instructions for Cryptography
      • This implies zve32x
    • zvkned: Vector AES Encryption & Decryption (Single Round)
      • This implies zve32x
    • zvknha: Vector SHA-2 (SHA-256 only))
      • This implies zve32x
    • zvknhb: Vector SHA-2 (SHA-256 and SHA-512)
      • This implies zve64x
      • This is superset of zvknha, but doesn't imply that feature at least in LLVM
    • zvksed: SM4 Block Cipher Instructions
      • This implies zve32x
    • zvksh: SM3 Hash Function Instructions
      • This implies zve32x
    • zvkt: Vector Data-Independent Execution Latency
      • Similar to already stabilized scalar cryptography extension zkt.
    • zvkn: Shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and 'Zvkt'
      • Similar to already stabilized scalar cryptography extension zkn.
    • zvknc: Shorthand for 'Zvkn' and 'Zvbc'
    • zvkng: shorthand for 'Zvkn' and 'Zvkg'
    • zvks: shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and 'Zvkt'
      • Similar to already stabilized scalar cryptography extension zks.
    • zvksc: shorthand for 'Zvks' and 'Zvbc'
    • zvksg: shorthand for 'Zvks' and 'Zvkg'

Also, our vector ABI check wants zvl*b target features, the second commit of this PR updates vector ABI check to use them.

const RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] =
&[/*(64, "zvl64b"), */ (128, "v")];


r? @Amanieu

@rustbot label +O-riscv +A-target-feature

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. O-riscv Target: RISC-V architecture labels Mar 20, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@a4lg
Copy link

a4lg commented Mar 22, 2025

Second this.

@a4lg
Copy link

a4lg commented Mar 22, 2025

Note: if #138823 is merged, zve32x should have dependency to zicsr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. O-riscv Target: RISC-V architecture S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants