This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Select f32 constants with vmov.f16
ClosedPublic

Authored by dmgreen on Sep 16 2020, 1:22 PM.

Details

Summary

This adds lowering for f32 values using the vmov.f16, which zero's the top bits whilst setting the lower bits to a pattern. This range of values does not often come up, except where a f16 constant value has been converted to a f32.

The tablegen pattern was a little tricky to get to work, but it seems happy as it is here.

Diff Detail

Event Timeline

dmgreen created this revision.Sep 16 2020, 1:22 PM
dmgreen requested review of this revision.Sep 16 2020, 1:22 PM
efriedma accepted this revision.Sep 16 2020, 7:02 PM

LGTM

On a side-note, should we be trying to emit movw+vmov instead of a constant-pool load under any circumstances?

llvm/lib/Target/ARM/MCTargetDesc/ARMAddressingModes.h
693

I'd probably write this as if (Imm.getActiveBits() > 16), so both instances of "16" refer to the same thing. But not a big deal either way.

This revision is now accepted and ready to land.Sep 16 2020, 7:02 PM
This revision was automatically updated to reflect the committed changes.