[PATCH] D25202: LegalizeDAG: Implement PROMOTE for ISD::BITREVERSE

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 11:23:25 PDT 2016


tstellarAMD created this revision.
tstellarAMD added a reviewer: bogner.
tstellarAMD added a subscriber: llvm-commits.
Herald added a subscriber: wdng.

This operation is promoted the same way was ISD::BSWAP.  This will
prevent a regression in test/Target/AMDGOU/bitreverse.ll when i16
support is implemented.


https://reviews.llvm.org/D25202

Files:
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp


Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4073,10 +4073,11 @@
     }
     Results.push_back(DAG.getNode(ISD::TRUNCATE, dl, OVT, Tmp1));
     break;
+  case ISD::BITREVERSE:
   case ISD::BSWAP: {
     unsigned DiffBits = NVT.getSizeInBits() - OVT.getSizeInBits();
     Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Node->getOperand(0));
-    Tmp1 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1);
+    Tmp1 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1);
     Tmp1 = DAG.getNode(
         ISD::SRL, dl, NVT, Tmp1,
         DAG.getConstant(DiffBits, dl,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25202.73308.patch
Type: text/x-patch
Size: 713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161003/9b708574/attachment.bin>


More information about the llvm-commits mailing list