<div dir="ltr">Hi,<div><br></div><div>I'm trying to let ".fpu neon" in arm assembly enable neon instructions. For this, I need to map the fpu name "neon" to subtarget features. The clang driver already has logic for this, but that logic isn't available in the assembly parser in llvm.</div>
<div><br></div><div>In fact, the list of accepted strings for the clang driver's -mfpu= and for the assembly parser's .fpu directive are currently duplicated in both places, and as a consequence are out of sync and don't agree with each other.</div>
<div><br>The attached patch adds a new file, include/llvm/Target/ARM/ARMSubtargetCommon.h, that exposes FPU names and their subtargets, and calls this from both the clang driver and the arm assembly parser to get FPU names and subtarget features. It also uses this to make the .fpu directive enable and disable subtarget features, so that neon instructions can be used after .fpu neon (PR20447). The name-reusing fixes various fpu name bugs, see test/MC/ARM/directive-fpu-names.s in the patch.</div>
<div><br>One drawback is that the new ARMSubtargetCommon.cpp file is in the library ARMCodeGen, so clang's driver now depends on ARMCodeGen, which is a bit icky. I could make it a standalone target I suppose, but that standalone target's cpp file depends on the ARMCodeGen target's tablegen output, so that wouldn't be a huge win. And since the driver processes flags related to ARMCodeGen, the dependency doesn't seem _that_ icky to me.</div>
<div><br></div><div>(There are several places in the driver that say "FIXME: this is duplicating subtarget code", both for ARM and x86, this patch removes one of them.)</div><div><br></div><div>Do folks think that this is ok as an incremental improvement than what's currently in the tree? On the bug the suggestion was made to just duplicate the fpu->feature mapping in two places, which would make this patch much smaller (and which would undo the .fpu name fixes), but that seems like a worse alternative to me.</div>
<div><br></div><div>Thanks,</div><div>Nico</div></div>