This is an archive of the discontinued LLVM Phabricator instance.

[DAG][AArch64][ARM] Recognize hadd from wrapping flags.
ClosedPublic

Authored by dmgreen on Feb 6 2023, 12:16 AM.

Details

Summary

This slightly extends the creation of hadd nodes to allow them to be generated with the original type size if wrapping flags allow.
https://alive2.llvm.org/ce/z/bPjakD
https://alive2.llvm.org/ce/z/fa_gzb

Diff Detail

Event Timeline

dmgreen created this revision.Feb 6 2023, 12:16 AM
dmgreen requested review of this revision.Feb 6 2023, 12:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2023, 12:16 AM
spatel accepted this revision.Feb 6 2023, 5:56 AM

LGTM - see inline for possible logic simplification.

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
950–956

It's semi-independent of this patch, but do we need this clause? We're looking for a "1" constant, so it would always get canonicalized to operand 1 of an incoming 'add'?

This revision is now accepted and ready to land.Feb 6 2023, 5:56 AM
spatel added a comment.Feb 6 2023, 5:58 AM

Note: I was confused by the patch description/title since "hadd" is a different operation on x86. This is about "ISD::AVG*" nodes.

Thanks

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
950–956

Good point. Will do.

This revision was landed with ongoing or failed builds.Feb 6 2023, 9:24 AM
This revision was automatically updated to reflect the committed changes.