Use Q_DECL_VECTORCALL in a few more places
There were a few functions that passed vectors in parameters but did not mark as vectorcall. I've taken the opportunity to de-macroify one macro, but I'm not going to do it for the rest. Change-Id: I42a48bd64ccc41aebf84fffd1564bfc21faa2a14 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>bb10
parent
40894d1a60
commit
986e49992c
|
|
@ -55,7 +55,8 @@ enum {
|
|||
// Vectorized blend functions:
|
||||
|
||||
// See BYTE_MUL_SSE2 for details.
|
||||
inline static void BYTE_MUL_AVX2(__m256i &pixelVector, const __m256i &alphaChannel, const __m256i &colorMask, const __m256i &half)
|
||||
inline static void Q_DECL_VECTORCALL
|
||||
BYTE_MUL_AVX2(__m256i &pixelVector, __m256i alphaChannel, __m256i colorMask, __m256i half)
|
||||
{
|
||||
__m256i pixelVectorAG = _mm256_srli_epi16(pixelVector, 8);
|
||||
__m256i pixelVectorRB = _mm256_and_si256(pixelVector, colorMask);
|
||||
|
|
@ -74,7 +75,8 @@ inline static void BYTE_MUL_AVX2(__m256i &pixelVector, const __m256i &alphaChann
|
|||
pixelVector = _mm256_or_si256(pixelVectorAG, pixelVectorRB);
|
||||
}
|
||||
|
||||
inline static void BYTE_MUL_RGB64_AVX2(__m256i &pixelVector, const __m256i &alphaChannel, const __m256i &colorMask, const __m256i &half)
|
||||
inline static void Q_DECL_VECTORCALL
|
||||
BYTE_MUL_RGB64_AVX2(__m256i &pixelVector, __m256i alphaChannel, __m256i colorMask, __m256i half)
|
||||
{
|
||||
__m256i pixelVectorAG = _mm256_srli_epi32(pixelVector, 16);
|
||||
__m256i pixelVectorRB = _mm256_and_si256(pixelVector, colorMask);
|
||||
|
|
@ -94,7 +96,8 @@ inline static void BYTE_MUL_RGB64_AVX2(__m256i &pixelVector, const __m256i &alph
|
|||
}
|
||||
|
||||
// See INTERPOLATE_PIXEL_255_SSE2 for details.
|
||||
inline static void INTERPOLATE_PIXEL_255_AVX2(const __m256i &srcVector, __m256i &dstVector, const __m256i &alphaChannel, const __m256i &oneMinusAlphaChannel, const __m256i &colorMask, const __m256i &half)
|
||||
inline static void Q_DECL_VECTORCALL
|
||||
INTERPOLATE_PIXEL_255_AVX2(__m256i srcVector, __m256i &dstVector, __m256i alphaChannel, __m256i oneMinusAlphaChannel, __m256i colorMask, __m256i half)
|
||||
{
|
||||
const __m256i srcVectorAG = _mm256_srli_epi16(srcVector, 8);
|
||||
const __m256i dstVectorAG = _mm256_srli_epi16(dstVector, 8);
|
||||
|
|
@ -116,7 +119,8 @@ inline static void INTERPOLATE_PIXEL_255_AVX2(const __m256i &srcVector, __m256i
|
|||
dstVector = _mm256_or_si256(finalAG, finalRB);
|
||||
}
|
||||
|
||||
inline static void INTERPOLATE_PIXEL_RGB64_AVX2(const __m256i &srcVector, __m256i &dstVector, const __m256i &alphaChannel, const __m256i &oneMinusAlphaChannel, const __m256i &colorMask, const __m256i &half)
|
||||
inline static void Q_DECL_VECTORCALL
|
||||
INTERPOLATE_PIXEL_RGB64_AVX2(__m256i srcVector, __m256i &dstVector, __m256i alphaChannel, __m256i oneMinusAlphaChannel, __m256i colorMask, __m256i half)
|
||||
{
|
||||
const __m256i srcVectorAG = _mm256_srli_epi32(srcVector, 16);
|
||||
const __m256i dstVectorAG = _mm256_srli_epi32(dstVector, 16);
|
||||
|
|
@ -140,7 +144,7 @@ inline static void INTERPOLATE_PIXEL_RGB64_AVX2(const __m256i &srcVector, __m256
|
|||
|
||||
|
||||
// See BLEND_SOURCE_OVER_ARGB32_SSE2 for details.
|
||||
inline static void BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *src, const int length)
|
||||
inline static void Q_DECL_VECTORCALL BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *src, const int length)
|
||||
{
|
||||
const __m256i half = _mm256_set1_epi16(0x80);
|
||||
const __m256i one = _mm256_set1_epi16(0xff);
|
||||
|
|
@ -211,7 +215,8 @@ inline static void BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *sr
|
|||
|
||||
|
||||
// See BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2 for details.
|
||||
inline static void BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(quint32 *dst, const quint32 *src, const int length, const int const_alpha)
|
||||
inline static void Q_DECL_VECTORCALL
|
||||
BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(quint32 *dst, const quint32 *src, const int length, const int const_alpha)
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -454,30 +454,30 @@ public:
|
|||
union Vect_buffer_i { Int32x4 v; int i[4]; };
|
||||
union Vect_buffer_f { Float32x4 v; float f[4]; };
|
||||
|
||||
static inline Float32x4 v_dup(float x) { return _mm_set1_ps(x); }
|
||||
static inline Float32x4 v_dup(double x) { return _mm_set1_ps(x); }
|
||||
static inline Int32x4 v_dup(int x) { return _mm_set1_epi32(x); }
|
||||
static inline Int32x4 v_dup(uint x) { return _mm_set1_epi32(x); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_dup(float x) { return _mm_set1_ps(x); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_dup(double x) { return _mm_set1_ps(x); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_dup(int x) { return _mm_set1_epi32(x); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_dup(uint x) { return _mm_set1_epi32(x); }
|
||||
|
||||
static inline Float32x4 v_add(Float32x4 a, Float32x4 b) { return _mm_add_ps(a, b); }
|
||||
static inline Int32x4 v_add(Int32x4 a, Int32x4 b) { return _mm_add_epi32(a, b); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_add(Float32x4 a, Float32x4 b) { return _mm_add_ps(a, b); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_add(Int32x4 a, Int32x4 b) { return _mm_add_epi32(a, b); }
|
||||
|
||||
static inline Float32x4 v_max(Float32x4 a, Float32x4 b) { return _mm_max_ps(a, b); }
|
||||
static inline Float32x4 v_min(Float32x4 a, Float32x4 b) { return _mm_min_ps(a, b); }
|
||||
static inline Int32x4 v_min_16(Int32x4 a, Int32x4 b) { return _mm_min_epi16(a, b); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_max(Float32x4 a, Float32x4 b) { return _mm_max_ps(a, b); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_min(Float32x4 a, Float32x4 b) { return _mm_min_ps(a, b); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_min_16(Int32x4 a, Int32x4 b) { return _mm_min_epi16(a, b); }
|
||||
|
||||
static inline Int32x4 v_and(Int32x4 a, Int32x4 b) { return _mm_and_si128(a, b); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_and(Int32x4 a, Int32x4 b) { return _mm_and_si128(a, b); }
|
||||
|
||||
static inline Float32x4 v_sub(Float32x4 a, Float32x4 b) { return _mm_sub_ps(a, b); }
|
||||
static inline Int32x4 v_sub(Int32x4 a, Int32x4 b) { return _mm_sub_epi32(a, b); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_sub(Float32x4 a, Float32x4 b) { return _mm_sub_ps(a, b); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_sub(Int32x4 a, Int32x4 b) { return _mm_sub_epi32(a, b); }
|
||||
|
||||
static inline Float32x4 v_mul(Float32x4 a, Float32x4 b) { return _mm_mul_ps(a, b); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_mul(Float32x4 a, Float32x4 b) { return _mm_mul_ps(a, b); }
|
||||
|
||||
static inline Float32x4 v_sqrt(Float32x4 x) { return _mm_sqrt_ps(x); }
|
||||
static inline Float32x4 Q_DECL_VECTORCALL v_sqrt(Float32x4 x) { return _mm_sqrt_ps(x); }
|
||||
|
||||
static inline Int32x4 v_toInt(Float32x4 x) { return _mm_cvttps_epi32(x); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_toInt(Float32x4 x) { return _mm_cvttps_epi32(x); }
|
||||
|
||||
static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return _mm_castps_si128(_mm_cmpgt_ps(a, b)); }
|
||||
static inline Int32x4 Q_DECL_VECTORCALL v_greaterOrEqual(Float32x4 a, Float32x4 b) { return _mm_castps_si128(_mm_cmpgt_ps(a, b)); }
|
||||
};
|
||||
|
||||
const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ static void convertARGBToARGB32PM_sse4(uint *buffer, const uint *src, int count)
|
|||
}
|
||||
}
|
||||
|
||||
static inline __m128 reciprocal_mul_ps(__m128 a, float mul)
|
||||
static inline __m128 Q_DECL_VECTORCALL reciprocal_mul_ps(__m128 a, float mul)
|
||||
{
|
||||
__m128 ia = _mm_rcp_ps(a); // Approximate 1/a
|
||||
// Improve precision of ia using Newton-Raphson
|
||||
|
|
|
|||
|
|
@ -79,55 +79,58 @@ QT_BEGIN_NAMESPACE
|
|||
// The computation being done is:
|
||||
// result = s + d * (1-alpha)
|
||||
// with shortcuts if fully opaque or fully transparent.
|
||||
#define BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
|
||||
int x = 0; \
|
||||
\
|
||||
/* First, get dst aligned. */ \
|
||||
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
|
||||
blend_pixel(dst[x], src[x]); \
|
||||
} \
|
||||
\
|
||||
const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\
|
||||
\
|
||||
if (!minusOffsetToAlignSrcOn16Bytes) {\
|
||||
/* src is aligned, usual algorithm but with aligned operations.\
|
||||
See the SSE2 version for more documentation on the algorithm itself. */\
|
||||
const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);\
|
||||
for (; x < length-3; x += 4) { \
|
||||
const __m128i srcVector = _mm_load_si128((const __m128i *)&src[x]); \
|
||||
const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
|
||||
if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
|
||||
_mm_store_si128((__m128i *)&dst[x], srcVector); \
|
||||
} else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
|
||||
__m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \
|
||||
alphaChannel = _mm_sub_epi16(one, alphaChannel); \
|
||||
const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
|
||||
__m128i destMultipliedByOneMinusAlpha; \
|
||||
BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
|
||||
const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
|
||||
_mm_store_si128((__m128i *)&dst[x], result); \
|
||||
} \
|
||||
} /* end for() */\
|
||||
} else if ((length - x) >= 8) {\
|
||||
/* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\
|
||||
__m128i srcVectorPrevLoaded = _mm_load_si128((const __m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\
|
||||
const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\
|
||||
\
|
||||
const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);\
|
||||
switch (palignrOffset) {\
|
||||
case 4:\
|
||||
BLENDING_LOOP(4, length)\
|
||||
break;\
|
||||
case 8:\
|
||||
BLENDING_LOOP(8, length)\
|
||||
break;\
|
||||
case 12:\
|
||||
BLENDING_LOOP(12, length)\
|
||||
break;\
|
||||
}\
|
||||
}\
|
||||
for (; x < length; ++x) \
|
||||
blend_pixel(dst[x], src[x]); \
|
||||
static inline void Q_DECL_VECTORCALL
|
||||
BLEND_SOURCE_OVER_ARGB32_SSSE3(quint32 *dst, const quint32 *src, int length,
|
||||
__m128i nullVector, __m128i half, __m128i one, __m128i colorMask, __m128i alphaMask)
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
/* First, get dst aligned. */
|
||||
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) {
|
||||
blend_pixel(dst[x], src[x]);
|
||||
}
|
||||
|
||||
const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;
|
||||
|
||||
if (!minusOffsetToAlignSrcOn16Bytes) {
|
||||
/* src is aligned, usual algorithm but with aligned operations.
|
||||
See the SSE2 version for more documentation on the algorithm itself. */
|
||||
const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);
|
||||
for (; x < length-3; x += 4) {
|
||||
const __m128i srcVector = _mm_load_si128((const __m128i *)&src[x]);
|
||||
const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask);
|
||||
if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) {
|
||||
_mm_store_si128((__m128i *)&dst[x], srcVector);
|
||||
} else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) {
|
||||
__m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask);
|
||||
alphaChannel = _mm_sub_epi16(one, alphaChannel);
|
||||
const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
|
||||
__m128i destMultipliedByOneMinusAlpha;
|
||||
BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half);
|
||||
const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha);
|
||||
_mm_store_si128((__m128i *)&dst[x], result);
|
||||
}
|
||||
} /* end for() */
|
||||
} else if ((length - x) >= 8) {
|
||||
/* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */
|
||||
__m128i srcVectorPrevLoaded = _mm_load_si128((const __m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);
|
||||
const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;
|
||||
|
||||
const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);
|
||||
switch (palignrOffset) {
|
||||
case 4:
|
||||
BLENDING_LOOP(4, length)
|
||||
break;
|
||||
case 8:
|
||||
BLENDING_LOOP(8, length)
|
||||
break;
|
||||
case 12:
|
||||
BLENDING_LOOP(12, length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (; x < length; ++x)
|
||||
blend_pixel(dst[x], src[x]);
|
||||
}
|
||||
|
||||
void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include <private/qsimd_p.h>
|
||||
#include "qdrawhelper_p.h"
|
||||
#include "qdrawhelper_x86_p.h"
|
||||
#include "qrgba64_p.h"
|
||||
|
||||
#ifdef __SSE2__
|
||||
|
|
@ -232,7 +232,7 @@ QT_END_NAMESPACE
|
|||
QT_BEGIN_NAMESPACE
|
||||
#if QT_COMPILER_SUPPORTS_HERE(SSE4_1)
|
||||
QT_FUNCTION_TARGET(SSE2)
|
||||
Q_ALWAYS_INLINE void reciprocal_mul_ss(__m128 &ia, const __m128 a, float mul)
|
||||
Q_ALWAYS_INLINE void Q_DECL_VECTORCALL reciprocal_mul_ss(__m128 &ia, const __m128 a, float mul)
|
||||
{
|
||||
ia = _mm_rcp_ss(a); // Approximate 1/a
|
||||
// Improve precision of ia using Newton-Raphson
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "qimagescale_p.h"
|
||||
#include "qimage.h"
|
||||
#include <private/qdrawhelper_x86_p.h>
|
||||
#include <private/qsimd_p.h>
|
||||
|
||||
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
|
||||
|
|
@ -47,7 +48,8 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
using namespace QImageScale;
|
||||
|
||||
inline static __m128i qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, const __m128i vxyap, const __m128i vCxy)
|
||||
inline static __m128i Q_DECL_VECTORCALL
|
||||
qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, const __m128i vxyap, const __m128i vCxy)
|
||||
{
|
||||
__m128i vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
|
||||
__m128i vx = _mm_mullo_epi32(vpix, vxyap);
|
||||
|
|
|
|||
Loading…
Reference in New Issue