Page MenuHomePhabricator

[ARM] Recognize "double extend" reduction patterns
ClosedPublic

Authored by dmgreen on Sep 8 2020, 3:20 AM.

Details

Summary

We can sometimes get code that does:

xe = zext i16 x to i32
ye = zext i16 y to i32
m = mul i32 xe, ye
me = zext i32 m to i64
r = vecreduce.add(me)

This "double extend" can trip up the reduction identification, but should give identical results.

This extends the pattern matching to handle them.

Diff Detail

Event Timeline

dmgreen created this revision.Sep 8 2020, 3:20 AM
dmgreen requested review of this revision.Sep 8 2020, 3:20 AM
samparker accepted this revision.Sep 10 2020, 12:33 AM

Nice one.

This revision is now accepted and ready to land.Sep 10 2020, 12:33 AM
This revision was automatically updated to reflect the committed changes.
efriedma added inline comments.Sep 14 2020, 2:04 PM
llvm/lib/Target/ARM/ARMISelLowering.cpp
14775

A minor followup suggestion: you might want to look at using ComputeNumSignBits etc instead of requiring a specific extension opcode. This would help if, for example, one of the operands is a constant.