From 6c1339ef4b44db3c298d1b58389d41c39af4ced5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 15:46:52 -0700 Subject: Move qt_memfill32-based implementation of qt_memfill16 to generic The SSE2 implementation and the one in qdrawhelper.cpp are almost identical. And if we make it so qt_memfill16 can tail-call to qt_memfill32, there's no need for inlining, so there's no need to keep it in qdrawhelper_sse2.cpp Change-Id: I343f2beed55440a7ac0bfffd15637027771c2254 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper.cpp | 25 +++++++++---------------- src/gui/painting/qdrawhelper_sse2.cpp | 23 ----------------------- src/gui/painting/qdrawhelper_x86_p.h | 1 - 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index b4050b41ac..fa1990ca60 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -6249,28 +6249,21 @@ void qt_memfill64(quint64 *dest, quint64 color, qsizetype count) qt_memfill_template(dest, color, count); } -#if !defined(__SSE2__) void qt_memfill16(quint16 *dest, quint16 value, qsizetype count) { - if (count < 3) { - switch (count) { - case 2: *dest++ = value; Q_FALLTHROUGH(); - case 1: *dest = value; - } - return; + const int align = quintptr(dest) & 0x3; + if (align) { + *dest++ = value; + --count; } - const int align = (quintptr)(dest) & 0x3; - switch (align) { - case 2: *dest++ = value; --count; - } - - const quint32 value32 = (value << 16) | value; - qt_memfill(reinterpret_cast(dest), value32, count / 2); if (count & 0x1) dest[count - 1] = value; + + const quint32 value32 = (value << 16) | value; + qt_memfill32(reinterpret_cast(dest), value32, count / 2); } -#endif + #if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__) void qt_memfill32(quint32 *dest, quint32 color, qsizetype count) { diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index efcbc8c643..34bdf7909a 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -314,29 +314,6 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u } } -void qt_memfill16(quint16 *dest, quint16 value, qsizetype count) -{ - if (count < 3) { - switch (count) { - case 2: *dest++ = value; Q_FALLTHROUGH(); - case 1: *dest = value; - } - return; - } - - const int align = (quintptr)(dest) & 0x3; - if (align) { - *dest++ = value; - --count; - } - - if (count & 0x1) - dest[count - 1] = value; - - const quint32 value32 = (value << 16) | value; - qt_memfill32(reinterpret_cast(dest), value32, count / 2); -} - void qt_bitmapblit32_sse2_base(QRasterBuffer *rasterBuffer, int x, int y, quint32 color, const uchar *src, int width, int height, int stride) diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h index 964d522fd2..12b95abe46 100644 --- a/src/gui/painting/qdrawhelper_x86_p.h +++ b/src/gui/painting/qdrawhelper_x86_p.h @@ -58,7 +58,6 @@ QT_BEGIN_NAMESPACE #ifdef __SSE2__ void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); -void qt_memfill16(quint16 *dest, quint16 value, qsizetype count); void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uchar *src, int width, int height, int stride); -- cgit v1.2.3