免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2519 | 回复: 5
打印 上一主题 下一主题

请问一个关于浮点处理的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-04 22:51 |只看该作者 |倒序浏览
用的处理器是SPARC体系结构,想把long double类型的数据处理成128位的,用-mhard-

quad-float选项只能得到64位的处理结果,如:
执行加法指令,只能得到faddd的汇编指令,
请问,如何才能将long double类型的数据加法处理成faddq这种类型的指令?

期待大家的解答,多谢!

论坛徽章:
3
2015年迎新春徽章
日期:2015-03-04 09:56:11数据库技术版块每日发帖之星
日期:2016-08-03 06:20:00数据库技术版块每日发帖之星
日期:2016-08-04 06:20:00
2 [报告]
发表于 2008-05-04 23:19 |只看该作者
什么编译器?
是gcc吗?
如果是gcc的话,我不知道最新的gcc是否支持硬件级的128bit
这是man gcc的结果
-msoft-quad-float
           Generate output containing library calls for quad-word (long double) floating point instructions.  The functions called are those specified in
           the SPARC ABI.  This is the default.

           As of this writing, there are no SPARC implementations that have hardware support for the quad-word floating point instructions.  They all
           invoke a trap handler for one of these instructions, and then the trap handler emulates the effect of the instruction.  Because of the trap
           handler overhead, this is much slower than calling the ABI library routines.  Thus the -msoft-quad-float option is the default.
2006-6-16

论坛徽章:
0
3 [报告]
发表于 2008-05-05 00:45 |只看该作者
多谢版主cjaizss的回答.
是用的GCC,从手册上看是有选项-mhard-quad-float的,只是用了这个选项之后,还是按照64位处理的,也就是long double的变量的加还是处理成faddd,不知道如何才能够处理成faddq,因为faddq才是处理quad类型的数据的。
选项-mhard-quad-float为何没起作用?
多谢!

论坛徽章:
0
4 [报告]
发表于 2008-05-05 07:58 |只看该作者
原帖由 danate 于 2008-5-5 00:45 发表
多谢版主cjaizss的回答.
是用的GCC,从手册上看是有选项-mhard-quad-float的,只是用了这个选项之后,还是按照64位处理的,也就是long double的变量的加还是处理成faddd,不知道如何才能够处理成faddq,因为fa ...


把示例代码和gcc 的编译命令贴上来.

论坛徽章:
0
5 [报告]
发表于 2008-05-05 13:16 |只看该作者
把示例代码和gcc 的编译命令贴上来.



a.c:


long double a = 1.0;
long double b = 2.0;
long double c = 1.0;

c = a + b;


编译命令:
gcc -mfpu -mhard-quad-float -mcpu=v8 a.c


请问:如何将c = a + b;翻译为可以使用faddq指令?我查看反汇编之后的结果是使用的faddd指令。

论坛徽章:
0
6 [报告]
发表于 2008-05-05 13:42 |只看该作者
原帖由 danate 于 2008-5-5 13:16 发表



a.c:


long double a = 1.0;
long double b = 2.0;
long double c = 1.0;

c = a + b;


编译命令:
gcc -mfpu -mhard-quad-float -mcpu=v8 a.c


请问:如何将c = a + b;翻译为可以使用f ...


将a,b 的其中一个扩大到64bit的最大值,或使a+b超出64bit的最大纸看看.

[ 本帖最后由 system888net 于 2008-5-5 13:56 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP