[PATCH] D128911: Emit table lookup from TargetLowering::expandCTTZ()

Shubham Narlawar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 08:10:01 PDT 2022


gsocshubham added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:8035
+  // Emit Table Lookup if ISD::CTLZ and ISD::CTPOP are not legal.
+  if (!VT.isVector() && TLI.isOperationExpand(ISD::CTPOP, VT) &&
+      !isOperationLegal(ISD::CTLZ, VT))
----------------
Regarding this  check -

`!VT.isVector() && TLI.isOperationExpand(ISD::CTPOP, VT) &&
      !isOperationLegal(ISD::CTLZ, VT)`

I am not sure whether these checks are complete to allow new lowering. I have these 3 failures currently -

```
  LLVM :: CodeGen/AVR/cttz.ll
  LLVM :: CodeGen/RISCV/ctlz-cttz-ctpop.ll
  LLVM :: CodeGen/RISCV/rv64zbb.ll
```

1. When I update these tests using `utils/update_llc_test_checks.py`, it crashes. Does it mean the new lowering is generating wrong code for `AVR` and `RISCV`?

2. Or is it like I am lowering those cases which should not be lowered in first place. Like adding some more checks in above `if()` block.




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

https://reviews.llvm.org/D128911



More information about the llvm-commits mailing list