ARM在使用gcc,特别是android的编译中经常使用- m float-ABI=soft fpor-mfpu=FP v4-sp-d16,这两个选项具体用于什么?
要想弄清楚就必须从ARM的EABI VFP和NEON开始
ARM EABI
ARM EABI定义了编译器用于在ARM平台上编译代码的规则。 有两种类型的ABIs:与ARM EABI不兼容,一种是使用浮点注册作为函数参数,另一种是不使用。 ARM具有标准的浮点指令集,我们的硬件不支持该指令集,但可以使用此ABI。
虚拟浮动点(VFP ) )。
VFP:ARM的浮点扩展。 在armv8之前,VFP被扩展为浮点协处理器。 在armv8中,VFP已被NEON替换。 对于ARM来说,VFP扩展了知识的选项部分。 例如,cortex-A8仅使用cut-down VFPLite而不是一个全VFP模块,以下是VFP的每个版本号
VFPv1
不按比例排列
VFPv2
16 64位fpu注册
optionalextensiontothearminstructionsetinthearmv 5te,ARMv5TEJ,ARMv6,and ARMv6K architectures
optionalextensiontothearmandthumbinstructionsetinthearmv6T2 architecture
supportsstandardfpuarithmetic (add,sub,neg,mul,div ),full square root
VFPv3
Backwards compatible with VFPv2,exceptthatitcannottrapfloating-point exceptions
addsvcvtinstructionstoconvertbetweenscalar,float and double
addsimmediatemodetovmovsuchthatconstantscanbeloadedintofpuregisters。
VFPv3-D32
32 64位fpu注册
implementedonmostcortex-A8 and a9 arm V7 processors
VFPv3-D16
16 64位fpu注册
implementedoncortex-R4 and r5 processorsandthetegra2(cortex-a9 )。
VFPv3-F16
Uncommon
supports IEEE 754-2008半精度(16位)浮动点as a存储格式
VFPv3U
avariantofvfpv3thatsupportsthetrappingoffloating-pointexceptionstosupportcode。
cansupportsingle-or half-precisionfloatingpoint
VFPv4
Built on VFPv3
adds半高级支持格式
addsfusedmultiply-accumulate instructions
VFPv4-D32
32 64位fpu注册
implementedonthecortex-a 12a NDA 15 arm V7 processors
cortex-a7optionallyhasvfpv4- d32 (inthecaseofanfpuwithneon ) ) ) ) ) ) ) ) ) 65
VFPv4-D16
16 64位fpu注册
implementedoncortex-a5 anda 7进程(incaseofanfpuwithoutneon ) )。
VFPv4U
avariantofvfpv4thatsupportsthetrappingoffloating-pointexceptionstosupportcode
cansupportsingle-or half-precisionfloatingpoint
VFPv5
implementedoncortex-m7whensingleanddouble-precision floating-pointcoreoptionexists
离子
neon:theandvancedsingleinstructionmultipledata (SIMD )扩展。 Neon是ARM VFP协处理器的继承者。 在ARMV8之前,对浮点的VFP和NEON支持不同。 NEON与IEE754不兼容,并且有一些VFP支持的指令不支持NEON,但从ARMV8开始就不再这样了。 在Cortex-a8中,NEON都包括在内。
计算机选项
-mfloat-abi=后续参数
soft :全软件流量支持
soft FP : allowsuseoffloating-pointinstructionsbutmaintainscompatibilitywiththesoft-float ABI
hard : uses floating-pointinstructionsandthefloating-point ABI。
同一program只能使用一种
FPU
如果使用hard或softfp float-abi,则必须同时指定FPU。
the-mfpu=optionsupportsthefollowingfputypes : VFP、vfpv3、vfpv3-fp16、vfpv3-d16-fp16、vfpv3-d16 neon-vfpv4、fp-armv8、neon-fp-armv8、and crypto-neon-fp-armv8。
fp16 -格式
the-mfp 16-format=optionallowsyoutospecifytheformatofthehalf-precision floating-point type (_ _ fp16 ).validoption