http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56586
Bug #: 56586 Summary: ARM vfpv3: Not using FPU (vsqrt op) for sqrt() / sqrtf() Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: eg...@google.com I have gcc built for armeb-unknown-eabi-gcc, using --with-fpu=vfpv3-d16. (I'm using a Cortex R4-based T.I. TMS570 chip, but I expect this would happen with any ARM vfpv3 target.) When I compile code that uses sqrt() or sqrtf(), it emits a call to those functions, which are defined in libg. Those functions compute the square root in software. Expected behavior is to use the available vsqrt.f32 or vsqrt.f64 opcodes, which calculate a lovely square root very quickly. (Sample code available, but it's trivial: "double foo(double x) { return sqrt(x); }".) I see a patch to improve vsqrt handing for AArch64 (http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00411.html) but I don't think that would apply to the 32-bit ARM chips I'm using. gcc -v output: ===== Using built-in specs. COLLECT_GCC=./third_party/car/embedded/toolchains/gcc_tms570/bin/armeb-unknown-eabi-gcc COLLECT_LTO_WRAPPER=/google/src/cloud/egnor/control/google3/third_party/car/embedded/toolchains/gcc_tms570/bin/../libexec/gcc/armeb-unknown-eabi/4.7.2/lto-wrapper Target: armeb-unknown-eabi Configured with: ../gcc-4.7.2/configure --prefix=/usr/local/google/armeb/toolchain --build=x86_64-cross-linux-gnu --target=armeb-unknown-eabi --host=x86_64-cross-linux-gnu --with-sysroot=/usr/local/google/armeb/sysroot --with-newlib --with-headers=../newlib-1.19.0/newlib/libc/include --disable-nls --enable-languages=c,c++ --enable-c99 --enable-long-long --with-mpfr=/usr/local/google/armeb/toolchain --with-gmp=/usr/local/google/armeb/toolchain --with-mpc=/usr/local/google/armeb/toolchain --disable-multilib --with-abi=aapcs --with-arch=armv7-r --with-mode=thumb --with-float=hard --with-fpu=vfpv3-d16 --disable-threads --disable-shared --disable-libgomp --disable-libmudflap --disable-libssp Thread model: single gcc version 4.7.2 (GCC) ======