Pulled out of D106237, this replaces the X86ISD::AVG DAG node with the generic ISD::AVGCEILU. It doesn't remove the detectAVGPattern method, but the extra generic ISel matching does allow some extra folding to happen in the tests.
Details
Diff Detail
Unit Tests
Event Timeline
Yeah I think that should be OK. I have it that way around at the moment, but can swap them easily enough I think. The tests might not be as good in the meantime is all :)
It will be a couple of days before I can get back to this though.
clang-format: please reformat the code