- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
error C2664: '_mm_mulhi_epi16' : cannot convert parameter 2 from 'const int' to '__m128i'
.h file
class bigyy
{
public:
bigyy();
.
.
.
protected:
__declspec(align(16))static const int pink[5][2];
__declspec(align(16))static const int orange[12];
protected:
__declspec(align(16))int _x;
__declspec(align(16))int _y;
};
.cpp file
#include
const int bigyy::pink[5][2] =
{
{1,2},
{3,4},
{5,6 },
{ 7,8},
{ 9,10 }
};
const int bigyy::orange[12] =
{
0, 2, 2 ,
2, 1, 1 ,
0, 2, 2 ,
2, 1, 1
};
bigyy::bigyy()
{
_x = 1;
_y = _x % 6;
}
__m128i xo,temp;
.
.
.int p=orange
.
.temp = _mm_mulhi_epi16(x0,pink[_y]
)//error C2664: '_mm_mulhi_epi16' : cannot convert parameter 2 from 'const int' to '__m128i'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
_mm_muli_epi16(__m128i, __m128i)
x0 is defined as __m128i but pink is an array.
You need to load pink[_y]
to another __mm128i variable then do the multiplication.
__m128i _pink = __mm_cvtsi32_si128(pinl[_y]
);
assuming you are loading 32bit integer. (you may have to check exact syntax.).
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
_mm_muli_epi16(__m128i, __m128i)
x0 is defined as __m128i but pink is an array.
You need to load pink[_y]
to another __mm128i variable then do the multiplication.
__m128i _pink = __mm_cvtsi32_si128(pinl[_y]
);
assuming you are loading 32bit integer. (you may have to check exact syntax.).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
error C2676: binary '[' : '__m128i' does not define this operator or a conversion to a type acceptable to the predefined operator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure how the code looks after the change. I assume that you are getting error at mm_cvtsi32_si128(). Make sure the parameter is "int" if not, then typecast to "int".
Secondly, I want to make sure that you understand that this instruction (movd) loads only 32bit integer and zeroes out upper part. You may have to shuffle this data up on other 32bit locations in xmm register if you want to broadcast to all locations. or you may have to copy someother data on upper 32bit locations.
it is defined as:
__m128i _mm_cvtsi32_si128 (int a);
and return values:
r0 := a
r1 := 0x0 ; r2 := 0x0 ; r3 := 0x0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
.h file
class bigyy
{
public:
bigyy();
.
.
.
protected:
__declspec(align(16))static const int pink[5][2];
__declspec(align(16))static const int orange[12];
protected:
__declspec(align(16))int _x;
__declspec(align(16))int _y;
};
.cpp file
#include
const int bigyy::pink[5][2] =
{
{1,2},
{3,4},
{5,6 },
{ 7,8},
{ 9,10 }
};
const int bigyy::orange[12] =
{
0, 2, 2 ,
2, 1, 1 ,
0, 2, 2 ,
2, 1, 1
};
bigyy::bigyy()
{
_x = 1;
_y = _x % 6;
}
__m128i xo,temp;
.
.
.int p=orange
.
__m128i _pink = __mm_cvtsi32_si128(pinl[_y]
);//this is the change i made and initial error was sorted
.temp = _mm_mulhi_epi16(x0,pink[_y]
)//error C2676: binary '[' : '__m128i' does not define this operator or a conversion to a type acceptable to the predefined operator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
temp = _mm_mulhi_epi16(x0,pink[_y]
)//error C2676: binary '[' : '__m128i' does not define this operator or a conversion to a type acceptable to the predefined operator.
it should be:
temp = _mm_mulhi_epi16(x0, _pink);
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page