FreeBSD doesn't have sincos, and as far as I can tell nether do the other BSDs. As such restrict the calls to this to just Linux.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/TargetLoweringBase.cpp | ||
---|---|---|
490 | Which systems have isGNUEnvironment true? |
lib/CodeGen/TargetLoweringBase.cpp | ||
---|---|---|
490 | It seems to be when the triple ends with gnu* |
Not part of this change, but it seems unfortunate that we use isGNUEnvironment or isOSLinux here to determine if sincos is available, but then in lib/Target/ARM/ARMSubtarget.cpp:
bool ARMSubtarget::hasSinCos() const { return isTargetWatchOS() || (isTargetIOS() && !getTargetTriple().isOSVersionLT(7, 0)); }
and lib/Target/X86/X86ISelLowering.cpp:
bool X86Subtarget::hasSinCos() const { return getTargetTriple().isMacOSX() && !getTargetTriple().isMacOSXVersionLT(10, 9) && is64Bit(); }
It looks good to me.
It is strange that both TargetLoweringBase.cpp and the ARM/X86 SubTargets have their own "hasSinCos" logic, though.
I don't understand this change. I don't expect to see sincos in freebsd even in the old code. If it did, than there was something wrong that wasn't fixed...
I'm also surprised that linux-gnu is not a GNU environment...
Can you dig a bit more the reason for those changes?
Thanks!
--renato
The ARM/X86 hasSinCos seems to be for macOS/iOS/watchOS.
We are getting sincos on FreeBSD on arm because we use armv6-freebsd-gnueabihf so TT.isGNUEnvironment() returns true enabling these functions.
linux-gnu is a gnu environment, however it's missing --enable-unsafe-fp-math which is needed to enable the call to sincos.
Hum, that sounds wrong. GLIBC has sincos since version 2.1, and if we're using it (whether ARM or x86), we can include it.
We are getting sincos on FreeBSD on arm because we use armv6-freebsd-gnueabihf so TT.isGNUEnvironment() returns true enabling these functions.
Why do you use "gnueabihf" if you don't use GLIBC? Why not just EABIHF, which would *also* work with GLIBC and GCC, but not have the idiosyncrasies of GLIBC.
linux-gnu is a gnu environment, however it's missing --enable-unsafe-fp-math which is needed to enable the call to sincos.
Right. "linux-gnu" is not used with ARM. I know it's not in this patch, but we should change that to "gnueabi" instead.
cheers,
--renato
lib/CodeGen/TargetLoweringBase.cpp | ||
---|---|---|
490 | See the code in include/llvm/ADT/Triple.h: bool isGNUEnvironment() const { EnvironmentType Env = getEnvironment(); return Env == Triple::GNU || Env == Triple::GNUABI64 || Env == Triple::GNUEABI || Env == Triple::GNUEABIHF || Env == Triple::GNUX32; } Though maybe a better name for the function would be isGLibCEnvironment() ... :) |
lib/CodeGen/TargetLoweringBase.cpp | ||
---|---|---|
490 | No, other libraries can emulate the GNU environment just as well, and they still need to provide whatever GNU does, or they shouldn't be called "gnuabi". This just looks like a nomenclature problem. FreeBSD uses "gnuabi" names and don't want to provide "gnuabi" features. I can see only two solutions:
|
Which systems have isGNUEnvironment true?