Linux下VFP NEON浮点编译
http://blog.csdn.net/liujia2100/article/details/27236477
NEON:SIMD(Single Instruction Multiple Data 单指令多重数据) 指令集, 其针对多媒体和讯号处理程式具备标准化的加速能力。
VFP: (Vector Float Point), 向量浮点运算单元,arm11(s3c6410 支持VFPv2),Cortex-A8(s5pv210)支持VFPv3.
NEON和VFPv3 浮点协处理器共享寄存器组,所以在汇编时,指令是一样的。
编译选项:
-mfpu = name(neon or vfpvx)指定FPU 单元
-mfloat-abi = name(soft、hard、 softfp):指定软件浮点或硬件浮点或兼容软浮点调用接口
如果只指定 -mfpu,那么默认编译不会选择选择硬件浮点指令集
如果只指定 -mfloat-abi = hard或者softfp,那么编译会使用硬件浮点指令集
测试C文件
- int main(void)
- {
- float f1, f2, f3;
- f1 = 1.2;
- f2 = 1.3;
- f3 = f1 / f2;
- return 0;
- }
1、 arm-eabi-gcc -S hello.c -mfpu=neon
- .arch armv5te
- .fpu softvfp
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .global __aeabi_fdiv
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- stmfd sp!, {fp, lr}
- .save {fp, lr}
- .LCFI0:
- .setfp fp, sp, #4
- add fp, sp, #4
- .LCFI1:
- .pad #16
- sub sp, sp, #16
- .LCFI2:
- ldr r3, .L3 @ float
- str r3, [fp, #-16] @ float
- ldr r3, .L3+4 @ float
- str r3, [fp, #-12] @ float
- ldr r0, [fp, #-16] @ float
- ldr r1, [fp, #-12] @ float
- bl __aeabi_fdiv
- mov r3, r0
- str r3, [fp, #-8] @ float
- mov r3, #0
- mov r0, r3
- sub sp, fp, #4
- ldmfd sp!, {fp, pc}
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
2、 arm-eabi-gcc -S hello.c -mfpu=vfp
- .arch armv5te
- .fpu softvfp
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .global __aeabi_fdiv
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- stmfd sp!, {fp, lr}
- .save {fp, lr}
- .LCFI0:
- .setfp fp, sp, #4
- add fp, sp, #4
- .LCFI1:
- .pad #16
- sub sp, sp, #16
- .LCFI2:
- ldr r3, .L3 @ float
- str r3, [fp, #-16] @ float
- ldr r3, .L3+4 @ float
- str r3, [fp, #-12] @ float
- ldr r0, [fp, #-16] @ float
- ldr r1, [fp, #-12] @ float
- bl __aeabi_fdiv
- mov r3, r0
- str r3, [fp, #-8] @ float
- mov r3, #0
- mov r0, r3
- sub sp, fp, #4
- ldmfd sp!, {fp, pc}
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
可以看到上面两个例子,使用的是 .fpu softvfp
3、 arm-eabi-gcc -S hello.c -mfpu=neon -mfloat-abi=hard
- .arch armv5te
- .eabi_attribute 27, 3
- .eabi_attribute 28, 1
- .fpu neon
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- @ link register save eliminated.
- str fp, [sp, #-4]!
- .save {fp}
- .LCFI0:
- .setfp fp, sp, #0
- add fp, sp, #0
- .LCFI1:
- .pad #20
- sub sp, sp, #20
- .LCFI2:
- flds s15, .L3
- fsts s15, [fp, #-16]
- flds s15, .L3+4
- fsts s15, [fp, #-12]
- flds s14, [fp, #-16]
- flds s15, [fp, #-12]
- fdivs s15, s14, s15
- fsts s15, [fp, #-8]
- mov r3, #0
- mov r0, r3
- add sp, fp, #0
- ldmfd sp!, {fp}
- bx lr
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
4、 arm-eabi-gcc -S hello.c -mfpu=neon -mfloat-abi=softfp
- .arch armv5te
- .eabi_attribute 27, 3
- .fpu neon
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- @ link register save eliminated.
- str fp, [sp, #-4]!
- .save {fp}
- .LCFI0:
- .setfp fp, sp, #0
- add fp, sp, #0
- .LCFI1:
- .pad #20
- sub sp, sp, #20
- .LCFI2:
- flds s15, .L3
- fsts s15, [fp, #-16]
- flds s15, .L3+4
- fsts s15, [fp, #-12]
- flds s14, [fp, #-16]
- flds s15, [fp, #-12]
- fdivs s15, s14, s15
- fsts s15, [fp, #-8]
- mov r3, #0
- mov r0, r3
- add sp, fp, #0
- ldmfd sp!, {fp}
- bx lr
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
5、 arm-eabi-gcc -S hello.c -mfpu=vfpv3 -mfloat-abi=softfp
- .arch armv5te
- .eabi_attribute 27, 3
- .fpu vfpv3
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- @ link register save eliminated.
- str fp, [sp, #-4]!
- .save {fp}
- .LCFI0:
- .setfp fp, sp, #0
- add fp, sp, #0
- .LCFI1:
- .pad #20
- sub sp, sp, #20
- .LCFI2:
- flds s15, .L3
- fsts s15, [fp, #-16]
- flds s15, .L3+4
- fsts s15, [fp, #-12]
- flds s14, [fp, #-16]
- flds s15, [fp, #-12]
- fdivs s15, s14, s15
- fsts s15, [fp, #-8]
- mov r3, #0
- mov r0, r3
- add sp, fp, #0
- ldmfd sp!, {fp}
- bx lr
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
6、 arm-eabi-gcc -S hello.c -mfpu=vfpv3 -mfloat-abi=hard
- .arch armv5te
- .eabi_attribute 27, 3
- .eabi_attribute 28, 1
- .fpu vfpv3
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- @ link register save eliminated.
- str fp, [sp, #-4]!
- .save {fp}
- .LCFI0:
- .setfp fp, sp, #0
- add fp, sp, #0
- .LCFI1:
- .pad #20
- sub sp, sp, #20
- .LCFI2:
- flds s15, .L3
- fsts s15, [fp, #-16]
- flds s15, .L3+4
- fsts s15, [fp, #-12]
- flds s14, [fp, #-16]
- flds s15, [fp, #-12]
- fdivs s15, s14, s15
- fsts s15, [fp, #-8]
- mov r3, #0
- mov r0, r3
- add sp, fp, #0
- ldmfd sp!, {fp}
- bx lr
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
从上面可以看到,使用softfp和hard使用的指令集是一样的,都是硬件浮点, neon和vfp的区别,仅仅体现在.fpu vfpv3和.fpu neon.
7、 arm-eabi-gcc -S hello.c -mfloat-abi=hard
- .arch armv5te
- .eabi_attribute 27, 3
- .eabi_attribute 28, 1
- .fpu vfp
- .eabi_attribute 20, 1
- .eabi_attribute 21, 1
- .eabi_attribute 23, 3
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
- .eabi_attribute 26, 2
- .eabi_attribute 30, 6
- .eabi_attribute 18, 4
- .file "hello.c"
- .text
- .align 2
- .global main
- .type main, %function
- main:
- .fnstart
- .LFB0:
- @ args = 0, pretend = 0, frame = 16
- @ frame_needed = 1, uses_anonymous_args = 0
- @ link register save eliminated.
- str fp, [sp, #-4]!
- .save {fp}
- .LCFI0:
- .setfp fp, sp, #0
- add fp, sp, #0
- .LCFI1:
- .pad #20
- sub sp, sp, #20
- .LCFI2:
- flds s15, .L3
- fsts s15, [fp, #-16]
- flds s15, .L3+4
- fsts s15, [fp, #-12]
- flds s14, [fp, #-16]
- flds s15, [fp, #-12]
- fdivs s15, s14, s15
- fsts s15, [fp, #-8]
- mov r3, #0
- mov r0, r3
- add sp, fp, #0
- ldmfd sp!, {fp}
- bx lr
- .L4:
- .align 2
- .L3:
- .word 1067030938
- .word 1067869798
- .LFE0:
- .fnend
- .size main, .-main
- .ident "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
- .section .note.GNU-stack,"",%progbits
当直接使用-mfloat-abi=hard时,会默认使用.fpu vfp硬件浮点。
Linux下VFP NEON浮点编译的更多相关文章
- [转]Caffe在Linux下的安装,编译,实验
Caffe在Linux下的安装,编译,实验 原文地址:http://www.cnblogs.com/evansyang/p/6150118.html 第一部分:Caffe 简介 caffe是有伯克利 ...
- Linux下librdkafka客户端的编译运行
Linux下librdkafka客户端的编译运行 librdkafka是一个开源的Kafka客户端C/C++实现,提供了Kafka生产者.消费者接口. 由于项目需要,我要将Kafka生产者接口封装起来 ...
- Linux下FFmpeg的安装编译过程【转】
本文转载自:http://www.linuxidc.com/Linux/2013-06/85628.htm 详细说下在Linux下FFmpeg的安装编译过程.参考 Ubuntu 10.04安装编译FF ...
- [zhuan] linux 下 wxWidgets 安装,编译
http://blog.csdn.net/yuzhenxiong0823/article/details/7727133 wxWidgets在Linux下有wxGTK和wxX11供使用,各需要GT ...
- Linux下通过源码编译安装程序
本文简单的记录了下,在linux下如何通过源码安装程序,以及相关的知识.(大神勿喷^_^) 一.程序的组成部分 Linux下程序大都是由以下几部分组成: 二进制文件:也就是可以运行的程序文件 库文件: ...
- linux下motion摄像头监控编译与配置
利用linxu下的开源的motion搭建嵌入式视频动态监控系统 所谓移动图像监测,简单来说就是利用摄像头定点监测某个区域,当有移动物体经过时,摄像头便自动抓拍(要监测多大物体.按拍照速率都是可调的), ...
- Linux 下提高make的编译效率
Linux下安装程序,一般都通过包管理器安装,但是包管理器或软件商店里的软件往往不是最新版本的,安装最新版软件时通常是下载源代码进行编译. 编译安装源代码时就离不开make了,但是make是单线程的, ...
- Linux下C++/C的编译调试
这几天因为任务的原因我需要在ubuntu下编写程序.因此恶补了许多linux程序编写的知识.我分以下几个方面总结我所学的知识. gcc,g++,make命令的使用 gdb 调试 VScode的使用 c ...
- 在linux下用命令行编译 java的eclipse项目
由于jdk的版本问题导致在windows上编译打包好的jar包放在linux服务器上运行的时候出现一点小异常,所以决定在linux上进行一次项目编译,这有两个选择1.在相同的linux环境下安装lin ...
随机推荐
- 【java基础学习一】int[]、Integer[]、String[] 排序( 正序、倒叙)、去重
调用: //重复项有9.5.1.2 int[] ints = new int[]{9,4,7,8,2,5,1,6,2,5,9,1}; arrayIntTest(ints); ///////////// ...
- C#中string在内存中是如何表示的
不知道你是否有过和我一样的疑问,不同编码的字符串是如何存储在运行时的内存中的呢,计算机在操作string类型的对象时,如何知道这个string是什么编码呢?和文本文件那样有类似BOM的东东在strin ...
- Canvas画图在360浏览器中跑偏的问题
问题描述,canvas画图的js代码中编写的是画正方形的代码,结果在360浏览器上变成了长方形,不知道怎么回事,请问各位大神是否遇到过此类问题? <!DOCTYPE html> <h ...
- spring mvc 定时器
1.下载quartz-all-1.7.3.jar包 a.在Spring配置和Quartz集成内容时,有两点需要注意 b.在<Beans>中不能够设置default-lazy-init=&q ...
- CentOS 7 安装php开发环境
安装服务 : yum install httpd httpd-devel service httpd start 启动 安装mariadb : yum -y install mariadb* ...
- 快速解析超大XML不占用太大内存
import xml.etree.ElementTree as ET def parse_res(xml_file): res_dic = {} tmp_lst_lev1 = [] tmp_lst_l ...
- machine learning----->Amazon Machine Learning机器学习平台
参考资料: 1.如何使用Amazon Machine Learning平台构建你的机器学习预测模型 2.
- python第十七天-----Django初体验
Django是一个MTV框架 M:models(数据库) T:templates(放置html模版) V:views(处理用户请求) 那么传说中的MVC框架又是什么呢? M:models(数据库) V ...
- C语言fgetpos()函数:获得当前文件的读写指针(转)
头文件:#include<stdio.h>fgetpos()函数获得当前文件的指针所指的位置,并把该指针所指的位置信息存放到pos所指的对象中.pos以内部格式存储,仅由fgetpos() ...
- iOS错误总结(三)
1.如果tableView设置为分组的样式(默认是有cell之间的分割线,可以设置颜色),默认有组以及组尾的高度 需要手动在组头组尾的代理方法中进行组高的设置(如果想设置为0,最好写0.01) 2.组 ...