This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix handling of zero immediate in fmov instructions
ClosedPublic

Authored by john.brawn on Apr 11 2017, 10:18 AM.

Details

Summary

Currently fmov #0 with a vector destination is handle incorrectly and results in fmov #-1.9375 being emitted but should instead give an error. This is due to the way we cope with fmov #0 with a scalar destination being an alias of fmov zr, so fix this by actually doing it through an alias.

Diff Detail

Repository
rL LLVM

Event Timeline

john.brawn created this revision.Apr 11 2017, 10:18 AM

Accidentally used the wrong diff, attach the correct one.

rengolin added inline comments.Apr 11 2017, 10:49 AM
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
2123 ↗(On Diff #94851)

Is this where the Parser.lex() from D31948 ended up?

2125 ↗(On Diff #94851)

Why two tokens?

john.brawn added inline comments.Apr 12 2017, 8:07 AM
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
2125 ↗(On Diff #94851)

Because that's what the MatchTable in AArch64GenAsmMatcher.inc expects for the #0.0 in the fmov InstAlias. After a bit of poking around it looks like this is because the AsmParserVariants defined in AArch64.td sets '.' to be a break character which starts a new token, probably so that the instruction qualifiers (which start with a '.') get treated as operands not as part of the mnemonic.

rengolin accepted this revision.Apr 19 2017, 10:03 AM

LGTM. Thanks!

lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
2125 ↗(On Diff #94851)

Right, I expected as much.

This revision is now accepted and ready to land.Apr 19 2017, 10:03 AM
This revision was automatically updated to reflect the committed changes.