Page MenuHomePhabricator

[InstCombine] Range metadata for ARM MVE VMIN/VMAX.
Needs ReviewPublic

Authored by simon_tatham on Wed, Sep 11, 4:58 AM.

Details

Summary

The VMINV and VMAXV intrinsics return a value of type i32. But it's
always going to be the sign- or zero-extension of a lane of its vector
operand, so if that lane is smaller than 32 bits, the i32 value will
often have a smaller range.

Setting range metadata on the output value should allow the backend to
avoid emitting an unnecessary UXTB or SXTB instruction if the user
code then casts the value back to the smaller vector-lane integer
type.

In fact, this seems to work in the unsigned case, but not in the
signed case, because SelectionDAGBuilder::lowerRangeToAssertZExt
doesn't come with a counterpart for AssertSExt. But if one is added in
future, then this commit will enable it to apply to VMIN and VMAX.

Event Timeline

simon_tatham created this revision.Wed, Sep 11, 4:58 AM