Skip to content

Conversation

@topperc
Copy link
Collaborator

@topperc topperc commented Jul 9, 2025

These instructions operate on bytes so we need to round the demanded bits up to the nearest byte which we aren't doing. I think we forgot to update this when we changed from hasAllWUsers to hasNBitUsers.

We don't have any test case for these instruction so remove them until we can put together a test.

These instructions operate on bytes so we need to round the demanded
bits up to the nearest byte which we aren't doing. I think we
forgot to update this when we changed from hasAllWUsers to
hasNBitUsers.

We don't have any test case for these instruction so remove them
until we can put together a test.
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

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

Author: Craig Topper (topperc)

Changes

These instructions operate on bytes so we need to round the demanded bits up to the nearest byte which we aren't doing. I think we forgot to update this when we changed from hasAllWUsers to hasNBitUsers.

We don't have any test case for these instruction so remove them until we can put together a test.


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

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp (-2)
diff --git a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
index ed61236415ccf..24c05a2f807d0 100644
--- a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
+++ b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
@@ -311,9 +311,7 @@ static bool hasAllNBitUsers(const MachineInstr &OrigMI,
       case RISCV::XORI:
 
       case RISCV::ANDN:
-      case RISCV::BREV8:
       case RISCV::CLMUL:
-      case RISCV::ORC_B:
       case RISCV::ORN:
       case RISCV::SH1ADD:
       case RISCV::SH2ADD:

Copy link
Collaborator

@preames preames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@topperc topperc merged commit 20a68c6 into llvm:main Jul 9, 2025
11 checks passed
@topperc topperc deleted the pr/rev8-orcb branch July 9, 2025 23:18
topperc added a commit that referenced this pull request Jul 11, 2025
…148076)

These were removed in #147830 due to ignoring that these instructions
operate on bytes. This patch adds them back with tests including a test
for the byte boundary issue.

I seperated out the commits to show bad optimization if we don't round
Bits to the nearest byte.
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