[cfe-dev] Questions about specifying VFP4 in clang for ARM

Weiming Zhao weimingz at codeaurora.org
Mon Sep 24 12:11:17 PDT 2012


Hi,

 

I’m able to use vfp4 via llc:   “-mattr=+neon,+vfp4 –fp-contract=fast” to
generate fused multiply-add (vfma)

 

However, with clang driver, I tried –mfpu=vfp4, but it returns:

clang: error: the clang compiler does not support '-mfpu=vfp4'

 

Then, I added the following code  in lib/Driver/Tools.cpp, addFPUArgs():




else if (FPU == "vfp4" || FPU == "vfpv4") {

    CmdArgs.push_back("-target-feature");

    CmdArgs.push_back("+vfp4");

    CmdArgs.push_back("-target-feature");

    CmdArgs.push_back("+neon");

..

 

I also updated lib/Basic/Targets.cpp::setFeatureEanbled()

if (Name == "soft-float" || Name == "soft-float-abi" ||

        Name == "vfp2" || Name == "vfp3" || Name == "neon" || Name == "d16"
||

        Name == "neonfp" || Name == "vfp4") {

      Features[Name] = Enabled;

 

But still no luck. It doesn’t even fold the mul/add to vmla instructions.

The cc1 flags are:

-cc1 -triple armv7-none-linux-gnueabi -S -disable-free -main-file-name
fdiv.c -mrelocation-model static -mdisable-fp-elim -fmath-errno
-ffp-contract=fast -mconstructor-aliases -target-abi aapcs-linux -target-cpu
cortex-a9 -mfloat-abi soft -target-feature +soft-float-abi -target-feature
+vfp4 -target-feature +neon -target-linker-version 2.20.1
-momit-leaf-frame-pointer -v -coverage-file /home/weimingz/llvm_tests/fdiv.s
-resource-dir
/local/scratch/llvm-build/llvm-tip/Debug+Asserts/bin/../lib/clang/3.2
-isysroot /home/common/build_tools/gcc-4.6.1-cs/arm-2011.09
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/home/common/build_tools/gcc-4.6.1-cs/arm-2011.09/usr/local/include
-internal-isystem
/local/scratch/llvm-build/llvm-tip/Debug+Asserts/bin/../lib/clang/3.2/includ
e -internal-externc-isystem
/home/common/build_tools/gcc-4.6.1-cs/arm-2011.09/include
-internal-externc-isystem
/home/common/build_tools/gcc-4.6.1-cs/arm-2011.09/usr/include -O3
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/weimingz/llvm_tests/fdiv -ferror-limit 19 -fmessage-length 147
-mstackrealign -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o test.s -x c test.c

 

And I also notice that, in lib/Driver/Tools.cpp, addFPUArgs():

else if (FPU == "vfp3" || FPU == "vfpv3") {

    CmdArgs.push_back("-target-feature");

    CmdArgs.push_back("+vfp3");

    CmdArgs.push_back("-target-feature");

    CmdArgs.push_back("-neon");  è why do we disable neon here?

  } 

..

 

Thanks,

Weiming

 

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
The Linux Foundation

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120924/a5b8dba9/attachment.html>


More information about the cfe-dev mailing list