Bug#704111: [cfe-dev] Bug#704111: clang fails to correctly implement hard float ABI during default compiles due to rediculously low default CPU setting.
Tim Northover
t.p.northover at gmail.com
Thu Mar 28 08:24:31 UTC 2013
Hi Peter,
> 1: What does the "coretex-a8" CPU setting imply for clang/llvm? in
> particular does it imply neon and the extra vfp registers?
At the LLVM level, the options that have to be enabled are "NEON" and
"restrict to 16 registers". Looking at (Clang's) lib/Basic/Targets.cpp
from 3.0 (and current). Cortex-A8 defaults to NEON enabled and using
all registers.
The option you ideally want to be using is "-mfpu". In current Clang,
this can have the value "vfpv3-d16", which disables NEON and restricts
to 16 registers, which sounds like exactly what you want.
Unfortunately this doesn't seem to exist in 3.0.
Backporting it would be a relatively simple feat. The following block
in addFPUArgs in lib/Driver/Tools.cpp implements it:
} else if (FPU == "vfp3-d16" || FPU == "vfpv3-d16") {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("+vfp3");
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("+d16");
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("-neon");
}
The one risk I see is that trunk LLVM contains two references to
hasD16, but 3.0 only refers to it once. The common reference is the
obvious place to implement the limit in LLVM. The second could mean
extra functionality was added which relies on the extra registers, or
it could mean there was a latent bug in 3.0 (around lowering
ConstantFPs). I can't really tell without more detailed investigation.
Hope this helps.
Tim.
More information about the Pkg-llvm-team
mailing list