[llvm-dev] NEON FP flags
Renato Golin via llvm-dev
llvm-dev at lists.llvm.org
Fri Apr 1 06:56:53 PDT 2016
On 29 March 2016 at 11:09, James Greenhalgh <james.greenhalgh at arm.com> wrote:
> That is to say, GCC will only auto-vectorize floationg-point arithmetic
> if both -mfpu=neon AND -funsafe-math-optimizations are given. -mfpu=neon
> by itself does not imply that it is OK for GCC to generate non-IEEE
> compliant code. The default is safe until explicitly told otherwise.
Right, that was what I originally though from Hal's bug report, but
recent emails on the thread confused me.
I think this is the right behaviour, and I'm glad GCC does it, so we
can follow the correct approach from start.
>> Furthermore, the only alternatives we have at the moment is to either
>> use NEON for everything or nothing. It would be good to have an option
>> to use NEON for integer arithmetic and VFP for FP if the user requires
>> IEEE compliance.
>
> In GCC, this is -mfpu=neon.
This makes my life *so* much easier! :)
> In GCC today:
>
> -mfpu=vfp is the minimum floating-point instruction set supported, the
> choice of which ABI you use (-mfloat-abi) is independent from the choice
> of floating-point hardware that exists. -mfpu=soft and -mfpu=softfp are
> rejected by GCC.
Yes, I mixed mfpu with mfloat-abi, my bad.
> For your set of use cases:
>
> Int (ALU), FP (LIB), no VFP/NEON instructions
> -mfloat-abi=soft
>
> Int (ALU), FP (LIB), VFP/NEON instructions allowed
> Impossible
I mentioned this as -mfloat-abi=floatfp. Now I see my representation
of int/fp mixed concepts. Ignore this.
> Int (ALU), FP (VFP)
> -mfloat-abi=hard or -mfloat-abi=softfp
> + -mfpu=vfp (or other non-neon FPU)
>
> Int (NEON), FP (VFP)
> -float-abi=hard or -mfloat-abi=softfp
> + -mfpu=neon (or greater)
Excellent! This means I can only make -fsubnormal flags count, and all
will be the same.
This was my first approach, but Hal convinced me that we may want a
specific flag that is included by fast/unsafe maths flags. See below.
> Int (NEON), FP (NEON)
> -float-abi=hard or -mfloat-abi=softfp
> + -mfpu=neon (or greater)
> + -funsafe-math-optimizations (or equivalent)
Do you have one specifically for subnormals? -funsafe-math is a bit of
a big hammer and will enable other (potentially unwanted) behaviour
from the vectorizer.
However, -ffast-math / unsafe-math should include subnormal support.
> Int (ALU), FP (NEON)
> Impossible (as far as I know).
Irrelevant, as far as I care. :)
cheers,
--renato
More information about the llvm-dev
mailing list