Solaris上的哪个xarch SHA扩展? [英] Which xarch for SHA extensions on Solaris?
问题描述
Oracle最近发布了Sun Studio 12.6.我们有一个SHA-1和SHA-256 基于内部的实现(对于ARM和Intel),我们希望在Solaris i86计算机上启用该扩展.
Oracle released Sun Studio 12.6 recently. We have a SHA-1 and SHA-256 intrinsic based implementation (for ARM and Intel), and we want to enable the extension on Solaris i86 machines.
The 12.6 manual and -xarch
options is available at A.2.115.3 -xarch Flags for x86, but it does not discuss SHA.
我们为SHA使用哪个-xarch
选项?
Which -xarch
option do we use for SHA?
推荐答案
如果Studio 12.6不支持SHA指令集(并且我强烈怀疑它不支持,因为我根本找不到提到的"SHA", Oracle Developer Studio 12.6版本中的新增功能文档),那么您不走运.
If Studio 12.6 doesn't support the SHA instruction set (and I strongly suspect it doesn't since I can't find "SHA" mentioned at all, in any form, in the What's New in the Oracle Developer Studio 12.6 Release documentation), you're out of luck.
差不多.
您可以做的是创建自己的内联汇编器函数. 请参见man inline
:
What you can do is create your own inline assembler functions. See man inline
:
内联(4)
名称
inline,filename.il-汇编语言内联模板文件
inline, filename.il - Assembly language inline template files
说明
汇编语言调用说明由其副本代替 从内联模板(* .il)获得的相应功能主体 文件.
Assembly language call instructions are replaced by a copy of their corresponding function body obtained from the inline template (*.il) file.
内联模板文件的后缀为.il,例如:
Inline template files have a suffix of .il, for example:
% CC foo.il hello.c
内联由编译器的代码生成器完成.
Inlining is done by the compiler's code generator.
...
示例
请查看libm.il或vis.il以获取示例.您可以在编译器的lib/目录下找到特定于每种受支持体系结构的这些库的版本.
Please review libm.il or vis.il for examples. You can find a version of these libraries that is specific to each supported architecture under the compiler's lib/ directory.
...
在此处可以找到示例> (强调我的):
An example can be found here (emphasis mine):
使用Sun Studio编译器和内联汇编代码进行性能调优
...
本文提供了如何衡量绩效的演示 关键代码片段.使用编译器标志和 提供了使用内联汇编代码的另一个示例.比较结果以显示每种方法的好处和不同之处 方法.
This paper provides a demonstration of how to measure the performance of a critical piece of code. An example using a compiler flag and another example using inline assembly code are provided. The results are compared to show the benefits and differences of each approach.
...
示例8:用于迭代Mandelbrot计算的内联汇编代码
了解所有这些事实之后,就可以编写内联代码,如下所示: 示例8.
Knowing all these facts, the inline code can be written, as shown in Example 8.
.inline mandel_il,0
// x is stored in %xmm0
// y is stored in %xmm1
// 4.0 is stored in %xmm2
// max_int is stored in %rdi
// set registers to zero
xorps %xmm3, %xmm3
xorps %xmm4, %xmm4
xorps %xmm5, %xmm5
xorps %xmm6, %xmm6
xorps %xmm7, %xmm7
xorq %rax, %rax
.loop:
// check to see if u2 - v2 > 4.0
movss %xmm5, %xmm7
addss %xmm6, %xmm7
ucomiss %xmm2, %xmm7
jp .exit
jae .exit
// v = 2 * v * u + y
mulss %xmm3, %xmm4
addss %xmm4, %xmm4
addss %xmm1, %xmm4
// u = u2 - v2 + x
movss %xmm5, %xmm3
subss %xmm6, %xmm3
addss %xmm0, %xmm3
// u2 = u * u
movss %xmm3, %xmm5
mulss %xmm3, %xmm5
// v2 = v * v
movss %xmm4, %xmm6
mulss %xmm4, %xmm6
incl %eax
cmpl %edi, %eax
jl .loop
.exit:
// end of mandel_il
.end
一点都不难.在Solaris 8天中,我不得不为正在咨询的客户编写许多SPARC内联汇编器函数,其中一些是非常基础的-有效地是一行即可包装一条指令.我向其中的一些人保证会在Studio编译器套件的更高版本中完成工作(由于我们本身是由Sun自己分包的,所以这并不奇怪,不要忘记其中有些是很明显的-IIRC floor()
和ceil()
,其中有两个-首先应该在那儿...)
It's not hard at all. I had to write a lot of SPARC inline assembler functions for a customer I was consulting for back in the Solaris 8 days, some of them were pretty basic - effectively one-liners to wrap a single instruction. I swear some of them wound up in later versions of the Studio compiler suite (since we were sub-contracted by Sun itself, that's not surprising, nevermind the fact that some of them were blatantly obvious - floor()
and ceil()
, IIRC, were two of them - and should have been there in the first place...)
这篇关于Solaris上的哪个xarch SHA扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!