[PATCH] D52304: [X86][BMI1]: X86DAGToDAGISel: select BEXTR from x & ~(-1 << nbits) pattern

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 21 22:07:58 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:2696
+  SDValue NBitsTrunc = NBits;
+  if (NBits->getSimpleValueType(0) != MVT::i8) {
+    NBitsTrunc = CurDAG->getNode(ISD::TRUNCATE, DL, MVT::i8, NBits);
----------------
This can just be NBits.getSimpleValueType(). Using the -> is taking you to SDNode, but you already had SDValue. But can NBits ever not be i8? It came from a shift didn't it?


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:2704
+  // We'd use X86::sub_8bit_hi, but that does not always work.
+  SDValue NBitsAL =
+      CurDAG->getTargetInsertSubreg(X86::sub_8bit, DL, NVT, Undef, NBitsTrunc);
----------------
I think I'd prefer to avoid using AL/AH here. It makes it seem like the instruction uses those registers and would be restricted to A/B/C/D registers.


Repository:
  rL LLVM

https://reviews.llvm.org/D52304





More information about the llvm-commits mailing list