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文件

  1. int main(void)
  2. {
  3. float f1, f2, f3;
  4. f1 = 1.2;
  5. f2 = 1.3;
  6. f3 = f1 / f2;
  7. return 0;
  8. }

1、 arm-eabi-gcc  -S hello.c -mfpu=neon

  1. .arch armv5te
  2. .fpu softvfp
  3. .eabi_attribute 20, 1
  4. .eabi_attribute 21, 1
  5. .eabi_attribute 23, 3
  6. .eabi_attribute 24, 1
  7. .eabi_attribute 25, 1
  8. .eabi_attribute 26, 2
  9. .eabi_attribute 30, 6
  10. .eabi_attribute 18, 4
  11. .file   "hello.c"
  12. .global __aeabi_fdiv
  13. .text
  14. .align  2
  15. .global main
  16. .type   main, %function
  17. main:
  18. .fnstart
  19. .LFB0:
  20. @ args = 0, pretend = 0, frame = 16
  21. @ frame_needed = 1, uses_anonymous_args = 0
  22. stmfd   sp!, {fp, lr}
  23. .save {fp, lr}
  24. .LCFI0:
  25. .setfp fp, sp, #4
  26. add fp, sp, #4
  27. .LCFI1:
  28. .pad #16
  29. sub sp, sp, #16
  30. .LCFI2:
  31. ldr r3, .L3 @ float
  32. str r3, [fp, #-16]  @ float
  33. ldr r3, .L3+4   @ float
  34. str r3, [fp, #-12]  @ float
  35. ldr r0, [fp, #-16]  @ float
  36. ldr r1, [fp, #-12]  @ float
  37. bl  __aeabi_fdiv
  38. mov r3, r0
  39. str r3, [fp, #-8]   @ float
  40. mov r3, #0
  41. mov r0, r3
  42. sub sp, fp, #4
  43. ldmfd   sp!, {fp, pc}
  44. .L4:
  45. .align  2
  46. .L3:
  47. .word   1067030938
  48. .word   1067869798
  49. .LFE0:
  50. .fnend
  51. .size   main, .-main
  52. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  53. .section    .note.GNU-stack,"",%progbits

2、 arm-eabi-gcc  -S hello.c -mfpu=vfp

  1. .arch armv5te
  2. .fpu softvfp
  3. .eabi_attribute 20, 1
  4. .eabi_attribute 21, 1
  5. .eabi_attribute 23, 3
  6. .eabi_attribute 24, 1
  7. .eabi_attribute 25, 1
  8. .eabi_attribute 26, 2
  9. .eabi_attribute 30, 6
  10. .eabi_attribute 18, 4
  11. .file   "hello.c"
  12. .global __aeabi_fdiv
  13. .text
  14. .align  2
  15. .global main
  16. .type   main, %function
  17. main:
  18. .fnstart
  19. .LFB0:
  20. @ args = 0, pretend = 0, frame = 16
  21. @ frame_needed = 1, uses_anonymous_args = 0
  22. stmfd   sp!, {fp, lr}
  23. .save {fp, lr}
  24. .LCFI0:
  25. .setfp fp, sp, #4
  26. add fp, sp, #4
  27. .LCFI1:
  28. .pad #16
  29. sub sp, sp, #16
  30. .LCFI2:
  31. ldr r3, .L3 @ float
  32. str r3, [fp, #-16]  @ float
  33. ldr r3, .L3+4   @ float
  34. str r3, [fp, #-12]  @ float
  35. ldr r0, [fp, #-16]  @ float
  36. ldr r1, [fp, #-12]  @ float
  37. bl  __aeabi_fdiv
  38. mov r3, r0
  39. str r3, [fp, #-8]   @ float
  40. mov r3, #0
  41. mov r0, r3
  42. sub sp, fp, #4
  43. ldmfd   sp!, {fp, pc}
  44. .L4:
  45. .align  2
  46. .L3:
  47. .word   1067030938
  48. .word   1067869798
  49. .LFE0:
  50. .fnend
  51. .size   main, .-main
  52. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  53. .section    .note.GNU-stack,"",%progbits

可以看到上面两个例子,使用的是 .fpu softvfp

3、 arm-eabi-gcc  -S hello.c -mfpu=neon -mfloat-abi=hard

  1. .arch armv5te
  2. .eabi_attribute 27, 3
  3. .eabi_attribute 28, 1
  4. .fpu neon
  5. .eabi_attribute 20, 1
  6. .eabi_attribute 21, 1
  7. .eabi_attribute 23, 3
  8. .eabi_attribute 24, 1
  9. .eabi_attribute 25, 1
  10. .eabi_attribute 26, 2
  11. .eabi_attribute 30, 6
  12. .eabi_attribute 18, 4
  13. .file   "hello.c"
  14. .text
  15. .align  2
  16. .global main
  17. .type   main, %function
  18. main:
  19. .fnstart
  20. .LFB0:
  21. @ args = 0, pretend = 0, frame = 16
  22. @ frame_needed = 1, uses_anonymous_args = 0
  23. @ link register save eliminated.
  24. str fp, [sp, #-4]!
  25. .save {fp}
  26. .LCFI0:
  27. .setfp fp, sp, #0
  28. add fp, sp, #0
  29. .LCFI1:
  30. .pad #20
  31. sub sp, sp, #20
  32. .LCFI2:
  33. flds    s15, .L3
  34. fsts    s15, [fp, #-16]
  35. flds    s15, .L3+4
  36. fsts    s15, [fp, #-12]
  37. flds    s14, [fp, #-16]
  38. flds    s15, [fp, #-12]
  39. fdivs   s15, s14, s15
  40. fsts    s15, [fp, #-8]
  41. mov r3, #0
  42. mov r0, r3
  43. add sp, fp, #0
  44. ldmfd   sp!, {fp}
  45. bx  lr
  46. .L4:
  47. .align  2
  48. .L3:
  49. .word   1067030938
  50. .word   1067869798
  51. .LFE0:
  52. .fnend
  53. .size   main, .-main
  54. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  55. .section    .note.GNU-stack,"",%progbits

4、 arm-eabi-gcc  -S hello.c -mfpu=neon -mfloat-abi=softfp

  1. .arch armv5te
  2. .eabi_attribute 27, 3
  3. .fpu neon
  4. .eabi_attribute 20, 1
  5. .eabi_attribute 21, 1
  6. .eabi_attribute 23, 3
  7. .eabi_attribute 24, 1
  8. .eabi_attribute 25, 1
  9. .eabi_attribute 26, 2
  10. .eabi_attribute 30, 6
  11. .eabi_attribute 18, 4
  12. .file   "hello.c"
  13. .text
  14. .align  2
  15. .global main
  16. .type   main, %function
  17. main:
  18. .fnstart
  19. .LFB0:
  20. @ args = 0, pretend = 0, frame = 16
  21. @ frame_needed = 1, uses_anonymous_args = 0
  22. @ link register save eliminated.
  23. str fp, [sp, #-4]!
  24. .save {fp}
  25. .LCFI0:
  26. .setfp fp, sp, #0
  27. add fp, sp, #0
  28. .LCFI1:
  29. .pad #20
  30. sub sp, sp, #20
  31. .LCFI2:
  32. flds    s15, .L3
  33. fsts    s15, [fp, #-16]
  34. flds    s15, .L3+4
  35. fsts    s15, [fp, #-12]
  36. flds    s14, [fp, #-16]
  37. flds    s15, [fp, #-12]
  38. fdivs   s15, s14, s15
  39. fsts    s15, [fp, #-8]
  40. mov r3, #0
  41. mov r0, r3
  42. add sp, fp, #0
  43. ldmfd   sp!, {fp}
  44. bx  lr
  45. .L4:
  46. .align  2
  47. .L3:
  48. .word   1067030938
  49. .word   1067869798
  50. .LFE0:
  51. .fnend
  52. .size   main, .-main
  53. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  54. .section    .note.GNU-stack,"",%progbits

5、 arm-eabi-gcc  -S hello.c -mfpu=vfpv3 -mfloat-abi=softfp

  1. .arch armv5te
  2. .eabi_attribute 27, 3
  3. .fpu vfpv3
  4. .eabi_attribute 20, 1
  5. .eabi_attribute 21, 1
  6. .eabi_attribute 23, 3
  7. .eabi_attribute 24, 1
  8. .eabi_attribute 25, 1
  9. .eabi_attribute 26, 2
  10. .eabi_attribute 30, 6
  11. .eabi_attribute 18, 4
  12. .file   "hello.c"
  13. .text
  14. .align  2
  15. .global main
  16. .type   main, %function
  17. main:
  18. .fnstart
  19. .LFB0:
  20. @ args = 0, pretend = 0, frame = 16
  21. @ frame_needed = 1, uses_anonymous_args = 0
  22. @ link register save eliminated.
  23. str fp, [sp, #-4]!
  24. .save {fp}
  25. .LCFI0:
  26. .setfp fp, sp, #0
  27. add fp, sp, #0
  28. .LCFI1:
  29. .pad #20
  30. sub sp, sp, #20
  31. .LCFI2:
  32. flds    s15, .L3
  33. fsts    s15, [fp, #-16]
  34. flds    s15, .L3+4
  35. fsts    s15, [fp, #-12]
  36. flds    s14, [fp, #-16]
  37. flds    s15, [fp, #-12]
  38. fdivs   s15, s14, s15
  39. fsts    s15, [fp, #-8]
  40. mov r3, #0
  41. mov r0, r3
  42. add sp, fp, #0
  43. ldmfd   sp!, {fp}
  44. bx  lr
  45. .L4:
  46. .align  2
  47. .L3:
  48. .word   1067030938
  49. .word   1067869798
  50. .LFE0:
  51. .fnend
  52. .size   main, .-main
  53. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  54. .section    .note.GNU-stack,"",%progbits

6、 arm-eabi-gcc  -S hello.c -mfpu=vfpv3 -mfloat-abi=hard

  1. .arch armv5te
  2. .eabi_attribute 27, 3
  3. .eabi_attribute 28, 1
  4. .fpu vfpv3
  5. .eabi_attribute 20, 1
  6. .eabi_attribute 21, 1
  7. .eabi_attribute 23, 3
  8. .eabi_attribute 24, 1
  9. .eabi_attribute 25, 1
  10. .eabi_attribute 26, 2
  11. .eabi_attribute 30, 6
  12. .eabi_attribute 18, 4
  13. .file   "hello.c"
  14. .text
  15. .align  2
  16. .global main
  17. .type   main, %function
  18. main:
  19. .fnstart
  20. .LFB0:
  21. @ args = 0, pretend = 0, frame = 16
  22. @ frame_needed = 1, uses_anonymous_args = 0
  23. @ link register save eliminated.
  24. str fp, [sp, #-4]!
  25. .save {fp}
  26. .LCFI0:
  27. .setfp fp, sp, #0
  28. add fp, sp, #0
  29. .LCFI1:
  30. .pad #20
  31. sub sp, sp, #20
  32. .LCFI2:
  33. flds    s15, .L3
  34. fsts    s15, [fp, #-16]
  35. flds    s15, .L3+4
  36. fsts    s15, [fp, #-12]
  37. flds    s14, [fp, #-16]
  38. flds    s15, [fp, #-12]
  39. fdivs   s15, s14, s15
  40. fsts    s15, [fp, #-8]
  41. mov r3, #0
  42. mov r0, r3
  43. add sp, fp, #0
  44. ldmfd   sp!, {fp}
  45. bx  lr
  46. .L4:
  47. .align  2
  48. .L3:
  49. .word   1067030938
  50. .word   1067869798
  51. .LFE0:
  52. .fnend
  53. .size   main, .-main
  54. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  55. .section    .note.GNU-stack,"",%progbits

从上面可以看到,使用softfp和hard使用的指令集是一样的,都是硬件浮点, neon和vfp的区别,仅仅体现在.fpu vfpv3和.fpu neon.

7、 arm-eabi-gcc  -S hello.c -mfloat-abi=hard

  1. .arch armv5te
  2. .eabi_attribute 27, 3
  3. .eabi_attribute 28, 1
  4. .fpu vfp
  5. .eabi_attribute 20, 1
  6. .eabi_attribute 21, 1
  7. .eabi_attribute 23, 3
  8. .eabi_attribute 24, 1
  9. .eabi_attribute 25, 1
  10. .eabi_attribute 26, 2
  11. .eabi_attribute 30, 6
  12. .eabi_attribute 18, 4
  13. .file   "hello.c"
  14. .text
  15. .align  2
  16. .global main
  17. .type   main, %function
  18. main:
  19. .fnstart
  20. .LFB0:
  21. @ args = 0, pretend = 0, frame = 16
  22. @ frame_needed = 1, uses_anonymous_args = 0
  23. @ link register save eliminated.
  24. str fp, [sp, #-4]!
  25. .save {fp}
  26. .LCFI0:
  27. .setfp fp, sp, #0
  28. add fp, sp, #0
  29. .LCFI1:
  30. .pad #20
  31. sub sp, sp, #20
  32. .LCFI2:
  33. flds    s15, .L3
  34. fsts    s15, [fp, #-16]
  35. flds    s15, .L3+4
  36. fsts    s15, [fp, #-12]
  37. flds    s14, [fp, #-16]
  38. flds    s15, [fp, #-12]
  39. fdivs   s15, s14, s15
  40. fsts    s15, [fp, #-8]
  41. mov r3, #0
  42. mov r0, r3
  43. add sp, fp, #0
  44. ldmfd   sp!, {fp}
  45. bx  lr
  46. .L4:
  47. .align  2
  48. .L3:
  49. .word   1067030938
  50. .word   1067869798
  51. .LFE0:
  52. .fnend
  53. .size   main, .-main
  54. .ident  "GCC: (Sourcery G++ Lite 2009q3-67) 4.4.1"
  55. .section    .note.GNU-stack,"",%progbits

当直接使用-mfloat-abi=hard时,会默认使用.fpu vfp硬件浮点。

Linux下VFP NEON浮点编译的更多相关文章

  1. [转]Caffe在Linux下的安装,编译,实验

    Caffe在Linux下的安装,编译,实验  原文地址:http://www.cnblogs.com/evansyang/p/6150118.html 第一部分:Caffe 简介 caffe是有伯克利 ...

  2. Linux下librdkafka客户端的编译运行

    Linux下librdkafka客户端的编译运行 librdkafka是一个开源的Kafka客户端C/C++实现,提供了Kafka生产者.消费者接口. 由于项目需要,我要将Kafka生产者接口封装起来 ...

  3. Linux下FFmpeg的安装编译过程【转】

    本文转载自:http://www.linuxidc.com/Linux/2013-06/85628.htm 详细说下在Linux下FFmpeg的安装编译过程.参考 Ubuntu 10.04安装编译FF ...

  4. [zhuan] linux 下 wxWidgets 安装,编译

      http://blog.csdn.net/yuzhenxiong0823/article/details/7727133 wxWidgets在Linux下有wxGTK和wxX11供使用,各需要GT ...

  5. Linux下通过源码编译安装程序

    本文简单的记录了下,在linux下如何通过源码安装程序,以及相关的知识.(大神勿喷^_^) 一.程序的组成部分 Linux下程序大都是由以下几部分组成: 二进制文件:也就是可以运行的程序文件 库文件: ...

  6. linux下motion摄像头监控编译与配置

    利用linxu下的开源的motion搭建嵌入式视频动态监控系统 所谓移动图像监测,简单来说就是利用摄像头定点监测某个区域,当有移动物体经过时,摄像头便自动抓拍(要监测多大物体.按拍照速率都是可调的), ...

  7. Linux 下提高make的编译效率

    Linux下安装程序,一般都通过包管理器安装,但是包管理器或软件商店里的软件往往不是最新版本的,安装最新版软件时通常是下载源代码进行编译. 编译安装源代码时就离不开make了,但是make是单线程的, ...

  8. Linux下C++/C的编译调试

    这几天因为任务的原因我需要在ubuntu下编写程序.因此恶补了许多linux程序编写的知识.我分以下几个方面总结我所学的知识. gcc,g++,make命令的使用 gdb 调试 VScode的使用 c ...

  9. 在linux下用命令行编译 java的eclipse项目

    由于jdk的版本问题导致在windows上编译打包好的jar包放在linux服务器上运行的时候出现一点小异常,所以决定在linux上进行一次项目编译,这有两个选择1.在相同的linux环境下安装lin ...

随机推荐

  1. 【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); ///////////// ...

  2. C#中string在内存中是如何表示的

    不知道你是否有过和我一样的疑问,不同编码的字符串是如何存储在运行时的内存中的呢,计算机在操作string类型的对象时,如何知道这个string是什么编码呢?和文本文件那样有类似BOM的东东在strin ...

  3. Canvas画图在360浏览器中跑偏的问题

    问题描述,canvas画图的js代码中编写的是画正方形的代码,结果在360浏览器上变成了长方形,不知道怎么回事,请问各位大神是否遇到过此类问题? <!DOCTYPE html> <h ...

  4. spring mvc 定时器

    1.下载quartz-all-1.7.3.jar包 a.在Spring配置和Quartz集成内容时,有两点需要注意 b.在<Beans>中不能够设置default-lazy-init=&q ...

  5. CentOS 7 安装php开发环境

    安装服务 : yum install httpd httpd-devel  service httpd start 启动     安装mariadb : yum -y install mariadb* ...

  6. 快速解析超大XML不占用太大内存

    import xml.etree.ElementTree as ET def parse_res(xml_file): res_dic = {} tmp_lst_lev1 = [] tmp_lst_l ...

  7. machine learning----->Amazon Machine Learning机器学习平台

    参考资料: 1.如何使用Amazon Machine Learning平台构建你的机器学习预测模型 2.

  8. python第十七天-----Django初体验

    Django是一个MTV框架 M:models(数据库) T:templates(放置html模版) V:views(处理用户请求) 那么传说中的MVC框架又是什么呢? M:models(数据库) V ...

  9. C语言fgetpos()函数:获得当前文件的读写指针(转)

    头文件:#include<stdio.h>fgetpos()函数获得当前文件的指针所指的位置,并把该指针所指的位置信息存放到pos所指的对象中.pos以内部格式存储,仅由fgetpos() ...

  10. iOS错误总结(三)

    1.如果tableView设置为分组的样式(默认是有cell之间的分割线,可以设置颜色),默认有组以及组尾的高度 需要手动在组头组尾的代理方法中进行组高的设置(如果想设置为0,最好写0.01) 2.组 ...