微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > ARM 浮点运算详解

ARM 浮点运算详解

时间:11-20 来源:互联网 点击:

这里明显包含vfp指令。 所以是使用vfp指令的:

arm-hisiv200-linux-gcc -c -Wall -mfpu=vfp -mfloat-abi=softfp fcpu.c -o fcpu.o

注意:VFP 指令指令在附录1中。

如果使用:

arm-hisiv200-linux-gcc -c -Wall fcpu.c -o fcpu.o

#arm-hisiv200-linux-objdump -d fcpu.o

00000000 :
0: e92d4800 push {fp, lr}
4: e28db004 add fp, sp, #4
8: e24dd008 sub sp, sp, #8
c: e3a03000 mov r3, #0
10: e50b300c str r3, [fp, #-12]
14: e3a03000 mov r3, #0
18: e50b3008 str r3, [fp, #-8]
1c: e3a03000 mov r3, #0
20: e50b3008 str r3, [fp, #-8]
24: ea000019 b 90
28: e3a03000 mov r3, #0
2c: e50b300c str r3, [fp, #-12]
30: ea00000f b 74
34: e51b200c ldr r2, [fp, #-12]
38: e59f3068 ldr r3, [pc, #104] ; a8
3c: e7932102 ldr r2, [r3, r2, lsl #2]
40: e51b100c ldr r1, [fp, #-12]
44: e59f3060 ldr r3, [pc, #96] ; ac
48: e7933101 ldr r3, [r3, r1, lsl #2]
4c: e1a00002 mov r0, r2
50: e1a01003 mov r1, r3
54: ebfffffebl 0 <__aeabi_fadd>
58: e1a03000 mov r3, r0
5c: e1a02003 mov r2, r3
60: e59f3048 ldr r3, [pc, #72] ; b0
64: e5832000 str r2, [r3]
68: e51b300c ldr r3, [fp, #-12]
6c: e2833001 add r3, r3, #1
70: e50b300c str r3, [fp, #-12]
74: e51b200c ldr r2, [fp, #-12]
78: e59f3034 ldr r3, [pc, #52] ; b4
7c: e1520003 cmp r2, r3
80: daffffeb ble 34
84: e51b3008 ldr r3, [fp, #-8]
88: e2833001 add r3, r3, #1
8c: e50b3008 str r3, [fp, #-8]
90: e51b2008 ldr r2, [fp, #-8]
94: e59f3018 ldr r3, [pc, #24] ; b4
98: e1520003 cmp r2, r3
9c: daffffe1 ble 28
a0: e24bd004 sub sp, fp, #4
a4: e8bd8800 pop {fp, pc}

则不包含VFP指令。

且去调用 __aeabi_fadd

附录1 :VFP 指令

可以查看arm的realView文档。

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204ic/Bcffbdga.html

附录2:

-mfpu=name
-mfpe=number
-mfp=number
This specifies what floating point hardware (or hardware emulation) is available on the target. Permissible names are: fpa, fpe2, fpe3, maverick, vfp. -mfp and -mfpe are synonyms for -mfpu=fpenumber, for compatibility with older versions of GCC.

-mfloat-abi=name
Specifies which ABI to use for floating point values. Permissible values are: soft, softfp and hard.

soft and hard are equivalent to -msoft-float and -mhard-float respectively. softfp allows the generation of floating point instructions, but still uses the soft-float calling conventions.

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top