2013-01-19 02:32:58 +04:00
|
|
|
/* test_shift.c
|
|
|
|
* vi:ts=4 sw=4
|
|
|
|
*
|
|
|
|
* (c) Copyright 2012 Hewlett-Packard Development Company, L.P.
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License. You may obtain
|
|
|
|
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
|
|
* or implied. See the License for the specific language governing
|
|
|
|
* permissions and limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-02-16 13:20:38 +03:00
|
|
|
#include <freerdp/config.h>
|
2013-01-19 23:27:34 +04:00
|
|
|
|
2013-02-27 18:58:06 +04:00
|
|
|
#include <winpr/sysinfo.h>
|
2013-01-19 02:32:58 +04:00
|
|
|
#include "prim_test.h"
|
|
|
|
|
|
|
|
#define FUNC_TEST_SIZE 65536
|
2016-07-13 15:04:48 +03:00
|
|
|
|
|
|
|
static BOOL test_lShift_16s_func(void)
|
|
|
|
{
|
|
|
|
pstatus_t status;
|
2019-05-08 13:20:43 +03:00
|
|
|
INT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
|
|
|
|
INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
|
|
|
/* Negative tests */
|
|
|
|
status = generic->lShiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
status = optimized->lShiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
/* Aligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->lShiftC_16s(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->lShiftC_16s(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Unaligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->lShiftC_16s(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->lShiftC_16s(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL test_lShift_16u_func(void)
|
|
|
|
{
|
|
|
|
pstatus_t status;
|
2019-05-08 13:20:43 +03:00
|
|
|
UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
|
|
|
|
UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
|
|
|
|
|
|
|
/* Negative tests */
|
|
|
|
status = generic->lShiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
status = optimized->lShiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
/* Aligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->lShiftC_16u(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->lShiftC_16u(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Unaligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->lShiftC_16u(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->lShiftC_16u(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL test_rShift_16s_func(void)
|
|
|
|
{
|
|
|
|
pstatus_t status;
|
2019-05-08 13:20:43 +03:00
|
|
|
INT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
|
|
|
|
INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
|
|
|
|
|
|
|
/* Negative Tests */
|
|
|
|
status = generic->rShiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
status = optimized->rShiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
/* Aligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->rShiftC_16s(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->rShiftC_16s(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Unaligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->rShiftC_16s(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->rShiftC_16s(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL test_rShift_16u_func(void)
|
|
|
|
{
|
|
|
|
pstatus_t status;
|
2019-05-08 13:20:43 +03:00
|
|
|
UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
|
|
|
|
UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
|
|
|
/* Negative tests */
|
|
|
|
status = generic->rShiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
status = optimized->rShiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
/* Aligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->rShiftC_16u(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->rShiftC_16u(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Unaligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->rShiftC_16u(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->rShiftC_16u(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL test_ShiftWrapper_16s_func(void)
|
|
|
|
{
|
|
|
|
pstatus_t status;
|
2019-05-08 13:20:43 +03:00
|
|
|
INT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
|
|
|
|
INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 tmp;
|
|
|
|
INT32 val;
|
|
|
|
winpr_RAND((BYTE*)&tmp, sizeof(tmp));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
2020-05-15 17:04:28 +03:00
|
|
|
val = tmp % 16;
|
|
|
|
|
|
|
|
/* Negative tests */
|
|
|
|
status = generic->shiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
status = optimized->shiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
/* Aligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->shiftC_16s(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16s(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->shiftC_16s(src + 1, -val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16s(src + 1, -val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Unaligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->shiftC_16s(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16s(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = generic->shiftC_16s(src + 1, -val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16s(src + 1, -val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL test_ShiftWrapper_16u_func(void)
|
|
|
|
{
|
|
|
|
pstatus_t status;
|
2019-05-08 13:20:43 +03:00
|
|
|
UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
|
|
|
|
UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 tmp;
|
|
|
|
INT32 val;
|
|
|
|
winpr_RAND((BYTE*)&tmp, sizeof(tmp));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
2020-05-15 17:04:28 +03:00
|
|
|
val = tmp % 16;
|
|
|
|
|
|
|
|
/* Negative */
|
|
|
|
status = generic->shiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
status = optimized->shiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
|
|
|
if (status == PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
/* Aligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->shiftC_16u(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16u(src + 1, val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->shiftC_16u(src + 1, -val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16u(src + 1, -val, d1 + 1, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Unaligned */
|
2019-05-08 13:20:43 +03:00
|
|
|
status = generic->shiftC_16u(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16u(src + 1, val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = generic->shiftC_16u(src + 1, -val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
2019-05-08 13:20:43 +03:00
|
|
|
|
|
|
|
status = optimized->shiftC_16u(src + 1, -val, d1 + 2, FUNC_TEST_SIZE);
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (status != PRIMITIVES_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2013-01-19 02:32:58 +04:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
2016-07-13 15:04:48 +03:00
|
|
|
static BOOL test_lShift_16s_speed(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
2019-05-08 13:20:43 +03:00
|
|
|
INT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
|
2016-07-13 15:04:48 +03:00
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("lShift_16s", "aligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16s,
|
|
|
|
(speed_test_fkt)optimized->lShiftC_16s, src, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("lShift_16s", "unaligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16s,
|
|
|
|
(speed_test_fkt)optimized->lShiftC_16s, src + 1, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
2016-07-13 15:04:48 +03:00
|
|
|
static BOOL test_lShift_16u_speed(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
2016-04-05 18:07:45 +03:00
|
|
|
UINT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
|
2016-07-13 15:04:48 +03:00
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
|
|
|
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("lShift_16u", "aligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16u,
|
|
|
|
(speed_test_fkt)optimized->lShiftC_16u, src, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("lShift_16u", "unaligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16u,
|
|
|
|
(speed_test_fkt)optimized->lShiftC_16u, src + 1, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
2016-07-13 15:04:48 +03:00
|
|
|
static BOOL test_rShift_16s_speed(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
2019-05-08 13:20:43 +03:00
|
|
|
INT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
|
2016-07-13 15:04:48 +03:00
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
2019-05-08 13:20:43 +03:00
|
|
|
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("rShift_16s", "aligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16s,
|
|
|
|
(speed_test_fkt)optimized->rShiftC_16s, src, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("rShift_16s", "unaligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16s,
|
|
|
|
(speed_test_fkt)optimized->rShiftC_16s, src + 1, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
2016-07-13 15:04:48 +03:00
|
|
|
static BOOL test_rShift_16u_speed(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
UINT32 val;
|
2016-04-05 18:07:45 +03:00
|
|
|
UINT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
|
2016-07-13 15:04:48 +03:00
|
|
|
winpr_RAND((BYTE*)&val, sizeof(val));
|
|
|
|
winpr_RAND((BYTE*)src, sizeof(src));
|
|
|
|
|
2020-05-15 17:04:28 +03:00
|
|
|
val = val % 16;
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("rShift_16u", "aligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16u,
|
|
|
|
(speed_test_fkt)optimized->rShiftC_16u, src, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!speed_test("rShift_16u", "unaligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16u,
|
|
|
|
(speed_test_fkt)optimized->rShiftC_16u, src + 1, val, dst, MAX_TEST_SIZE))
|
2016-07-13 15:04:48 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
2014-09-04 23:46:20 +04:00
|
|
|
|
|
|
|
int TestPrimitivesShift(int argc, char* argv[])
|
|
|
|
{
|
2019-05-08 13:20:43 +03:00
|
|
|
WINPR_UNUSED(argc);
|
|
|
|
WINPR_UNUSED(argv);
|
2016-07-13 15:04:48 +03:00
|
|
|
prim_test_setup(FALSE);
|
2014-09-04 23:46:20 +04:00
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_lShift_16s_func())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (g_TestPrimitivesPerformance)
|
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_lShift_16s_speed())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_lShift_16u_func())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (g_TestPrimitivesPerformance)
|
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_lShift_16u_speed())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_rShift_16s_func())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (g_TestPrimitivesPerformance)
|
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_rShift_16s_speed())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_rShift_16u_func())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (g_TestPrimitivesPerformance)
|
|
|
|
{
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_rShift_16u_speed())
|
2014-09-04 23:46:20 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
if (!test_ShiftWrapper_16s_func())
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (!test_ShiftWrapper_16u_func())
|
|
|
|
return 1;
|
|
|
|
|
2014-09-04 23:46:20 +04:00
|
|
|
return 0;
|
|
|
|
}
|