[PATCH] D77152: [SelectionDAG] Better legalization for FSHL and FSHR

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 10:31:17 PDT 2020


bjope added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6163
+  unsigned RevOpcode = IsFSHL ? ISD::FSHR : ISD::FSHL;
+  if (!isOperationLegalOrCustom(Node->getOpcode(), VT) &&
+      isOperationLegalOrCustom(RevOpcode, VT)) {
----------------
Is this transform even correct?

Assume we got `fshl 3, 2, 0`, then the result would be 3. But this code could turn it into `fshr 3, 2, (0-0)`, then the result would become 2.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77152/new/

https://reviews.llvm.org/D77152



More information about the llvm-commits mailing list