Visual Studio C++ 中的 v4sf 和 __attribute__ 等效项是什么?
typedef float v4sf __attribute__ ((mode(V4SF)));
这是在海湾合作委员会。有人知道等价语法吗?
VS 2010将显示__attribute__
没有这种类型的存储类,并且模式未定义。
我在网上搜索了一下,上面说
相当于GCC中的
__attribute__(aligned(size))
很有帮助 对于前 UNIX 开发人员或编写适用于 UNIX 的代码的人 在 GCC 中您可以使用多个平台获得相同的结果 属性(对齐(...))
请参阅此处了解更多信息: http://gcc.gnu。 org/onlinedocs/gcc-4.1.2/gcc/Type-Attributes.html#Type-Attributes
完整的 GCC 代码在这里:http://pastebin.com/bKkTTmH1
typedef float v4sf __attribute__ ((mode(V4SF)));
This is in GCC. Anyone knows the equivalence syntax?
VS 2010 will show __attribute__
has no storage class of this type, and mode is not defined.
I searched on the Internet and it said
Equivalent to
__attribute__( aligned( size ) )
in GCCIt is helpful
for former unix developers or people writing code that works on
multiple platforms that in GCC you achieve the same results using
attribute( aligned( ... ) )See here for more information:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Type-Attributes.html#Type-Attributes
The full GCC code is here: http://pastebin.com/bKkTTmH1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您要在 VC++ 中查找对齐指令,则为
__declspec(align(16))
。 (或任何您想要的对齐方式)示例用法如下:
http: //msdn.microsoft.com/en-us/library/83ythb65.aspx
请注意,
attribute
(在 GCC 中)和__declspec
(在 VC++ 中)是编译器特定的扩展。编辑:
现在我再次查看代码,需要做的工作不仅仅是将
__attribute__
行替换为 VC++ 等效项以使其在 VC++ 中进行编译。如果您正在使用以下宏/函数,则 VC++ 没有任何宏/函数:
__builtin_ia32_xorps
__builtin_ia32_loadups
__builtin_ia32_mulps
__builtin_ia32_addps
__builtin_ia32_storeups
你最好将所有这些替换为 SSE 内在函数 - 适用于两者GCC 和 VC++。
这是转换为内在函数的代码:
If you're looking for the alignment directive in VC++ it's
__declspec(align(16))
. (or whatever you want the alignment to be)And example usage is this:
http://msdn.microsoft.com/en-us/library/83ythb65.aspx
Note that both
attribute
(in GCC) and__declspec
(in VC++) are compiler-specific extensions.EDIT :
Now that I take a second look at the code, it's gonna take more work than just replacing the
__attribute__
line with the VC++ equivalent to get it to compile in VC++.VC++ doesn't have any if these macros/functions that you are using:
__builtin_ia32_xorps
__builtin_ia32_loadups
__builtin_ia32_mulps
__builtin_ia32_addps
__builtin_ia32_storeups
You're better off just replacing all of those with SSE intrinsics - which will work on both GCC and VC++.
Here's the code converted to intrinsics:
V4SF 和朋友与 GCC“矢量扩展”有关:
http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Vector-Extensions.html#Vector%20Extensions
http://gcc.gnu.org/onlinedocs/gcc -3.1/gcc/X86-Built-in-Functions.html
我不确定 MSVS/MSVC 中支持多少(如果有的话)。以下是一些链接:
http://www.codeproject.com/KB /recipes/sseintro.aspx?msg=643444
http://msdn.microsoft.com/en-us /library/y0dh78ez%28v=vs.80%29.aspx
http://msdn.microsoft.com/en-us/library/01fth20w.aspx
V4SF and friends have to do with GCC "vector extensions":
http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Vector-Extensions.html#Vector%20Extensions
http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/X86-Built-in-Functions.html
I'm not sure how much - if any of this stuff - is supported in MSVS/MSVC. Here are a few links:
http://www.codeproject.com/KB/recipes/sseintro.aspx?msg=643444
http://msdn.microsoft.com/en-us/library/y0dh78ez%28v=vs.80%29.aspx
http://msdn.microsoft.com/en-us/library/01fth20w.aspx