Skip to content

[RISCV] Add IsSignExtendingOpW to P-ext CLS, CLSW, and ABSW instructions. #151037

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

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Jul 28, 2025

This matches other W instructions. CLS is included since it can only return 0-63 which has bits [63:31] as zero. This is similar to CLZ.

This doesn't do anything yet since we don't have CodeGen support for P.

…ons.

This matches other W instructions. CLS is included since it can only
return 0-63 which has bits [63:31] as zero. This is similar to CLZ.

This doesn't do anything yet since we don't have CodeGen support
for P.
@llvmbot
Copy link
Member

llvmbot commented Jul 28, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

This matches other W instructions. CLS is included since it can only return 0-63 which has bits [63:31] as zero. This is similar to CLZ.

This doesn't do anything yet since we don't have CodeGen support for P.


Full diff: https://github.com/llvm/llvm-project/pull/151037.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfoP.td (+3)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoP.td b/llvm/lib/Target/RISCV/RISCVInstrInfoP.td
index dd365cfa1379b..8297d5050ceda 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoP.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoP.td
@@ -136,6 +136,7 @@ class RVPUnary_ri<bits<2> w, bits<5> uf, string opcodestr>
 //===----------------------------------------------------------------------===//
 
 let Predicates = [HasStdExtP] in {
+let IsSignExtendingOpW = 1 in
 def CLS    : Unary_r<0b011000000011, 0b001, "cls">;
 def ABS    : Unary_r<0b011000000111, 0b001, "abs">;
 } // Predicates = [HasStdExtP]
@@ -146,8 +147,10 @@ let Predicates = [HasStdExtP, IsRV64] in {
 def REV16      : Unary_r<0b011010110000, 0b101, "rev16">;
 def REV_RV64   : Unary_r<0b011010111111, 0b101, "rev">;
 
+let IsSignExtendingOpW = 1 in {
 def CLSW  : UnaryW_r<0b011000000011, 0b001, "clsw">;
 def ABSW  : UnaryW_r<0b011000000111, 0b001, "absw">;
+}
 } // Predicates = [HasStdExtP, IsRV64]
 
 let Predicates = [HasStdExtP] in {

@topperc topperc merged commit dbcbdc4 into llvm:main Jul 29, 2025
11 checks passed
@topperc topperc deleted the pr/signextendedopw-p branch July 29, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants