__m64_czx1l, __m64_czx1r, __m64_czx2l, __m64_czx2r
Microsoft Specific
Emit various forms of the IPF Compute Zero Index (czx) instruction.
__m64 __m64_czx1l(
__m64 value
);
__m64 __m64_czx1r(
__m64 value
);
__m64 __m64_czx2l(
__m64 value
);
__m64 __m64_czx2r(
__m64 value
);
Parameters
- [in] value
The 64-bit value to scan.
Return Value
The 1-byte form looks at each aligned 8-bit block in turn, either from right to left or left to right (depending on the intrinsic used), identifying the first aligned 8-bit section that is all zeroes and returning a number from 0 to 7 indicating the number of bytes scanned before the first zero byte was found. If no zero byte is found, the return value is 8. The 2-byte form looks at each aligned 16-bit block in turn, either from right to left or left to right, identifying the first aligned 16-bit section found that is all zeroes. A return value from 0 to 3 indicates the number of 16-bit blocks scanned before finding the first 16-bit block that was all zeroes. If no such section is found, the return value is 4.
Requirements
Intrinsic |
Architecture |
---|---|
__m64_czx1l |
IPF |
__m64_czx1r |
IPF |
__m64_czx2l |
IPF |
__m64_czx2r |
IPF |
Header file <intrin.h>
Remarks
__m64_czx1l and __m64_czx1r emit the left and right forms of the 1-byte form of the instruction (czx1.l and czx1.r, respectively). __m64_czx2l and __m64_czx2r emit the left and right forms of the 2-byte form of the instruction (czx2.l and czx2.r, respectively). These intrinsics scan the value passed in for an aligned section of 1 or 2 bytes in length (depending on the intrinsic used) that is all zeroes. The left forms of these instructions scan from the most significant bit (MSB) down, and the right forms scan from the least significant bit (LSB) up.
Example
// czx.cpp
// compile with: /EHsc
// processor: IPF
#include <iostream>
#include <intrin.h>
using namespace std;
#pragma intrinsic(__m64_czx1l, __m64_czx1r, __m64_czx2l, __m64_czx2r)
int main()
{
__m64 i, j, k, m;
__m64 result_czx1l, result_czx1r, result_czx2l, result_czx2r;
i.m64_u64 = 0xff00ff00ff00ff00;
j.m64_u64 = 0xffffffffffffffff;
k.m64_u64 = 0x00000000ffffffff;
m.m64_u64 = 0x1101f0000230f10e;
cout << hex;
result_czx1l = __m64_czx1l(i);
result_czx1r = __m64_czx1r(i);
result_czx2l = __m64_czx2l(i);
result_czx2r = __m64_czx2r(i);
cout << "__m64_czx1l(" << i.m64_u64 << ") returns " <<
result_czx1l.m64_u64 << " " << endl;
cout << "__m64_czx1r(" << i.m64_u64 << ") returns " <<
result_czx1r.m64_u64 << " " << endl;
cout << "__m64_czx2l(" << i.m64_u64 << ") returns " <<
result_czx2l.m64_u64 << " " << endl;
cout << "__m64_czx2r(" << i.m64_u64 << ") returns " <<
result_czx2r.m64_u64 << " " << endl;
result_czx1l = __m64_czx1l(j);
result_czx1r = __m64_czx1r(j);
result_czx2l = __m64_czx2l(j);
result_czx2r = __m64_czx2r(j);
cout << "__m64_czx1l(" << j.m64_u64 << ") returns " <<
result_czx1l.m64_u64 << " " << endl;
cout << "__m64_czx1r(" << j.m64_u64 << ") returns " <<
result_czx1r.m64_u64 << " " << endl;
cout << "__m64_czx2l(" << j.m64_u64 << ") returns " <<
result_czx2l.m64_u64 << " " << endl;
cout << "__m64_czx2r(" << j.m64_u64 << ") returns " <<
result_czx2r.m64_u64 << " " << endl;
result_czx1l = __m64_czx1l(k);
result_czx1r = __m64_czx1r(k);
result_czx2l = __m64_czx2l(k);
result_czx2r = __m64_czx2r(k);
cout << "__m64_czx1l(" << k.m64_u64 << ") returns " <<
result_czx1l.m64_u64 << " " << endl;
cout << "__m64_czx1r(" << k.m64_u64 << ") returns " <<
result_czx1r.m64_u64 << " " << endl;
cout << "__m64_czx2l(" << k.m64_u64 << ") returns " <<
result_czx2l.m64_u64 << " " << endl;
cout << "__m64_czx2r(" << k.m64_u64 << ") returns " <<
result_czx2r.m64_u64 << " " << endl;
result_czx1l = __m64_czx1l(m);
result_czx1r = __m64_czx1r(m);
result_czx2l = __m64_czx2l(m);
result_czx2r = __m64_czx2r(m);
// Even though m has a 16-bit section of zeroes, it is not aligned
// on a 16-byte boundary, so won't be a match.
cout << "__m64_czx1l(" << m.m64_u64 << ") returns " <<
result_czx1l.m64_u64 << " " << endl;
cout << "__m64_czx1r(" << m.m64_u64 << ") returns " <<
result_czx1r.m64_u64 << " " << endl;
cout << "__m64_czx2l(" << m.m64_u64 << ") returns " <<
result_czx2l.m64_u64 << " " << endl;
cout << "__m64_czx2r(" << m.m64_u64 << ") returns " <<
result_czx2r.m64_u64 << " " << endl;
}
Output
__m64_czx1l(ff00ff00ff00ff00) returns 1
__m64_czx1r(ff00ff00ff00ff00) returns 0
__m64_czx2l(ff00ff00ff00ff00) returns 4
__m64_czx2r(ff00ff00ff00ff00) returns 4
__m64_czx1l(ffffffffffffffff) returns 8
__m64_czx1r(ffffffffffffffff) returns 8
__m64_czx2l(ffffffffffffffff) returns 4
__m64_czx2r(ffffffffffffffff) returns 4
__m64_czx1l(ffffffff) returns 0
__m64_czx1r(ffffffff) returns 4
__m64_czx2l(ffffffff) returns 0
__m64_czx2r(ffffffff) returns 2
__m64_czx1l(1101f0000230f10e) returns 3
__m64_czx1r(1101f0000230f10e) returns 4
__m64_czx2l(1101f0000230f10e) returns 4
__m64_czx2r(1101f0000230f10e) returns 4