Open RKSimon opened 8 months ago
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
test/
create fine-grained testing targets, so you can e.g. use make check-clang-ast
to only run Clang's AST tests.git clang-format HEAD~1
to format your changes.If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Simon Pilgrim (RKSimon)
Hi. I would like to work on this
Thanks @chansuke - I think ISD::AVGCEILS -> ISD::AVGCEILU can be performed in the same way.
I'd expect both of these to be handled in DAGCombiner::visitAVG
@chansuke reverse-ping - any progress?
@RKSimon No progress yet.Start working this weekend🙏
@chansuke ping?
@RKSimon I will resume work on this starting tomorrow.
You should be able to create very similar patterns to these: https://github.com/llvm/llvm-project/blob/fae31e283203da9a4a3225e2d016e245d4887c2f/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L5280:L5293
@RKSimon thanks
@RKSimon I have added the implementation. How can I test it?
Running ninja check-llvm-codegen
should find any cases that are already committed - we will then need to add additional test coverage, probably in aarch64 and x64 tests
https://rust.godbolt.org/z/ejh1bh97q
Pulled out of Hacker's Delight - if a signed floor average is between known non-negative arguments then the unsigned variant can be used instead, to potentially allow further simplification in the future.
(Sorry only aarch64 has decent ISD::AVG coverage atm):
CC @davemgreen