42 #ifndef QDRAWHELPER_SSE_P_H 43 #define QDRAWHELPER_SSE_P_H 56 #include <private/qdrawhelper_mmx_p.h> 63 # define posix_memalign _lsb_hack_posix_memalign 64 # include <xmmintrin.h> 65 # undef posix_memalign 67 # include <xmmintrin.h> 73 #define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \ 74 (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0)) 77 struct QSSEIntrinsics :
public QMMXIntrinsics
79 static inline m64 alpha(
m64 x) {
80 return _mm_shuffle_pi16 (x, _MM_SHUFFLE(3, 3, 3, 3));
83 static inline m64 _load_alpha(
uint x,
const m64 &mmx_0x0000) {
84 m64 t = _mm_unpacklo_pi8(_mm_cvtsi32_si64(x), mmx_0x0000);
85 return _mm_shuffle_pi16 (t, _MM_SHUFFLE(0, 0, 0, 0));
90 inline void qt_memfill32_sse_template(
quint32 *dest,
quint32 value,
int count)
94 case 6: *dest++ = value;
95 case 5: *dest++ = value;
96 case 4: *dest++ = value;
97 case 3: *dest++ = value;
98 case 2: *dest++ = value;
99 case 1: *dest = value;
104 __m64 *dst64 =
reinterpret_cast<__m64*
>(dest);
105 const __m64 value64 = _mm_set_pi32(value, value);
106 int count64 = count / 2;
108 int n = (count64 + 3) / 4;
109 switch (count64 & 0x3) {
110 case 0:
do { _mm_stream_pi(dst64++, value64);
111 case 3: _mm_stream_pi(dst64++, value64);
112 case 2: _mm_stream_pi(dst64++, value64);
113 case 1: _mm_stream_pi(dst64++, value64);
118 dest[count - 1] = value;
124 inline void qt_bitmapblit16_sse_template(
QRasterBuffer *rasterBuffer,
128 int width,
int height,
int stride)
130 const quint16 c = qt_colorConvert<quint16, quint32>(color, 0);
134 const __m64 c64 = _mm_set1_pi16(c);
136 # pragma warning(disable: 4309) // truncation of constant value 138 const __m64 maskmask1 = _mm_set_pi16(0x1010, 0x2020, 0x4040, 0x8080);
139 const __m64 maskadd1 = _mm_set_pi16(0x7070, 0x6060, 0x4040, 0x0000);
142 const __m64 maskmask2 = _mm_set_pi16(0x0101, 0x0202, 0x0404, 0x0808);
143 const __m64 maskadd2 = _mm_set_pi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878);
146 for (
int x = 0; x < width; x += 8) {
147 const quint8 s = src[x >> 3];
150 __m64 mask1 = _mm_set1_pi8(s);
152 mask1 = _m_pand(mask1, maskmask1);
153 mask1 = _mm_add_pi16(mask1, maskadd1);
154 _mm_maskmove_si64(c64, mask1, (
char*)(dest + x));
155 mask2 = _m_pand(mask2, maskmask2);
156 mask2 = _mm_add_pi16(mask2, maskadd2);
157 _mm_maskmove_si64(c64, mask2, (
char*)(dest + x + 4));
166 __m64 mask1 = _mm_set1_pi8(s);
167 mask1 = _m_pand(mask1, maskmask1);
168 mask1 = _mm_add_pi16(mask1, maskadd1);
169 _mm_maskmove_si64(c64, mask1, (
char*)(dest));
181 #endif // QT_HAVE_SSE 182 #endif // QDRAWHELPER_SSE_P_H
#define QT_END_NAMESPACE
This macro expands to.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static const KeyPair *const end