Skip to content

Commit 40f2da5

Browse files
authored
[RISCV] Add hasREV8Like helper to RISCVSubtarget. NFC (#158775)
1 parent 7bc91f3 commit 40f2da5

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
378378
setOperationAction({ISD::ROTL, ISD::ROTR}, XLenVT, Expand);
379379
}
380380

381-
// With Zbb we have an XLen rev8 instruction, but not GREVI. So we'll
382-
// pattern match it directly in isel.
383381
setOperationAction(ISD::BSWAP, XLenVT,
384-
(Subtarget.hasStdExtZbb() || Subtarget.hasStdExtZbkb() ||
385-
Subtarget.hasVendorXTHeadBb())
386-
? Legal
387-
: Expand);
382+
Subtarget.hasREV8Like() ? Legal : Expand);
388383

389384
if ((Subtarget.hasVendorXCVbitmanip() || Subtarget.hasVendorXqcibm()) &&
390385
!Subtarget.is64Bit()) {

llvm/lib/Target/RISCV/RISCVSubtarget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {
196196
bool hasCPOPLike() const {
197197
return HasStdExtZbb || (HasVendorXCVbitmanip && !IsRV64);
198198
}
199+
bool hasREV8Like() const {
200+
return HasStdExtZbb || HasStdExtZbkb || HasVendorXTHeadBb;
201+
}
199202

200203
bool hasBEXTILike() const { return HasStdExtZbs || HasVendorXTHeadBs; }
201204

0 commit comments

Comments
 (0)