[flang-commits] [PATCH] D129584: Lower F08 bit-population count intrinsics

Kiran Chandramohan via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jul 12 14:37:07 PDT 2022


kiranchandramohan added a comment.

The math dialect has operations that model leadz, trailz, pop etc. There exists a conversion from math dialect to llvm (https://github.com/llvm/llvm-project/blob/4ae254e48850033f4e441a28fb28ae27d63ea458/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp#L87). Using these ops might be useful since the might have some transformations/folding, the existence of vector versions might help vectorisation in the future.
https://mlir.llvm.org/docs/Dialects/MathOps/#mathctpop-mlirmathctpopop
https://mlir.llvm.org/docs/Dialects/MathOps/#mathctlz-mlirmathcountleadingzerosop
https://mlir.llvm.org/docs/Dialects/MathOps/#mathcttz-mlirmathcounttrailingzerosop



================
Comment at: flang/test/Evaluate/fold-popcnt.f90:1
+! RUN: %python %S/test_folding.py %s %flang_fc1
+! Test counts of set bits.
----------------
I think this can go in as a separate NFC patch since the patch is testing the implementation of existing code.


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

https://reviews.llvm.org/D129584



More information about the flang-commits mailing list