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

Weiming Zhao weimingz at codeaurora.org
Mon Sep 24 16:37:10 PDT 2012


Hi Eli,

I passed "-ffp-contract=fast" to clang.
The complete clang command is:
clang -O3 -mcpu=cortex-a9 -mfpu=vfp4  -S -c -o test.s test.c
-ffp-contract=fast
The cc1 flags (use -v) are in the previouse email.

Clang doesn't recognize "vfp4" for mfpu option. 
Maybe there is other option to specify vfp4?

Weiming

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

-----Original Message-----
From: Eli Friedman [mailto:eli.friedman at gmail.com] 
Sent: Monday, September 24, 2012 3:58 PM
To: Weiming Zhao
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] Questions about specifying VFP4 in clang for ARM

On Mon, Sep 24, 2012 at 12:11 PM, Weiming Zhao <weimingz at codeaurora.org>
wrote:
> 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.

I see a pretty obvious hole in your reasoning: you didn't specify anything
to make clang default to -fp-contract=fast.  Am I missing something?

-Eli




More information about the cfe-dev mailing list