如何告诉编译器在 ARM 中使用硬件浮点指令

编程入门 行业动态 更新时间:2024-10-11 17:23:53
本文介绍了如何告诉编译器在 ARM 中使用硬件浮点指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在为 ARM 编译一个程序.makefile 有一个标志 -msoft-float,它告诉编译器使用软件浮点模拟.我的问题是如何在 makefile 中指定使用硬件浮点指令代替.我试过 -mhard-float,但如果我这样做,我会出错.我还尝试了 -msoftfp-float,正如 这个站点 但编译器甚至不识别该标志.所以,请告诉我应该如何解决这个问题.

I am compiling a program for ARM. The makefile has a flag -msoft-float which is telling the compiler to use software floating point emulation. My question is how can I specify in the makefile to use the hardware floating point instructions instead. I tried -mhard-float, but if I do so I get errors. I also tried -msoftfp-float as told by this site but the compiler doesn't even recognize that flag. So, please tell me how should I solve this problem.

推荐答案

Soft float 是配置 gcc 的一个选项,它是开源的,任何人都可以在有/没有 的情况下配置工具链软浮动支持.请参阅 http://crosstool-ng/ 以获取构建您自己的编译器的工具.我从正在使用 gcc 4.1.2 的引用链接中获取它;-mfloat-abi=softfp 可能会给您带来最好的运气.ARM 上有三种变体.Debian ARM 浮点维基 在描述差异方面做得非常出色.此外,Debian VFP 比较可能很有趣.

Soft float is an option to configure gcc, it is open source and anyone can configure a tool chain with/without soft float support. See http://crosstool-ng/ for a tool to build your own compiler. I take it from the referenced link that gcc 4.1.2 is being used; You will probably have the best luck with -mfloat-abi=softfp. There are three variants on the ARM. The Debian ARM floating point wiki does an excellent job of describing the differences. Also Debian VFP comparison may be of interest.

这篇关于如何告诉编译器在 ARM 中使用硬件浮点指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-16 14:41:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/889208.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浮点   编译器   指令   硬件   ARM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!