_MM_TRANSPOSE4_PS会导致GCC中的编译器错误? [英] _MM_TRANSPOSE4_PS causes compiler errors in GCC?
问题描述
我第一次编译我的数学库在GCC而不是MSVC,并通过所有的小错误,我打了一个根本没有意义:
行284:错误:作为赋值的左操作数需要lvalue
this:
_MM_TRANSPOSE4_PS(r,u,t,_mm_setr_ps(0.0f,0.0f,0.0f,1.0f)); c $ c>
(r,u和t都是 __ m128
的实例)
熟悉 xmmintrin.h
的用户将会注意到 _MM_TRANSPOSE4_PS
isn' t实际上是一个函数,而是一个宏,扩展为:
/ *转置由行[0- 3]。 * /
#define _MM_TRANSPOSE4_PS(row0,row1,row2,row3)\
do {\
__v4sf __r0 =(row0),__r1 =(row1),__r2 = ,__r3 =(row3); \
__v4sf __t0 = __builtin_ia32_unpcklps(__r0,__r1); \
__v4sf __t1 = __builtin_ia32_unpcklps(__r2,__r3); \
__v4sf __t2 = __builtin_ia32_unpckhps(__r0,__r1); \
__v4sf __t3 = __builtin_ia32_unpckhps(__r2,__r3); \
(row0)= __builtin_ia32_movlhps(__t0,__t1); \
(row1)= __builtin_ia32_movhlps(__t1,__t0); \
(row2)= __builtin_ia32_movlhps(__t2,__t3); \
(row3)= __builtin_ia32_movhlps(__t3,__t2); \
} while(0)
那么...是什么原因导致我的编译器错误?我不在这里重新定义任何东西,我知道。
您需要更改:
_MM_TRANSPOSE4_PS(r,u,t,_mm_setr_ps(0.0f,0.0f,0.0f,1.0f));
到:
code> __ m128 v = _mm_setr_ps(0.0f,0.0f,0.0f,1.0f);
_MM_TRANSPOSE4_PS(r,u,t,v);
,因为这是一个就地转置,并且4个输入向量也用于输出。 / p>
I'm compiling my math library in GCC instead of MSVC for the first time and going through all the little errors, and I've hit one that simply makes no sense:
Line 284: error: lvalue required as left operand of assignment
What's on line 284? this:
_MM_TRANSPOSE4_PS(r, u, t, _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f));
(r, u, and t are all instances of __m128
)
Those familiar with using xmmintrin.h
will be aware that _MM_TRANSPOSE4_PS
isn't actually a function, but rather a macro, which expands to:
/* Transpose the 4x4 matrix composed of row[0-3]. */
#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
do { \
__v4sf __r0 = (row0), __r1 = (row1), __r2 = (row2), __r3 = (row3); \
__v4sf __t0 = __builtin_ia32_unpcklps (__r0, __r1); \
__v4sf __t1 = __builtin_ia32_unpcklps (__r2, __r3); \
__v4sf __t2 = __builtin_ia32_unpckhps (__r0, __r1); \
__v4sf __t3 = __builtin_ia32_unpckhps (__r2, __r3); \
(row0) = __builtin_ia32_movlhps (__t0, __t1); \
(row1) = __builtin_ia32_movhlps (__t1, __t0); \
(row2) = __builtin_ia32_movlhps (__t2, __t3); \
(row3) = __builtin_ia32_movhlps (__t3, __t2); \
} while (0)
So... what's causing my compiler errors? I don't redefine anything here, that I know of. This exact same code compiled and ran perfectly well when I was using MSVC.
You need to change:
_MM_TRANSPOSE4_PS(r, u, t, _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f));
to:
__m128 v = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f);
_MM_TRANSPOSE4_PS(r, u, t, v);
since this is an in-place transpose, and the 4 input vectors are also used for output.
这篇关于_MM_TRANSPOSE4_PS会导致GCC中的编译器错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!