Page MenuHomePhabricator

[TableGen] Add logtwo bang operator
ClosedPublic

Authored by michaelmaitland on Sep 16 2022, 12:51 PM.

Details

Summary

This patch adds base 2 logarithm that returns integer result. I initially wanted to name it !log2,
but numbers are not permitted in the name. The documentation makes sure to clarify that it is
base 2 since it is not explicit in the operator name.

I also used ERROR3 and ERROR4 in the test files since there is another patch that has not
landed yet that uses ERROR1 and ERROR2: https://reviews.llvm.org/D134001

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 12:51 PM
michaelmaitland requested review of this revision.Sep 16 2022, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 12:51 PM
michaelmaitland edited the summary of this revision. (Show Details)Sep 16 2022, 12:53 PM
craig.topper added inline comments.Sep 21 2022, 5:29 PM
llvm/docs/TableGen/ProgRef.rst
1748

I find myself wondering if logtwo would be a better name?

Rename log -> logtwo

craig.topper retitled this revision from [TableGen] Add log bang operator to [TableGen] Add logtwo bang operator.Sep 30 2022, 10:32 AM
craig.topper added inline comments.
llvm/lib/TableGen/Record.cpp
899

Reuse LHsv here

Rebase main to resolve conflicts from revision D134001

barannikov88 accepted this revision.Oct 17 2022, 6:07 AM
barannikov88 added inline comments.
llvm/docs/TableGen/ProgRef.rst
1749

Worth noting that this is a flooring operation?

This revision is now accepted and ready to land.Oct 17 2022, 6:07 AM

Agree that the flooring should be noted in the document for completeness. Apart from that this LGTM.

This revision was landed with ongoing or failed builds.Oct 26 2022, 9:16 AM
This revision was automatically updated to reflect the committed changes.