<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m able to use vfp4 via llc:   “-mattr=+neon,+vfp4 –fp-contract=fast” to generate fused multiply-add (vfma)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, with clang driver, I tried –mfpu=vfp4, but it returns:<o:p></o:p></p><p class=MsoNormal>clang: error: the clang compiler does not support '-mfpu=vfp4'<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Then, I added the following code  in lib/Driver/Tools.cpp, addFPUArgs():<o:p></o:p></p><p class=MsoNormal>…<o:p></o:p></p><p class=MsoNormal>else if (FPU == "vfp4" || FPU == "vfpv4") {<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("-target-feature");<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("+vfp4");<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("-target-feature");<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("+neon");<o:p></o:p></p><p class=MsoNormal>..<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I also updated lib/Basic/Targets.cpp::setFeatureEanbled()<o:p></o:p></p><p class=MsoNormal>if (Name == "soft-float" || Name == "soft-float-abi" ||<o:p></o:p></p><p class=MsoNormal>        Name == "vfp2" || Name == "vfp3" || Name == "neon" || Name == "d16" ||<o:p></o:p></p><p class=MsoNormal>        Name == "neonfp" || Name == "vfp4") {<o:p></o:p></p><p class=MsoNormal>      Features[Name] = Enabled;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>But still no luck. It doesn’t even fold the mul/add to vmla instructions.<o:p></o:p></p><p class=MsoNormal>The cc1 flags are:<o:p></o:p></p><p class=MsoNormal>-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/include -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<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>And I also notice that, in lib/Driver/Tools.cpp, addFPUArgs():<o:p></o:p></p><p class=MsoNormal>else if (FPU == "vfp3" || FPU == "vfpv3") {<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("-target-feature");<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("+vfp3");<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("-target-feature");<o:p></o:p></p><p class=MsoNormal>    CmdArgs.push_back("-neon");  <span style='font-family:Wingdings'>่</span> why do we disable neon here?<o:p></o:p></p><p class=MsoNormal>  } <o:p></o:p></p><p class=MsoNormal>..<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal>Weiming<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>