Added SCE SIMD math library in Extras/simdmathlibrary
The upcoming vectormath that will used to speed up the SPU version of Extras/BulletMultiThreaded depends on this.
This commit is contained in:
119
Extras/simdmathlibrary/spu/tests/Makefile
Normal file
119
Extras/simdmathlibrary/spu/tests/Makefile
Normal file
@@ -0,0 +1,119 @@
|
||||
# Makefile for testsuite for the SPU SIMD math library
|
||||
# Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms,
|
||||
# with or without modification, are permitted provided that the
|
||||
# following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
# of its contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
TESTS = fabsd2 fabsf4 truncf4 divf4 recipd2 divd2 sqrtf4 \
|
||||
absi4 sqrtd2 rsqrtf4 rsqrtd2 copysignf4 remainderf4 \
|
||||
recipf4 copysignd2 negatef4 negated2 modff4 ceilf4 \
|
||||
fminf4_fmaxf4 floorf4 negatei4 divi4 llroundd2 llroundf4 \
|
||||
llrintf4 isequalf4 isequald2 islessgreaterf4 islessgreaterd2 \
|
||||
islessf4 islessd2 isgreaterf4 isgreaterd2 islessequalf4 islessequald2 \
|
||||
isgreaterequalf4 isgreaterequald2 isnanf4 isnand2 isinff4 isinfd2 \
|
||||
isfinitef4 isfinited2 isnormalf4 isnormald2 isunorderedf4 isunorderedd2 \
|
||||
is0denormf4 is0denormd2 signbitf4 signbitd2 llrintd2 \
|
||||
roundf4 iroundf4 rintf4 irintf4 fmind2_fmaxd2 fdimd2 \
|
||||
fmad2 nextafterd2 nextafterf4 fpclassifyf4 fpclassifyd2 nearbyintd2 nearbyintf4 \
|
||||
llabsi2 truncd2 roundd2 rintd2 negatell2 hypotf4 hypotd2 divu4 modfd2 \
|
||||
lldivu2 ceild2 floord2 ldexpd2 ilogbd2 ilogbf4 logbf4 logbd2 scalbnf4 \
|
||||
scalbllnd2 lldivi2 frexpf4 frexpd2 remquof4 remquod2 fmodd2 remainderd2
|
||||
|
||||
|
||||
ALL_TESTS = $(TESTS)
|
||||
|
||||
INCLUDES_SPU = -I../../
|
||||
|
||||
CROSS_SPU = spu-
|
||||
AR_SPU = $(CROSS_SPU)ar
|
||||
CC_SPU = $(CROSS_SPU)gcc
|
||||
CXX_SPU = $(CROSS_SPU)g++
|
||||
TEST_CMD_SPU =
|
||||
|
||||
CFLAGS_SPU=$(INCLUDES_SPU) -O2 -W -Wall
|
||||
LDFLAGS_SPU=-L../ -l$(LIB_BASE) -lm
|
||||
|
||||
MAKE_DEFS = \
|
||||
LIB_BASE='$(LIB_BASE)' \
|
||||
LIB_NAME='$(LIB_NAME)' \
|
||||
STATIC_LIB='$(STATIC_LIB)' \
|
||||
CROSS_SPU='$(CROSS_SPU)' \
|
||||
AR_SPU='$(AR_SPU)' \
|
||||
CC_SPU='$(CC_SPU)' \
|
||||
CXX_SPU='$(CXX_SPU)' \
|
||||
TEST_CMD_SPU='$(TEST_CMD_SPU)'
|
||||
|
||||
LIB_BASE = simdmath
|
||||
LIB_NAME = lib$(LIB_BASE)
|
||||
STATIC_LIB = $(LIB_NAME).a
|
||||
|
||||
TEST_CMD = $(TEST_CMD_SPU)
|
||||
|
||||
COMMON_OBJS = testutils.o
|
||||
|
||||
all: $(ALL_TESTS)
|
||||
|
||||
|
||||
$(TESTS): %: %.o ../$(STATIC_LIB) $(COMMON_OBJS)
|
||||
$(CC_SPU) $@.o $(COMMON_OBJS) $(LDFLAGS_SPU) -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(TESTS)
|
||||
rm -f core*
|
||||
|
||||
check: $(ALL_TESTS)
|
||||
for test in $(ALL_TESTS); do \
|
||||
echo "TEST $${test}"; \
|
||||
if $(TEST_CMD) ./$${test}; then \
|
||||
pass="$$pass $$test"; \
|
||||
else \
|
||||
fail="$$fail $$test"; \
|
||||
fi \
|
||||
done; \
|
||||
echo; echo "PASS:$$pass"; echo "FAIL:$$fail"; \
|
||||
test -z "$$fail"
|
||||
|
||||
../$(STATIC_LIB):
|
||||
cd ../;$(MAKE) $(MAKE_DEFS) $(STATIC_LIB)
|
||||
|
||||
%.o: %.c
|
||||
$(CC_SPU) $(CFLAGS_SPU) -c $<
|
||||
|
||||
#----------
|
||||
# C++
|
||||
#----------
|
||||
%.o: %.C
|
||||
$(CXX_SPU) $(CFLAGS_SPU) -c $<
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX_SPU) $(CFLAGS_SPU) -c $<
|
||||
|
||||
%.o: %.cc
|
||||
$(CXX_SPU) $(CFLAGS_SPU) -c $<
|
||||
|
||||
%.o: %.cxx
|
||||
$(CXX_SPU) $(CFLAGS_SPU) -c $<
|
||||
|
||||
90
Extras/simdmathlibrary/spu/tests/absi4.c
Normal file
90
Extras/simdmathlibrary/spu/tests/absi4.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/* Test absi4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040908101807EJL","EJL", "abs");
|
||||
|
||||
int x0n = hide_int(0);
|
||||
int x0p = hide_int(0);
|
||||
int x1n = hide_int(-1);
|
||||
int x1p = hide_int(1);
|
||||
int x2n = hide_int(-83532);
|
||||
int x2p = hide_int(83532);
|
||||
|
||||
vec_int4 x0n_v = spu_splats(x0n);
|
||||
vec_int4 x0p_v = spu_splats(x0p);
|
||||
vec_int4 x1n_v = spu_splats(x1n);
|
||||
vec_int4 x1p_v = spu_splats(x1p);
|
||||
vec_int4 x2n_v = spu_splats(x2n);
|
||||
vec_int4 x2p_v = spu_splats(x2p);
|
||||
|
||||
int res;
|
||||
vec_int4 res_v;
|
||||
|
||||
TEST_START("absi4");
|
||||
res_v = absi4(x0n_v);
|
||||
TEST_CHECK("20040908103824EJL", allequal_int4( res_v, x0p_v ), 0);
|
||||
res_v = absi4(x0p_v);
|
||||
TEST_CHECK("20040908103903EJL", allequal_int4( res_v, x0p_v ), 0);
|
||||
res_v = absi4(x1n_v);
|
||||
TEST_CHECK("20040908103905EJL", allequal_int4( res_v, x1p_v ), 0);
|
||||
res_v = absi4(x1p_v);
|
||||
TEST_CHECK("20040908114003EJL", allequal_int4( res_v, x1p_v ), 0);
|
||||
res_v = absi4(x2n_v);
|
||||
TEST_CHECK("20040908114714EJL", allequal_int4( res_v, x2p_v ), 0);
|
||||
res_v = absi4(x2p_v);
|
||||
TEST_CHECK("20040908114715EJL", allequal_int4( res_v, x2p_v ), 0);
|
||||
|
||||
TEST_START("abs");
|
||||
res = abs(x0n);
|
||||
TEST_CHECK("20040908114718EJL", res == x0p, 0);
|
||||
res = abs(x0p);
|
||||
TEST_CHECK("20040908114719EJL", res == x0p, 0);
|
||||
res = abs(x1n);
|
||||
TEST_CHECK("20040908114720EJL", res == x1p, 0);
|
||||
res = abs(x1p);
|
||||
TEST_CHECK("20040908114721EJL", res == x1p, 0);
|
||||
res = abs(x2n);
|
||||
TEST_CHECK("20040908114722EJL", res == x2p, 0);
|
||||
res = abs(x2p);
|
||||
TEST_CHECK("20040908114723EJL", res == x2p, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
156
Extras/simdmathlibrary/spu/tests/ceild2.c
Normal file
156
Extras/simdmathlibrary/spu/tests/ceild2.c
Normal file
@@ -0,0 +1,156 @@
|
||||
/* Test roundd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ ceild2for each of two doule slots,
|
||||
* round up to smallest integer not less than the value.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for ceild2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
double xxx[2];
|
||||
double ans[2];
|
||||
} dbl;
|
||||
struct {
|
||||
unsigned long long xxx[2];
|
||||
unsigned long long ans[2];
|
||||
} ull;
|
||||
} TestVec_Roundd2;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec_Roundd2 test_a[] = {
|
||||
{
|
||||
ull:{
|
||||
// 0 -> 0 , -0 -> -0
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// -Inf -> -Inf , Inf -> Inf
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// MAX -> MAX , MIN -> MIN
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Denormalize -> 0
|
||||
{0x0000000000000001ULL,0x8000000000000010ULL},
|
||||
{0x3ff0000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Denormalize -> 0
|
||||
{0x800FFFFFFFFFFFFFULL,0x000FFFFFFFFFFFFFULL},
|
||||
{0x8000000000000000ULL,0x3ff0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// border
|
||||
{0x4320000000000001ULL,0xC320000000000001ULL},
|
||||
{0x4320000000000002ULL,0xC320000000000000ULL}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{1.0, -1.0},
|
||||
{1.0, -1.0}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{0.5, -0.5},
|
||||
{1.0, -0.0}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{-2.75, 3.2},
|
||||
{-2.0, 4.0}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Nan
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL},
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
//vec_double2 input;
|
||||
|
||||
TEST_SET_START("51651906100000NM","CED", "ceild2");
|
||||
|
||||
TEST_START("ceild2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].ull.xxx[0] == 0) && (test_a[ii].ull.xxx[1] == 0) ) break;
|
||||
//input = *((vec_double2 *)&test_a[ii].dbl.xxx[0]);
|
||||
res_v = ceild2 (*((vec_double2 *)&test_a[ii].dbl.xxx[0]) );
|
||||
sprintf(msg,"5165190610%04dCED", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, (vec_llong2)*((vec_double2 *)&test_a[ii].dbl.ans[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
108
Extras/simdmathlibrary/spu/tests/ceilf4.c
Normal file
108
Extras/simdmathlibrary/spu/tests/ceilf4.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* Test ceilf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040916103300EJL","EJL", "ceilf");
|
||||
|
||||
unsigned int i3 = 0x4affffff; // 2^23 - 0.5, largest truncatable value.
|
||||
unsigned int i3i = 0x4b000000;
|
||||
unsigned int i4 = 0x4b000000; // 2^23, no fractional part.
|
||||
unsigned int i5 = 0xcf000001; // -2^31, one more large, and negative, value.
|
||||
|
||||
float x0 = hide_float(0.91825f);
|
||||
float x0i = hide_float(1.0f);
|
||||
float x1 = hide_float(-0.12958f);
|
||||
float x1i = hide_float(0.0f);
|
||||
float x2 = hide_float(-79615.1875f);
|
||||
float x2i = hide_float(-79615.0f);
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3i = hide_float(make_float(i3i));
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4i = hide_float(make_float(i4));
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5i = hide_float(make_float(i5));
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 x0i_v = spu_splats(x0i);
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 x1i_v = spu_splats(x1i);
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 x2i_v = spu_splats(x2i);
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3i_v = spu_splats(x3i);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4i_v = spu_splats(x4i);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5i_v = spu_splats(x5i);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("ceilf4");
|
||||
res_v = ceilf4(x0_v);
|
||||
TEST_CHECK("20040916103310EJL", allequal_float4( res_v, x0i_v ), 0);
|
||||
res_v = ceilf4(x1_v);
|
||||
TEST_CHECK("20040916103324EJL", allequal_float4( res_v, x1i_v ), 0);
|
||||
res_v = ceilf4(x2_v);
|
||||
TEST_CHECK("20040916103334EJL", allequal_float4( res_v, x2i_v ), 0);
|
||||
res_v = ceilf4(x3_v);
|
||||
TEST_CHECK("20040916103341EJL", allequal_float4( res_v, x3i_v ), 0);
|
||||
res_v = ceilf4(x4_v);
|
||||
TEST_CHECK("20040916103350EJL", allequal_float4( res_v, x4i_v ), 0);
|
||||
res_v = ceilf4(x5_v);
|
||||
TEST_CHECK("20040916103357EJL", allequal_float4( res_v, x5i_v ), 0);
|
||||
|
||||
TEST_START("ceilf");
|
||||
res = ceilf(x0);
|
||||
TEST_CHECK("20040916103407EJL", res == x0i, 0);
|
||||
res = ceilf(x1);
|
||||
TEST_CHECK("20040916103418EJL", res == x1i, 0);
|
||||
res = ceilf(x2);
|
||||
TEST_CHECK("20040916103428EJL", res == x2i, 0);
|
||||
res = ceilf(x3);
|
||||
TEST_CHECK("20040916103437EJL", res == x3i, 0);
|
||||
res = ceilf(x4);
|
||||
TEST_CHECK("20040916103448EJL", res == x4i, 0);
|
||||
res = ceilf(x5);
|
||||
TEST_CHECK("20040916103457EJL", res == x5i, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
201
Extras/simdmathlibrary/spu/tests/common-test.h
Normal file
201
Extras/simdmathlibrary/spu/tests/common-test.h
Normal file
@@ -0,0 +1,201 @@
|
||||
/* SIMD math library - common testsuite part for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
static inline unsigned int clock()
|
||||
{
|
||||
unsigned int ret;
|
||||
int tmp = 0;
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n"
|
||||
: "=r" (ret)
|
||||
: "r" (tmp)
|
||||
: "memory" );
|
||||
return (ret);
|
||||
}
|
||||
// Test files begin with TEST_SET_START("your initials","test set description")
|
||||
// Individual tests begin with TEST_START("name of test")
|
||||
// and end with TEST_PASS(), TEST_FAIL("reason for failure") or TEST_CHECK(<test to evaluate>)
|
||||
// Or you can run a test encapsulated in a function with:
|
||||
// TEST_FUNCTION("name of test", function(), "reason for failure")
|
||||
//
|
||||
// The clock starts when you call TEST_START and stops with TEST_PASS, TEST_FAIL or TEST_CHECK
|
||||
// After a start there can be several PASS, FAIL or CHECK calls, each one counts as a test, time is measured from the prior call
|
||||
//
|
||||
char
|
||||
*__initials, // Test owner's initials
|
||||
*__description, // short descriptive name for this test set
|
||||
*__name, // name of the currently running test
|
||||
*__set_id; // id of the the test set
|
||||
int
|
||||
// __zip=0,
|
||||
__success=1, // set to 0 if any tests failed
|
||||
__count, // Total number of tests run
|
||||
__passed; // Total number of tests passed
|
||||
unsigned int
|
||||
__ttemp,
|
||||
__time, // For timing tests (usually start time of last test)
|
||||
__ttime; // Cumulative test runtime NOT counting runtime of the TEST macros
|
||||
|
||||
// TEST_SET_START
|
||||
// Call at the start of a set of related tests to identify them
|
||||
// Prints a "start of set banner message"
|
||||
// set_id - unique test set identifyer a time in the format yyyymmddhhmmss followed by your initials ie: 20040716104615GAC
|
||||
// initials - your initials
|
||||
// description - brief descriptive name for this test set
|
||||
#define TEST_SET_START(set_id,initials,description) \
|
||||
do { \
|
||||
__set_id=set_id; \
|
||||
__initials=initials; \
|
||||
__description=description; \
|
||||
__count=0; \
|
||||
__passed=0; \
|
||||
__time=0; \
|
||||
__ttime=0; \
|
||||
printf("0\t%s\t%d\t%s\tSTART\tpassed\ttotal\ttime\t%s\tunique test id \t%s\n",__FILE__,__LINE__,__initials,__set_id, __description); \
|
||||
} while(0)
|
||||
|
||||
// TEST_START
|
||||
// Begins a test, and starts the clock
|
||||
// name - brief name for this test
|
||||
#define TEST_START(name) \
|
||||
do { \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (0) : "memory" ); \
|
||||
__name=name; \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (0) : "memory" ); \
|
||||
} while(0)
|
||||
|
||||
// TEST_PASS
|
||||
// Indicates the test passed
|
||||
// test_id - unique test ID number, same format as the set_id number
|
||||
// This should match the id provided to the matching TEST_FAIL call
|
||||
#define TEST_PASS(test_id) \
|
||||
do { \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__ttemp) : "r" (0) : "memory" ); \
|
||||
__time=__ttemp-__time; \
|
||||
__ttime+=__time; \
|
||||
__count++; \
|
||||
__passed++; \
|
||||
printf("1\t%s\t%d\t%s\tPASS\t%d\t%d\t%d\t%s\t%s\t%s\n",__FILE__,__LINE__,__initials,__passed,__count,__time,__set_id,test_id,__name); \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (0) : "memory" ); \
|
||||
} while(0)
|
||||
|
||||
// __time=clock();
|
||||
// __asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (__zip) : "memory" );
|
||||
// __asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__ttemp) : "r" (__zip) : "memory" );
|
||||
|
||||
// TEST_FAIL
|
||||
// Indicates the test failed
|
||||
// test_id - unique test ID number, same format as the set_id number
|
||||
// This should match the id provided to the matching TEST_PASS call
|
||||
// why - brief description of why it failed
|
||||
#define TEST_FAIL(test_id,why,error_code) \
|
||||
do { \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__ttemp) : "r" (0) : "memory" ); \
|
||||
__time=__ttemp-__time; \
|
||||
__ttime+=__time; \
|
||||
__count++; \
|
||||
__success=0; \
|
||||
printf("1\t%s\t%d\t%s\tFAIL\t%d\t%d\t%d\t%s\t%s\t%s\tFAILED BECAUSE: %s\t%d\n",__FILE__,__LINE__,__initials,__passed,__count,__time,__set_id,test_id,__name,why,error_code); \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (0) : "memory" ); \
|
||||
} while(0)
|
||||
|
||||
// TEST_CHECK
|
||||
// Passes or fails the test after evaluating the "test" argument (just like assert but without terminating the program)
|
||||
// The clock is immediately stopped so the time required to evaluate "test" will NOT be included in the reported time
|
||||
// If the test failed, the reason will be printed as FAILED BECAUSE: check (value of "test") failed
|
||||
// test_id - unique test ID number, same format as the set_id number
|
||||
// test - expression evaluating to true/false
|
||||
#define TEST_CHECK(test_id,test,error_code) \
|
||||
do { \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__ttemp) : "r" (0) : "memory" ); \
|
||||
__time=__ttemp-__time; \
|
||||
__ttime+=__time; \
|
||||
__count++; \
|
||||
if(test) \
|
||||
{ \
|
||||
__passed++; \
|
||||
printf("1\t%s\t%d\t%s\tPASS\t%d\t%d\t%d\t%s\t%s\t%s\n",__FILE__,__LINE__,__initials,__passed,__count,__time,__set_id,test_id,__name); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
__success=0; \
|
||||
printf("1\t%s\t%d\t%s\tFAIL\t%d\t%d\t%d\t%s\t%s\t%s\tFAILED BECAUSE: check %s failed\t%d\n",__FILE__,__LINE__,__initials,__passed,__count,__time,__set_id,test_id,__name,#test,error_code); \
|
||||
} \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (0) : "memory" ); \
|
||||
} while(0)
|
||||
|
||||
// TEST_FUNCTION
|
||||
// Runs a test encapsulated in a function that returns 0 if the test passed and an error number if it failed
|
||||
// The clock is started on calling the function and stopped as soon as it returns so the branching logic will not be included in the time
|
||||
// test_id - unique test ID number, same format as the set_id number
|
||||
// name - brief name for the test
|
||||
// func - function invocation (should include parenthesis, may have arguments)
|
||||
// why - brief description to print if the test fails
|
||||
#define TEST_FUNCTION(test_id,name,func,why) \
|
||||
do { \
|
||||
TEST_START(name); \
|
||||
int result=func; \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__ttemp) : "r" (0) : "memory" ); \
|
||||
__time=__ttemp-__time; \
|
||||
__ttime+=__time; \
|
||||
__count++; \
|
||||
if(result==0) \
|
||||
{ \
|
||||
__passed++; \
|
||||
printf("1\t%s\t%d\t%s\tPASS\t%d\t%d\t%d\t%s\t%s\t%s\n",__FILE__,__LINE__,__initials,__passed,__count,__time,__set_id,test_id,__name); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
__success=0; \
|
||||
printf("1\t%s\t%d\t%s\tFAIL\t%d\t%d\t%d\t%s\t%s\t%s\tFAILED BECAUSE: %s\t%d\n",__FILE__,__LINE__,__initials,__passed,__count,__time,__set_id,test_id,__name,why,result); \
|
||||
} \
|
||||
__asm __volatile__ ( "syscall %0,%1,0x2b\n" : "=r" (__time) : "r" (0) : "memory" ); \
|
||||
} while(0)
|
||||
|
||||
// TEST_SET_DONE
|
||||
// Ends a set of tests, prints out the closing banner (OK if all tests pass, PROBLEM if any fail)
|
||||
// Also prints count of tests passed, tests run and total time
|
||||
#define TEST_SET_DONE() \
|
||||
do { \
|
||||
printf("9\t%s\t%d\t%s\t%s\t%d\t%d\t%d\t%s\tunique test id \t%s\n",__FILE__,__LINE__,__initials,(__count==__passed)?"OK":"PROBLEM",__passed,__count,__ttime,__set_id,__description); \
|
||||
} while(0)
|
||||
|
||||
// TEST_EXIT
|
||||
// Call this ONCE at the very end of the test program, it calls "exit" to return
|
||||
// EXIT_SUCCESS if all tests passed or EXIT_FAILURE if any tests failed.
|
||||
// This allows the makefile/shell script running the tests to know which ones failed
|
||||
#define TEST_EXIT() \
|
||||
do { \
|
||||
if(__success) \
|
||||
exit(0); \
|
||||
else \
|
||||
exit(-1); \
|
||||
} while (0)
|
||||
74
Extras/simdmathlibrary/spu/tests/copysignd2.c
Normal file
74
Extras/simdmathlibrary/spu/tests/copysignd2.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/* Test copysignd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928185245EJL","EJL", "copysign");
|
||||
|
||||
double x0m = hide_double(1989.0);
|
||||
double x0s = hide_double(-319875.0);
|
||||
double x0c = hide_double(-1989.0);
|
||||
double x1m = hide_double(9013.0);
|
||||
double x1s = hide_double(185.0);
|
||||
double x1c = hide_double(9013.0);
|
||||
|
||||
vec_double2 x0m_v = spu_splats(x0m);
|
||||
vec_double2 x0s_v = spu_splats(x0s);
|
||||
vec_double2 x0c_v = spu_splats(x0c);
|
||||
|
||||
vec_double2 x1m_v = spu_splats(x1m);
|
||||
vec_double2 x1s_v = spu_splats(x1s);
|
||||
vec_double2 x1c_v = spu_splats(x1c);
|
||||
|
||||
double res;
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("copysignd2");
|
||||
res_v = copysignd2( x0m_v, x0s_v );
|
||||
TEST_CHECK("20040928185248EJL", allequal_double2( res_v, x0c_v ), 0);
|
||||
res_v = copysignd2( x1m_v, x1s_v );
|
||||
TEST_CHECK("20040928185251EJL", allequal_double2( res_v, x1c_v ), 0);
|
||||
|
||||
TEST_START("copysign");
|
||||
res = copysign( x0m, x0s );
|
||||
TEST_CHECK("20040928185253EJL", res == x0c, 0);
|
||||
res = copysign( x1m, x1s );
|
||||
TEST_CHECK("20040928185256EJL", res == x1c, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
75
Extras/simdmathlibrary/spu/tests/copysignf4.c
Normal file
75
Extras/simdmathlibrary/spu/tests/copysignf4.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/* Test copysignf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040917114054EJL", "EJL", "copysignf");
|
||||
|
||||
float x0m = hide_float(1989.0f);
|
||||
float x0s = hide_float(-319875.0f);
|
||||
float x0c = hide_float(-1989.0f);
|
||||
float x1m = hide_float(9013.0f);
|
||||
float x1s = hide_float(185.0f);
|
||||
float x1c = hide_float(9013.0f);
|
||||
|
||||
vec_float4 x0m_v = spu_splats(x0m);
|
||||
vec_float4 x0s_v = spu_splats(x0s);
|
||||
vec_float4 x0c_v = spu_splats(x0c);
|
||||
|
||||
vec_float4 x1m_v = spu_splats(x1m);
|
||||
vec_float4 x1s_v = spu_splats(x1s);
|
||||
vec_float4 x1c_v = spu_splats(x1c);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("copysignf4");
|
||||
res_v = copysignf4( x0m_v, x0s_v );
|
||||
TEST_CHECK("20040917114058EJL", allequal_float4( res_v, x0c_v ), 0);
|
||||
res_v = copysignf4( x1m_v, x1s_v );
|
||||
TEST_CHECK("20040917114100EJL", allequal_float4( res_v, x1c_v ), 0);
|
||||
|
||||
TEST_START("copysignf");
|
||||
res = copysignf( x0m, x0s );
|
||||
TEST_CHECK("20040917114102EJL", res == x0c, 0);
|
||||
res = copysignf( x1m, x1s );
|
||||
TEST_CHECK("20040917114104EJL", res == x1c, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
153
Extras/simdmathlibrary/spu/tests/divd2.c
Normal file
153
Extras/simdmathlibrary/spu/tests/divd2.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* Test divd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040927182952EJL","EJL", "divd2");
|
||||
|
||||
unsigned long long i3n = 0x747f7fefa0c3274aull;
|
||||
unsigned long long i3d = 0x7606a4533cf5605eull;
|
||||
unsigned long long i3r = 0x3e66426af0ec01b0ull;
|
||||
unsigned long long i4n = 0x4c042c295376566eull;
|
||||
unsigned long long i4d = 0x39b3720562510408ull;
|
||||
unsigned long long i4r = 0x52409928d3244077ull;
|
||||
unsigned long long i5n = 0x6911a64538a389aeull;
|
||||
unsigned long long i5d = 0x1ac4d062d451c99dull;
|
||||
unsigned long long i5r = 0x7ff0000000000000ull;
|
||||
unsigned long long i6n = 0x5b112f9d39e7de27ull;
|
||||
unsigned long long i6d = 0x5659f8dbe4993d7cull;
|
||||
unsigned long long i6r = 0x44a52cb9b9d2b2cdull;
|
||||
unsigned long long i7n = 0x7410065c772e25daull;
|
||||
unsigned long long i7d = 0x6a576b936e5f1034ull;
|
||||
unsigned long long i7r = 0x49a5e53936c1b556ull;
|
||||
unsigned long long i8n = 0x3605d9b2916be0f5ull;
|
||||
unsigned long long i8d = 0x61f25e39867b0a9eull;
|
||||
unsigned long long i8r = 0x1403088aa08482f2ull;
|
||||
|
||||
double x0n = hide_double(-1.0/0.0); // -Inf/ Inf == NaN
|
||||
double x0d = hide_double(1.0/0.0);
|
||||
|
||||
double x1n = hide_double(0.0); // 0 / 0 == NaN
|
||||
double x1d = hide_double(-0.0);
|
||||
|
||||
double x2n = hide_double(0.0/0.0); // NaN / 2 == NaN
|
||||
double x2d = hide_double(2.0);
|
||||
|
||||
double x3n = hide_double(make_double(i3n));
|
||||
double x3d = hide_double(make_double(i3d));
|
||||
double x3r = hide_double(make_double(i3r));
|
||||
|
||||
double x4n = hide_double(make_double(i4n));
|
||||
double x4d = hide_double(make_double(i4d));
|
||||
double x4r = hide_double(make_double(i4r));
|
||||
|
||||
double x5n = hide_double(make_double(i5n));
|
||||
double x5d = hide_double(make_double(i5d));
|
||||
double x5r = hide_double(make_double(i5r));
|
||||
|
||||
double x6n = hide_double(make_double(i6n));
|
||||
double x6d = hide_double(make_double(i6d));
|
||||
double x6r = hide_double(make_double(i6r));
|
||||
|
||||
double x7n = hide_double(make_double(i7n));
|
||||
double x7d = hide_double(make_double(i7d));
|
||||
double x7r = hide_double(make_double(i7r));
|
||||
|
||||
double x8n = hide_double(make_double(i8n));
|
||||
double x8d = hide_double(make_double(i8d));
|
||||
double x8r = hide_double(make_double(i8r));
|
||||
|
||||
vec_double2 x0n_v = spu_splats(x0n);
|
||||
vec_double2 x0d_v = spu_splats(x0d);
|
||||
|
||||
vec_double2 x1n_v = spu_splats(x1n);
|
||||
vec_double2 x1d_v = spu_splats(x1d);
|
||||
|
||||
vec_double2 x2n_v = spu_splats(x2n);
|
||||
vec_double2 x2d_v = spu_splats(x2d);
|
||||
|
||||
vec_double2 x3n_v = spu_splats(x3n);
|
||||
vec_double2 x3d_v = spu_splats(x3d);
|
||||
vec_double2 x3r_v = spu_splats(x3r);
|
||||
|
||||
vec_double2 x4n_v = spu_splats(x4n);
|
||||
vec_double2 x4d_v = spu_splats(x4d);
|
||||
vec_double2 x4r_v = spu_splats(x4r);
|
||||
|
||||
vec_double2 x5n_v = spu_splats(x5n);
|
||||
vec_double2 x5d_v = spu_splats(x5d);
|
||||
vec_double2 x5r_v = spu_splats(x5r);
|
||||
|
||||
vec_double2 x6n_v = spu_splats(x6n);
|
||||
vec_double2 x6d_v = spu_splats(x6d);
|
||||
vec_double2 x6r_v = spu_splats(x6r);
|
||||
|
||||
vec_double2 x7n_v = spu_splats(x7n);
|
||||
vec_double2 x7d_v = spu_splats(x7d);
|
||||
vec_double2 x7r_v = spu_splats(x7r);
|
||||
|
||||
vec_double2 x8n_v = spu_splats(x8n);
|
||||
vec_double2 x8d_v = spu_splats(x8d);
|
||||
vec_double2 x8r_v = spu_splats(x8r);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("divd2");
|
||||
res_v = divd2(x0n_v, x0d_v);
|
||||
TEST_CHECK("20040927183001EJL", allnan_double2( res_v ), 0);
|
||||
res_v = divd2(x1n_v, x1d_v);
|
||||
TEST_CHECK("20040927183003EJL", allnan_double2( res_v ), 0);
|
||||
res_v = divd2(x2n_v, x2d_v);
|
||||
TEST_CHECK("20040927183006EJL", allnan_double2( res_v ), 0);
|
||||
res_v = divd2(x3n_v, x3d_v);
|
||||
TEST_CHECK("20040927183008EJL", allequal_ulps_double2( res_v, x3r_v, 1 ), 0 );
|
||||
res_v = divd2(x4n_v, x4d_v);
|
||||
TEST_CHECK("20040927183010EJL", allequal_ulps_double2( res_v, x4r_v, 1 ), 0 );
|
||||
res_v = divd2(x5n_v, x5d_v);
|
||||
TEST_CHECK("20040927183012EJL", allequal_ulps_double2( res_v, x5r_v, 1 ), 0 );
|
||||
res_v = divd2(x6n_v, x6d_v);
|
||||
TEST_CHECK("20040927183014EJL", allequal_ulps_double2( res_v, x6r_v, 1 ), 0 );
|
||||
res_v = divd2(x7n_v, x7d_v);
|
||||
TEST_CHECK("20040927183016EJL", allequal_ulps_double2( res_v, x7r_v, 1 ), 0 );
|
||||
res_v = divd2(x8n_v, x8d_v);
|
||||
TEST_CHECK("20040927183018EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0 );
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
128
Extras/simdmathlibrary/spu/tests/divf4.c
Normal file
128
Extras/simdmathlibrary/spu/tests/divf4.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* Test divf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928105926EJL","EJL", "divf4");
|
||||
|
||||
unsigned int i0n = 0x75013340;
|
||||
unsigned int i0d = 0x75e7753f;
|
||||
unsigned int i0r = 0x3e8ee64b;
|
||||
unsigned int i1n = 0x4c7fed5a;
|
||||
unsigned int i1d = 0x3a0731f0;
|
||||
unsigned int i1r = 0x51f24e86;
|
||||
unsigned int i2n = 0x5b08b303;
|
||||
unsigned int i2d = 0x562f5046;
|
||||
unsigned int i2r = 0x44479d24;
|
||||
unsigned int i3n = 0x748a9b87;
|
||||
unsigned int i3d = 0x6b014b46;
|
||||
unsigned int i3r = 0x49093864;
|
||||
unsigned int i4n = 0x35dcf9d8;
|
||||
unsigned int i4d = 0x6278d6e0;
|
||||
unsigned int i4r = 0x12e355b5;
|
||||
unsigned int i5n = 0x74d505fd;
|
||||
unsigned int i5d = 0x61ef565e;
|
||||
unsigned int i5r = 0x5263daa3;
|
||||
|
||||
float x0n = hide_float(make_float(i0n));
|
||||
float x0d = hide_float(make_float(i0d));
|
||||
float x0r = hide_float(make_float(i0r));
|
||||
|
||||
float x1n = hide_float(make_float(i1n));
|
||||
float x1d = hide_float(make_float(i1d));
|
||||
float x1r = hide_float(make_float(i1r));
|
||||
|
||||
float x2n = hide_float(make_float(i2n));
|
||||
float x2d = hide_float(make_float(i2d));
|
||||
float x2r = hide_float(make_float(i2r));
|
||||
|
||||
float x3n = hide_float(make_float(i3n));
|
||||
float x3d = hide_float(make_float(i3d));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
|
||||
float x4n = hide_float(make_float(i4n));
|
||||
float x4d = hide_float(make_float(i4d));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
|
||||
float x5n = hide_float(make_float(i5n));
|
||||
float x5d = hide_float(make_float(i5d));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
|
||||
vec_float4 x0n_v = spu_splats(x0n);
|
||||
vec_float4 x0d_v = spu_splats(x0d);
|
||||
vec_float4 x0r_v = spu_splats(x0r);
|
||||
|
||||
vec_float4 x1n_v = spu_splats(x1n);
|
||||
vec_float4 x1d_v = spu_splats(x1d);
|
||||
vec_float4 x1r_v = spu_splats(x1r);
|
||||
|
||||
vec_float4 x2n_v = spu_splats(x2n);
|
||||
vec_float4 x2d_v = spu_splats(x2d);
|
||||
vec_float4 x2r_v = spu_splats(x2r);
|
||||
|
||||
vec_float4 x3n_v = spu_splats(x3n);
|
||||
vec_float4 x3d_v = spu_splats(x3d);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
|
||||
vec_float4 x4n_v = spu_splats(x4n);
|
||||
vec_float4 x4d_v = spu_splats(x4d);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
|
||||
vec_float4 x5n_v = spu_splats(x5n);
|
||||
vec_float4 x5d_v = spu_splats(x5d);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("divf4");
|
||||
res_v = divf4(x0n_v, x0d_v);
|
||||
TEST_CHECK("20040928105932EJL", allequal_ulps_float4( res_v, x0r_v, 2 ), 0);
|
||||
res_v = divf4(x1n_v, x1d_v);
|
||||
TEST_CHECK("20040928105934EJL", allequal_ulps_float4( res_v, x1r_v, 2 ), 0);
|
||||
res_v = divf4(x2n_v, x2d_v);
|
||||
TEST_CHECK("20040928105936EJL", allequal_ulps_float4( res_v, x2r_v, 2 ), 0);
|
||||
res_v = divf4(x3n_v, x3d_v);
|
||||
TEST_CHECK("20040928105938EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
|
||||
res_v = divf4(x4n_v, x4d_v);
|
||||
TEST_CHECK("20040928105940EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
|
||||
res_v = divf4(x5n_v, x5d_v);
|
||||
TEST_CHECK("20040928105943EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
123
Extras/simdmathlibrary/spu/tests/divi4.c
Normal file
123
Extras/simdmathlibrary/spu/tests/divi4.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/* Test divi4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928161739EJL","EJL", "divi4");
|
||||
|
||||
int x0n = 0xffccb78d;
|
||||
int x0d = 0x0 ;
|
||||
int x0q = 0x0 ;
|
||||
int x0r = 0xffccb78d;
|
||||
int x1n = 0xff978333;
|
||||
int x1d = 0xff976bb6;
|
||||
int x1q = 0x0 ;
|
||||
int x1r = 0xff978333;
|
||||
int x2n = 0x5e146 ;
|
||||
int x2d = 0xd14ebe0e;
|
||||
int x2q = 0x0 ;
|
||||
int x2r = 0x5e146 ;
|
||||
int x3n = 0xf0e91618;
|
||||
int x3d = 0xfddff7ac;
|
||||
int x3q = 0x7 ;
|
||||
int x3r = 0xffc95064;
|
||||
|
||||
int x4n = 0xf2128d9d;
|
||||
int x4d = 0xe0f76 ;
|
||||
int x4q = 0xffffff03;
|
||||
int x4r = 0xfff7d53b;
|
||||
int x5n = 0xda1ba2ce;
|
||||
int x5d = 0x4c9 ;
|
||||
int x5q = 0xfff814d3;
|
||||
int x5r = 0xfffffd23;
|
||||
int x6n = 0xdd4426a6;
|
||||
int x6d = 0xf8d245cf;
|
||||
int x6q = 0x4 ;
|
||||
int x6r = 0xf9fb0f6a;
|
||||
int x7n = 0xd1d5ae9 ;
|
||||
int x7d = 0x333ab105;
|
||||
int x7q = 0x0 ;
|
||||
int x7r = 0xd1d5ae9 ;
|
||||
|
||||
int x8n = 0x3e0c6 ;
|
||||
int x8d = 0xfff24255;
|
||||
int x8q = 0x0 ;
|
||||
int x8r = 0x3e0c6 ;
|
||||
int x9n = 0xfd6fe27e;
|
||||
int x9d = 0xf32454 ;
|
||||
int x9q = 0xfffffffe;
|
||||
int x9r = 0xff562b26;
|
||||
int x10n =0xfb150f79;
|
||||
int x10d =0xf521 ;
|
||||
int x10q =0xfffffade;
|
||||
int x10r =0xffff42db;
|
||||
int x11n =0xfe88071f;
|
||||
int x11d =0xfff937c2;
|
||||
int x11q =0x37 ;
|
||||
int x11r =0xfffd0c71;
|
||||
|
||||
|
||||
vec_int4 x0n_v = (vec_int4){ x0n, x1n, x2n, x3n };
|
||||
vec_int4 x1n_v = (vec_int4){ x4n, x5n, x6n, x7n };
|
||||
vec_int4 x2n_v = (vec_int4){ x8n, x9n, x10n, x11n };
|
||||
|
||||
vec_int4 x0d_v = (vec_int4){ x0d, x1d, x2d, x3d };
|
||||
vec_int4 x1d_v = (vec_int4){ x4d, x5d, x6d, x7d };
|
||||
vec_int4 x2d_v = (vec_int4){ x8d, x9d, x10d, x11d };
|
||||
|
||||
vec_int4 x0q_v = (vec_int4){ x0q, x1q, x2q, x3q };
|
||||
vec_int4 x1q_v = (vec_int4){ x4q, x5q, x6q, x7q };
|
||||
vec_int4 x2q_v = (vec_int4){ x8q, x9q, x10q, x11q };
|
||||
|
||||
vec_int4 x0r_v = (vec_int4){ x0r, x1r, x2r, x3r };
|
||||
vec_int4 x1r_v = (vec_int4){ x4r, x5r, x6r, x7r };
|
||||
vec_int4 x2r_v = (vec_int4){ x8r, x9r, x10r, x11r };
|
||||
|
||||
divi4_t res;
|
||||
|
||||
TEST_START("divi4");
|
||||
res = divi4(x0n_v, x0d_v);
|
||||
TEST_CHECK("20040928161846EJL", allequal_int4( res.quot, x0q_v ) && allequal_int4( res.rem, x0r_v ), 0);
|
||||
res = divi4(x1n_v, x1d_v);
|
||||
TEST_CHECK("20040928161851EJL", allequal_int4( res.quot, x1q_v ) && allequal_int4( res.rem, x1r_v ), 0);
|
||||
res = divi4(x2n_v, x2d_v);
|
||||
TEST_CHECK("20040928161855EJL", allequal_int4( res.quot, x2q_v ) && allequal_int4( res.rem, x2r_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
146
Extras/simdmathlibrary/spu/tests/divu4.c
Normal file
146
Extras/simdmathlibrary/spu/tests/divu4.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/* Test divu4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060901150000MH","MH", "divu4");
|
||||
|
||||
unsigned int x0n = 0xffccb78d;
|
||||
unsigned int x0d = 0x0 ;
|
||||
unsigned int x0q = 0x0 ;
|
||||
unsigned int x0r = 0xffccb78d;
|
||||
unsigned int x1n = 0xff978333;
|
||||
unsigned int x1d = 0xff976bb6;
|
||||
unsigned int x1q = 0x1 ;
|
||||
unsigned int x1r = 0x177d ;
|
||||
unsigned int x2n = 0x5e146 ;
|
||||
unsigned int x2d = 0xd14ebe0e;
|
||||
unsigned int x2q = 0x0 ;
|
||||
unsigned int x2r = 0x5e146 ;
|
||||
unsigned int x3n = 0xf0e91618;
|
||||
unsigned int x3d = 0xfddff7ac;
|
||||
unsigned int x3q = 0x0 ;
|
||||
unsigned int x3r = 0xf0e91618;
|
||||
|
||||
unsigned int x4n = 0xf2128d9d;
|
||||
unsigned int x4d = 0xe0f76 ;
|
||||
unsigned int x4q = 0x1137 ;
|
||||
unsigned int x4r = 0x66543 ;
|
||||
unsigned int x5n = 0xda1ba2ce;
|
||||
unsigned int x5d = 0x4c9 ;
|
||||
unsigned int x5q = 0x2d9482 ;
|
||||
unsigned int x5r = 0xbc ;
|
||||
unsigned int x6n = 0xdd4426a6;
|
||||
unsigned int x6d = 0xf8d245cf;
|
||||
unsigned int x6q = 0x0 ;
|
||||
unsigned int x6r = 0xdd4426a6;
|
||||
unsigned int x7n = 0xd1d5ae9 ;
|
||||
unsigned int x7d = 0x333ab105;
|
||||
unsigned int x7q = 0x0 ;
|
||||
unsigned int x7r = 0xd1d5ae9 ;
|
||||
|
||||
unsigned int x8n = 0x3e0c6 ;
|
||||
unsigned int x8d = 0xfff24255;
|
||||
unsigned int x8q = 0x0 ;
|
||||
unsigned int x8r = 0x3e0c6 ;
|
||||
unsigned int x9n = 0xfd6fe27e;
|
||||
unsigned int x9d = 0xf32454 ;
|
||||
unsigned int x9q = 0x10a ;
|
||||
unsigned int x9r = 0xcc2336 ;
|
||||
unsigned int x10n =0xfb150f79;
|
||||
unsigned int x10d =0xf521 ;
|
||||
unsigned int x10q =0x10637 ;
|
||||
unsigned int x10r =0x9f62 ;
|
||||
unsigned int x11n =0xfe88071f;
|
||||
unsigned int x11d =0xfff937c2;
|
||||
unsigned int x11q =0x0 ;
|
||||
unsigned int x11r =0xfe88071f;
|
||||
|
||||
unsigned int x12n =0xc374fa4 ;
|
||||
unsigned int x12d =0x1234 ;
|
||||
unsigned int x12q =0xabcd ;
|
||||
unsigned int x12r =0x0 ;
|
||||
unsigned int x13n =0xffffffff;
|
||||
unsigned int x13d =0x2 ;
|
||||
unsigned int x13q =0x7fffffff;
|
||||
unsigned int x13r =0x1 ;
|
||||
unsigned int x14n =0x0 ;
|
||||
unsigned int x14d =0x12345678;
|
||||
unsigned int x14q =0x0 ;
|
||||
unsigned int x14r =0x0 ;
|
||||
unsigned int x15n =0xffffffff;
|
||||
unsigned int x15d =0x1 ;
|
||||
unsigned int x15q =0xffffffff;
|
||||
unsigned int x15r =0x0 ;
|
||||
|
||||
vec_uint4 x0n_v = (vec_uint4){ x0n, x1n, x2n, x3n };
|
||||
vec_uint4 x1n_v = (vec_uint4){ x4n, x5n, x6n, x7n };
|
||||
vec_uint4 x2n_v = (vec_uint4){ x8n, x9n, x10n, x11n };
|
||||
vec_uint4 x3n_v = (vec_uint4){ x12n, x13n, x14n, x15n };
|
||||
|
||||
vec_uint4 x0d_v = (vec_uint4){ x0d, x1d, x2d, x3d };
|
||||
vec_uint4 x1d_v = (vec_uint4){ x4d, x5d, x6d, x7d };
|
||||
vec_uint4 x2d_v = (vec_uint4){ x8d, x9d, x10d, x11d };
|
||||
vec_uint4 x3d_v = (vec_uint4){ x12d, x13d, x14d, x15d };
|
||||
|
||||
vec_uint4 x0q_v = (vec_uint4){ x0q, x1q, x2q, x3q };
|
||||
vec_uint4 x1q_v = (vec_uint4){ x4q, x5q, x6q, x7q };
|
||||
vec_uint4 x2q_v = (vec_uint4){ x8q, x9q, x10q, x11q };
|
||||
vec_uint4 x3q_v = (vec_uint4){ x12q, x13q, x14q, x15q };
|
||||
|
||||
vec_uint4 x0r_v = (vec_uint4){ x0r, x1r, x2r, x3r };
|
||||
vec_uint4 x1r_v = (vec_uint4){ x4r, x5r, x6r, x7r };
|
||||
vec_uint4 x2r_v = (vec_uint4){ x8r, x9r, x10r, x11r };
|
||||
vec_uint4 x3r_v = (vec_uint4){ x12r, x13r, x14r, x15r };
|
||||
|
||||
divu4_t res;
|
||||
|
||||
TEST_START("divu4");
|
||||
res = divu4(x0n_v, x0d_v);
|
||||
TEST_CHECK("20060901150001MH", allequal_uint4( res.quot, x0q_v ) && allequal_uint4( res.rem, x0r_v ), 0);
|
||||
res = divu4(x1n_v, x1d_v);
|
||||
TEST_CHECK("20060901150002MH", allequal_uint4( res.quot, x1q_v ) && allequal_uint4( res.rem, x1r_v ), 0);
|
||||
res = divu4(x2n_v, x2d_v);
|
||||
TEST_CHECK("20060901150003MH", allequal_uint4( res.quot, x2q_v ) && allequal_uint4( res.rem, x2r_v ), 0);
|
||||
res = divu4(x3n_v, x3d_v);
|
||||
TEST_CHECK("20060901150004MH", allequal_uint4( res.quot, x3q_v ) && allequal_uint4( res.rem, x3r_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
103
Extras/simdmathlibrary/spu/tests/fabsd2.c
Normal file
103
Extras/simdmathlibrary/spu/tests/fabsd2.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/* Test fabsd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040908022501EJL","EJL", "fabs");
|
||||
|
||||
double x0n = hide_double(-0.0);
|
||||
double x0p = hide_double(0.0);
|
||||
double x1n = hide_double(-83532.96153153);
|
||||
double x1p = hide_double(83532.96153153);
|
||||
double x2n = hide_double(-0.0000000013152);
|
||||
double x2p = hide_double(0.0000000013152);
|
||||
double x3n = hide_double(-1.0/0.0);
|
||||
double x3p = hide_double(1.0/0.0);
|
||||
|
||||
vec_double2 x0n_v = spu_splats(x0n);
|
||||
vec_double2 x0p_v = spu_splats(x0p);
|
||||
vec_double2 x1n_v = spu_splats(x1n);
|
||||
vec_double2 x1p_v = spu_splats(x1p);
|
||||
vec_double2 x2n_v = spu_splats(x2n);
|
||||
vec_double2 x2p_v = spu_splats(x2p);
|
||||
vec_double2 x3n_v = spu_splats(x3n);
|
||||
vec_double2 x3p_v = spu_splats(x3p);
|
||||
|
||||
double res;
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("fabsd2");
|
||||
res_v = fabsd2(x0n_v);
|
||||
TEST_CHECK("20040908022502EJL", allequal_double2( res_v, x0p_v ), 0);
|
||||
res_v = fabsd2(x0p_v);
|
||||
TEST_CHECK("20040908022503EJL", allequal_double2( res_v, x0p_v ), 0);
|
||||
res_v = fabsd2(x1n_v);
|
||||
TEST_CHECK("20040908022504EJL", allequal_double2( res_v, x1p_v ), 0);
|
||||
res_v = fabsd2(x1p_v);
|
||||
TEST_CHECK("20040908022505EJL", allequal_double2( res_v, x1p_v ), 0);
|
||||
res_v = fabsd2(x2n_v);
|
||||
TEST_CHECK("20040908022506EJL", allequal_double2( res_v, x2p_v ), 0);
|
||||
res_v = fabsd2(x2p_v);
|
||||
TEST_CHECK("20040908022507EJL", allequal_double2( res_v, x2p_v ), 0);
|
||||
res_v = fabsd2(x3n_v);
|
||||
TEST_CHECK("20040908022508EJL", allposinf_double2( res_v ), 0);
|
||||
res_v = fabsd2(x3p_v);
|
||||
TEST_CHECK("20040908022509EJL", allposinf_double2( res_v ), 0);
|
||||
|
||||
TEST_START("fabs");
|
||||
res = fabs( x0n );
|
||||
TEST_CHECK("20040908022510EJL", res == x0p, 0);
|
||||
res = fabs( x0p );
|
||||
TEST_CHECK("20040908022511EJL", res == x0p, 0);
|
||||
res = fabs( x1n );
|
||||
TEST_CHECK("20040908022512EJL", res == x1p, 0);
|
||||
res = fabs( x1p );
|
||||
TEST_CHECK("20040908022513EJL", res == x1p, 0);
|
||||
res = fabs( x2n );
|
||||
TEST_CHECK("20040908022514EJL", res == x2p, 0);
|
||||
res = fabs( x2p );
|
||||
TEST_CHECK("20040908022515EJL", res == x2p, 0);
|
||||
res = fabs( x3n );
|
||||
TEST_CHECK("20040908022516EJL", isinf(res) == 1, 0);
|
||||
res = fabs( x3p );
|
||||
TEST_CHECK("20040908022517EJL", isinf(res) == 1, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
106
Extras/simdmathlibrary/spu/tests/fabsf4.c
Normal file
106
Extras/simdmathlibrary/spu/tests/fabsf4.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* Test fabsf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040915032605EJL","EJL", "fabsf");
|
||||
|
||||
unsigned int i3n = 0xffffffff;
|
||||
unsigned int i3p = 0x7fffffff;
|
||||
|
||||
float x0n = hide_float(-0.0f);
|
||||
float x0p = hide_float(0.0f);
|
||||
float x1n = hide_float(-83532.96153153f);
|
||||
float x1p = hide_float(83532.96153153f);
|
||||
float x2n = hide_float(-0.0000000013152f);
|
||||
float x2p = hide_float(0.0000000013152f);
|
||||
float x3n = hide_float(make_float(i3n));
|
||||
float x3p = hide_float(make_float(i3p));
|
||||
|
||||
vec_float4 x0n_v = spu_splats(x0n);
|
||||
vec_float4 x0p_v = spu_splats(x0p);
|
||||
vec_float4 x1n_v = spu_splats(x1n);
|
||||
vec_float4 x1p_v = spu_splats(x1p);
|
||||
vec_float4 x2n_v = spu_splats(x2n);
|
||||
vec_float4 x2p_v = spu_splats(x2p);
|
||||
vec_float4 x3n_v = spu_splats(x3n);
|
||||
vec_float4 x3p_v = spu_splats(x3p);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("fabsf4");
|
||||
res_v = fabsf4(x0n_v);
|
||||
TEST_CHECK("20040915032618EJL", allequal_float4( res_v, x0p_v ), 0);
|
||||
res_v = fabsf4(x0p_v);
|
||||
TEST_CHECK("20040915032632EJL", allequal_float4( res_v, x0p_v ), 0);
|
||||
res_v = fabsf4(x1n_v);
|
||||
TEST_CHECK("20040915032643EJL", allequal_float4( res_v, x1p_v ), 0);
|
||||
res_v = fabsf4(x1p_v);
|
||||
TEST_CHECK("20040915032654EJL", allequal_float4( res_v, x1p_v ), 0);
|
||||
res_v = fabsf4(x2n_v);
|
||||
TEST_CHECK("20040915032704EJL", allequal_float4( res_v, x2p_v ), 0);
|
||||
res_v = fabsf4(x2p_v);
|
||||
TEST_CHECK("20040915032712EJL", allequal_float4( res_v, x2p_v ), 0);
|
||||
res_v = fabsf4(x3n_v);
|
||||
TEST_CHECK("20040915032719EJL", allequal_float4( res_v, x3p_v ), 0);
|
||||
res_v = fabsf4(x3p_v);
|
||||
TEST_CHECK("20040915032729EJL", allequal_float4( res_v, x3p_v ), 0);
|
||||
|
||||
TEST_START("fabsf");
|
||||
res = fabsf( x0n );
|
||||
TEST_CHECK("20040915032739EJL", res == x0p, 0);
|
||||
res = fabsf( x0p );
|
||||
TEST_CHECK("20040915032747EJL", res == x0p, 0);
|
||||
res = fabsf( x1n );
|
||||
TEST_CHECK("20040915032755EJL", res == x1p, 0);
|
||||
res = fabsf( x1p );
|
||||
TEST_CHECK("20040915032806EJL", res == x1p, 0);
|
||||
res = fabsf( x2n );
|
||||
TEST_CHECK("20040915032814EJL", res == x2p, 0);
|
||||
res = fabsf( x2p );
|
||||
TEST_CHECK("20040915032826EJL", res == x2p, 0);
|
||||
res = fabsf( x3n );
|
||||
TEST_CHECK("20040915032834EJL", res == x3p, 0);
|
||||
res = fabsf( x3p );
|
||||
TEST_CHECK("20040915032841EJL", res == x3p, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
173
Extras/simdmathlibrary/spu/tests/fdimd2.c
Normal file
173
Extras/simdmathlibrary/spu/tests/fdimd2.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/* Test fdimd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ fdimd2 - compute positive difference.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for fdimd2.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* when both of two values are denormalized, it may not work correctly.
|
||||
*
|
||||
*@note
|
||||
* source of fdimd2.c was modified from IBM SDK1.1 math library
|
||||
*
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060824151500MH","MH", "fdimd2");
|
||||
|
||||
double x0min = hide_double(1760.135);
|
||||
double x0max = hide_double(19355.03);
|
||||
double x0dim = hide_double(19355.03 - 1760.135);
|
||||
|
||||
double x1min = hide_double(-12351.9);
|
||||
double x1max = hide_double(-139.035);
|
||||
double x1dim = hide_double((-139.035) - (-12351.9));
|
||||
|
||||
double x2min = hide_double(-1.0);
|
||||
double x2max = hide_double(0.0);
|
||||
double x2dim = hide_double(1.0);
|
||||
|
||||
double x3min = hide_double(nan(""));
|
||||
double x3max = hide_double(-1.0);
|
||||
|
||||
double x4min = hide_double(-0.0);
|
||||
double x4max = hide_double(0.0);
|
||||
|
||||
double x5min = hide_double(5.0e-324);
|
||||
double x5max = hide_double(1.0e-323);
|
||||
double x5dim = hide_double(1.0e-323 - 5.0e-324);
|
||||
|
||||
double x6min = hide_double(DBL_MAX);
|
||||
double x6max = hide_double(1.0/0.0);
|
||||
|
||||
double x7min = hide_double(-1.0/0.0);
|
||||
double x7max = hide_double(19355.03);
|
||||
|
||||
double x8min = hide_double(-1.0/0.0);
|
||||
double x8max = hide_double(1.0/0.0);
|
||||
|
||||
vec_double2 x0min_v = spu_splats(x0min);
|
||||
vec_double2 x0max_v = spu_splats(x0max);
|
||||
vec_double2 x0dim_v = spu_splats(x0dim);
|
||||
|
||||
vec_double2 x1min_v = spu_splats(x1min);
|
||||
vec_double2 x1max_v = spu_splats(x1max);
|
||||
vec_double2 x1dim_v = spu_splats(x1dim);
|
||||
|
||||
vec_double2 x2min_v = spu_splats(x2min);
|
||||
vec_double2 x2max_v = spu_splats(x2max);
|
||||
vec_double2 x2dim_v = spu_splats(x2dim);
|
||||
|
||||
vec_double2 x3min_v = spu_splats(x3min);
|
||||
vec_double2 x3max_v = spu_splats(x3max);
|
||||
|
||||
vec_double2 x4min_v = spu_splats(x4min);
|
||||
vec_double2 x4max_v = spu_splats(x4max);
|
||||
|
||||
vec_double2 x5min_v = spu_splats(x5min);
|
||||
vec_double2 x5max_v = spu_splats(x5max);
|
||||
vec_double2 x5dim_v = spu_splats(x5dim);
|
||||
|
||||
vec_double2 x6min_v = spu_splats(x6min);
|
||||
vec_double2 x6max_v = spu_splats(x6max);
|
||||
|
||||
vec_double2 x7min_v = spu_splats(x7min);
|
||||
vec_double2 x7max_v = spu_splats(x7max);
|
||||
|
||||
vec_double2 x8min_v = spu_splats(x8min);
|
||||
vec_double2 x8max_v = spu_splats(x8max);
|
||||
|
||||
vec_double2 x9minmax_v = (vec_double2){x0min, x1max};
|
||||
vec_double2 x9maxmin_v = (vec_double2){x0max, x1min};
|
||||
vec_double2 x9dim1_v = (vec_double2){x0dim, 0.0};
|
||||
vec_double2 x9dim2_v = (vec_double2){0.0, x1dim};
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("fdimd2");
|
||||
res_v = fdimd2(x0min_v, x0max_v);
|
||||
TEST_CHECK("20060824151501MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x0max_v, x0min_v);
|
||||
TEST_CHECK("20060824151502MH", allequal_double2( res_v, x0dim_v ), 0);
|
||||
res_v = fdimd2(x1min_v, x1max_v);
|
||||
TEST_CHECK("20060824151503MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x1max_v, x1min_v);
|
||||
TEST_CHECK("20060824151504MH", allequal_double2( res_v, x1dim_v ), 0);
|
||||
res_v = fdimd2(x2min_v, x2max_v);
|
||||
TEST_CHECK("20060824151505MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x2max_v, x2min_v);
|
||||
TEST_CHECK("20060824151506MH", allequal_double2( res_v, x2dim_v ), 0);
|
||||
res_v = fdimd2(x3min_v, x3max_v);
|
||||
TEST_CHECK("20060824151507MH", allnan_double2( res_v ), 0);
|
||||
res_v = fdimd2(x3max_v, x3min_v);
|
||||
TEST_CHECK("20060824151508MH", allnan_double2( res_v ), 0);
|
||||
res_v = fdimd2(x4min_v, x4max_v);
|
||||
TEST_CHECK("20060824151509MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x4max_v, x4min_v);
|
||||
TEST_CHECK("20060824151510MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x5min_v, x5max_v);
|
||||
TEST_CHECK("20060824151511MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x5max_v, x5min_v);
|
||||
TEST_CHECK("20060824151512MH", allequal_double2( res_v, x5dim_v ), 0);
|
||||
res_v = fdimd2(x6min_v, x6max_v);
|
||||
TEST_CHECK("20060824151513MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x6max_v, x6min_v);
|
||||
TEST_CHECK("20060824151514MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fdimd2(x7min_v, x7max_v);
|
||||
TEST_CHECK("20060824151515MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x7max_v, x7min_v);
|
||||
TEST_CHECK("20060824151516MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fdimd2(x8min_v, x8max_v);
|
||||
TEST_CHECK("20060824151517MH", allposzero_double2( res_v ), 0);
|
||||
res_v = fdimd2(x8max_v, x8min_v);
|
||||
TEST_CHECK("20060824151518MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fdimd2(x9minmax_v, x9maxmin_v);
|
||||
TEST_CHECK("20060824151519MH", allequal_double2( res_v, x9dim2_v ), 0);
|
||||
res_v = fdimd2(x9maxmin_v, x9minmax_v);
|
||||
TEST_CHECK("20060824151520MH", allequal_double2( res_v, x9dim1_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
173
Extras/simdmathlibrary/spu/tests/floatingpoint_tests.h
Normal file
173
Extras/simdmathlibrary/spu/tests/floatingpoint_tests.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* Common part of testsuite for SPU SIMD Math library
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _FLOATINGPOINT_TESTS_H_
|
||||
#define _FLOATINGPOINT_TESTS_H_
|
||||
|
||||
#if __PPC__
|
||||
#include <altivec.h>
|
||||
#define vec_uchar16 vector unsigned char
|
||||
#define vec_char16 vector signed char
|
||||
#define vec_ushort8 vector unsigned short
|
||||
#define vec_short8 vector signed short
|
||||
#define vec_uint4 vector unsigned int
|
||||
#define vec_int4 vector signed int
|
||||
#define vec_ullong2 vector unsigned long long
|
||||
#define vec_llong2 vector signed long long
|
||||
#define vec_float4 vector float
|
||||
#define vec_double2 vector double
|
||||
#else
|
||||
#if __SPU__
|
||||
#include <spu_intrinsics.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// To avoid type punning warnings (for printing in hex notation, doing bit-diff etc)
|
||||
typedef union {
|
||||
double d;
|
||||
unsigned char uc[8];
|
||||
unsigned int ui[2];
|
||||
unsigned long long int ull;
|
||||
} sce_math_alt_double;
|
||||
|
||||
typedef union {
|
||||
float f;
|
||||
unsigned char uc[4];
|
||||
unsigned int ui;
|
||||
} sce_math_alt_float;
|
||||
|
||||
#if (__PPC__ || __SPU__)
|
||||
typedef union {
|
||||
vec_int4 vsi;
|
||||
int si[4];
|
||||
} sce_math_alt_vec_int4;
|
||||
|
||||
typedef union {
|
||||
vec_uint4 vui;
|
||||
int ui[4];
|
||||
} sce_math_alt_vec_uint4;
|
||||
|
||||
typedef union {
|
||||
vec_float4 vf;
|
||||
float sf[4];
|
||||
unsigned int ui[4];
|
||||
} sce_math_alt_vec_float4;
|
||||
#endif
|
||||
#if __SPU__
|
||||
typedef union {
|
||||
double sd[2];
|
||||
vec_double2 vd;
|
||||
unsigned long long int ui[2];
|
||||
} sce_math_alt_vec_double2;
|
||||
#endif
|
||||
|
||||
#if __PPC__
|
||||
static inline vec_int4 bitdiff4(vec_float4 ref, vec_float4 vals) {
|
||||
vec_int4 refi = (vec_int4)ref;
|
||||
vec_int4 valsi = (vec_int4)vals;
|
||||
vec_int4 diff = vec_sub(refi, valsi);
|
||||
vec_int4 negdiff = vec_sub(((vec_int4)0), diff);
|
||||
|
||||
return vec_sel(negdiff, diff, vec_cmpgt(diff, ((vec_int4)0) ));
|
||||
}
|
||||
static inline int bitdiff(float ref, float val) {
|
||||
sce_math_alt_float aref, aval;
|
||||
aref.f = ref;
|
||||
aval.f = val;
|
||||
int diff = aref.ui - aval.ui;
|
||||
return (diff>0)?diff:-diff;
|
||||
}
|
||||
static inline vec_int4 bitmatch4(vec_float4 ref, vec_float4 vals) {
|
||||
vec_int4 refi = (vec_int4)ref;
|
||||
vec_int4 valsi = (vec_int4)vals;
|
||||
vec_int4 diff = vec_sub(refi, valsi);
|
||||
vec_int4 negdiff = vec_sub(((vec_int4)0), diff);
|
||||
|
||||
diff = vec_sel(negdiff, diff, vec_cmpgt(diff, ((vec_int4)0) ));
|
||||
vec_float4 logdiff = vec_loge(vec_ctf(diff,0));
|
||||
return vec_sub(((vec_int4)32), vec_cts(vec_ceil(logdiff),0));
|
||||
}
|
||||
static inline int bitmatch(float ref, float val) {
|
||||
sce_math_alt_vec_float4 aref, aval;
|
||||
sce_math_alt_vec_int4 adiff;
|
||||
aref.sf[0] = ref;
|
||||
aval.sf[0] = val;
|
||||
adiff.vsi = bitmatch4(aref.vf, aval.vf);
|
||||
return adiff.si[0];
|
||||
}
|
||||
#else
|
||||
#if __SPU__
|
||||
static inline vec_int4 bitdiff4(vec_float4 ref, vec_float4 vals) {
|
||||
vec_int4 refi = (vec_int4)ref;
|
||||
vec_int4 valsi = (vec_int4)vals;
|
||||
vec_int4 diff = spu_sub(refi, valsi);
|
||||
vec_int4 negdiff = spu_sub(spu_splats((int)0), diff);
|
||||
|
||||
return spu_sel(negdiff, diff, (vec_uchar16)spu_cmpgt(diff, 0));
|
||||
}
|
||||
static inline int bitdiff(float ref, float val) {
|
||||
return spu_extract(bitdiff4(spu_promote(ref,0), spu_promote(val,0)), 0);
|
||||
}
|
||||
static inline vec_int4 bitmatch4(vec_float4 ref, vec_float4 vals) {
|
||||
vec_int4 refi = (vec_int4)ref;
|
||||
vec_int4 valsi = (vec_int4)vals;
|
||||
vec_int4 diff = spu_sub(refi, valsi);
|
||||
vec_int4 negdiff = spu_sub(spu_splats((int)0), diff);
|
||||
|
||||
return (vec_int4)spu_cntlz(spu_sel(negdiff, diff, (vec_uchar16)spu_cmpgt(diff, 0)));
|
||||
}
|
||||
static inline int bitmatch(float ref, float val) {
|
||||
return spu_extract(bitmatch4(spu_promote(ref,0), spu_promote(val,0)), 0);
|
||||
}
|
||||
|
||||
#else
|
||||
inline int bitdiff(sce_math_alt_float ref, sce_math_alt_float val) {
|
||||
int diff = ref.ui - val.ui;
|
||||
return((diff>0)?diff:-diff);
|
||||
}
|
||||
inline int bitmatch(sce_math_alt_float ref, sce_math_alt_float val) {
|
||||
int diff, i;
|
||||
unsigned int udiff;
|
||||
diff = ref.ui - val.ui;
|
||||
udiff = (diff>0) ? diff : -diff;
|
||||
i = 32;
|
||||
while(udiff != 0) {
|
||||
i = i-1;
|
||||
udiff = udiff >> 1;
|
||||
}
|
||||
return udiff;
|
||||
}
|
||||
#endif // __SPU__
|
||||
#endif // __PPC__
|
||||
|
||||
|
||||
#endif // _FLOATINGPOINT_TESTS_H_
|
||||
157
Extras/simdmathlibrary/spu/tests/floord2.c
Normal file
157
Extras/simdmathlibrary/spu/tests/floord2.c
Normal file
@@ -0,0 +1,157 @@
|
||||
/* Test roundd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ floord2 - for each of two doule slots,
|
||||
* round up to smallest integer not more than the value.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for floord2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
double xxx[2];
|
||||
double ans[2];
|
||||
} dbl;
|
||||
struct {
|
||||
unsigned long long xxx[2];
|
||||
unsigned long long ans[2];
|
||||
} ull;
|
||||
} TestVec_Roundd2;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec_Roundd2 test_a[] = {
|
||||
{
|
||||
ull:{
|
||||
// 0 -> 0 , -0 -> -0
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// -Inf -> -Inf , Inf -> Inf
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// MAX -> MAX , MIN -> MIN
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// +Denormalize -> 0, -Denormalize -> -1.0
|
||||
{0x0000000000000001ULL,0x8000000000000010ULL},
|
||||
{0x0000000000000000ULL,0xbff0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// +Denormalize -> 0, -Denormalize -> -1.0
|
||||
{0x000FFFFFFFFFFFFFULL,0x800FFFFFFFFFFFFFULL},
|
||||
{0x0000000000000000ULL,0xbff0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// border
|
||||
{0x4320000000000001ULL,0xC320000000000001ULL},
|
||||
{0x4320000000000000ULL,0xC320000000000002ULL}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{1.0, -1.0},
|
||||
{1.0, -1.0}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{0.5, -0.5},
|
||||
{0.0, -1.0}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{-2.75, 3.25},
|
||||
{-3.0, 3.0}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Nan
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL},
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
//vec_double2 input;
|
||||
|
||||
TEST_SET_START("96743652190000NM","FLR", "floord2");
|
||||
|
||||
TEST_START("floord2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].ull.xxx[0] == 0) && (test_a[ii].ull.xxx[1] == 0) ) break;
|
||||
//input = *((vec_double2 *)&test_a[ii].dbl.xxx[0]);
|
||||
res_v = floord2 (*((vec_double2 *)&test_a[ii].dbl.xxx[0]) );
|
||||
sprintf(msg,"9674365219%04dFLR", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, (vec_llong2)*((vec_double2 *)&test_a[ii].dbl.ans[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
109
Extras/simdmathlibrary/spu/tests/floorf4.c
Normal file
109
Extras/simdmathlibrary/spu/tests/floorf4.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/* Test floorf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040916145017EJL","EJL", "floorf");
|
||||
|
||||
unsigned int i3 = 0x4affffff; // 2^23 - 0.5, largest truncatable value.
|
||||
unsigned int i3i = 0x4afffffe;
|
||||
unsigned int i4 = 0x4b000000; // 2^23, no fractional part.
|
||||
unsigned int i5 = 0xcf000001; // -2^31, one more large, and negative, value.
|
||||
|
||||
float x0 = hide_float(0.91825f);
|
||||
float x0i = hide_float(0.0f);
|
||||
float x1 = hide_float(-0.12958f);
|
||||
float x1i = hide_float(-1.0f);
|
||||
float x2 = hide_float(-79615.1875f);
|
||||
float x2i = hide_float(-79616.0f);
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3i = hide_float(make_float(i3i));
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4i = hide_float(make_float(i4));
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5i = hide_float(make_float(i5));
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 x0i_v = spu_splats(x0i);
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 x1i_v = spu_splats(x1i);
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 x2i_v = spu_splats(x2i);
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3i_v = spu_splats(x3i);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4i_v = spu_splats(x4i);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5i_v = spu_splats(x5i);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("floorf4");
|
||||
res_v = floorf4(x0_v);
|
||||
TEST_CHECK("20040916145022EJL", allequal_float4( res_v, x0i_v ), 0);
|
||||
res_v = floorf4(x1_v);
|
||||
TEST_CHECK("20040916145024EJL", allequal_float4( res_v, x1i_v ), 0);
|
||||
res_v = floorf4(x2_v);
|
||||
TEST_CHECK("20040916145027EJL", allequal_float4( res_v, x2i_v ), 0);
|
||||
res_v = floorf4(x3_v);
|
||||
TEST_CHECK("20040916145029EJL", allequal_float4( res_v, x3i_v ), 0);
|
||||
res_v = floorf4(x4_v);
|
||||
TEST_CHECK("20040916145032EJL", allequal_float4( res_v, x4i_v ), 0);
|
||||
res_v = floorf4(x5_v);
|
||||
TEST_CHECK("20040916145034EJL", allequal_float4( res_v, x5i_v ), 0);
|
||||
|
||||
TEST_START("floorf");
|
||||
res = floorf(x0);
|
||||
TEST_CHECK("20040916155814EJL", res == x0i, 0);
|
||||
res = floorf(x1);
|
||||
TEST_CHECK("20040916155818EJL", res == x1i, 0);
|
||||
res = floorf(x2);
|
||||
TEST_CHECK("20040916155822EJL", res == x2i, 0);
|
||||
res = floorf(x3);
|
||||
TEST_CHECK("20040916155825EJL", res == x3i, 0);
|
||||
res = floorf(x4);
|
||||
TEST_CHECK("20040916155827EJL", res == x4i, 0);
|
||||
res = floorf(x5);
|
||||
TEST_CHECK("20040916155830EJL", res == x5i, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
146
Extras/simdmathlibrary/spu/tests/fmad2.c
Normal file
146
Extras/simdmathlibrary/spu/tests/fmad2.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/* Test fmad2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*@@ fmad2 - multiply and add (double).
|
||||
*
|
||||
*@brief
|
||||
* boundary test for fmad2.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* if input parameters are denorm, it may not work correctly.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060828114000MH","MH", "fmad2");
|
||||
|
||||
// double denorm_min = hide_double(make_double(0x0000000000000001ull));
|
||||
double denorm_max = hide_double(make_double(0x000fffffffffffffull));
|
||||
// double norm_min = hide_double(make_double(0x0010000000000000ull));
|
||||
double norm_max = hide_double(make_double(0x7fefffffffffffffull));
|
||||
|
||||
double x0 = hide_double(1760.135);
|
||||
double y0 = hide_double(19355.03);
|
||||
double z0 = hide_double(-12351.9);
|
||||
double a0 = hide_double(34055113.82905);
|
||||
|
||||
double x1 = hide_double(-139.035);
|
||||
double y1 = hide_double(0.0);
|
||||
double z1 = hide_double(-1.0);
|
||||
|
||||
double x2 = hide_double(nan(""));
|
||||
double y2 = hide_double(-1.0);
|
||||
double z2 = hide_double(-0.0);
|
||||
|
||||
double x3 = hide_double(1.0);
|
||||
double y3 = hide_double(1.0/0.0);
|
||||
double z3 = hide_double(-1.0);
|
||||
|
||||
double x4 = norm_max;
|
||||
double y4 = norm_max;
|
||||
double z4 = hide_double(0.0);
|
||||
|
||||
double x5 = hide_double(100.0);
|
||||
double y5 = denorm_max;
|
||||
double z5 = hide_double(0.0);
|
||||
double a5 = hide_double(make_double(0x0078fffffffffffeull));
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_double2 z0_v = spu_splats(z0);
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_double2 z1_v = spu_splats(z1);
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_double2 z2_v = spu_splats(z2);
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_double2 z3_v = spu_splats(z3);
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_double2 z4_v = spu_splats(z4);
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_double2 z5_v = spu_splats(z5);
|
||||
|
||||
vec_double2 a0_v = spu_splats(a0);
|
||||
vec_double2 a1_v = spu_splats(z1);
|
||||
vec_double2 a5_v = spu_splats(a5);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("fmad2");
|
||||
res_v = fmad2(x0_v, y0_v, z0_v);
|
||||
TEST_CHECK("20060828114001MH", allequal_ulps_double2( res_v, a0_v, 1 ), 0);
|
||||
res_v = fmad2(y0_v, x0_v, z0_v);
|
||||
TEST_CHECK("20060828114002MH", allequal_ulps_double2( res_v, a0_v, 1 ), 0);
|
||||
res_v = fmad2(x1_v, y1_v, z1_v);
|
||||
TEST_CHECK("20060828114003MH", allequal_ulps_double2( res_v, a1_v, 1 ), 0);
|
||||
res_v = fmad2(y1_v, x1_v, z1_v);
|
||||
TEST_CHECK("20060828114004MH", allequal_ulps_double2( res_v, a1_v, 1 ), 0);
|
||||
res_v = fmad2(x2_v, y2_v, z2_v);
|
||||
TEST_CHECK("20060828114005MH", allnan_double2( res_v ), 0);
|
||||
res_v = fmad2(y2_v, x2_v, z2_v);
|
||||
TEST_CHECK("20060828114006MH", allnan_double2( res_v ), 0);
|
||||
res_v = fmad2(x3_v, y3_v, z3_v);
|
||||
TEST_CHECK("20060828114007MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fmad2(y3_v, x3_v, z3_v);
|
||||
TEST_CHECK("20060828114008MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fmad2(x4_v, y4_v, z4_v);
|
||||
TEST_CHECK("20060828114009MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fmad2(y4_v, x4_v, z4_v);
|
||||
TEST_CHECK("20060828114010MH", allposinf_double2( res_v ), 0);
|
||||
res_v = fmad2(x5_v, y5_v, z5_v);
|
||||
TEST_CHECK("20060828114011MH", allequal_ulps_double2( res_v, a5_v, 1 ), 0);
|
||||
res_v = fmad2(y5_v, x5_v, z5_v);
|
||||
TEST_CHECK("20060828114012MH", allequal_ulps_double2( res_v, a5_v, 1 ), 0);
|
||||
//printf("res:%.10le, a5:%.10le\n", spu_extract(res_v, 0), spu_extract(a5_v, 0));
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
225
Extras/simdmathlibrary/spu/tests/fmind2_fmaxd2.c
Normal file
225
Extras/simdmathlibrary/spu/tests/fmind2_fmaxd2.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/* Test fmind2 and fmaxd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*@@ fmind2_fmaxd2 - find minimum/maximum value.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for fmind2/fmaxd2.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
*
|
||||
*@note
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060824103000MH","MH", "fmind2_fmaxd2");
|
||||
|
||||
double denorm_min = hide_double(make_double(0x0000000000000001ull));
|
||||
double denorm_max = hide_double(make_double(0x000fffffffffffffull));
|
||||
double norm_min = hide_double(make_double(0x0010000000000000ull));
|
||||
double norm_max = hide_double(make_double(0x7fefffffffffffffull));
|
||||
|
||||
double x0min = hide_double(1760.135);
|
||||
double x0max = hide_double(19355.03);
|
||||
|
||||
double x1min = hide_double(-12351.9);
|
||||
double x1max = hide_double(-139.035);
|
||||
|
||||
double x2min = hide_double(-1.0);
|
||||
double x2max = hide_double(0.0);
|
||||
|
||||
double x3min = hide_double(nan(""));
|
||||
double x3max = hide_double(-1.0);
|
||||
|
||||
double x4min = hide_double(-0.0);
|
||||
double x4max = hide_double(0.0);
|
||||
|
||||
double x5min = denorm_min;
|
||||
double x5max = hide_double(1.0e-323);
|
||||
|
||||
double x6min = norm_max;
|
||||
double x6max = hide_double(1.0/0.0);
|
||||
|
||||
double x7min = hide_double(-1.0/0.0);
|
||||
double x7max = hide_double(19355.03);
|
||||
|
||||
double x8min = hide_double(-1.0/0.0);
|
||||
double x8max = hide_double(1.0/0.0);
|
||||
|
||||
double x9min = denorm_max;
|
||||
double x9max = norm_min;
|
||||
|
||||
vec_double2 x0min_v = spu_splats(x0min);
|
||||
vec_double2 x0max_v = spu_splats(x0max);
|
||||
|
||||
vec_double2 x1min_v = spu_splats(x1min);
|
||||
vec_double2 x1max_v = spu_splats(x1max);
|
||||
|
||||
vec_double2 x2min_v = spu_splats(x2min);
|
||||
vec_double2 x2max_v = spu_splats(x2max);
|
||||
|
||||
vec_double2 x3min_v = spu_splats(x3min);
|
||||
vec_double2 x3max_v = spu_splats(x3max);
|
||||
|
||||
vec_double2 x4min_v = spu_splats(x4min);
|
||||
vec_double2 x4max_v = spu_splats(x4max);
|
||||
|
||||
vec_double2 x5min_v = spu_splats(x5min);
|
||||
vec_double2 x5max_v = spu_splats(x5max);
|
||||
|
||||
vec_double2 x6min_v = spu_splats(x6min);
|
||||
vec_double2 x6max_v = spu_splats(x6max);
|
||||
|
||||
vec_double2 x7min_v = spu_splats(x7min);
|
||||
vec_double2 x7max_v = spu_splats(x7max);
|
||||
|
||||
vec_double2 x8min_v = spu_splats(x8min);
|
||||
vec_double2 x8max_v = spu_splats(x8max);
|
||||
|
||||
vec_double2 x9min_v = spu_splats(x9min);
|
||||
vec_double2 x9max_v = spu_splats(x9max);
|
||||
|
||||
vec_double2 x51min_v = (vec_double2){x5min, x1min};
|
||||
vec_double2 x51max_v = (vec_double2){x5max, x1max};
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("fmind2");
|
||||
res_v = fmind2(x0min_v, x0max_v);
|
||||
TEST_CHECK("20060824103001MH", allequal_double2( res_v, x0min_v ), 0);
|
||||
res_v = fmind2(x0max_v, x0min_v);
|
||||
TEST_CHECK("20060824103002MH", allequal_double2( res_v, x0min_v ), 0);
|
||||
res_v = fmind2(x1min_v, x1max_v);
|
||||
TEST_CHECK("20060824103003MH", allequal_double2( res_v, x1min_v ), 0);
|
||||
res_v = fmind2(x1max_v, x1min_v);
|
||||
TEST_CHECK("20060824103004MH", allequal_double2( res_v, x1min_v ), 0);
|
||||
res_v = fmind2(x2min_v, x2max_v);
|
||||
TEST_CHECK("20060824103005MH", allequal_double2( res_v, x2min_v ), 0);
|
||||
res_v = fmind2(x2max_v, x2min_v);
|
||||
TEST_CHECK("20060824103006MH", allequal_double2( res_v, x2min_v ), 0);
|
||||
res_v = fmind2(x3min_v, x3max_v);
|
||||
TEST_CHECK("20060824103007MH", allequal_double2( res_v, x3max_v ), 0);
|
||||
res_v = fmind2(x3max_v, x3min_v);
|
||||
TEST_CHECK("20060824103008MH", allequal_double2( res_v, x3max_v ), 0);
|
||||
res_v = fmind2(x4min_v, x4max_v);
|
||||
TEST_CHECK("20060824103009MH", allequal_double2( res_v, x4min_v ), 0);
|
||||
res_v = fmind2(x4max_v, x4min_v);
|
||||
TEST_CHECK("20060824103010MH", allequal_double2( res_v, x4min_v ), 0);
|
||||
res_v = fmind2(x5min_v, x5max_v);
|
||||
TEST_CHECK("20060824103011MH", allequal_double2( res_v, x5min_v ), 0);
|
||||
res_v = fmind2(x5max_v, x5min_v);
|
||||
TEST_CHECK("20060824103012MH", allequal_double2( res_v, x5min_v ), 0);
|
||||
res_v = fmind2(x6min_v, x6max_v);
|
||||
TEST_CHECK("20060824103013MH", allequal_double2( res_v, x6min_v ), 0);
|
||||
res_v = fmind2(x6max_v, x6min_v);
|
||||
TEST_CHECK("20060824103014MH", allequal_double2( res_v, x6min_v ), 0);
|
||||
res_v = fmind2(x7min_v, x7max_v);
|
||||
TEST_CHECK("20060824103015MH", allequal_double2( res_v, x7min_v ), 0);
|
||||
res_v = fmind2(x7max_v, x7min_v);
|
||||
TEST_CHECK("20060824103016MH", allequal_double2( res_v, x7min_v ), 0);
|
||||
res_v = fmind2(x8min_v, x8max_v);
|
||||
TEST_CHECK("20060824103017MH", allequal_double2( res_v, x8min_v ), 0);
|
||||
res_v = fmind2(x8max_v, x8min_v);
|
||||
TEST_CHECK("20060824103018MH", allequal_double2( res_v, x8min_v ), 0);
|
||||
res_v = fmind2(x9min_v, x9max_v);
|
||||
TEST_CHECK("20060824103019MH", allequal_double2( res_v, x9min_v ), 0);
|
||||
res_v = fmind2(x9max_v, x9min_v);
|
||||
TEST_CHECK("20060824103020MH", allequal_double2( res_v, x9min_v ), 0);
|
||||
res_v = fmind2(x51min_v, x51max_v);
|
||||
TEST_CHECK("20060824103021MH", allequal_double2( res_v, x51min_v ), 0);
|
||||
res_v = fmind2(x51max_v, x51min_v);
|
||||
TEST_CHECK("20060824103022MH", allequal_double2( res_v, x51min_v ), 0);
|
||||
|
||||
TEST_START("fmaxd2");
|
||||
res_v = fmaxd2(x0min_v, x0max_v);
|
||||
TEST_CHECK("20060824103101MH", allequal_double2( res_v, x0max_v ), 0);
|
||||
res_v = fmaxd2(x0max_v, x0min_v);
|
||||
TEST_CHECK("20060824103102MH", allequal_double2( res_v, x0max_v ), 0);
|
||||
res_v = fmaxd2(x1min_v, x1max_v);
|
||||
TEST_CHECK("20060824103103MH", allequal_double2( res_v, x1max_v ), 0);
|
||||
res_v = fmaxd2(x1max_v, x1min_v);
|
||||
TEST_CHECK("20060824103104MH", allequal_double2( res_v, x1max_v ), 0);
|
||||
res_v = fmaxd2(x2min_v, x2max_v);
|
||||
TEST_CHECK("20060824103105MH", allequal_double2( res_v, x2max_v ), 0);
|
||||
res_v = fmaxd2(x2max_v, x2min_v);
|
||||
TEST_CHECK("20060824103106MH", allequal_double2( res_v, x2max_v ), 0);
|
||||
res_v = fmaxd2(x3min_v, x3max_v);
|
||||
TEST_CHECK("20060824103107MH", allequal_double2( res_v, x3max_v ), 0);
|
||||
res_v = fmaxd2(x3max_v, x3min_v);
|
||||
TEST_CHECK("20060824103108MH", allequal_double2( res_v, x3max_v ), 0);
|
||||
res_v = fmaxd2(x4min_v, x4max_v);
|
||||
TEST_CHECK("20060824103109MH", allequal_double2( res_v, x4max_v ), 0);
|
||||
res_v = fmaxd2(x4max_v, x4min_v);
|
||||
TEST_CHECK("20060824103110MH", allequal_double2( res_v, x4max_v ), 0);
|
||||
res_v = fmaxd2(x5min_v, x5max_v);
|
||||
TEST_CHECK("20060824103111MH", allequal_double2( res_v, x5max_v ), 0);
|
||||
res_v = fmaxd2(x5max_v, x5min_v);
|
||||
TEST_CHECK("20060824103112MH", allequal_double2( res_v, x5max_v ), 0);
|
||||
res_v = fmaxd2(x6min_v, x6max_v);
|
||||
TEST_CHECK("20060824103113MH", allequal_double2( res_v, x6max_v ), 0);
|
||||
res_v = fmaxd2(x6max_v, x6min_v);
|
||||
TEST_CHECK("20060824103114MH", allequal_double2( res_v, x6max_v ), 0);
|
||||
res_v = fmaxd2(x7min_v, x7max_v);
|
||||
TEST_CHECK("20060824103115MH", allequal_double2( res_v, x7max_v ), 0);
|
||||
res_v = fmaxd2(x7max_v, x7min_v);
|
||||
TEST_CHECK("20060824103116MH", allequal_double2( res_v, x7max_v ), 0);
|
||||
res_v = fmaxd2(x8min_v, x8max_v);
|
||||
TEST_CHECK("20060824103117MH", allequal_double2( res_v, x8max_v ), 0);
|
||||
res_v = fmaxd2(x8max_v, x8min_v);
|
||||
TEST_CHECK("20060824103118MH", allequal_double2( res_v, x8max_v ), 0);
|
||||
res_v = fmaxd2(x9min_v, x9max_v);
|
||||
TEST_CHECK("20060824103119MH", allequal_double2( res_v, x9max_v ), 0);
|
||||
res_v = fmaxd2(x9max_v, x9min_v);
|
||||
TEST_CHECK("20060824103120MH", allequal_double2( res_v, x9max_v ), 0);
|
||||
res_v = fmaxd2(x51min_v, x51max_v);
|
||||
TEST_CHECK("20060824103121MH", allequal_double2( res_v, x51max_v ), 0);
|
||||
res_v = fmaxd2(x51max_v, x51min_v);
|
||||
TEST_CHECK("20060824103122MH", allequal_double2( res_v, x51max_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
124
Extras/simdmathlibrary/spu/tests/fminf4_fmaxf4.c
Normal file
124
Extras/simdmathlibrary/spu/tests/fminf4_fmaxf4.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Test fminf4 and fmaxf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928184342EJL","EJL", "fminf4_fmaxf4");
|
||||
|
||||
float x0min = hide_float(1760.135f);
|
||||
float x0max = hide_float(19355.03f);
|
||||
|
||||
float x1min = hide_float(-12351.9f);
|
||||
float x1max = hide_float(-139.035f);
|
||||
|
||||
float x2min = hide_float(-1.0);
|
||||
float x2max = hide_float(0.0);
|
||||
|
||||
vec_float4 x0min_v = spu_splats(x0min);
|
||||
vec_float4 x0max_v = spu_splats(x0max);
|
||||
|
||||
vec_float4 x1min_v = spu_splats(x1min);
|
||||
vec_float4 x1max_v = spu_splats(x1max);
|
||||
|
||||
vec_float4 x2min_v = spu_splats(x2min);
|
||||
vec_float4 x2max_v = spu_splats(x2max);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("fminf4");
|
||||
res_v = fminf4(x0min_v, x0max_v);
|
||||
TEST_CHECK("20040928184345EJL", allequal_float4( res_v, x0min_v ), 0);
|
||||
res_v = fminf4(x0max_v, x0min_v);
|
||||
TEST_CHECK("20040928184349EJL", allequal_float4( res_v, x0min_v ), 0);
|
||||
res_v = fminf4(x1min_v, x1max_v);
|
||||
TEST_CHECK("20040928184351EJL", allequal_float4( res_v, x1min_v ), 0);
|
||||
res_v = fminf4(x1max_v, x1min_v);
|
||||
TEST_CHECK("20040928184353EJL", allequal_float4( res_v, x1min_v ), 0);
|
||||
res_v = fminf4(x2min_v, x2max_v);
|
||||
TEST_CHECK("20040928184354EJL", allequal_float4( res_v, x2min_v ), 0);
|
||||
res_v = fminf4(x2max_v, x2min_v);
|
||||
TEST_CHECK("20040928184356EJL", allequal_float4( res_v, x2min_v ), 0);
|
||||
|
||||
TEST_START("fminf");
|
||||
res = fminf(x0min, x0max);
|
||||
TEST_CHECK("20040928184358EJL", res == x0min, 0);
|
||||
res = fminf(x0max, x0min);
|
||||
TEST_CHECK("20040928184400EJL", res == x0min, 0);
|
||||
res = fminf(x1min, x1max);
|
||||
TEST_CHECK("20040928184401EJL", res == x1min, 0);
|
||||
res = fminf(x1max, x1min);
|
||||
TEST_CHECK("20040928184403EJL", res == x1min, 0);
|
||||
res = fminf(x2min, x2max);
|
||||
TEST_CHECK("20040928184405EJL", res == x2min, 0);
|
||||
res = fminf(x2max, x2min);
|
||||
TEST_CHECK("20040928184406EJL", res == x2min, 0);
|
||||
|
||||
TEST_START("fmaxf4");
|
||||
res_v = fmaxf4(x0min_v, x0max_v);
|
||||
TEST_CHECK("20040928184411EJL", allequal_float4( res_v, x0max_v ), 0);
|
||||
res_v = fmaxf4(x0max_v, x0min_v);
|
||||
TEST_CHECK("20040928184413EJL", allequal_float4( res_v, x0max_v ), 0);
|
||||
res_v = fmaxf4(x1min_v, x1max_v);
|
||||
TEST_CHECK("20040928184415EJL", allequal_float4( res_v, x1max_v ), 0);
|
||||
res_v = fmaxf4(x1max_v, x1min_v);
|
||||
TEST_CHECK("20040928184416EJL", allequal_float4( res_v, x1max_v ), 0);
|
||||
res_v = fmaxf4(x2min_v, x2max_v);
|
||||
TEST_CHECK("20040928184417EJL", allequal_float4( res_v, x2max_v ), 0);
|
||||
res_v = fmaxf4(x2max_v, x2min_v);
|
||||
TEST_CHECK("20040928184419EJL", allequal_float4( res_v, x2max_v ), 0);
|
||||
|
||||
TEST_START("fmaxf");
|
||||
res = fmaxf(x0min, x0max);
|
||||
TEST_CHECK("20040928184420EJL", res == x0max, 0);
|
||||
res = fmaxf(x0max, x0min);
|
||||
TEST_CHECK("20040928184422EJL", res == x0max, 0);
|
||||
res = fmaxf(x1min, x1max);
|
||||
TEST_CHECK("20040928184423EJL", res == x1max, 0);
|
||||
res = fmaxf(x1max, x1min);
|
||||
TEST_CHECK("20040928184424EJL", res == x1max, 0);
|
||||
res = fmaxf(x2min, x2max);
|
||||
TEST_CHECK("20040928184426EJL", res == x2max, 0);
|
||||
res = fmaxf(x2max, x2min);
|
||||
TEST_CHECK("20040928184428EJL", res == x2max, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
364
Extras/simdmathlibrary/spu/tests/fmodd2.c
Normal file
364
Extras/simdmathlibrary/spu/tests/fmodd2.c
Normal file
@@ -0,0 +1,364 @@
|
||||
/* Test roundd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ fmodd2
|
||||
|
||||
*
|
||||
*@brief
|
||||
* boundary test for fmodd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
double xxx[2];
|
||||
double yyy[2];
|
||||
double rrr[2];
|
||||
} dbl;
|
||||
struct {
|
||||
unsigned long long xxx[2];
|
||||
unsigned long long yyy[2];
|
||||
unsigned long long rrr[2];
|
||||
} ull;
|
||||
} TestVec_Roundd2;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec_Roundd2 test_a[] = {
|
||||
{
|
||||
ull:{
|
||||
// 1.00...11 / 1.0...0 -> 0.00...11, 1.00...1 /1.0...0 -> 0.0...1
|
||||
{0x3ff0000000000003ULL,0x3ff0000000000001ULL},
|
||||
{0x3fe0000000000000ULL,0x3fe0000000000000ULL},
|
||||
{0x3cc8000000000000ULL,0x3cb0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// 1.00...1111 / 0.10...0 -> 0.00...11, 1.00...1 /0.10...0 -> 0.0...1
|
||||
{0x3ff000000000000fULL,0x3ff0000000000001ULL},
|
||||
{0x3fe0000000000000ULL,0x3fe0000000000000ULL},
|
||||
{0x3cee000000000000ULL,0x3cb0000000000000ULL}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
ull:{
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL},/*(nan nan)*/
|
||||
{0x0000000000000000ULL, 0x7aa0000000000000ULL},/*(0.000000 4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL},/*(nan nan)*/
|
||||
{0x7ff0000000000000ULL, 0x0000000000000001ULL},/*(inf 0.000000)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL},/*(nan nan)*/
|
||||
{0xfff0000000000000ULL, 0x7fffffffeffffffeULL},/*(-inf nan)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0000000000000000ULL, 0x7aa0000000000000ULL},/*(0.000000 4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL},/*(nan nan)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7ff0000000000000ULL, 0x0000000000000001ULL},/*(inf 0.000000)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL},/*(nan nan)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0xfff0000000000000ULL, 0x7fffffffeffffffeULL},/*(-inf nan)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL},/*(nan nan)*/
|
||||
{0x7fffffffeffffffeULL, 0x7fffffffeffffffeULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0000000000000000ULL, 0x7aa0000000000000ULL},/*(0.000000 4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7ff0000000000000ULL, 0x0000000000000001ULL},/*(inf 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0xfff0000000000000ULL, 0x7fffffffeffffffeULL},/*(-inf nan)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x7fffffffeffffffeULL}/*(0.000000, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7ff0000000000000ULL, 0x7ff0000000000000ULL},/*(inf inf)*/
|
||||
{0x7ff0000000000000ULL, 0xfff0000000000000ULL},/*(inf -inf)*/
|
||||
{0x7ff8000000000000ULL, 0x7ff8000000000000ULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0xfff0000000000000ULL, 0xfff0000000000000ULL},/*(-inf -inf)*/
|
||||
{0x7ff0000000000000ULL, 0xfff0000000000000ULL},/*(inf -inf)*/
|
||||
{0x7ff8000000000000ULL, 0x7ff8000000000000ULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7ff0000000000000ULL, 0xfff0000000000000ULL},/*(inf -inf)*/
|
||||
{0x7aa0000000000000ULL, 0x7aa0000000000000ULL},/*(4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000 4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000)*/
|
||||
{0x7ff8000000000000ULL, 0x7ff8000000000000ULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7ff0000000000000ULL, 0xfff0000000000000ULL},/*(inf -inf)*/
|
||||
{0x0000000000000001ULL, 0x0000000000000001ULL},/*(0.000000 0.000000)*/
|
||||
{0x7ff8000000000000ULL, 0x7ff8000000000000ULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7aa0000000000000ULL, 0x0000000000000001ULL},/*(4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000 0.000000)*/
|
||||
{0x7ff0000000000000ULL, 0xfff0000000000000ULL},/*(inf -inf)*/
|
||||
{0x7aa0000000000000ULL, 0x0000000000000001ULL}/*(4646927838993072071243945306718439250410188130185607684549287060362314553626263667328650982800488595593121011844353040782670578892327830336846345565944983205571783876398312106070895030732180427719497486819848241268961714708993375275490934188589556509412640954544199727574266715045888.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x7ff0000000000000ULL, 0xfff0000000000000ULL},/*(inf -inf)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7fefffffffffffffULL, 0x7fefffffffffffffULL},/*(179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
{0x7feffffffffffffeULL, 0x7feeffffffffffffULL},/*(179769313486231550856124328384506240234343437157459335924404872448581845754556114388470639943126220321960804027157371570809852884964511743044087662767600909594331927728237078876188760579532563768698654064825262115771015791463983014857704008123419459386245141723703148097529108423358883457665451722744025579520.000000 174151522439786833602873345010488654505514389466650288559122786766978114661106633662692418716441642670880455394768401421807484146614013663315566064496053950599244663907024235661361045727850388502842959666202477512028391028080020983119748774627722497113443122745251401348739825745341808746724299140883367854080.000000)*/
|
||||
{0x7ca0000000000000ULL, 0x7fa0000000000000ULL}/*(19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848.000000, 5617791046444737211654078721215702292556178059194708039794690036179146118921905097897139916325235500660003558745981042426837180275450519452901482207483566386805246669527046414884444362538940441232908842252656430276192208823201965046059784704400851161354703458893321819998351435577491134526104885300757004288.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0008000000000000ULL, 0x7fefffffffffffffULL},/*(0.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
{0x7ff0000000000000ULL, 0x7ff0000000000000ULL},/*(inf inf)*/
|
||||
{0x0008000000000000ULL, 0x7fefffffffffffffULL}/*(0.000000, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7fefffffffffffffULL, 0x0010000000000000ULL},/*(179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 0.000000)*/
|
||||
{0x7fdfffffffffffffULL, 0x0008000000000003ULL},/*(89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184.000000 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x0007fffffffffffdULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x7ff0000000000000ULL, 0x7fefffffffffffffULL},/*(inf 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
{0x7fefffffffffffffULL, 0x0000000000000003ULL},/*(179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 0.000000)*/
|
||||
{0x7ff8000000000000ULL, 0x0000000000000002ULL}/*(nan, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0xffe0000000000000ULL, 0x7fefffffffffffffULL},/*(-89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715319737062188883946712432742638151109800623047059726541476042502884419075341171231440736956555270413618581675255342293149119973622969239858152417678164812112068608.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
{0x0008000000000000ULL, 0x0010000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x8000000000000000ULL, 0x0000000000000000ULL}/*(-0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x4004000000000000ULL, 0x403d000000000000ULL},/*(2.500000 29.000000)*/
|
||||
{0x3ff8000000000000ULL, 0x4008000000000000ULL},/*(1.500000 3.000000)*/
|
||||
{0x3ff0000000000000ULL, 0x4000000000000000ULL}/*(1.000000, 2.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x8010000000000002ULL, 0x9000000000000000ULL},/*(-0.000000 -0.000000)*/
|
||||
{0x8000000000000000ULL, 0x0000000000000000ULL},/*(-0.000000 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x0000000000000000ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0xffefffffffffffffULL, 0x7fefffffffffffffULL},/*(-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
{0xffefffffffffffffULL, 0x7fefffffffffffffULL},/*(-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)*/
|
||||
{0x8000000000000000ULL, 0x0000000000000000ULL}/*(-0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0xfff0000000000000ULL, 0x7ff0000000000000ULL},/*(-inf inf)*/
|
||||
{0xfff0000000000000ULL, 0x7ff0000000000000ULL},/*(-inf inf)*/
|
||||
{0x7ff8000000000000ULL, 0x7ff8000000000000ULL}/*(nan, nan)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x800ffffffffffff3ULL, 0x09d0000000000006ULL},/*(-0.000000 0.000000)*/
|
||||
{0x8000000000000005ULL, 0x8010000000000005ULL},/*(-0.000000 -0.000000)*/
|
||||
{0x8000000000000003ULL, 0x000fffffffffff88ULL}/*(-0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x1000000000000000ULL, 0x0000000000000001ULL},/*(0.000000 0.000000)*/
|
||||
{0x0010000000000005ULL, 0x8000000000000001ULL},/*(0.000000 -0.000000)*/
|
||||
{0x00058000000001eaULL, 0x0000000000000000ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0010000000000002ULL, 0x1000000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x800000000000000bULL, 0x0010000000000007ULL},/*(-0.000000 0.000000)*/
|
||||
{0x0000000000000006ULL, 0x000c800000000e62ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0000000000000002ULL, 0x0000000000000003ULL},/*(0.000000 0.000000)*/
|
||||
{0x0000000000000003ULL, 0x0000000000000002ULL},/*(0.000000 0.000000)*/
|
||||
{0x0000000000000002ULL, 0x0000000000000001ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x806ffffffffffff3ULL, 0x0010000000000000ULL},/*(-0.000000 0.000000)*/
|
||||
{0x8000000000000005ULL, 0x0000000000000009ULL},/*(-0.000000 0.000000)*/
|
||||
{0x8000000000000003ULL, 0x0000000000000007ULL}/*(-0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0000000000000000ULL, 0x8000000000000000ULL},/*(0.000000 -0.000000)*/
|
||||
{0x800ffffffffffff1ULL, 0x0000000000000003ULL},/*(-0.000000 0.000000)*/
|
||||
{0x0000000000000000ULL, 0x8000000000000000ULL}/*(0.000000, -0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x1000000000000000ULL, 0x8000000000000000ULL},/*(0.000000 -0.000000)*/
|
||||
{0x0010000000000005ULL, 0x0000000000000001ULL},/*(0.000000 0.000000)*/
|
||||
{0x00058000000001eaULL, 0x8000000000000000ULL}/*(0.000000, -0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0fbfffffffffffffULL, 0x0f30000000000000ULL},/*(0.000000 0.000000)*/
|
||||
{0x000ffffffffffff1ULL, 0x0000000000000003ULL},/*(0.000000 0.000000)*/
|
||||
{0x000b7400000053f7ULL, 0x0000000000000001ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0000000000000003ULL, 0x0000000000000003ULL},/*(0.000000 0.000000)*/
|
||||
{0x0000000000000006ULL, 0x8000000000000006ULL},/*(0.000000 -0.000000)*/
|
||||
{0x0000000000000003ULL, 0x0000000000000003ULL}/*(0.000000, 0.000000)*/
|
||||
}
|
||||
},
|
||||
{
|
||||
ull:{
|
||||
{0x0020000000000001ULL, 0x8020000000000001ULL},/*(0.000000 -0.000000)*/
|
||||
{0x8010000000000002ULL, 0x0010000000000002ULL},/*(-0.000000 0.000000)*/
|
||||
{0x0010000000000000ULL, 0x8010000000000000ULL}/*(0.000000, -0.000000)*/
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
ull:{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
//vec_double2 input;
|
||||
|
||||
TEST_SET_START("96743652190000NM","FLR", "floord2");
|
||||
|
||||
TEST_START("floord2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].ull.xxx[0] == 0)
|
||||
&& (test_a[ii].ull.xxx[1] == 0)
|
||||
&& (test_a[ii].ull.xxx[2] == 0) ) break;
|
||||
|
||||
//input = *((vec_double2 *)&test_a[ii].dbl.xxx[0]);
|
||||
res_v = fmodd2 (*((vec_double2 *)&test_a[ii].dbl.xxx[0]),
|
||||
*((vec_double2 *)&test_a[ii].dbl.yyy[0]) );
|
||||
sprintf(msg,"9674365219%04dFLR", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, (vec_llong2)*((vec_double2 *)&test_a[ii].dbl.rrr[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
145
Extras/simdmathlibrary/spu/tests/fmodf4.c
Normal file
145
Extras/simdmathlibrary/spu/tests/fmodf4.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/* Test fmodf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928191240EJL","EJL", "fmodf4");
|
||||
|
||||
unsigned int i0n = 0x449edbc6;
|
||||
unsigned int i0d = 0x40cf799d;
|
||||
unsigned int i0r = 0x3daa7300;
|
||||
unsigned int i1n = 0x6bca107a;
|
||||
unsigned int i1d = 0x6c4a107a;
|
||||
unsigned int i1r = 0x6bca107a;
|
||||
unsigned int i2n = 0x1c123605;
|
||||
unsigned int i2d = 0x1c923602;
|
||||
unsigned int i2r = 0x1c123605;
|
||||
unsigned int i3n = 0x2b4c50fa;
|
||||
unsigned int i3d = 0x253a3ae3;
|
||||
unsigned int i3r = 0x25141df9;
|
||||
unsigned int i4n = 0x73addffc;
|
||||
unsigned int i4d = 0x742ddffc;
|
||||
unsigned int i4r = 0x73addffc;
|
||||
unsigned int i5n = 0x29d4d97c;
|
||||
unsigned int i5d = 0x2a546e77;
|
||||
unsigned int i5r = 0x29d4d97c;
|
||||
|
||||
float x0n = hide_float(make_float(i0n));
|
||||
float x0d = hide_float(make_float(i0d));
|
||||
float x0r = hide_float(make_float(i0r));
|
||||
|
||||
float x1n = hide_float(make_float(i1n));
|
||||
float x1d = hide_float(make_float(i1d));
|
||||
float x1r = hide_float(make_float(i1r));
|
||||
|
||||
float x2n = hide_float(make_float(i2n));
|
||||
float x2d = hide_float(make_float(i2d));
|
||||
float x2r = hide_float(make_float(i2r));
|
||||
|
||||
float x3n = hide_float(make_float(i3n));
|
||||
float x3d = hide_float(make_float(i3d));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
|
||||
float x4n = hide_float(make_float(i4n));
|
||||
float x4d = hide_float(make_float(i4d));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
|
||||
float x5n = hide_float(make_float(i5n));
|
||||
float x5d = hide_float(make_float(i5d));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
|
||||
vec_float4 x0n_v = spu_splats(x0n);
|
||||
vec_float4 x0d_v = spu_splats(x0d);
|
||||
vec_float4 x0r_v = spu_splats(x0r);
|
||||
|
||||
vec_float4 x1n_v = spu_splats(x1n);
|
||||
vec_float4 x1d_v = spu_splats(x1d);
|
||||
vec_float4 x1r_v = spu_splats(x1r);
|
||||
|
||||
vec_float4 x2n_v = spu_splats(x2n);
|
||||
vec_float4 x2d_v = spu_splats(x2d);
|
||||
vec_float4 x2r_v = spu_splats(x2r);
|
||||
|
||||
vec_float4 x3n_v = spu_splats(x3n);
|
||||
vec_float4 x3d_v = spu_splats(x3d);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
|
||||
vec_float4 x4n_v = spu_splats(x4n);
|
||||
vec_float4 x4d_v = spu_splats(x4d);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
|
||||
vec_float4 x5n_v = spu_splats(x5n);
|
||||
vec_float4 x5d_v = spu_splats(x5d);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("fmodf4");
|
||||
res_v = fmodf4(x0n_v, x0d_v);
|
||||
TEST_CHECK("20040928191245EJL", allequal_ulps_float4( res_v, x0r_v, 1 ), 0);
|
||||
res_v = fmodf4(x1n_v, x1d_v);
|
||||
TEST_CHECK("20040928191247EJL", allequal_ulps_float4( res_v, x1r_v, 1 ), 0);
|
||||
res_v = fmodf4(x2n_v, x2d_v);
|
||||
TEST_CHECK("20040928191249EJL", allequal_ulps_float4( res_v, x2r_v, 1 ), 0);
|
||||
res_v = fmodf4(x3n_v, x3d_v);
|
||||
TEST_CHECK("20040928191251EJL", allequal_ulps_float4( res_v, x3r_v, 1 ), 0);
|
||||
res_v = fmodf4(x4n_v, x4d_v);
|
||||
TEST_CHECK("20040928191253EJL", allequal_ulps_float4( res_v, x4r_v, 1 ), 0);
|
||||
res_v = fmodf4(x5n_v, x5d_v);
|
||||
TEST_CHECK("20040928191255EJL", allequal_ulps_float4( res_v, x5r_v, 1 ), 0);
|
||||
|
||||
TEST_START("fmodf");
|
||||
res = fmodf(x0n, x0d);
|
||||
TEST_CHECK("20040928191258EJL", ulpDiff_f( res, x0r ) <= 1, 0);
|
||||
res = fmodf(x1n, x1d);
|
||||
TEST_CHECK("20040928191300EJL", ulpDiff_f( res, x1r ) <= 1, 0);
|
||||
res = fmodf(x2n, x2d);
|
||||
TEST_CHECK("20040928191302EJL", ulpDiff_f( res, x2r ) <= 1, 0);
|
||||
res = fmodf(x3n, x3d);
|
||||
TEST_CHECK("20040928191303EJL", ulpDiff_f( res, x3r ) <= 1, 0);
|
||||
res = fmodf(x4n, x4d);
|
||||
TEST_CHECK("20040928191305EJL", ulpDiff_f( res, x4r ) <= 1, 0);
|
||||
res = fmodf(x5n, x5d);
|
||||
TEST_CHECK("20040928191307EJL", ulpDiff_f( res, x5r ) <= 1, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
225
Extras/simdmathlibrary/spu/tests/fpclassifyd2.c
Normal file
225
Extras/simdmathlibrary/spu/tests/fpclassifyd2.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/* Test fpclassifyd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060828000000AAN","AAN", "fpclassifyd2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
long long r0 = FP_NAN;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
long long r1 = FP_INFINITE;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
long long r2 = FP_NORMAL;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
long long r3 = FP_NORMAL;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
long long r4 = FP_NORMAL;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
long long r5 = FP_SUBNORMAL;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
long long r6 = FP_ZERO;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
long long r7 = FP_ZERO;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
long long r8 = FP_ZERO;
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
long long r9 = FP_ZERO;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
long long r10 = FP_SUBNORMAL;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
long long r11 = FP_NORMAL;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
long long r12 = FP_NORMAL;
|
||||
|
||||
// +Dmax
|
||||
double x13 = hide_double(DBL_MAX);
|
||||
long long r13 = FP_NORMAL;
|
||||
|
||||
// +Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
long long r14 = FP_INFINITE;
|
||||
|
||||
//+Nan
|
||||
double x15 = hide_double( nan(""));
|
||||
long long r15 = FP_NAN;
|
||||
|
||||
// Compound
|
||||
vec_double2 x16_v = (vec_double2) {make_double(0x000AAAAAAAAAAAAAull), -1.0e-999 };
|
||||
vec_llong2 r16_v = (vec_llong2) {FP_SUBNORMAL, FP_ZERO};
|
||||
|
||||
// Compound
|
||||
vec_double2 x17_v = (vec_double2) { 345.27533, -2.40e-310 };
|
||||
vec_llong2 r17_v = (vec_llong2) {FP_NORMAL, FP_SUBNORMAL};
|
||||
|
||||
// Compound
|
||||
vec_double2 x18_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_llong2 r18_v = (vec_llong2) {FP_NAN, FP_NORMAL};
|
||||
|
||||
// Compound
|
||||
vec_double2 x19_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_llong2 r19_v = (vec_llong2) {FP_INFINITE, FP_NAN};
|
||||
|
||||
// Compound
|
||||
vec_double2 x20_v = (vec_double2) { -1.0e-999, -1.0/0.0} ;
|
||||
vec_llong2 r20_v = (vec_llong2) {FP_ZERO, FP_INFINITE};
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_llong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_llong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_llong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_llong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_llong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_llong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_llong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_llong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_llong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_llong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_llong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_llong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_llong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_llong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_llong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_llong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_llong2 res_v;
|
||||
|
||||
TEST_START("fpclassifyd2");
|
||||
|
||||
res_v = (vec_llong2)fpclassifyd2(x0_v);
|
||||
TEST_CHECK("20060828000000AAN", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x1_v);
|
||||
TEST_CHECK("20060828000001AAN", allequal_llong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x2_v);
|
||||
TEST_CHECK("20060828000002AAN", allequal_llong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x3_v);
|
||||
TEST_CHECK("20060828000003AAN", allequal_llong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x4_v);
|
||||
TEST_CHECK("20060828000004AAN", allequal_llong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x5_v);
|
||||
TEST_CHECK("20060828000005AAN", allequal_llong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x6_v);
|
||||
TEST_CHECK("20060828000006AAN", allequal_llong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x7_v);
|
||||
TEST_CHECK("20060828000007AAN", allequal_llong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x8_v);
|
||||
TEST_CHECK("20060828000008AAN", allequal_llong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x9_v);
|
||||
TEST_CHECK("20060828000009AAN", allequal_llong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x10_v);
|
||||
TEST_CHECK("20060828000010AAN", allequal_llong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x11_v);
|
||||
TEST_CHECK("20060828000011AAN", allequal_llong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x12_v);
|
||||
TEST_CHECK("20060828000012AAN", allequal_llong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x13_v);
|
||||
TEST_CHECK("20060828000013AAN", allequal_llong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x14_v);
|
||||
TEST_CHECK("20060828000014AAN", allequal_llong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x15_v);
|
||||
TEST_CHECK("20060828000015AAN", allequal_llong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x16_v);
|
||||
TEST_CHECK("20060828000016AAN", allequal_llong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x17_v);
|
||||
TEST_CHECK("20060828000017AAN", allequal_llong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x18_v);
|
||||
TEST_CHECK("20060828000018AAN", allequal_llong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x19_v);
|
||||
TEST_CHECK("20060828000019AAN", allequal_llong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_llong2)fpclassifyd2(x20_v);
|
||||
TEST_CHECK("20060828000020AAN", allequal_llong2( res_v, r20_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
200
Extras/simdmathlibrary/spu/tests/fpclassifyf4.c
Normal file
200
Extras/simdmathlibrary/spu/tests/fpclassifyf4.c
Normal file
@@ -0,0 +1,200 @@
|
||||
/* Test fpclassifyf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060828000000AAN","AAN", "fpclassifyf4");
|
||||
|
||||
// -Nan
|
||||
float x0 = hide_float(-nan(""));
|
||||
int r0 = FP_NORMAL;
|
||||
|
||||
// -Inf
|
||||
float x1 = hide_float(-1.0/0.0);
|
||||
int r1 = FP_NORMAL;
|
||||
|
||||
// -Smax
|
||||
float x2 = hide_float(make_float(0xFFFFFFFF));
|
||||
int r2 = FP_NORMAL;
|
||||
|
||||
// -Norm
|
||||
float x3 = hide_float(-824842.58421394f);
|
||||
int r3 = FP_NORMAL;
|
||||
|
||||
// -Smin
|
||||
float x4 = hide_float(make_float(0x80800000));
|
||||
int r4 = FP_NORMAL;
|
||||
|
||||
// -Denorm
|
||||
float x5 = hide_float(make_float(0x803AAAAA));
|
||||
int r5 = FP_SUBNORMAL;
|
||||
|
||||
// -Unf
|
||||
float x6 = hide_float(-1.0e-999);
|
||||
int r6 = FP_ZERO;
|
||||
|
||||
// -0
|
||||
float x7 = hide_float(-0.0f);
|
||||
int r7 = FP_ZERO;
|
||||
|
||||
// 0
|
||||
float x8 = hide_float( 0.0f);
|
||||
int r8 = FP_ZERO;
|
||||
|
||||
// +Unf
|
||||
float x9 = hide_float( 1.0e-999);
|
||||
int r9 = FP_ZERO;
|
||||
|
||||
// +Denorm
|
||||
float x10 = hide_float(make_float(0x003AAAAA));
|
||||
int r10 = FP_SUBNORMAL;
|
||||
|
||||
// +Smin
|
||||
float x11 = hide_float(make_float(0x00800000));
|
||||
int r11 = FP_NORMAL;
|
||||
|
||||
// +Norm
|
||||
float x12 = hide_float(3.14152634f);
|
||||
int r12 = FP_NORMAL;
|
||||
|
||||
// +Smax
|
||||
float x13 = hide_float(make_float(0x7FFFFFFF));
|
||||
int r13 = FP_NORMAL;
|
||||
|
||||
// +Inf
|
||||
float x14 = hide_float( 1.0/0.0);
|
||||
int r14 = FP_NORMAL;
|
||||
|
||||
//+Nan
|
||||
float x15 = hide_float( nan(""));
|
||||
int r15 = FP_NORMAL;
|
||||
|
||||
// Compound
|
||||
vec_float4 x16_v = (vec_float4) {make_float(0x003AAAAA), -1.0e-999, 345.27533, make_float(0x803AAAAA)};
|
||||
vec_int4 r16_v = (vec_int4) {FP_SUBNORMAL, FP_ZERO, FP_NORMAL, FP_SUBNORMAL};
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_int4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_int4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_int4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_int4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_int4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_int4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_int4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_int4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_int4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_int4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_int4 r10_v = spu_splats(r10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_int4 r11_v = spu_splats(r11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_int4 r12_v = spu_splats(r12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_int4 r13_v = spu_splats(r13);
|
||||
|
||||
vec_float4 x14_v = spu_splats(x14);
|
||||
vec_int4 r14_v = spu_splats(r14);
|
||||
|
||||
vec_float4 x15_v = spu_splats(x15);
|
||||
vec_int4 r15_v = spu_splats(r15);
|
||||
|
||||
vec_int4 res_v;
|
||||
|
||||
TEST_START("fpclassifyf4");
|
||||
|
||||
res_v = (vec_int4)fpclassifyf4(x0_v);
|
||||
TEST_CHECK("20060828000000AAN", allequal_int4( res_v, r0_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x1_v);
|
||||
TEST_CHECK("20060828000001AAN", allequal_int4( res_v, r1_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x2_v);
|
||||
TEST_CHECK("20060828000002AAN", allequal_int4( res_v, r2_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x3_v);
|
||||
TEST_CHECK("20060828000003AAN", allequal_int4( res_v, r3_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x4_v);
|
||||
TEST_CHECK("20060828000004AAN", allequal_int4( res_v, r4_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x5_v);
|
||||
TEST_CHECK("20060828000005AAN", allequal_int4( res_v, r5_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x6_v);
|
||||
TEST_CHECK("20060828000006AAN", allequal_int4( res_v, r6_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x7_v);
|
||||
TEST_CHECK("20060828000007AAN", allequal_int4( res_v, r7_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x8_v);
|
||||
TEST_CHECK("20060828000008AAN", allequal_int4( res_v, r8_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x9_v);
|
||||
TEST_CHECK("20060828000009AAN", allequal_int4( res_v, r9_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x10_v);
|
||||
TEST_CHECK("20060828000010AAN", allequal_int4( res_v, r10_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x11_v);
|
||||
TEST_CHECK("20060828000011AAN", allequal_int4( res_v, r11_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x12_v);
|
||||
TEST_CHECK("20060828000012AAN", allequal_int4( res_v, r12_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x13_v);
|
||||
TEST_CHECK("20060828000013AAN", allequal_int4( res_v, r13_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x14_v);
|
||||
TEST_CHECK("20060828000014AAN", allequal_int4( res_v, r14_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x15_v);
|
||||
TEST_CHECK("20060828000015AAN", allequal_int4( res_v, r15_v ), 0);
|
||||
res_v = (vec_int4)fpclassifyf4(x16_v);
|
||||
TEST_CHECK("20060828000016AAN", allequal_int4( res_v, r16_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
426
Extras/simdmathlibrary/spu/tests/frexpd2.c
Normal file
426
Extras/simdmathlibrary/spu/tests/frexpd2.c
Normal file
@@ -0,0 +1,426 @@
|
||||
/* Test frexpd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#ifndef DBL_INF
|
||||
#define DBL_INF ((long long)0x7FF0000000000000ull)
|
||||
#endif
|
||||
|
||||
#ifndef DBL_NAN
|
||||
#define DBL_NAN ((long long)0x7FF8000000000000ull)
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060907000000AAN","AAN", "frexpd2");
|
||||
|
||||
vec_double2 res_v;
|
||||
vec_llong2 exp_v;
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
double r0 = hide_double( nan(""));
|
||||
//long long e0 = 0;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
double r1 = x1;
|
||||
//long long e1 = 0;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
double r2 = hide_double(make_double(0xBFEFFFFFFFFFFFFFull));
|
||||
long long e2 = 1024;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
double r3 = hide_double(make_double(0xBFE92C152B1E16ECull));
|
||||
long long e3 = 20;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(make_double(0x8000000000000001ull));
|
||||
double r4 = hide_double(make_double(0xBFE0000000000000ull));
|
||||
long long e4 = -1073;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
double r5 = hide_double(make_double(0xBFE6170DBAADCD80ull));
|
||||
long long e5 = -1028;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
double r6 = hide_double(make_double(0x0000000000000000ull));
|
||||
long long e6 = 0;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
double r7 = hide_double(make_double(0x0000000000000000ull));
|
||||
long long e7 = 0;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
double r8 = hide_double(make_double(0x0000000000000000ull));
|
||||
long long e8 = 0;
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
double r9 = hide_double(make_double(0x0000000000000000ull));
|
||||
long long e9 = 0;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
double r10 = hide_double(make_double(0x3FE6170DBAADCD80ull));
|
||||
long long e10 = -1028;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double(make_double(0x0000000000000001ull));
|
||||
double r11 = hide_double(make_double(0x3FE0000000000000ull));
|
||||
long long e11 = -1073;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
double r12 = hide_double(make_double(0x3FE921D88FCE94A3ull));
|
||||
long long e12 = 2;
|
||||
|
||||
// +Norm
|
||||
double x13 = hide_double(7.0673903e149);
|
||||
double r13 = hide_double(make_double(0x3FEBA2C056BA0DB2ull));
|
||||
long long e13 = 498;
|
||||
|
||||
// +Norm
|
||||
double x14 = hide_double(2.4673e304);
|
||||
double r14 = hide_double(make_double(0x3FE1FD485BDF688Eull));
|
||||
long long e14 = 1012;
|
||||
|
||||
// +Norm
|
||||
double x15 = hide_double(7.235672e-25);
|
||||
double r15 = hide_double(make_double(0x3FEBFDDCCA6FF682ull));
|
||||
long long e15 = -80;
|
||||
|
||||
// +Denorm
|
||||
double x16 = hide_double(9.452854e-312);
|
||||
double r16 = hide_double(make_double(0x3FEBD784FE999000ull));
|
||||
long long e16 = -1033;
|
||||
|
||||
// +Demorm
|
||||
double x17 = hide_double(3.045784e-320);
|
||||
double r17 = hide_double(make_double(0x3FE8150000000000ull));
|
||||
long long e17 = -1061;
|
||||
|
||||
// -Norm
|
||||
double x18 = hide_double(-6.459273e7);
|
||||
double r18 = hide_double(make_double(0xBFEECCDAD0000000ull));
|
||||
long long e18 = 26;
|
||||
|
||||
// -Norm
|
||||
double x19 = hide_double(-2.493472e-99);
|
||||
double r19 = hide_double(make_double(0xBFE5D0BDA52F448Cull));
|
||||
long long e19 = -327;
|
||||
|
||||
// -Norm
|
||||
double x20 = hide_double(-1.4824543e128);
|
||||
double r20 = hide_double(make_double(0xBFEB5FFBEAE7B3E1ull));
|
||||
long long e20 = 426;
|
||||
|
||||
// -Denorm
|
||||
double x21 = hide_double(-5.53856231e-315);
|
||||
double r21 = hide_double(make_double(0xBFE0B457A5000000ull));
|
||||
long long e21 = -1043;
|
||||
|
||||
// -Demorm
|
||||
double x22 = hide_double(-2.5684367e-312);
|
||||
double r22 = hide_double(make_double(0xBFEE427A82514000ull));
|
||||
long long e22 = -1035;
|
||||
|
||||
// +Dmax
|
||||
double x23 = hide_double(DBL_MAX);
|
||||
double r23 = hide_double(make_double(0x3FEFFFFFFFFFFFFFull));
|
||||
long long e23 = 1024;
|
||||
|
||||
// +Inf
|
||||
double x24 = hide_double( 1.0/0.0 );
|
||||
double r24 = x24;
|
||||
//long long e24 = 0;
|
||||
|
||||
//+Nan
|
||||
double x25 = hide_double( nan(""));
|
||||
double r25 = hide_double( nan(""));
|
||||
//long long e25 = 0;
|
||||
|
||||
// Compound
|
||||
vec_double2 x26_v = (vec_double2) { -2.561286432e-317, -1.0e-999 };
|
||||
vec_double2 r26_v = (vec_double2) { hide_double(make_double(0xBFE3C69940000000ull)), 0.0 };
|
||||
vec_llong2 e26_v = (vec_llong2) { -1051, 0 };
|
||||
|
||||
// Compound
|
||||
vec_double2 x27_v = (vec_double2) { 345.27533, -8.673e-310 };
|
||||
vec_double2 r27_v = (vec_double2) { hide_double(make_double(0x3FE59467C06E19B9ull)), hide_double(make_double(0xBFE3F4FCCDB156C0ull)) };
|
||||
vec_llong2 e27_v = (vec_llong2) { 9, -1026 };
|
||||
|
||||
// Compound
|
||||
vec_llong2 keep28_v = exp_v;
|
||||
vec_double2 x28_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_double2 r28_v = (vec_double2) { nan(""), hide_double(make_double(0xBFEC1043703246A4ull)) };
|
||||
vec_llong2 e28_v = (vec_llong2) { spu_extract(exp_v, 0), 22 };
|
||||
|
||||
// Compound
|
||||
vec_llong2 keep29_v = exp_v;
|
||||
vec_double2 x29_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_double2 r29_v = (vec_double2) { 1.0/0.0, nan("") };
|
||||
vec_llong2 e29_v = (vec_llong2) { spu_extract(exp_v, 0), spu_extract(exp_v, 1) };
|
||||
|
||||
// Compound
|
||||
vec_llong2 keep30_v = exp_v;
|
||||
vec_double2 x30_v = (vec_double2) { -1.2e-99, -1.0/0.0 } ;
|
||||
vec_double2 r30_v = (vec_double2) { hide_double(make_double(0xBFE4FF632B6A83E4ull)), -1.0/0.0 };
|
||||
vec_llong2 e30_v = (vec_llong2) { -328, spu_extract(exp_v, 1) };
|
||||
|
||||
vec_llong2 keep0_v = exp_v;
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 r0_v = spu_splats(r0);
|
||||
vec_llong2 e0_v = exp_v;
|
||||
|
||||
vec_llong2 keep1_v = exp_v;
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 r1_v = spu_splats(r1);
|
||||
vec_llong2 e1_v = exp_v;
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 r2_v = spu_splats(r2);
|
||||
vec_llong2 e2_v = spu_splats(e2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 r3_v = spu_splats(r3);
|
||||
vec_llong2 e3_v = spu_splats(e3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 r4_v = spu_splats(r4);
|
||||
vec_llong2 e4_v = spu_splats(e4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 r5_v = spu_splats(r5);
|
||||
vec_llong2 e5_v = spu_splats(e5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 r6_v = spu_splats(r6);
|
||||
vec_llong2 e6_v = spu_splats(e6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 r7_v = spu_splats(r7);
|
||||
vec_llong2 e7_v = spu_splats(e7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 r8_v = spu_splats(r8);
|
||||
vec_llong2 e8_v = spu_splats(e8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 r9_v = spu_splats(r9);
|
||||
vec_llong2 e9_v = spu_splats(e9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 r10_v = spu_splats(r10);
|
||||
vec_llong2 e10_v = spu_splats(e10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 r11_v = spu_splats(r11);
|
||||
vec_llong2 e11_v = spu_splats(e11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 r12_v = spu_splats(r12);
|
||||
vec_llong2 e12_v = spu_splats(e12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 r13_v = spu_splats(r13);
|
||||
vec_llong2 e13_v = spu_splats(e13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 r14_v = spu_splats(r14);
|
||||
vec_llong2 e14_v = spu_splats(e14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 r15_v = spu_splats(r15);
|
||||
vec_llong2 e15_v = spu_splats(e15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 r16_v = spu_splats(r16);
|
||||
vec_llong2 e16_v = spu_splats(e16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 r17_v = spu_splats(r17);
|
||||
vec_llong2 e17_v = spu_splats(e17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 r18_v = spu_splats(r18);
|
||||
vec_llong2 e18_v = spu_splats(e18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 r19_v = spu_splats(r19);
|
||||
vec_llong2 e19_v = spu_splats(e19);
|
||||
|
||||
vec_double2 x20_v = spu_splats(x20);
|
||||
vec_double2 r20_v = spu_splats(r20);
|
||||
vec_llong2 e20_v = spu_splats(e20);
|
||||
|
||||
vec_double2 x21_v = spu_splats(x21);
|
||||
vec_double2 r21_v = spu_splats(r21);
|
||||
vec_llong2 e21_v = spu_splats(e21);
|
||||
|
||||
vec_double2 x22_v = spu_splats(x22);
|
||||
vec_double2 r22_v = spu_splats(r22);
|
||||
vec_llong2 e22_v = spu_splats(e22);
|
||||
|
||||
vec_double2 x23_v = spu_splats(x23);
|
||||
vec_double2 r23_v = spu_splats(r23);
|
||||
vec_llong2 e23_v = spu_splats(e23);
|
||||
|
||||
vec_llong2 keep24_v = exp_v;
|
||||
vec_double2 x24_v = spu_splats(x24);
|
||||
vec_double2 r24_v = spu_splats(r24);
|
||||
vec_llong2 e24_v = exp_v;
|
||||
|
||||
vec_llong2 keep25_v = exp_v;
|
||||
vec_double2 x25_v = spu_splats(x25);
|
||||
vec_double2 r25_v = spu_splats(r25);
|
||||
vec_llong2 e25_v = exp_v;
|
||||
|
||||
TEST_START("frexpd2");
|
||||
|
||||
exp_v = keep0_v;
|
||||
res_v = (vec_double2)frexpd2(x0_v, &exp_v);
|
||||
TEST_CHECK("20060907000000AAN", allnan_double2( res_v ), 0); (void)r0_v;
|
||||
TEST_CHECK("20060907000000AAN", allequal_llong2( exp_v, e0_v ), 0);
|
||||
exp_v = keep1_v;
|
||||
res_v = (vec_double2)frexpd2(x1_v, &exp_v);
|
||||
TEST_CHECK("20060907000001AAN", allequal_double2( res_v, r1_v ), 0);
|
||||
TEST_CHECK("20060907000001AAN", allequal_llong2( exp_v, e1_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x2_v, &exp_v);
|
||||
TEST_CHECK("20060907000002AAN", allequal_double2( res_v, r2_v ), 0);
|
||||
TEST_CHECK("20060907000002AAN", allequal_llong2( exp_v, e2_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x3_v, &exp_v);
|
||||
TEST_CHECK("20060907000003AAN", allequal_double2( res_v, r3_v ), 0);
|
||||
TEST_CHECK("20060907000003AAN", allequal_llong2( exp_v, e3_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x4_v, &exp_v);
|
||||
TEST_CHECK("20060907000004AAN", allequal_double2( res_v, r4_v ), 0);
|
||||
TEST_CHECK("20060907000004AAN", allequal_llong2( exp_v, e4_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x5_v, &exp_v);
|
||||
TEST_CHECK("20060907000005AAN", allequal_double2( res_v, r5_v ), 0);
|
||||
TEST_CHECK("20060907000005AAN", allequal_llong2( exp_v, e5_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x6_v, &exp_v);
|
||||
TEST_CHECK("20060907000006AAN", allequal_double2( res_v, r6_v ), 0);
|
||||
TEST_CHECK("20060907000006AAN", allequal_llong2( exp_v, e6_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x7_v, &exp_v);
|
||||
TEST_CHECK("20060907000007AAN", allequal_double2( res_v, r7_v ), 0);
|
||||
TEST_CHECK("20060907000007AAN", allequal_llong2( exp_v, e7_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x8_v, &exp_v);
|
||||
TEST_CHECK("20060907000008AAN", allequal_double2( res_v, r8_v ), 0);
|
||||
TEST_CHECK("20060907000008AAN", allequal_llong2( exp_v, e8_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x9_v, &exp_v);
|
||||
TEST_CHECK("20060907000009AAN", allequal_double2( res_v, r9_v ), 0);
|
||||
TEST_CHECK("20060907000009AAN", allequal_llong2( exp_v, e9_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x10_v, &exp_v);
|
||||
TEST_CHECK("20060907000010AAN", allequal_double2( res_v, r10_v ), 0);
|
||||
TEST_CHECK("20060907000010AAN", allequal_llong2( exp_v, e10_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x11_v, &exp_v);
|
||||
TEST_CHECK("20060907000011AAN", allequal_double2( res_v, r11_v ), 0);
|
||||
TEST_CHECK("20060907000011AAN", allequal_llong2( exp_v, e11_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x12_v, &exp_v);
|
||||
TEST_CHECK("20060907000012AAN", allequal_double2( res_v, r12_v ), 0);
|
||||
TEST_CHECK("20060907000012AAN", allequal_llong2( exp_v, e12_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x13_v, &exp_v);
|
||||
TEST_CHECK("20060907000013AAN", allequal_double2( res_v, r13_v ), 0);
|
||||
TEST_CHECK("20060907000013AAN", allequal_llong2( exp_v, e13_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x14_v, &exp_v);
|
||||
TEST_CHECK("20060907000014AAN", allequal_double2( res_v, r14_v ), 0);
|
||||
TEST_CHECK("20060907000014AAN", allequal_llong2( exp_v, e14_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x15_v, &exp_v);
|
||||
TEST_CHECK("20060907000015AAN", allequal_double2( res_v, r15_v ), 0);
|
||||
TEST_CHECK("20060907000015AAN", allequal_llong2( exp_v, e15_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x16_v, &exp_v);
|
||||
TEST_CHECK("20060907000016AAN", allequal_double2( res_v, r16_v ), 0);
|
||||
TEST_CHECK("20060907000016AAN", allequal_llong2( exp_v, e16_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x17_v, &exp_v);
|
||||
TEST_CHECK("20060907000017AAN", allequal_double2( res_v, r17_v ), 0);
|
||||
TEST_CHECK("20060907000017AAN", allequal_llong2( exp_v, e17_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x18_v, &exp_v);
|
||||
TEST_CHECK("20060907000018AAN", allequal_double2( res_v, r18_v ), 0);
|
||||
TEST_CHECK("20060907000018AAN", allequal_llong2( exp_v, e18_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x19_v, &exp_v);
|
||||
TEST_CHECK("20060907000019AAN", allequal_double2( res_v, r19_v ), 0);
|
||||
TEST_CHECK("20060907000019AAN", allequal_llong2( exp_v, e19_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x20_v, &exp_v);
|
||||
TEST_CHECK("20060907000020AAN", allequal_double2( res_v, r20_v ), 0);
|
||||
TEST_CHECK("20060907000020AAN", allequal_llong2( exp_v, e20_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x21_v, &exp_v);
|
||||
TEST_CHECK("20060907000021AAN", allequal_double2( res_v, r21_v ), 0);
|
||||
TEST_CHECK("20060907000021AAN", allequal_llong2( exp_v, e21_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x22_v, &exp_v);
|
||||
TEST_CHECK("20060907000022AAN", allequal_double2( res_v, r22_v ), 0);
|
||||
TEST_CHECK("20060907000022AAN", allequal_llong2( exp_v, e22_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x23_v, &exp_v);
|
||||
TEST_CHECK("20060907000023AAN", allequal_double2( res_v, r23_v ), 0);
|
||||
TEST_CHECK("20060907000023AAN", allequal_llong2( exp_v, e23_v ), 0);
|
||||
exp_v = keep24_v;
|
||||
res_v = (vec_double2)frexpd2(x24_v, &exp_v);
|
||||
TEST_CHECK("20060907000024AAN", allequal_double2( res_v, r24_v ), 0);
|
||||
TEST_CHECK("20060907000024AAN", allequal_llong2( exp_v, e24_v ), 0);
|
||||
exp_v = keep25_v;
|
||||
res_v = (vec_double2)frexpd2(x25_v, &exp_v);
|
||||
TEST_CHECK("20060907000025AAN", allnan_double2( res_v ), 0); (void)r25_v;
|
||||
TEST_CHECK("20060907000025AAN", allequal_llong2( exp_v, e25_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x26_v, &exp_v);
|
||||
TEST_CHECK("20060907000026AAN", allequal_double2( res_v, r26_v ), 0);
|
||||
TEST_CHECK("20060907000026AAN", allequal_llong2( exp_v, e26_v ), 0);
|
||||
res_v = (vec_double2)frexpd2(x27_v, &exp_v);
|
||||
TEST_CHECK("20060907000027AAN", allequal_double2( res_v, r27_v ), 0);
|
||||
TEST_CHECK("20060907000027AAN", allequal_llong2( exp_v, e27_v ), 0);
|
||||
exp_v = keep28_v;
|
||||
res_v = (vec_double2)frexpd2(x28_v, &exp_v);
|
||||
TEST_CHECK("20060907000028AAN", allequal_ulps_double2( res_v, r28_v, 0 ), 0);
|
||||
TEST_CHECK("20060907000028AAN", allequal_llong2( exp_v, e28_v ), 0);
|
||||
exp_v = keep29_v;
|
||||
res_v = (vec_double2)frexpd2(x29_v, &exp_v);
|
||||
TEST_CHECK("20060907000029AAN", allequal_ulps_double2( res_v, r29_v, 0 ), 0);
|
||||
TEST_CHECK("20060907000029AAN", allequal_llong2( exp_v, e29_v ), 0);
|
||||
exp_v = keep30_v;
|
||||
res_v = (vec_double2)frexpd2(x30_v, &exp_v);
|
||||
TEST_CHECK("20060907000030AAN", allequal_ulps_double2( res_v, r30_v, 0 ), 0);
|
||||
TEST_CHECK("20060907000000AAN", allequal_llong2( exp_v, e30_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
405
Extras/simdmathlibrary/spu/tests/frexpf4.c
Normal file
405
Extras/simdmathlibrary/spu/tests/frexpf4.c
Normal file
@@ -0,0 +1,405 @@
|
||||
/* Test frexpf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060907000000AAN","AAN", "frexpf4");
|
||||
|
||||
// -Norm (IEEE-754: -Nan)
|
||||
float x0 = hide_float(make_float(0xFFC00000));
|
||||
float r0 = hide_float(make_float(0xBF400000));
|
||||
int e0 = 129;
|
||||
|
||||
// -Norm (IEEE-754: -Inf)
|
||||
float x1 = hide_float(-1.0/0.0);
|
||||
float r1 = hide_float(make_float(0xBF7FFFFF));
|
||||
int e1 = 129;
|
||||
|
||||
// -Smax
|
||||
float x2 = hide_float(make_float(0xFFFFFFFF));
|
||||
float r2 = hide_float(make_float(0xBF7FFFFF));
|
||||
int e2 = 129;
|
||||
|
||||
// -Norm
|
||||
float x3 = hide_float(-824842.58421394);
|
||||
float r3 = hide_float(make_float(0xBF4960A9));
|
||||
int e3 = 20;
|
||||
|
||||
// -Smin
|
||||
float x4 = hide_float(make_float(0x80800000));
|
||||
float r4 = hide_float(make_float(0xBF000000));
|
||||
int e4 = -125;
|
||||
|
||||
// -Denorm
|
||||
float x5 = hide_float(make_float(0x807AAAAA));
|
||||
float r5 = 0.0;
|
||||
int e5 = 0;
|
||||
|
||||
// -Unf
|
||||
float x6 = hide_float(-1.0e-999);
|
||||
float r6 = 0.0;
|
||||
int e6 = 0;
|
||||
|
||||
// -0
|
||||
float x7 = hide_float(-0.0);
|
||||
float r7 = 0.0;
|
||||
int e7 = 0;
|
||||
|
||||
// 0
|
||||
float x8 = hide_float( 0.0);
|
||||
float r8 = 0.0;
|
||||
int e8 = 0;
|
||||
|
||||
// +Unf
|
||||
float x9 = hide_float( 1.0e-999);
|
||||
float r9 = 0.0;
|
||||
int e9 = 0;
|
||||
|
||||
// +Denorm
|
||||
float x10 = hide_float(make_float(0x007AAAAA));
|
||||
float r10 = 0.0;
|
||||
int e10 = 0;
|
||||
|
||||
// +Smin
|
||||
float x11 = hide_float(make_float(0x00800000));
|
||||
float r11 = hide_float(make_float(0x3F000000));
|
||||
int e11 = -125;
|
||||
|
||||
// +Norm
|
||||
float x12 = hide_float(3.14152634);
|
||||
float r12 = hide_float(make_float(0x3F490EC4));
|
||||
int e12 = 2;
|
||||
|
||||
// +Norm
|
||||
float x13 = hide_float(7.0673903e37);
|
||||
float r13 = hide_float(make_float(0x3F54AD32));
|
||||
int e13 = 126;
|
||||
|
||||
// +Norm
|
||||
float x14 = hide_float(2.4673e14);
|
||||
float r14 = hide_float(make_float(0x3F60664E));
|
||||
int e14 = 48;
|
||||
|
||||
// +Norm
|
||||
float x15 = hide_float(7.235672e-25);
|
||||
float r15 = hide_float(make_float(0x3F5FEEE6));
|
||||
int e15 = -80;
|
||||
|
||||
// +Norm
|
||||
float x16 = hide_float(9.452854e17);
|
||||
float r16 = hide_float(make_float(0x3F51E541));
|
||||
int e16 = 60;
|
||||
|
||||
// +Norm
|
||||
float x17 = hide_float(3.045784e-18);
|
||||
float r17 = hide_float(make_float(0x3F60BD3C));
|
||||
int e17 = -58;
|
||||
|
||||
// -Norm
|
||||
float x18 = hide_float(-6.459273e7);
|
||||
float r18 = hide_float(make_float(0xBF7666D6));
|
||||
int e18 = 26;
|
||||
|
||||
// -Norm
|
||||
float x19 = hide_float(-2.493472e-9);
|
||||
float r19 = hide_float(make_float(0xBF2B59A0));
|
||||
int e19 = -28;
|
||||
|
||||
// -Norm
|
||||
float x20 = hide_float(-1.4824543e28);
|
||||
float r20 = hide_float(make_float(0xBF3F9A4C));
|
||||
int e20 = 94;
|
||||
|
||||
// -Norm
|
||||
float x21 = hide_float(-5.53856231e-27);
|
||||
float r21 = hide_float(make_float(0xBF5B67B2));
|
||||
int e21 = -87;
|
||||
|
||||
// -Norm
|
||||
float x22 = hide_float(-1.000001);
|
||||
float r22 = hide_float(make_float(0xBF000008));
|
||||
int e22 = 1;
|
||||
|
||||
// +Smax
|
||||
float x23 = hide_float(make_float(0x7FFFFFFF));
|
||||
float r23 = hide_float(make_float(0x3F7FFFFF));
|
||||
int e23 = 129;
|
||||
|
||||
//+Norm (IEEE-754: +Inf)
|
||||
float x24 = hide_float( 1.0/0.0);
|
||||
float r24 = hide_float(make_float(0x3F7FFFFF));
|
||||
int e24 = 129;
|
||||
|
||||
//+Norm (IEEE-754: +Nan)
|
||||
float x25 = hide_float(make_float(0x7FC00000));
|
||||
float r25 = hide_float(make_float(0x3F400000));
|
||||
int e25 = 129;
|
||||
|
||||
// Compound
|
||||
vec_float4 x26_v = (vec_float4) { -2.561286432e10, make_float(0x7FFFFFFF), -1.0e-999, 7.235672e-25 };
|
||||
vec_float4 r26_v = (vec_float4) { make_float(0xBF3ED4A9), make_float(0x3F7FFFFF), 0.0, make_float(0x3F5FEEE6) };
|
||||
vec_int4 e26_v = (vec_int4) { 35, 129, 0, -80 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x27_v = (vec_float4) { 345.27533f, 7.0673903e37, -0.0f, -2.40e-310 };
|
||||
vec_float4 r27_v = (vec_float4) { make_float(0x3F2CA33E), make_float(0x3F54AD32), 0.0, 0.0};
|
||||
vec_int4 e27_v = (vec_int4) { 9, 126, 0, 0 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x28_v = (vec_float4) { make_float(0x7FC00000), -824842.58421394f, -0.0f, -3678342.8765343f };
|
||||
vec_float4 r28_v = (vec_float4) { make_float(0x3F400000), make_float(0xBF4960A9), 0.0, make_float(0xBF60821B) };
|
||||
vec_int4 e28_v = (vec_int4) { 129, 20, 0, 22 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x29_v = (vec_float4) { 1.0/0.0, 1.0e-99, -5.53856231e-27, make_float(0xFFC00000) };
|
||||
vec_float4 r29_v = (vec_float4) { make_float(0x3F7FFFFF), 0.0, make_float(0xBF5B67B2), make_float(0xBF400000) };
|
||||
vec_int4 e29_v = (vec_int4) { 129, 0, -87, 129 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x30_v = (vec_float4) { 1.2e-57, -1.2e-19, 3.045784e-18, -1.0/0.0 } ;
|
||||
vec_float4 r30_v = (vec_float4) { 0.0, make_float(0xBF0DABC6 ), make_float(0x3F60BD3C), make_float(0xBF7FFFFF) };
|
||||
vec_int4 e30_v = (vec_int4) { 0, -62, -58, 129 };
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 r0_v = spu_splats(r0);
|
||||
vec_int4 e0_v = spu_splats(e0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 r1_v = spu_splats(r1);
|
||||
vec_int4 e1_v = spu_splats(e1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 r2_v = spu_splats(r2);
|
||||
vec_int4 e2_v = spu_splats(e2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 r3_v = spu_splats(r3);
|
||||
vec_int4 e3_v = spu_splats(e3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 r4_v = spu_splats(r4);
|
||||
vec_int4 e4_v = spu_splats(e4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 r5_v = spu_splats(r5);
|
||||
vec_int4 e5_v = spu_splats(e5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 r6_v = spu_splats(r6);
|
||||
vec_int4 e6_v = spu_splats(e6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 r7_v = spu_splats(r7);
|
||||
vec_int4 e7_v = spu_splats(e7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 r8_v = spu_splats(r8);
|
||||
vec_int4 e8_v = spu_splats(e8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 r9_v = spu_splats(r9);
|
||||
vec_int4 e9_v = spu_splats(e9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_float4 r10_v = spu_splats(r10);
|
||||
vec_int4 e10_v = spu_splats(e10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_float4 r11_v = spu_splats(r11);
|
||||
vec_int4 e11_v = spu_splats(e11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_float4 r12_v = spu_splats(r12);
|
||||
vec_int4 e12_v = spu_splats(e12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_float4 r13_v = spu_splats(r13);
|
||||
vec_int4 e13_v = spu_splats(e13);
|
||||
|
||||
vec_float4 x14_v = spu_splats(x14);
|
||||
vec_float4 r14_v = spu_splats(r14);
|
||||
vec_int4 e14_v = spu_splats(e14);
|
||||
|
||||
vec_float4 x15_v = spu_splats(x15);
|
||||
vec_float4 r15_v = spu_splats(r15);
|
||||
vec_int4 e15_v = spu_splats(e15);
|
||||
|
||||
vec_float4 x16_v = spu_splats(x16);
|
||||
vec_float4 r16_v = spu_splats(r16);
|
||||
vec_int4 e16_v = spu_splats(e16);
|
||||
|
||||
vec_float4 x17_v = spu_splats(x17);
|
||||
vec_float4 r17_v = spu_splats(r17);
|
||||
vec_int4 e17_v = spu_splats(e17);
|
||||
|
||||
vec_float4 x18_v = spu_splats(x18);
|
||||
vec_float4 r18_v = spu_splats(r18);
|
||||
vec_int4 e18_v = spu_splats(e18);
|
||||
|
||||
vec_float4 x19_v = spu_splats(x19);
|
||||
vec_float4 r19_v = spu_splats(r19);
|
||||
vec_int4 e19_v = spu_splats(e19);
|
||||
|
||||
vec_float4 x20_v = spu_splats(x20);
|
||||
vec_float4 r20_v = spu_splats(r20);
|
||||
vec_int4 e20_v = spu_splats(e20);
|
||||
|
||||
vec_float4 x21_v = spu_splats(x21);
|
||||
vec_float4 r21_v = spu_splats(r21);
|
||||
vec_int4 e21_v = spu_splats(e21);
|
||||
|
||||
vec_float4 x22_v = spu_splats(x22);
|
||||
vec_float4 r22_v = spu_splats(r22);
|
||||
vec_int4 e22_v = spu_splats(e22);
|
||||
|
||||
vec_float4 x23_v = spu_splats(x23);
|
||||
vec_float4 r23_v = spu_splats(r23);
|
||||
vec_int4 e23_v = spu_splats(e23);
|
||||
|
||||
vec_float4 x24_v = spu_splats(x24);
|
||||
vec_float4 r24_v = spu_splats(r24);
|
||||
vec_int4 e24_v = spu_splats(e24);
|
||||
|
||||
vec_float4 x25_v = spu_splats(x25);
|
||||
vec_float4 r25_v = spu_splats(r25);
|
||||
vec_int4 e25_v = spu_splats(e25);
|
||||
|
||||
vec_float4 res_v;
|
||||
vec_int4 exp_v;
|
||||
|
||||
TEST_START("frexpf4");
|
||||
|
||||
res_v = (vec_float4)frexpf4(x0_v, &exp_v);
|
||||
TEST_CHECK("20060907000000AAN", allequal_ulps_float4( res_v, r0_v, 0 ), 0);
|
||||
TEST_CHECK("20060907000000AAN", allequal_int4( exp_v, e0_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x1_v, &exp_v);
|
||||
TEST_CHECK("20060907000001AAN", allequal_ulps_float4( res_v, r1_v, 0 ), 0);
|
||||
TEST_CHECK("20060907000001AAN", allequal_int4( exp_v, e1_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x2_v, &exp_v);
|
||||
TEST_CHECK("20060907000002AAN", allequal_ulps_float4( res_v, r2_v, 0 ), 0);
|
||||
TEST_CHECK("20060907000002AAN", allequal_int4( exp_v, e2_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x3_v, &exp_v);
|
||||
TEST_CHECK("20060907000003AAN", allequal_float4( res_v, r3_v ), 0);
|
||||
TEST_CHECK("20060907000003AAN", allequal_int4( exp_v, e3_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x4_v, &exp_v);
|
||||
TEST_CHECK("20060907000004AAN", allequal_float4( res_v, r4_v ), 0);
|
||||
TEST_CHECK("20060907000004AAN", allequal_int4( exp_v, e4_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x5_v, &exp_v);
|
||||
TEST_CHECK("20060907000005AAN", allequal_float4( res_v, r5_v ), 0);
|
||||
TEST_CHECK("20060907000005AAN", allequal_int4( exp_v, e5_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x6_v, &exp_v);
|
||||
TEST_CHECK("20060907000006AAN", allequal_float4( res_v, r6_v ), 0);
|
||||
TEST_CHECK("20060907000006AAN", allequal_int4( exp_v, e6_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x7_v, &exp_v);
|
||||
TEST_CHECK("20060907000007AAN", allequal_float4( res_v, r7_v ), 0);
|
||||
TEST_CHECK("20060907000007AAN", allequal_int4( exp_v, e7_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x8_v, &exp_v);
|
||||
TEST_CHECK("20060907000008AAN", allequal_float4( res_v, r8_v ), 0);
|
||||
TEST_CHECK("20060907000008AAN", allequal_int4( exp_v, e8_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x9_v, &exp_v);
|
||||
TEST_CHECK("20060907000009AAN", allequal_float4( res_v, r9_v ), 0);
|
||||
TEST_CHECK("20060907000009AAN", allequal_int4( exp_v, e9_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x10_v, &exp_v);
|
||||
TEST_CHECK("20060907000010AAN", allequal_float4( res_v, r10_v ), 0);
|
||||
TEST_CHECK("20060907000010AAN", allequal_int4( exp_v, e10_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x11_v, &exp_v);
|
||||
TEST_CHECK("20060907000011AAN", allequal_float4( res_v, r11_v ), 0);
|
||||
TEST_CHECK("20060907000011AAN", allequal_int4( exp_v, e11_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x12_v, &exp_v);
|
||||
TEST_CHECK("20060907000012AAN", allequal_float4( res_v, r12_v ), 0);
|
||||
TEST_CHECK("20060907000012AAN", allequal_int4( exp_v, e12_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x13_v, &exp_v);
|
||||
TEST_CHECK("20060907000013AAN", allequal_float4( res_v, r13_v ), 0);
|
||||
TEST_CHECK("20060907000013AAN", allequal_int4( exp_v, e13_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x14_v, &exp_v);
|
||||
TEST_CHECK("20060907000014AAN", allequal_float4( res_v, r14_v ), 0);
|
||||
TEST_CHECK("20060907000014AAN", allequal_int4( exp_v, e14_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x15_v, &exp_v);
|
||||
TEST_CHECK("20060907000015AAN", allequal_float4( res_v, r15_v ), 0);
|
||||
TEST_CHECK("20060907000015AAN", allequal_int4( exp_v, e15_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x16_v, &exp_v);
|
||||
TEST_CHECK("20060907000016AAN", allequal_float4( res_v, r16_v ), 0);
|
||||
TEST_CHECK("20060907000016AAN", allequal_int4( exp_v, e16_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x17_v, &exp_v);
|
||||
TEST_CHECK("20060907000017AAN", allequal_float4( res_v, r17_v ), 0);
|
||||
TEST_CHECK("20060907000017AAN", allequal_int4( exp_v, e17_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x18_v, &exp_v);
|
||||
TEST_CHECK("20060907000018AAN", allequal_float4( res_v, r18_v ), 0);
|
||||
TEST_CHECK("20060907000018AAN", allequal_int4( exp_v, e18_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x19_v, &exp_v);
|
||||
TEST_CHECK("20060907000019AAN", allequal_float4( res_v, r19_v ), 0);
|
||||
TEST_CHECK("20060907000019AAN", allequal_int4( exp_v, e19_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x20_v, &exp_v);
|
||||
TEST_CHECK("20060907000020AAN", allequal_float4( res_v, r20_v ), 0);
|
||||
TEST_CHECK("20060907000020AAN", allequal_int4( exp_v, e20_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x21_v, &exp_v);
|
||||
TEST_CHECK("20060907000021AAN", allequal_float4( res_v, r21_v ), 0);
|
||||
TEST_CHECK("20060907000021AAN", allequal_int4( exp_v, e21_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x22_v, &exp_v);
|
||||
TEST_CHECK("20060907000022AAN", allequal_float4( res_v, r22_v ), 0);
|
||||
TEST_CHECK("20060907000022AAN", allequal_int4( exp_v, e22_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x23_v, &exp_v);
|
||||
TEST_CHECK("20060907000023AAN", allequal_float4( res_v, r23_v ), 0);
|
||||
TEST_CHECK("20060907000023AAN", allequal_int4( exp_v, e23_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x24_v, &exp_v);
|
||||
TEST_CHECK("20060907000024AAN", allequal_float4( res_v, r24_v ), 0);
|
||||
TEST_CHECK("20060907000024AAN", allequal_int4( exp_v, e24_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x25_v, &exp_v);
|
||||
TEST_CHECK("20060907000025AAN", allequal_float4( res_v, r25_v ), 0);
|
||||
TEST_CHECK("20060907000025AAN", allequal_int4( exp_v, e25_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x26_v, &exp_v);
|
||||
TEST_CHECK("20060907000026AAN", allequal_float4( res_v, r26_v ), 0);
|
||||
TEST_CHECK("20060907000026AAN", allequal_int4( exp_v, e26_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x27_v, &exp_v);
|
||||
TEST_CHECK("20060907000027AAN", allequal_float4( res_v, r27_v ), 0);
|
||||
TEST_CHECK("20060907000027AAN", allequal_int4( exp_v, e27_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x28_v, &exp_v);
|
||||
TEST_CHECK("20060907000028AAN", allequal_float4( res_v, r28_v ), 0);
|
||||
TEST_CHECK("20060907000028AAN", allequal_int4( exp_v, e28_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x29_v, &exp_v);
|
||||
TEST_CHECK("20060907000029AAN", allequal_float4( res_v, r29_v ), 0);
|
||||
TEST_CHECK("20060907000029AAN", allequal_int4( exp_v, e29_v ), 0);
|
||||
res_v = (vec_float4)frexpf4(x30_v, &exp_v);
|
||||
TEST_CHECK("20060907000030AAN", allequal_float4( res_v, r30_v ), 0);
|
||||
TEST_CHECK("20060907000030AAN", allequal_int4( exp_v, e30_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
341
Extras/simdmathlibrary/spu/tests/hypotd2.c
Normal file
341
Extras/simdmathlibrary/spu/tests/hypotd2.c
Normal file
@@ -0,0 +1,341 @@
|
||||
/* Test hypotd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060831000000AAN","AAN", "hypotd2");
|
||||
|
||||
// Does not test precesion, which depends on sqrtd2 implementation
|
||||
// Uses Pythagorean triplets to test result validity
|
||||
|
||||
//-QNaN, Norm
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
double r0 = hide_double( nan(""));
|
||||
|
||||
//-QNaN, -Norm
|
||||
double x1 = hide_double(-nan(""));
|
||||
double y1 = hide_double(-21345853556.492);
|
||||
double r1 = hide_double( nan(""));
|
||||
|
||||
//-Inf, -QNaN
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(make_double(0xFFFFFFFFFFFFFFFFull));
|
||||
double r2 = hide_double( nan(""));
|
||||
|
||||
//-Norm, -SNaN
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(make_double(0xFFF7FFFFFFFFFFFFull));
|
||||
double r3 = hide_double( nan(""));
|
||||
|
||||
//-Norm, -Denorm
|
||||
double x4 = hide_double(-4.0e120);
|
||||
double y4 = hide_double(-3.0e-320);
|
||||
double r4 = hide_double( 4.0e120);
|
||||
|
||||
//-Norm, -Inf
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-1.0/0.0);
|
||||
double r5 = hide_double( 1.0/0.0);
|
||||
|
||||
//+Inf, -Inf
|
||||
double x6 = hide_double( 1.0/0.0);
|
||||
double y6 = hide_double(-1.0/0.0);
|
||||
double r6 = hide_double( 1.0/0.0);
|
||||
|
||||
//-Norm, -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
double r7 = hide_double( 168.97345223013);
|
||||
|
||||
//-Unf, -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
double r8 = hide_double( 83532.96153153);
|
||||
|
||||
//-Unf, 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
double r9 = hide_double(0.0);
|
||||
|
||||
//QNaN, 0
|
||||
double x10 = hide_double(make_double(0x7FFFFFFFFFFFFFFFull));
|
||||
double y10 = hide_double( 0.0);
|
||||
double r10 = hide_double( nan(""));
|
||||
|
||||
//+Unf, +QNaN
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( nan(""));
|
||||
double r11 = hide_double( nan(""));
|
||||
|
||||
//+Unf, +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
double r12 = hide_double(0.0031529324);
|
||||
|
||||
//+Norm, +Norm
|
||||
double x13 = hide_double(55000.0e116);
|
||||
double y13 = hide_double(480.0e118);
|
||||
double r13 = hide_double(7.3e120);
|
||||
|
||||
//+Norm, -Denorm
|
||||
double x14 = hide_double(120.0e120);
|
||||
double y14 = hide_double(-5.0e-321);
|
||||
double r14 = hide_double(120.0e120/*1.3e101*/);
|
||||
|
||||
//-Norm, +Demorm
|
||||
double x15 = hide_double(-0.0000000008);
|
||||
double y15 = hide_double(1.5e-320);
|
||||
double r15 = hide_double( 0.8e-9);
|
||||
|
||||
//+Norm, -Norm
|
||||
double x16 = hide_double( 7.0e-6);
|
||||
double y16 = hide_double(-24.0e-6);
|
||||
double r16 = hide_double(25.0e-6);
|
||||
|
||||
//+Norm, +Norm
|
||||
double x17 = hide_double(0.0055);
|
||||
double y17 = hide_double(0.0048);
|
||||
double r17 = hide_double(0.0073);
|
||||
|
||||
//+Denorm, +Norm
|
||||
double x18 = hide_double(4.5e-320);
|
||||
double y18 = hide_double(2.8);
|
||||
double r18 = hide_double(2.8);
|
||||
|
||||
//-Norm, +Norm
|
||||
double x19 = hide_double(-8000.0);
|
||||
double y19 = hide_double(39.0e2);
|
||||
double r19 = hide_double(8900.0);
|
||||
|
||||
//+Norm, +Norm
|
||||
double x20 = hide_double(6.5e128);
|
||||
double y20 = hide_double(7.2e128);
|
||||
double r20 = hide_double(9.7e128);
|
||||
|
||||
//-Norm, -Norm
|
||||
double x21 = hide_double(-0.0035);
|
||||
double y21 = hide_double(-1.2e-3);
|
||||
double r21 = hide_double( 0.0037);
|
||||
|
||||
//+Norm, +Norm
|
||||
double x22 = hide_double(456548.6027761);
|
||||
double y22 = hide_double(106165.2293520);
|
||||
double r22 = hide_double(468729.8610289);
|
||||
|
||||
//+Inf, +Ovf
|
||||
double x23 = hide_double( 1.0/0.0);
|
||||
double y23 = hide_double( 1.0e999);
|
||||
double r23 = hide_double( 1.0/0.0);
|
||||
|
||||
//+Norm, +QNaN
|
||||
double x24 = hide_double(264.345643345);
|
||||
double y24 = hide_double(make_double(0x7FFAAAAAAAAAAAAAull));
|
||||
double r24 = hide_double( nan(""));
|
||||
|
||||
//+Inf, +QNaN
|
||||
double x25 = hide_double( 1.0/0.0);
|
||||
double y25 = hide_double(nan(""));
|
||||
double r25 = hide_double(nan(""));
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_double2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_double2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_double2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_double2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_double2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_double2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_double2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_double2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_double2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_double2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_double2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_double2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_double2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_double2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_double2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_double2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_double2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_double2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_double2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_double2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_double2 x20_v = spu_splats(x20);
|
||||
vec_double2 y20_v = spu_splats(y20);
|
||||
vec_double2 r20_v = spu_splats(r20);
|
||||
|
||||
vec_double2 x21_v = spu_splats(x21);
|
||||
vec_double2 y21_v = spu_splats(y21);
|
||||
vec_double2 r21_v = spu_splats(r21);
|
||||
|
||||
vec_double2 x22_v = spu_splats(x22);
|
||||
vec_double2 y22_v = spu_splats(y22);
|
||||
vec_double2 r22_v = spu_splats(r22);
|
||||
|
||||
vec_double2 x23_v = spu_splats(x23);
|
||||
vec_double2 y23_v = spu_splats(y23);
|
||||
vec_double2 r23_v = spu_splats(r23);
|
||||
|
||||
vec_double2 x24_v = spu_splats(x24);
|
||||
vec_double2 y24_v = spu_splats(y24);
|
||||
vec_double2 r24_v = spu_splats(r24);
|
||||
|
||||
vec_double2 x25_v = spu_splats(x25);
|
||||
vec_double2 y25_v = spu_splats(y25);
|
||||
vec_double2 r25_v = spu_splats(r25);
|
||||
|
||||
vec_double2 res_v;
|
||||
int tolerance = (int)0x0000000000000001ull;
|
||||
|
||||
TEST_START("hypotd2");
|
||||
|
||||
res_v = (vec_double2)hypotd2(x0_v, y0_v);
|
||||
TEST_CHECK("20060831000000AAN", allnan_double2( res_v ), 0); (void)r0_v;
|
||||
res_v = (vec_double2)hypotd2(x1_v, y1_v);
|
||||
TEST_CHECK("20060831000001AAN", allnan_double2( res_v ), 0); (void)r1_v;
|
||||
res_v = (vec_double2)hypotd2(x2_v, y2_v);
|
||||
TEST_CHECK("20060831000002AAN", allnan_double2( res_v ), 0); (void)r2_v;
|
||||
res_v = (vec_double2)hypotd2(x3_v, y3_v);
|
||||
TEST_CHECK("20060831000003AAN", allnan_double2( res_v ), 0); (void)r3_v;
|
||||
res_v = (vec_double2)hypotd2(x4_v, y4_v);
|
||||
TEST_CHECK("20060831000004AAN", allequal_ulps_double2( res_v, r4_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x5_v, y5_v);
|
||||
TEST_CHECK("20060831000005AAN", allequal_ulps_double2( res_v, r5_v, 0 ), 0);
|
||||
res_v = (vec_double2)hypotd2(x6_v, y6_v);
|
||||
TEST_CHECK("20060831000006AAN", allequal_ulps_double2( res_v, r6_v, 0 ), 0);
|
||||
res_v = (vec_double2)hypotd2(x7_v, y7_v);
|
||||
TEST_CHECK("20060831000007AAN", allequal_ulps_double2( res_v, r7_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x8_v, y8_v);
|
||||
TEST_CHECK("20060831000008AAN", allequal_ulps_double2( res_v, r8_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x9_v, y9_v);
|
||||
TEST_CHECK("20060831000009AAN", allequal_ulps_double2( res_v, r9_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x10_v, y10_v);
|
||||
TEST_CHECK("20060831000010AAN", allnan_double2( res_v ), 0); (void)r10_v;
|
||||
res_v = (vec_double2)hypotd2(x11_v, y11_v);
|
||||
TEST_CHECK("20060831000011AAN", allnan_double2( res_v ), 0); (void)r11_v;
|
||||
res_v = (vec_double2)hypotd2(x12_v, y12_v);
|
||||
TEST_CHECK("20060831000012AAN", allequal_ulps_double2( res_v, r12_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x13_v, y13_v);
|
||||
TEST_CHECK("20060831000013AAN", allequal_ulps_double2( res_v, r13_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x14_v, y14_v);
|
||||
TEST_CHECK("20060831000014AAN", allequal_ulps_double2( res_v, r14_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x15_v, y15_v);
|
||||
TEST_CHECK("20060831000015AAN", allequal_ulps_double2( res_v, r15_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x16_v, y16_v);
|
||||
TEST_CHECK("20060831000016AAN", allequal_ulps_double2( res_v, r16_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x17_v, y17_v);
|
||||
TEST_CHECK("20060831000017AAN", allequal_ulps_double2( res_v, r17_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x18_v, y18_v);
|
||||
TEST_CHECK("20060831000018AAN", allequal_ulps_double2( res_v, r18_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x19_v, y19_v);
|
||||
TEST_CHECK("20060831000019AAN", allequal_ulps_double2( res_v, r19_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x20_v, y20_v);
|
||||
TEST_CHECK("20060831000020AAN", allequal_ulps_double2( res_v, r20_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x21_v, y21_v);
|
||||
TEST_CHECK("20060831000021AAN", allequal_ulps_double2( res_v, r21_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x22_v, y22_v);
|
||||
TEST_CHECK("20060831000022AAN", allequal_ulps_double2( res_v, r22_v, tolerance ), 0);
|
||||
res_v = (vec_double2)hypotd2(x23_v, y23_v);
|
||||
TEST_CHECK("20060831000023AAN", allequal_ulps_double2( res_v, r23_v, 0 ), 0);
|
||||
res_v = (vec_double2)hypotd2(x24_v, y24_v);
|
||||
TEST_CHECK("20060831000024AAN", allnan_double2( res_v ), 0); (void)r24_v;
|
||||
res_v = (vec_double2)hypotd2(x25_v, y25_v);
|
||||
TEST_CHECK("20060831000025AAN", allnan_double2( res_v ), 0); (void)r25_v;
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
208
Extras/simdmathlibrary/spu/tests/hypotf4.c
Normal file
208
Extras/simdmathlibrary/spu/tests/hypotf4.c
Normal file
@@ -0,0 +1,208 @@
|
||||
/* Test hypotf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060831000000AAN","AAN", "hypotf4");
|
||||
|
||||
// Does not test precesion, which depends on sqrtf4 implementation
|
||||
// Uses Pythagorean triplets to test result validity
|
||||
|
||||
//-Norm, -0
|
||||
float x0 = hide_float(-168.97345223013f);
|
||||
float y0 = hide_float(-0.0);
|
||||
float r0 = hide_float( 168.97345223013f);
|
||||
|
||||
//-Unf, -Norm
|
||||
float x1 = hide_float(-1.0e-999);
|
||||
float y1 = hide_float(-83532.96153153f);
|
||||
float r1 = hide_float( 83532.96153153f);
|
||||
|
||||
//-Unf, 0
|
||||
float x2 = hide_float(-1.0e-999);
|
||||
float y2 = hide_float( 0.0);
|
||||
float r2 = hide_float( 0.0);
|
||||
|
||||
//+Unf, +Norm
|
||||
float x3 = hide_float(1.0e-999);
|
||||
float y3 = hide_float(0.0031529324f);
|
||||
float r3 = hide_float(0.0031529324f);
|
||||
|
||||
//+Norm, +Norm
|
||||
float x4 = hide_float(5.5e12);
|
||||
float y4 = hide_float(4.8e12);
|
||||
float r4 = hide_float(7.3e12);
|
||||
|
||||
//+Norm, -Denorm
|
||||
float x5 = hide_float(12.0e12);
|
||||
float y5 = hide_float(make_float(0x803AAAAA));
|
||||
float r5 = hide_float(12.0e12);
|
||||
|
||||
//-Norm, +Norm
|
||||
float x6 = hide_float(-0.0000000008);
|
||||
float y6 = hide_float( 0.0000000015);
|
||||
float r6 = hide_float( 0.0000000017);
|
||||
|
||||
//+Norm, -Norm
|
||||
float x7 = hide_float( 7.0e-6);
|
||||
float y7 = hide_float(-24.0e-6);
|
||||
float r7 = hide_float( 25.0e-6);
|
||||
|
||||
//+Norm, +Norm
|
||||
float x8 = hide_float(0.0055f);
|
||||
float y8 = hide_float(0.0048f);
|
||||
float r8 = hide_float(0.0073f);
|
||||
|
||||
//+Denorm, +Norm
|
||||
float x9 = hide_float(make_float(0x007AAAAA));
|
||||
float y9 = hide_float(2.8f);
|
||||
float r9 = hide_float(2.8f);
|
||||
|
||||
//-Norm, +Norm
|
||||
float x10 = hide_float(-8000.0);
|
||||
float y10 = hide_float(39.0e2);
|
||||
float r10 = hide_float(8900.0);
|
||||
|
||||
//+Norm, +Norm
|
||||
float x11 = hide_float(6.5e16);
|
||||
float y11 = hide_float(7.2e16);
|
||||
float r11 = hide_float(9.7e16);
|
||||
|
||||
//-Norm, -Norm
|
||||
float x12 = hide_float(-0.0035);
|
||||
float y12 = hide_float(-12e-4);
|
||||
float r12 = hide_float(3700e-6);
|
||||
|
||||
//+Norm, +Norm
|
||||
float x13 = hide_float(456548.6027761f);
|
||||
float y13 = hide_float(106165.2293520f);
|
||||
float r13 = hide_float(468729.8610289f);
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_float4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_float4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_float4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_float4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_float4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_float4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_float4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_float4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_float4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_float4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_float4 y10_v = spu_splats(y10);
|
||||
vec_float4 r10_v = spu_splats(r10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_float4 y11_v = spu_splats(y11);
|
||||
vec_float4 r11_v = spu_splats(r11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_float4 y12_v = spu_splats(y12);
|
||||
vec_float4 r12_v = spu_splats(r12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_float4 y13_v = spu_splats(y13);
|
||||
vec_float4 r13_v = spu_splats(r13);
|
||||
|
||||
vec_float4 res_v;
|
||||
int tolerance = 0x00000001;
|
||||
|
||||
TEST_START("hypotf4");
|
||||
|
||||
res_v = (vec_float4)hypotf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060831000000AAN", allequal_ulps_float4( res_v, r0_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060831000001AAN", allequal_ulps_float4( res_v, r1_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060831000002AAN", allequal_ulps_float4( res_v, r2_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060831000003AAN", allequal_ulps_float4( res_v, r3_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060831000004AAN", allequal_ulps_float4( res_v, r4_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060831000005AAN", allequal_ulps_float4( res_v, r5_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060831000006AAN", allequal_ulps_float4( res_v, r6_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060831000007AAN", allequal_ulps_float4( res_v, r7_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060831000008AAN", allequal_ulps_float4( res_v, r8_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060831000009AAN", allequal_ulps_float4( res_v, r9_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x10_v, y10_v);
|
||||
TEST_CHECK("20060831000010AAN", allequal_ulps_float4( res_v, r10_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x11_v, y11_v);
|
||||
TEST_CHECK("20060831000011AAN", allequal_ulps_float4( res_v, r11_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x12_v, y12_v);
|
||||
TEST_CHECK("20060831000012AAN", allequal_ulps_float4( res_v, r12_v, tolerance ), 0);
|
||||
res_v = (vec_float4)hypotf4(x13_v, y13_v);
|
||||
TEST_CHECK("20060831000013AAN", allequal_ulps_float4( res_v, r13_v, tolerance ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
322
Extras/simdmathlibrary/spu/tests/ilogbd2.c
Normal file
322
Extras/simdmathlibrary/spu/tests/ilogbd2.c
Normal file
@@ -0,0 +1,322 @@
|
||||
/* Test ilogbd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#ifndef FP_ILOGB0
|
||||
#define FP_ILOGB0 ((int)0x80000001)
|
||||
#endif
|
||||
#ifndef FP_ILOGBNAN
|
||||
#define FP_ILOGBNAN ((int)0x7FFFFFFF)
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060904000000AAN","AAN", "ilogbd2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
long long r0 = (long long)FP_ILOGBNAN;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
long long r1 = (long long)FP_ILOGB0;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
long long r2 = 1023ll;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
long long r3 = 19ll;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
long long r4 = -1022ll;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
long long r5 = -1029ll;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
long long r6 = (long long)FP_ILOGB0;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
long long r7 = (long long)FP_ILOGB0;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
long long r8 = (long long)FP_ILOGB0;
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
long long r9 = (long long)FP_ILOGB0;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
long long r10 = -1029ll;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
long long r11 = -1022ll;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
long long r12 = 1ll;
|
||||
|
||||
// +Norm
|
||||
double x13 = hide_double(7.0673903e149);
|
||||
long long r13 = 497ll;
|
||||
|
||||
// +Norm
|
||||
double x14 = hide_double(2.4673e304);
|
||||
long long r14 = 1011ll;
|
||||
|
||||
// +Norm
|
||||
double x15 = hide_double(7.235672e-25);
|
||||
long long r15 = -81ll;
|
||||
|
||||
// +Denorm
|
||||
double x16 = hide_double(9.452854e-312);
|
||||
long long r16 = -1034ll;
|
||||
|
||||
// +Demorm
|
||||
double x17 = hide_double(3.045784e-320);
|
||||
long long r17 = -1062ll;
|
||||
|
||||
// -Norm
|
||||
double x18 = hide_double(-6.459273e7);
|
||||
long long r18 = 25ll;
|
||||
|
||||
// -Norm
|
||||
double x19 = hide_double(-2.493472e-99);
|
||||
long long r19 = -328ll;
|
||||
|
||||
// -Norm
|
||||
double x20 = hide_double(-1.4824543e128);
|
||||
long long r20 = 425ll;
|
||||
|
||||
// -Denorm
|
||||
double x21 = hide_double(-5.53856231e-315);
|
||||
long long r21 = -1044ll;
|
||||
|
||||
// -Demorm
|
||||
double x22 = hide_double(-2.5684367e-312);
|
||||
long long r22 = -1036ll;
|
||||
|
||||
// +Dmax
|
||||
double x23 = hide_double(DBL_MAX);
|
||||
long long r23 = 1023ll;
|
||||
|
||||
// +Inf
|
||||
double x24 = hide_double( 1.0/0.0);
|
||||
long long r24 = (long long)FP_ILOGB0;
|
||||
|
||||
//+Nan
|
||||
double x25 = hide_double( nan(""));
|
||||
long long r25 = (long long)FP_ILOGBNAN;
|
||||
|
||||
// Compound
|
||||
vec_double2 x26_v = (vec_double2) { -2.561286432e-317, -1.0e-999 };
|
||||
vec_llong2 r26_v = (vec_llong2) { -1052ll, FP_ILOGB0 };
|
||||
|
||||
// Compound
|
||||
vec_double2 x27_v = (vec_double2) { 345.27533, -8.673e-310 };
|
||||
vec_llong2 r27_v = (vec_llong2) { 8ll, -1027ll };
|
||||
|
||||
// Compound
|
||||
vec_double2 x28_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_llong2 r28_v = (vec_llong2) { FP_ILOGBNAN, 21ll };
|
||||
|
||||
// Compound
|
||||
vec_double2 x29_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_llong2 r29_v = (vec_llong2) { FP_ILOGB0, FP_ILOGBNAN };
|
||||
|
||||
// Compound
|
||||
vec_double2 x30_v = (vec_double2) { -1.2e-99, -1.0/0.0 } ;
|
||||
vec_llong2 r30_v = (vec_llong2) { -329ll, FP_ILOGB0 };
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_llong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_llong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_llong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_llong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_llong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_llong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_llong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_llong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_llong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_llong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_llong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_llong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_llong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_llong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_llong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_llong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_llong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_llong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_llong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_llong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_double2 x20_v = spu_splats(x20);
|
||||
vec_llong2 r20_v = spu_splats(r20);
|
||||
|
||||
vec_double2 x21_v = spu_splats(x21);
|
||||
vec_llong2 r21_v = spu_splats(r21);
|
||||
|
||||
vec_double2 x22_v = spu_splats(x22);
|
||||
vec_llong2 r22_v = spu_splats(r22);
|
||||
|
||||
vec_double2 x23_v = spu_splats(x23);
|
||||
vec_llong2 r23_v = spu_splats(r23);
|
||||
|
||||
vec_double2 x24_v = spu_splats(x24);
|
||||
vec_llong2 r24_v = spu_splats(r24);
|
||||
|
||||
vec_double2 x25_v = spu_splats(x25);
|
||||
vec_llong2 r25_v = spu_splats(r25);
|
||||
|
||||
vec_llong2 res_v;
|
||||
|
||||
TEST_START("ilogbd2");
|
||||
|
||||
res_v = (vec_llong2)ilogbd2(x0_v);
|
||||
TEST_CHECK("20060904000000AAN", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x1_v);
|
||||
TEST_CHECK("20060904000001AAN", allequal_llong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x2_v);
|
||||
TEST_CHECK("20060904000002AAN", allequal_llong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x3_v);
|
||||
TEST_CHECK("20060904000003AAN", allequal_llong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x4_v);
|
||||
TEST_CHECK("20060904000004AAN", allequal_llong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x5_v);
|
||||
TEST_CHECK("20060904000005AAN", allequal_llong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x6_v);
|
||||
TEST_CHECK("20060904000006AAN", allequal_llong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x7_v);
|
||||
TEST_CHECK("20060904000007AAN", allequal_llong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x8_v);
|
||||
TEST_CHECK("20060904000008AAN", allequal_llong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x9_v);
|
||||
TEST_CHECK("20060904000009AAN", allequal_llong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x10_v);
|
||||
TEST_CHECK("20060904000010AAN", allequal_llong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x11_v);
|
||||
TEST_CHECK("20060904000011AAN", allequal_llong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x12_v);
|
||||
TEST_CHECK("20060904000012AAN", allequal_llong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x13_v);
|
||||
TEST_CHECK("20060904000013AAN", allequal_llong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x14_v);
|
||||
TEST_CHECK("20060904000014AAN", allequal_llong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x15_v);
|
||||
TEST_CHECK("20060904000015AAN", allequal_llong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x16_v);
|
||||
TEST_CHECK("20060904000016AAN", allequal_llong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x17_v);
|
||||
TEST_CHECK("20060904000017AAN", allequal_llong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x18_v);
|
||||
TEST_CHECK("20060904000018AAN", allequal_llong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x19_v);
|
||||
TEST_CHECK("20060904000019AAN", allequal_llong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x20_v);
|
||||
TEST_CHECK("20060904000020AAN", allequal_llong2( res_v, r20_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x21_v);
|
||||
TEST_CHECK("20060904000021AAN", allequal_llong2( res_v, r21_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x22_v);
|
||||
TEST_CHECK("20060904000022AAN", allequal_llong2( res_v, r22_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x23_v);
|
||||
TEST_CHECK("20060904000023AAN", allequal_llong2( res_v, r23_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x24_v);
|
||||
TEST_CHECK("20060904000024AAN", allequal_llong2( res_v, r24_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x25_v);
|
||||
TEST_CHECK("20060904000025AAN", allequal_llong2( res_v, r25_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x26_v);
|
||||
TEST_CHECK("20060904000026AAN", allequal_llong2( res_v, r26_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x27_v);
|
||||
TEST_CHECK("20060904000027AAN", allequal_llong2( res_v, r27_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x28_v);
|
||||
TEST_CHECK("20060904000028AAN", allequal_llong2( res_v, r28_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x29_v);
|
||||
TEST_CHECK("20060904000029AAN", allequal_llong2( res_v, r29_v ), 0);
|
||||
res_v = (vec_llong2)ilogbd2(x30_v);
|
||||
TEST_CHECK("20060904000030AAN", allequal_llong2( res_v, r30_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
320
Extras/simdmathlibrary/spu/tests/ilogbf4.c
Normal file
320
Extras/simdmathlibrary/spu/tests/ilogbf4.c
Normal file
@@ -0,0 +1,320 @@
|
||||
/* Test ilogbf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#ifndef FP_ILOGB0
|
||||
#define FP_ILOGB0 ((int)0x80000001)
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060904000000AAN","AAN", "ilogbf4");
|
||||
|
||||
// -Norm (IEEE-754: -Nan)
|
||||
float x0 = hide_float(make_float(0xFFC00000));
|
||||
int r0 = 128;
|
||||
|
||||
// -Norm (IEEE-754: -Inf)
|
||||
float x1 = hide_float(-1.0/0.0);
|
||||
int r1 = 128;
|
||||
|
||||
// -Smax
|
||||
float x2 = hide_float(-FLT_MAX);
|
||||
int r2 = 128;
|
||||
|
||||
// -Norm
|
||||
float x3 = hide_float(-824842.58421394);
|
||||
int r3 = 19;
|
||||
|
||||
// -Smin
|
||||
float x4 = hide_float(make_float(0x80800000));
|
||||
int r4 = -126;
|
||||
|
||||
// -Denorm
|
||||
float x5 = hide_float(make_float(0x807AAAAA));
|
||||
int r5 = (int)FP_ILOGB0;
|
||||
|
||||
// -Unf
|
||||
float x6 = hide_float(-1.0e-999);
|
||||
int r6 = (int)FP_ILOGB0;
|
||||
|
||||
// -0
|
||||
float x7 = hide_float(-0.0);
|
||||
int r7 = (int)FP_ILOGB0;
|
||||
|
||||
// 0
|
||||
float x8 = hide_float( 0.0);
|
||||
int r8 = (int)FP_ILOGB0;
|
||||
|
||||
// +Unf
|
||||
float x9 = hide_float( 1.0e-999);
|
||||
int r9 = (int)FP_ILOGB0;
|
||||
|
||||
// +Denorm
|
||||
float x10 = hide_float(make_float(0x007AAAAA));
|
||||
int r10 = (int)FP_ILOGB0;
|
||||
|
||||
// +Smin
|
||||
float x11 = hide_float(make_float(0x00800000));
|
||||
int r11 = -126;
|
||||
|
||||
// +Norm
|
||||
float x12 = hide_float(3.14152634);
|
||||
int r12 = 1;
|
||||
|
||||
// +Norm
|
||||
float x13 = hide_float(7.0673903e37);
|
||||
int r13 = 125;
|
||||
|
||||
// +Norm
|
||||
float x14 = hide_float(2.4673e14);
|
||||
int r14 = 47;
|
||||
|
||||
// +Norm
|
||||
float x15 = hide_float(7.235672e-25);
|
||||
int r15 = -81;
|
||||
|
||||
// +Norm
|
||||
float x16 = hide_float(9.452854e17);
|
||||
int r16 = 59;
|
||||
|
||||
// +Norm
|
||||
float x17 = hide_float(3.045784e-18);
|
||||
int r17 = -59;
|
||||
|
||||
// -Norm
|
||||
float x18 = hide_float(-6.459273e7);
|
||||
int r18 = 25;
|
||||
|
||||
// -Norm
|
||||
float x19 = hide_float(-2.493472e-9);
|
||||
int r19 = -29;
|
||||
|
||||
// -Norm
|
||||
float x20 = hide_float(-1.4824543e28);
|
||||
int r20 = 93;
|
||||
|
||||
// -Norm
|
||||
float x21 = hide_float(-5.53856231e-27);
|
||||
int r21 = -88;
|
||||
|
||||
// -Norm
|
||||
float x22 = hide_float(-1.000001);
|
||||
int r22 = 0;
|
||||
|
||||
// +Smax
|
||||
float x23 = hide_float(FLT_MAX);
|
||||
int r23 = 128;
|
||||
|
||||
//+Norm (IEEE-754: +Inf)
|
||||
float x24 = hide_float( 1.0/0.0);
|
||||
int r24 = 128;
|
||||
|
||||
//+Norm (IEEE-754: +Nan)
|
||||
float x25 = hide_float(make_float(0x7FC00000));
|
||||
int r25 = 128;
|
||||
|
||||
// Compound
|
||||
vec_float4 x26_v = (vec_float4) { -2.561286432e10, FLT_MAX, -1.0e-999, 7.235672e-25 };
|
||||
vec_int4 r26_v = (vec_int4) { 34, 128, FP_ILOGB0, -81 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x27_v = (vec_float4) { 345.27533, 7.0673903e37, -0.0, -2.40e-310 };
|
||||
vec_int4 r27_v = (vec_int4) { 8, 125, FP_ILOGB0, FP_ILOGB0 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x28_v = (vec_float4) { make_float(0x7FC00000), -824842.58421394, -0.0, -3678342.8765343 };
|
||||
vec_int4 r28_v = (vec_int4) { 128, 19, FP_ILOGB0, 21 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x29_v = (vec_float4) { 1.0/0.0, 1.0e-99, -5.53856231e-27, make_float(0xFFC00000) };
|
||||
vec_int4 r29_v = (vec_int4) { 128, FP_ILOGB0, -88, 128 };
|
||||
|
||||
// Compound
|
||||
vec_float4 x30_v = (vec_float4) { 1.2e-57, -1.2e-19, 3.045784e-18, -1.0/0.0 } ;
|
||||
vec_int4 r30_v = (vec_int4) { FP_ILOGB0, -63, -59, 128 };
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_int4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_int4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_int4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_int4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_int4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_int4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_int4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_int4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_int4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_int4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_int4 r10_v = spu_splats(r10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_int4 r11_v = spu_splats(r11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_int4 r12_v = spu_splats(r12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_int4 r13_v = spu_splats(r13);
|
||||
|
||||
vec_float4 x14_v = spu_splats(x14);
|
||||
vec_int4 r14_v = spu_splats(r14);
|
||||
|
||||
vec_float4 x15_v = spu_splats(x15);
|
||||
vec_int4 r15_v = spu_splats(r15);
|
||||
|
||||
vec_float4 x16_v = spu_splats(x16);
|
||||
vec_int4 r16_v = spu_splats(r16);
|
||||
|
||||
vec_float4 x17_v = spu_splats(x17);
|
||||
vec_int4 r17_v = spu_splats(r17);
|
||||
|
||||
vec_float4 x18_v = spu_splats(x18);
|
||||
vec_int4 r18_v = spu_splats(r18);
|
||||
|
||||
vec_float4 x19_v = spu_splats(x19);
|
||||
vec_int4 r19_v = spu_splats(r19);
|
||||
|
||||
vec_float4 x20_v = spu_splats(x20);
|
||||
vec_int4 r20_v = spu_splats(r20);
|
||||
|
||||
vec_float4 x21_v = spu_splats(x21);
|
||||
vec_int4 r21_v = spu_splats(r21);
|
||||
|
||||
vec_float4 x22_v = spu_splats(x22);
|
||||
vec_int4 r22_v = spu_splats(r22);
|
||||
|
||||
vec_float4 x23_v = spu_splats(x23);
|
||||
vec_int4 r23_v = spu_splats(r23);
|
||||
|
||||
vec_float4 x24_v = spu_splats(x24);
|
||||
vec_int4 r24_v = spu_splats(r24);
|
||||
|
||||
vec_float4 x25_v = spu_splats(x25);
|
||||
vec_int4 r25_v = spu_splats(r25);
|
||||
|
||||
vec_int4 res_v;
|
||||
|
||||
TEST_START("ilogbf4");
|
||||
|
||||
res_v = (vec_int4)ilogbf4(x0_v);
|
||||
TEST_CHECK("20060904000000AAN", allequal_int4( res_v, r0_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x1_v);
|
||||
TEST_CHECK("20060904000001AAN", allequal_int4( res_v, r1_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x2_v);
|
||||
TEST_CHECK("20060904000002AAN", allequal_int4( res_v, r2_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x3_v);
|
||||
TEST_CHECK("20060904000003AAN", allequal_int4( res_v, r3_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x4_v);
|
||||
TEST_CHECK("20060904000004AAN", allequal_int4( res_v, r4_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x5_v);
|
||||
TEST_CHECK("20060904000005AAN", allequal_int4( res_v, r5_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x6_v);
|
||||
TEST_CHECK("20060904000006AAN", allequal_int4( res_v, r6_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x7_v);
|
||||
TEST_CHECK("20060904000007AAN", allequal_int4( res_v, r7_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x8_v);
|
||||
TEST_CHECK("20060904000008AAN", allequal_int4( res_v, r8_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x9_v);
|
||||
TEST_CHECK("20060904000009AAN", allequal_int4( res_v, r9_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x10_v);
|
||||
TEST_CHECK("20060904000010AAN", allequal_int4( res_v, r10_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x11_v);
|
||||
TEST_CHECK("20060904000011AAN", allequal_int4( res_v, r11_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x12_v);
|
||||
TEST_CHECK("20060904000012AAN", allequal_int4( res_v, r12_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x13_v);
|
||||
TEST_CHECK("20060904000013AAN", allequal_int4( res_v, r13_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x14_v);
|
||||
TEST_CHECK("20060904000014AAN", allequal_int4( res_v, r14_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x15_v);
|
||||
TEST_CHECK("20060904000015AAN", allequal_int4( res_v, r15_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x16_v);
|
||||
TEST_CHECK("20060904000016AAN", allequal_int4( res_v, r16_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x17_v);
|
||||
TEST_CHECK("20060904000017AAN", allequal_int4( res_v, r17_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x18_v);
|
||||
TEST_CHECK("20060904000018AAN", allequal_int4( res_v, r18_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x19_v);
|
||||
TEST_CHECK("20060904000019AAN", allequal_int4( res_v, r19_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x20_v);
|
||||
TEST_CHECK("20060904000020AAN", allequal_int4( res_v, r20_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x21_v);
|
||||
TEST_CHECK("20060904000021AAN", allequal_int4( res_v, r21_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x22_v);
|
||||
TEST_CHECK("20060904000022AAN", allequal_int4( res_v, r22_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x23_v);
|
||||
TEST_CHECK("20060904000023AAN", allequal_int4( res_v, r23_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x24_v);
|
||||
TEST_CHECK("20060904000024AAN", allequal_int4( res_v, r24_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x25_v);
|
||||
TEST_CHECK("20060904000025AAN", allequal_int4( res_v, r25_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x26_v);
|
||||
TEST_CHECK("20060904000026AAN", allequal_int4( res_v, r26_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x27_v);
|
||||
TEST_CHECK("20060904000027AAN", allequal_int4( res_v, r27_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x28_v);
|
||||
TEST_CHECK("20060904000028AAN", allequal_int4( res_v, r28_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x29_v);
|
||||
TEST_CHECK("20060904000029AAN", allequal_int4( res_v, r29_v ), 0);
|
||||
res_v = (vec_int4)ilogbf4(x30_v);
|
||||
TEST_CHECK("20060904000030AAN", allequal_int4( res_v, r30_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
96
Extras/simdmathlibrary/spu/tests/irintf4.c
Normal file
96
Extras/simdmathlibrary/spu/tests/irintf4.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/* Test irintf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#define DEFINE_DATA(val,a,b)\
|
||||
float val = hide_float(a); \
|
||||
signed int val ## _out =b;\
|
||||
vec_float4 val ## _v = spu_splats(val);\
|
||||
vec_int4 val ## _out_v = spu_splats(val ## _out);
|
||||
|
||||
#define DEFINE_DATA_UNSIGNED(val,a,b)\
|
||||
unsigned int val ## _in = a;\
|
||||
float val = make_float(val ## _in);\
|
||||
signed int val ## _out = b;\
|
||||
vec_float4 val ## _v = spu_splats(val);\
|
||||
vec_int4 val ## _out_v = spu_splats(val ## _out);
|
||||
|
||||
#define DO_TEST(var,id) \
|
||||
res_v = irintf4(var ## _v); \
|
||||
TEST_CHECK(" #id ", allequal_int4( res_v, var ## _out_v ), 0);
|
||||
|
||||
int main()
|
||||
{
|
||||
vec_int4 res_v;
|
||||
|
||||
TEST_SET_START("921537538600","RNT", "irintf4");
|
||||
|
||||
/*
|
||||
Define original values and the results
|
||||
*/
|
||||
//s=0
|
||||
DEFINE_DATA(x1, 1.0, 1)
|
||||
DEFINE_DATA(x2, -1.0,-1)
|
||||
|
||||
//s=-1
|
||||
DEFINE_DATA(x3, 0.5, 0)
|
||||
DEFINE_DATA(x4, -0.5, 0)
|
||||
//s=-2
|
||||
DEFINE_DATA(x5, 0.25, 0)
|
||||
//s=-3
|
||||
DEFINE_DATA(x6, 0.125, 0)
|
||||
|
||||
//s=0, e=27, f=0 -> 134217728
|
||||
DEFINE_DATA_UNSIGNED(x7, 0x4d000000,134217728)
|
||||
//s=0, e=-126, f=0 --> 0
|
||||
DEFINE_DATA_UNSIGNED(x8, 0x800000,0)
|
||||
|
||||
/* TEST */
|
||||
TEST_START("irintf4");
|
||||
|
||||
DO_TEST(x1,921537538601RNT)
|
||||
DO_TEST(x2,921537538602RNT)
|
||||
DO_TEST(x3,921537538603RNT)
|
||||
DO_TEST(x4,921537538604RNT)
|
||||
DO_TEST(x5,921537538605RNT)
|
||||
DO_TEST(x6,921537538606RNT)
|
||||
DO_TEST(x7,921537538607RNT)
|
||||
DO_TEST(x8,921537538608RNT)
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
96
Extras/simdmathlibrary/spu/tests/iroundf4.c
Normal file
96
Extras/simdmathlibrary/spu/tests/iroundf4.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/* Test iroundf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#define DEFINE_DATA(val,a,b)\
|
||||
float val = hide_float(a); \
|
||||
signed int val ## _out =b;\
|
||||
vec_float4 val ## _v = spu_splats(val);\
|
||||
vec_int4 val ## _out_v = spu_splats(val ## _out);
|
||||
|
||||
#define DEFINE_DATA_UNSIGNED(val,a,b)\
|
||||
unsigned int val ## _in = a;\
|
||||
float val = make_float(val ## _in);\
|
||||
signed int val ## _out = b;\
|
||||
vec_float4 val ## _v = spu_splats(val);\
|
||||
vec_int4 val ## _out_v = spu_splats(val ## _out);
|
||||
|
||||
#define DO_TEST(var,id) \
|
||||
res_v = iroundf4(var ## _v); \
|
||||
TEST_CHECK(" #id ", allequal_int4( res_v, var ## _out_v ), 0);
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vec_int4 res_v;
|
||||
|
||||
TEST_SET_START("592642590100","RUD", "iroundf4");
|
||||
|
||||
/*
|
||||
Define original values and the results
|
||||
*/
|
||||
//s=0
|
||||
DEFINE_DATA(x1, 1.0, 1.0f)
|
||||
DEFINE_DATA(x2, -1.0,-1.0f)
|
||||
//s=-1
|
||||
DEFINE_DATA(x3, 0.5, 1.0f)
|
||||
DEFINE_DATA(x4, -0.5, -1.0f)
|
||||
//s=-2
|
||||
DEFINE_DATA(x5, 0.25, 0.0f)
|
||||
//s=-3
|
||||
DEFINE_DATA(x6, 0.125, 0.0f)
|
||||
//s=0, e=27, f=0 -> 134217728
|
||||
DEFINE_DATA_UNSIGNED(x7, 0x4d000000,134217728)
|
||||
//s=0, e=-126, f=0 --> 0
|
||||
DEFINE_DATA_UNSIGNED(x8, 0x800000,0)
|
||||
|
||||
/* TEST */
|
||||
TEST_START("iroundf4");
|
||||
|
||||
DO_TEST(x1,592642590101RUD)
|
||||
DO_TEST(x2,592642590102RUD)
|
||||
DO_TEST(x3,592642590103RUD)
|
||||
DO_TEST(x4,592642590104RUD)
|
||||
DO_TEST(x5,592642590105RUD)
|
||||
DO_TEST(x6,592642590106RUD)
|
||||
DO_TEST(x7,592642590107RUD)
|
||||
DO_TEST(x8,592642590108RUD)
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
225
Extras/simdmathlibrary/spu/tests/is0denormd2.c
Normal file
225
Extras/simdmathlibrary/spu/tests/is0denormd2.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/* Test is0denormd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "is0denormd2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0x0000000000000000ull;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
unsigned long long r3 = 0x0000000000000000ull;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
unsigned long long r4 = 0x0000000000000000ull;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
unsigned long long r5 = 0xffffffffffffffffull;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0xffffffffffffffffull;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
unsigned long long r8 = 0xffffffffffffffffull;
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
unsigned long long r9 = 0xffffffffffffffffull;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
// +Dmax
|
||||
double x13 = hide_double(DBL_MAX);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
// +Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Nan
|
||||
double x15 = hide_double( nan(""));
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
// Compound
|
||||
vec_double2 x16_v = (vec_double2) {make_double(0x000AAAAAAAAAAAAAull), -1.0e-999 };
|
||||
vec_ullong2 r16_v = (vec_ullong2) {0xffffffffffffffffull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x17_v = (vec_double2) { 345.27533, -2.40e-310 };
|
||||
vec_ullong2 r17_v = (vec_ullong2) {0x0000000000000000ull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x18_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_ullong2 r18_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x19_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_ullong2 r19_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x20_v = (vec_double2) { -1.0e-999, -1.0/0.0} ;
|
||||
vec_ullong2 r20_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("is0denormd2");
|
||||
|
||||
res_v = (vec_ullong2)is0denormd2(x0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x17_v);
|
||||
TEST_CHECK("20060830000017AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x18_v);
|
||||
TEST_CHECK("20060830000018AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x19_v);
|
||||
TEST_CHECK("20060830000019AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_ullong2)is0denormd2(x20_v);
|
||||
TEST_CHECK("20060830000020AAN", allequal_ullong2( res_v, r20_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
200
Extras/simdmathlibrary/spu/tests/is0denormf4.c
Normal file
200
Extras/simdmathlibrary/spu/tests/is0denormf4.c
Normal file
@@ -0,0 +1,200 @@
|
||||
/* Test is0denormf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "is0denormf4");
|
||||
|
||||
// -Nan
|
||||
float x0 = hide_float(-nan(""));
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
// -Inf
|
||||
float x1 = hide_float(-1.0/0.0);
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
// -Smax
|
||||
float x2 = hide_float(make_float(0xffffffff));
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
// -Norm
|
||||
float x3 = hide_float(-824842.58421394f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
// -Smin
|
||||
float x4 = hide_float(make_float(0x80800000));
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
// -Denorm
|
||||
float x5 = hide_float(make_float(0x803aaaaa));
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
// -Unf
|
||||
float x6 = hide_float(-1.0e-999);
|
||||
unsigned int r6 = 0xffffffff;
|
||||
|
||||
// -0
|
||||
float x7 = hide_float(-0.0f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
// 0
|
||||
float x8 = hide_float( 0.0f);
|
||||
unsigned int r8 = 0xffffffff;
|
||||
|
||||
// +Unf
|
||||
float x9 = hide_float( 1.0e-999);
|
||||
unsigned int r9 = 0xffffffff;
|
||||
|
||||
// +Denorm
|
||||
float x10 = hide_float(make_float(0x003aaaaa));
|
||||
unsigned int r10 = 0xffffffff;
|
||||
|
||||
// +Smin
|
||||
float x11 = hide_float(make_float(0x00800000));
|
||||
unsigned int r11 = 0x00000000;
|
||||
|
||||
// +Norm
|
||||
float x12 = hide_float(3.14152634f);
|
||||
unsigned int r12 = 0x00000000;
|
||||
|
||||
// +Smax
|
||||
float x13 = hide_float(make_float(0x7fffffff));
|
||||
unsigned int r13 = 0x00000000;
|
||||
|
||||
// +Inf
|
||||
float x14 = hide_float( 1.0/0.0);
|
||||
unsigned int r14 = 0x00000000;
|
||||
|
||||
//+Nan
|
||||
float x15 = hide_float( nan(""));
|
||||
unsigned int r15 = 0x00000000;
|
||||
|
||||
// Compound
|
||||
vec_float4 x16_v = (vec_float4) {make_float(0x003AAAAA), -1.0e-999, 345.27533, make_float(0x803AAAAA)};
|
||||
vec_uint4 r16_v = (vec_uint4) {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff};
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_uint4 r10_v = spu_splats(r10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_uint4 r11_v = spu_splats(r11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_uint4 r12_v = spu_splats(r12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_uint4 r13_v = spu_splats(r13);
|
||||
|
||||
vec_float4 x14_v = spu_splats(x14);
|
||||
vec_uint4 r14_v = spu_splats(r14);
|
||||
|
||||
vec_float4 x15_v = spu_splats(x15);
|
||||
vec_uint4 r15_v = spu_splats(r15);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("is0denormf4");
|
||||
|
||||
res_v = (vec_uint4)is0denormf4(x0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_uint4( res_v, r10_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_uint4( res_v, r11_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_uint4( res_v, r12_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_uint4( res_v, r13_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_uint4( res_v, r14_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_uint4( res_v, r15_v ), 0);
|
||||
res_v = (vec_uint4)is0denormf4(x16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_uint4( res_v, r16_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
271
Extras/simdmathlibrary/spu/tests/isequald2.c
Normal file
271
Extras/simdmathlibrary/spu/tests/isequald2.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Test isequald2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060825000000AAN","AAN", "isequald2");
|
||||
|
||||
//-QNaN: NG
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
//-Inf < -Dmax
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm > -Inf
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(-1.0/0.0);
|
||||
unsigned long long r3 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm < -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm = -Norm
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-168.97345223013);
|
||||
unsigned long long r5 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm > -Norm
|
||||
double x6 = hide_double(-168.97345223013);
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm < -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf > -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf = 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0xffffffffffffffffull;
|
||||
|
||||
//-0 = 0
|
||||
double x10 = hide_double(-0.0);
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf = 0
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( 0.0);
|
||||
unsigned long long r11 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf < +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm > +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm = +Norm
|
||||
double x14 = hide_double(5172.2845321);
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm < +Norm
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(2353705.31415);
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm > -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm < +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > +Dmax
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double(DBL_MAX);
|
||||
unsigned long long r18 = 0x0000000000000000ull;
|
||||
|
||||
//+QNaN: NG
|
||||
double x19 = hide_double(nan(""));
|
||||
double y19 = hide_double(3.14);
|
||||
unsigned long long r19 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isequald2");
|
||||
|
||||
res_v = (vec_ullong2)isequald2(x0_v, y0_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x1_v, y1_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x2_v, y2_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x3_v, y3_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x4_v, y4_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x5_v, y5_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x6_v, y6_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x7_v, y7_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x8_v, y8_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x9_v, y9_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x10_v, y10_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x11_v, y11_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x12_v, y12_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x13_v, y13_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x14_v, y14_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x15_v, y15_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x16_v, y16_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x17_v, y17_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x18_v, y18_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isequald2(x19_v, y19_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/isequalf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/isequalf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test isequalf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060817000000AAN","AAN", "isequalf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0xffffffff;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0xffffffff;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0x00000000;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isequalf4");
|
||||
|
||||
res_v = (vec_uint4)isequalf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060817000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060817000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060817000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060817000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060817000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060817000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060817000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060817000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060817000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isequalf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060817000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
225
Extras/simdmathlibrary/spu/tests/isfinited2.c
Normal file
225
Extras/simdmathlibrary/spu/tests/isfinited2.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/* Test isfinited2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "isfinited2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
unsigned long long r5 = 0xffffffffffffffffull;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0xffffffffffffffffull;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
unsigned long long r8 = 0xffffffffffffffffull;
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
unsigned long long r9 = 0xffffffffffffffffull;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
unsigned long long r11 = 0xffffffffffffffffull;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
unsigned long long r12 = 0xffffffffffffffffull;
|
||||
|
||||
// +Dmax
|
||||
double x13 = hide_double(DBL_MAX);
|
||||
unsigned long long r13 = 0xffffffffffffffffull;
|
||||
|
||||
// +Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Nan
|
||||
double x15 = hide_double( nan(""));
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
// Compound
|
||||
vec_double2 x16_v = (vec_double2) {make_double(0x000AAAAAAAAAAAAAull), -1.0e-999 };
|
||||
vec_ullong2 r16_v = (vec_ullong2) {0xffffffffffffffffull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x17_v = (vec_double2) { 345.27533, -2.40e-310 };
|
||||
vec_ullong2 r17_v = (vec_ullong2) {0xffffffffffffffffull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x18_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_ullong2 r18_v = (vec_ullong2) {0x0000000000000000ull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x19_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_ullong2 r19_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x20_v = (vec_double2) { -1.0e-999, -1.0/0.0} ;
|
||||
vec_ullong2 r20_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isfinited2");
|
||||
|
||||
res_v = (vec_ullong2)isfinited2(x0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x17_v);
|
||||
TEST_CHECK("20060830000017AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x18_v);
|
||||
TEST_CHECK("20060830000018AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x19_v);
|
||||
TEST_CHECK("20060830000019AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_ullong2)isfinited2(x20_v);
|
||||
TEST_CHECK("20060830000020AAN", allequal_ullong2( res_v, r20_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
130
Extras/simdmathlibrary/spu/tests/isfinitef4.c
Normal file
130
Extras/simdmathlibrary/spu/tests/isfinitef4.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/* Test isfinitef4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060822000000AAN","AAN", "isfinitef4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
unsigned int r0 = 0xffffffff;
|
||||
|
||||
float x1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0xffffffff;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
unsigned int r2 = 0xffffffff;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0xffffffff;
|
||||
|
||||
float x4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0xffffffff;
|
||||
|
||||
float x5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
unsigned int r6 = 0xffffffff;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
float x8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0xffffffff;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
unsigned int r9 = 0xffffffff;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isfinitef4");
|
||||
|
||||
res_v = (vec_uint4)isfinitef4(x0_v);
|
||||
TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x1_v);
|
||||
TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x2_v);
|
||||
TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x3_v);
|
||||
TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x4_v);
|
||||
TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x5_v);
|
||||
TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x6_v);
|
||||
TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x7_v);
|
||||
TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x8_v);
|
||||
TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isfinitef4(x9_v);
|
||||
TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
271
Extras/simdmathlibrary/spu/tests/isgreaterd2.c
Normal file
271
Extras/simdmathlibrary/spu/tests/isgreaterd2.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Test isgreaterd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060825000000AAN","AAN", "isgreaterd2");
|
||||
|
||||
//-QNaN: NG
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0xffffffffffffffffull;
|
||||
|
||||
//-Inf < -Dmax
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm > -Inf
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(-1.0/0.0);
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm < -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm = -Norm
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-168.97345223013);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm > -Norm
|
||||
double x6 = hide_double(-168.97345223013);
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm < -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf > -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf = 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
//-0 = 0
|
||||
double x10 = hide_double(-0.0);
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf = 0
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( 0.0);
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf < +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm > +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm = +Norm
|
||||
double x14 = hide_double(5172.2845321);
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm < +Norm
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(2353705.31415);
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm > -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm < +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > +Dmax
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double(DBL_MAX);
|
||||
unsigned long long r18 = 0xffffffffffffffffull;
|
||||
|
||||
//+QNaN: NG
|
||||
double x19 = hide_double(nan(""));
|
||||
double y19 = hide_double(3.14);
|
||||
unsigned long long r19 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isgreaterd2");
|
||||
|
||||
res_v = (vec_ullong2)isgreaterd2(x0_v, y0_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x1_v, y1_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x2_v, y2_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x3_v, y3_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x4_v, y4_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x5_v, y5_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x6_v, y6_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x7_v, y7_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x8_v, y8_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x9_v, y9_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x10_v, y10_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x11_v, y11_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x12_v, y12_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x13_v, y13_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x14_v, y14_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x15_v, y15_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x16_v, y16_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x17_v, y17_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x18_v, y18_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterd2(x19_v, y19_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
271
Extras/simdmathlibrary/spu/tests/isgreaterequald2.c
Normal file
271
Extras/simdmathlibrary/spu/tests/isgreaterequald2.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Test isgreaterequald2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060825000000AAN","AAN", "isgreaterequald2");
|
||||
|
||||
//-QNaN: NG
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0xffffffffffffffffull;
|
||||
|
||||
//-Inf < -Dmax
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm > -Inf
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(-1.0/0.0);
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm < -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm = -Norm
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-168.97345223013);
|
||||
unsigned long long r5 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm > -Norm
|
||||
double x6 = hide_double(-168.97345223013);
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm < -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf > -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf = 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0xffffffffffffffffull;
|
||||
|
||||
//-0 = 0
|
||||
double x10 = hide_double(-0.0);
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf = 0
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( 0.0);
|
||||
unsigned long long r11 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf < +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm > +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm = +Norm
|
||||
double x14 = hide_double(5172.2845321);
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm < +Norm
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(2353705.31415);
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm > -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm < +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > +Dmax
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double(DBL_MAX);
|
||||
unsigned long long r18 = 0xffffffffffffffffull;
|
||||
|
||||
//+QNaN: NG
|
||||
double x19 = hide_double(nan(""));
|
||||
double y19 = hide_double(3.14);
|
||||
unsigned long long r19 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isgreaterequald2");
|
||||
|
||||
res_v = (vec_ullong2)isgreaterequald2(x0_v, y0_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x1_v, y1_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x2_v, y2_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x3_v, y3_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x4_v, y4_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x5_v, y5_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x6_v, y6_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x7_v, y7_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x8_v, y8_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x9_v, y9_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x10_v, y10_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x11_v, y11_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x12_v, y12_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x13_v, y13_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x14_v, y14_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x15_v, y15_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x16_v, y16_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x17_v, y17_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x18_v, y18_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isgreaterequald2(x19_v, y19_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/isgreaterequalf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/isgreaterequalf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test isgreaterequalf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060817000000AAN","AAN", "isgreaterequalf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0xffffffff;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0xffffffff;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0xffffffff;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0xffffffff;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0x00000000;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0xffffffff;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isgreaterequalf4");
|
||||
|
||||
res_v = (vec_uint4)isgreaterequalf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060817000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060817000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060817000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060817000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060817000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060817000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060817000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060817000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060817000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterequalf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060817000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/isgreaterf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/isgreaterf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test isgreaterf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060817000000AAN","AAN", "isgreaterf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0xffffffff;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0xffffffff;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0x00000000;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0x00000000;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0xffffffff;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isgreaterf4");
|
||||
|
||||
res_v = (vec_uint4)isgreaterf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060817000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060817000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060817000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060817000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060817000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060817000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060817000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060817000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060817000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isgreaterf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060817000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
225
Extras/simdmathlibrary/spu/tests/isinfd2.c
Normal file
225
Extras/simdmathlibrary/spu/tests/isinfd2.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/* Test isinfd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "isinfd2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0xffffffffffffffffull;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0x0000000000000000ull;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
unsigned long long r3 = 0x0000000000000000ull;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
unsigned long long r4 = 0x0000000000000000ull;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
unsigned long long r6 = 0x0000000000000000ull;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
// +Inf
|
||||
double x9 = hide_double( 1.0e999);
|
||||
unsigned long long r9 = 0xffffffffffffffffull;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
unsigned long long r10 = 0x0000000000000000ull;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
// +Dmax
|
||||
double x13 = hide_double(DBL_MAX);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
// +Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
unsigned long long r14 = 0xffffffffffffffffull;
|
||||
|
||||
//+Nan
|
||||
double x15 = hide_double( nan(""));
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
// Compound
|
||||
vec_double2 x16_v = (vec_double2) {make_double(0x000AAAAAAAAAAAAAull), -1.0e-999 };
|
||||
vec_ullong2 r16_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x17_v = (vec_double2) { 345.27533, -2.40e-310 };
|
||||
vec_ullong2 r17_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x18_v = (vec_double2) { nan(""), 1.0e999 };
|
||||
vec_ullong2 r18_v = (vec_ullong2) {0x0000000000000000ull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x19_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_ullong2 r19_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x20_v = (vec_double2) { -1.0e999, -1.0/0.0} ;
|
||||
vec_ullong2 r20_v = (vec_ullong2) {0xffffffffffffffffull, 0xffffffffffffffffull};
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isinfd2");
|
||||
|
||||
res_v = (vec_ullong2)isinfd2(x0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x17_v);
|
||||
TEST_CHECK("20060830000017AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x18_v);
|
||||
TEST_CHECK("20060830000018AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x19_v);
|
||||
TEST_CHECK("20060830000019AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_ullong2)isinfd2(x20_v);
|
||||
TEST_CHECK("20060830000020AAN", allequal_ullong2( res_v, r20_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
130
Extras/simdmathlibrary/spu/tests/isinff4.c
Normal file
130
Extras/simdmathlibrary/spu/tests/isinff4.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/* Test isinff4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060822000000AAN","AAN", "isinff4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
float x4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0x00000000;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0x00000000;
|
||||
|
||||
float x8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isinff4");
|
||||
|
||||
res_v = (vec_uint4)isinff4(x0_v);
|
||||
TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x1_v);
|
||||
TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x2_v);
|
||||
TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x3_v);
|
||||
TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x4_v);
|
||||
TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x5_v);
|
||||
TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x6_v);
|
||||
TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x7_v);
|
||||
TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x8_v);
|
||||
TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isinff4(x9_v);
|
||||
TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
272
Extras/simdmathlibrary/spu/tests/islessd2.c
Normal file
272
Extras/simdmathlibrary/spu/tests/islessd2.c
Normal file
@@ -0,0 +1,272 @@
|
||||
/* Test islessd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060825000000AAN","AAN", "islessd2");
|
||||
|
||||
//-QNaN: NG
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
//-Inf < -Dmax
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm > -Inf
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(-1.0/0.0);
|
||||
unsigned long long r3 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm < -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm = -Norm
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-168.97345223013);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm > -Norm
|
||||
double x6 = hide_double(-168.97345223013);
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm < -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf > -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf = 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
//-0 = 0
|
||||
double x10 = hide_double(-0.0);
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf = 0
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( 0.0);
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf < +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm > +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm = +Norm
|
||||
double x14 = hide_double(5172.2845321);
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm < +Norm
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(2353705.31415);
|
||||
unsigned long long r15 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm > -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm < +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0xffffffffffffffffull;
|
||||
|
||||
//+Inf > +Dmax
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double(DBL_MAX);
|
||||
unsigned long long r18 = 0x0000000000000000ull;
|
||||
|
||||
//+QNaN: NG
|
||||
double x19 = hide_double(nan(""));
|
||||
double y19 = hide_double(3.14);
|
||||
unsigned long long r19 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("islessd2");
|
||||
|
||||
res_v = (vec_ullong2)islessd2(x0_v, y0_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x1_v, y1_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x2_v, y2_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x3_v, y3_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x4_v, y4_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x5_v, y5_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x6_v, y6_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x7_v, y7_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x8_v, y8_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x9_v, y9_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x10_v, y10_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x11_v, y11_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x12_v, y12_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x13_v, y13_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x14_v, y14_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x15_v, y15_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x16_v, y16_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x17_v, y17_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x18_v, y18_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)islessd2(x19_v, y19_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
271
Extras/simdmathlibrary/spu/tests/islessequald2.c
Normal file
271
Extras/simdmathlibrary/spu/tests/islessequald2.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Test islessequald2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060825000000AAN","AAN", "islessequald2");
|
||||
|
||||
//-QNaN: NG
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
//-Inf < -Dmax
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm > -Inf
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(-1.0/0.0);
|
||||
unsigned long long r3 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm < -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm = -Norm
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-168.97345223013);
|
||||
unsigned long long r5 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm > -Norm
|
||||
double x6 = hide_double(-168.97345223013);
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm < -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf > -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf = 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0xffffffffffffffffull;
|
||||
|
||||
//-0 = 0
|
||||
double x10 = hide_double(-0.0);
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf = 0
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( 0.0);
|
||||
unsigned long long r11 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf < +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm > +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm = +Norm
|
||||
double x14 = hide_double(5172.2845321);
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm < +Norm
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(2353705.31415);
|
||||
unsigned long long r15 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm > -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm < +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0xffffffffffffffffull;
|
||||
|
||||
//+Inf > +Dmax
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double(DBL_MAX);
|
||||
unsigned long long r18 = 0x0000000000000000ull;
|
||||
|
||||
//+QNaN: NG
|
||||
double x19 = hide_double(nan(""));
|
||||
double y19 = hide_double(3.14);
|
||||
unsigned long long r19 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("islessequald2");
|
||||
|
||||
res_v = (vec_ullong2)islessequald2(x0_v, y0_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x1_v, y1_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x2_v, y2_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x3_v, y3_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x4_v, y4_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x5_v, y5_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x6_v, y6_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x7_v, y7_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x8_v, y8_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x9_v, y9_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x10_v, y10_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x11_v, y11_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x12_v, y12_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x13_v, y13_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x14_v, y14_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x15_v, y15_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x16_v, y16_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x17_v, y17_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x18_v, y18_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)islessequald2(x19_v, y19_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/islessequalf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/islessequalf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test islessequalf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060816000000AAN","AAN", "islessequalf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0xffffffff;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0xffffffff;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0xffffffff;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0xffffffff;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0xffffffff;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("islessequalf4");
|
||||
|
||||
res_v = (vec_uint4)islessequalf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060816000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060816000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060816000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060816000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060816000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060816000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060816000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060816000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060816000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)islessequalf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060816000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/islessf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/islessf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test islessf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060815000000AAN","AAN", "islessf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0xffffffff;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0xffffffff;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0x00000000;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0xffffffff;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("islessf4");
|
||||
|
||||
res_v = (vec_uint4)islessf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060815000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060815000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060815000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060815000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060815000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060815000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060815000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060815000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060815000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)islessf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060815000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
271
Extras/simdmathlibrary/spu/tests/islessgreaterd2.c
Normal file
271
Extras/simdmathlibrary/spu/tests/islessgreaterd2.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Test islessgreaterd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060825000000AAN","AAN", "islessgreaterd2");
|
||||
|
||||
//-QNaN: NG
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf > -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0xffffffffffffffffull;
|
||||
|
||||
//-Inf < -Dmax
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm > -Inf
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(-1.0/0.0);
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm < -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm = -Norm
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-168.97345223013);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm > -Norm
|
||||
double x6 = hide_double(-168.97345223013);
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm < -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf > -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf = 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
//-0 = 0
|
||||
double x10 = hide_double(-0.0);
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf = 0
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( 0.0);
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf < +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm > +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm = +Norm
|
||||
double x14 = hide_double(5172.2845321);
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm < +Norm
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(2353705.31415);
|
||||
unsigned long long r15 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm > -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm < +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0xffffffffffffffffull;
|
||||
|
||||
//+Inf > +Dmax
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double(DBL_MAX);
|
||||
unsigned long long r18 = 0xffffffffffffffffull;
|
||||
|
||||
//+QNaN: NG
|
||||
double x19 = hide_double(nan(""));
|
||||
double y19 = hide_double(3.14);
|
||||
unsigned long long r19 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("islessgreaterd2");
|
||||
|
||||
res_v = (vec_ullong2)islessgreaterd2(x0_v, y0_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x1_v, y1_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x2_v, y2_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x3_v, y3_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x4_v, y4_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x5_v, y5_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x6_v, y6_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x7_v, y7_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x8_v, y8_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x9_v, y9_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x10_v, y10_v);
|
||||
TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x11_v, y11_v);
|
||||
TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x12_v, y12_v);
|
||||
TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x13_v, y13_v);
|
||||
TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x14_v, y14_v);
|
||||
TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x15_v, y15_v);
|
||||
TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x16_v, y16_v);
|
||||
TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x17_v, y17_v);
|
||||
TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x18_v, y18_v);
|
||||
TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)islessgreaterd2(x19_v, y19_v);
|
||||
TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/islessgreaterf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/islessgreaterf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test islessgreaterf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060816000000AAN","AAN", "islessgreaterf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0xffffffff;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0xffffffff;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0xffffffff;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0xffffffff;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0x00000000;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0xffffffff;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0xffffffff;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("islessgreaterf4");
|
||||
|
||||
res_v = (vec_uint4)islessgreaterf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060816000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060816000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060816000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060816000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060816000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060816000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060816000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060816000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060816000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)islessgreaterf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060816000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
226
Extras/simdmathlibrary/spu/tests/isnand2.c
Normal file
226
Extras/simdmathlibrary/spu/tests/isnand2.c
Normal file
@@ -0,0 +1,226 @@
|
||||
/* Test isnand2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "isnand2");
|
||||
|
||||
// -QNan
|
||||
double x0 = hide_double(-nan(""));
|
||||
unsigned long long r0 = 0xffffffffffffffffull;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0x0000000000000000ull;
|
||||
|
||||
// -QNaN
|
||||
double x3 = hide_double(make_double(0xFFFFFFFFFFFFFFFFull));
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
// -SNaN
|
||||
double x4 = hide_double(make_double(0xFFF7FFFFFFFFFFFFull));
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
unsigned long long r6 = 0x0000000000000000ull;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
// +Inf
|
||||
double x9 = hide_double( 1.0e999);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
// +QNaN
|
||||
double x10 = hide_double(make_double(0x7FFFFFFFFFFFFFFFull));
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
// +SNaN
|
||||
double x13 = hide_double(make_double(0x7FF3333333333333ull));
|
||||
unsigned long long r13 = 0xffffffffffffffffull;
|
||||
|
||||
// +Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Nan
|
||||
double x15 = hide_double( nan(""));
|
||||
unsigned long long r15 = 0xffffffffffffffffull;
|
||||
|
||||
// Compound
|
||||
vec_double2 x16_v = (vec_double2) {make_double(0xFFF7000000000000ull), -1.0e-999 };
|
||||
vec_ullong2 r16_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x17_v = (vec_double2) { 345.27533, -2.40e-310 };
|
||||
vec_ullong2 r17_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x18_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_ullong2 r18_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x19_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_ullong2 r19_v = (vec_ullong2) {0x0000000000000000ull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x20_v = (vec_double2) { make_double(0x7FF8000000000000ull), -1.0/0.0} ;
|
||||
vec_ullong2 r20_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isnand2");
|
||||
|
||||
res_v = (vec_ullong2)isnand2(x0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x17_v);
|
||||
TEST_CHECK("20060830000017AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x18_v);
|
||||
TEST_CHECK("20060830000018AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x19_v);
|
||||
TEST_CHECK("20060830000019AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_ullong2)isnand2(x20_v);
|
||||
TEST_CHECK("20060830000020AAN", allequal_ullong2( res_v, r20_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
129
Extras/simdmathlibrary/spu/tests/isnanf4.c
Normal file
129
Extras/simdmathlibrary/spu/tests/isnanf4.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Test isnanf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060822000000AAN","AAN", "isnanf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
float x4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0x00000000;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0x00000000;
|
||||
|
||||
float x8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isnanf4");
|
||||
|
||||
res_v = (vec_uint4)isnanf4(x0_v);
|
||||
TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x1_v);
|
||||
TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x2_v);
|
||||
TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x3_v);
|
||||
TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x4_v);
|
||||
TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x5_v);
|
||||
TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x6_v);
|
||||
TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x7_v);
|
||||
TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x8_v);
|
||||
TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isnanf4(x9_v);
|
||||
TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
225
Extras/simdmathlibrary/spu/tests/isnormald2.c
Normal file
225
Extras/simdmathlibrary/spu/tests/isnormald2.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/* Test isnormald2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "isnormald2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
unsigned long long r0 = 0x0000000000000000ull;
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
unsigned long long r6 = 0x0000000000000000ull;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
unsigned long long r10 = 0x0000000000000000ull;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
unsigned long long r11 = 0xffffffffffffffffull;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
unsigned long long r12 = 0xffffffffffffffffull;
|
||||
|
||||
// +Dmax
|
||||
double x13 = hide_double(DBL_MAX);
|
||||
unsigned long long r13 = 0xffffffffffffffffull;
|
||||
|
||||
// +Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+Nan
|
||||
double x15 = hide_double( nan(""));
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
// Compound
|
||||
vec_double2 x16_v = (vec_double2) {make_double(0x000AAAAAAAAAAAAAull), -1.0e-999 };
|
||||
vec_ullong2 r16_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x17_v = (vec_double2) { 345.27533, -2.40e-310 };
|
||||
vec_ullong2 r17_v = (vec_ullong2) {0xffffffffffffffffull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x18_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_ullong2 r18_v = (vec_ullong2) {0x0000000000000000ull, 0xffffffffffffffffull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x19_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_ullong2 r19_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
// Compound
|
||||
vec_double2 x20_v = (vec_double2) { -1.0e-999, -1.0/0.0} ;
|
||||
vec_ullong2 r20_v = (vec_ullong2) {0x0000000000000000ull, 0x0000000000000000ull};
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isnormald2");
|
||||
|
||||
res_v = (vec_ullong2)isnormald2(x0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x17_v);
|
||||
TEST_CHECK("20060830000017AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x18_v);
|
||||
TEST_CHECK("20060830000018AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x19_v);
|
||||
TEST_CHECK("20060830000019AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
res_v = (vec_ullong2)isnormald2(x20_v);
|
||||
TEST_CHECK("20060830000020AAN", allequal_ullong2( res_v, r20_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
130
Extras/simdmathlibrary/spu/tests/isnormalf4.c
Normal file
130
Extras/simdmathlibrary/spu/tests/isnormalf4.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/* Test isnormalf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060822000000AAN","AAN", "isnormalf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0xffffffff;
|
||||
|
||||
float x2 = hide_float( 0.0f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0xffffffff;
|
||||
|
||||
float x4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
float x8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0xffffffff;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
unsigned int r9 = 0xffffffff;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isnormalf4");
|
||||
|
||||
res_v = (vec_uint4)isnormalf4(x0_v);
|
||||
TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x1_v);
|
||||
TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x2_v);
|
||||
TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x3_v);
|
||||
TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x4_v);
|
||||
TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x5_v);
|
||||
TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x6_v);
|
||||
TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x7_v);
|
||||
TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x8_v);
|
||||
TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isnormalf4(x9_v);
|
||||
TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
271
Extras/simdmathlibrary/spu/tests/isunorderedd2.c
Normal file
271
Extras/simdmathlibrary/spu/tests/isunorderedd2.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Test isunorderedd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060830000000AAN","AAN", "isunorderedd2");
|
||||
|
||||
//-QNaN, Norm
|
||||
double x0 = hide_double(-nan(""));
|
||||
double y0 = hide_double(1.0);
|
||||
unsigned long long r0 = 0xffffffffffffffffull;
|
||||
|
||||
//+Inf, -Inf
|
||||
double x1 = hide_double( 1.0/0.0);
|
||||
double y1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0x0000000000000000ull;
|
||||
|
||||
//-Inf, -QNaN
|
||||
double x2 = hide_double(-1.0/0.0);
|
||||
double y2 = hide_double(make_double(0xFFFFFFFFFFFFFFFFull));
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm, -SNaN
|
||||
double x3 = hide_double(-67418234.34256245);
|
||||
double y3 = hide_double(make_double(0xFFF7FFFFFFFFFFFFull));
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm, -Denorm
|
||||
double x4 = hide_double(-273453.3234458053);
|
||||
double y4 = hide_double(-3.0e-321);
|
||||
unsigned long long r4 = 0x0000000000000000ull;
|
||||
|
||||
//-Norm, -Inf
|
||||
double x5 = hide_double(-168.97345223013);
|
||||
double y5 = hide_double(-1.0/0.0);
|
||||
unsigned long long r5 = 0x0000000000000000ull;
|
||||
|
||||
//-QNaN, -Norm
|
||||
double x6 = hide_double(-nan(""));
|
||||
double y6 = hide_double(-21345853556.492);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm, -0
|
||||
double x7 = hide_double(-168.97345223013);
|
||||
double y7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf, -Norm
|
||||
double x8 = hide_double(-1.0e-999);
|
||||
double y8 = hide_double(-83532.96153153);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
//-Unf, 0
|
||||
double x9 = hide_double(-1.0e-999);
|
||||
double y9 = hide_double(0.0);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
//QNaN, 0
|
||||
double x10 = hide_double(make_double(0x7FFFFFFFFFFFFFFFull));
|
||||
double y10 = hide_double( 0.0);
|
||||
unsigned long long r10 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf, +QNaN
|
||||
double x11 = hide_double( 1.0e-999);
|
||||
double y11 = hide_double( nan(""));
|
||||
unsigned long long r11 = 0xffffffffffffffffull;
|
||||
|
||||
//+Unf, +Norm
|
||||
double x12 = hide_double( 1e-999);
|
||||
double y12 = hide_double(0.0031529324);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm, +Denorm
|
||||
double x13 = hide_double(5172.2845321);
|
||||
double y13 = hide_double(3.0e-321);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
//+SNaN, +Norm
|
||||
double x14 = hide_double(make_double(0x7FF3333333333333ull));
|
||||
double y14 = hide_double(5172.2845321);
|
||||
unsigned long long r14 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm, +QNaN
|
||||
double x15 = hide_double(264.345643345);
|
||||
double y15 = hide_double(make_double(0x7FFAAAAAAAAAAAAAull));
|
||||
unsigned long long r15 = 0xffffffffffffffffull;
|
||||
|
||||
//+Norm, -Norm
|
||||
double x16 = hide_double( 926.605118542);
|
||||
double y16 = hide_double(-9.43574552184);
|
||||
unsigned long long r16 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm, +Dmax
|
||||
double x17 = hide_double( 926.605118542);
|
||||
double y17 = hide_double(DBL_MAX);
|
||||
unsigned long long r17 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf, +Ovf
|
||||
double x18 = hide_double( 1.0/0.0);
|
||||
double y18 = hide_double( 1.0e999);
|
||||
unsigned long long r18 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf, +QNaN
|
||||
double x19 = hide_double( 1.0/0.0);
|
||||
double y19 = hide_double(nan(""));
|
||||
unsigned long long r19 = 0xffffffffffffffffull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 y0_v = spu_splats(y0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 y1_v = spu_splats(y1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 y2_v = spu_splats(y2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 y3_v = spu_splats(y3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 y4_v = spu_splats(y4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 y5_v = spu_splats(y5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 y6_v = spu_splats(y6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 y7_v = spu_splats(y7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 y8_v = spu_splats(y8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 y9_v = spu_splats(y9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 y10_v = spu_splats(y10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 y11_v = spu_splats(y11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 y12_v = spu_splats(y12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 y13_v = spu_splats(y13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 y14_v = spu_splats(y14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 y15_v = spu_splats(y15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 y16_v = spu_splats(y16);
|
||||
vec_ullong2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 y17_v = spu_splats(y17);
|
||||
vec_ullong2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 y18_v = spu_splats(y18);
|
||||
vec_ullong2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 y19_v = spu_splats(y19);
|
||||
vec_ullong2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("isunorderedd2");
|
||||
|
||||
res_v = (vec_ullong2)isunorderedd2(x0_v, y0_v);
|
||||
TEST_CHECK("20060830000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x1_v, y1_v);
|
||||
TEST_CHECK("20060830000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x2_v, y2_v);
|
||||
TEST_CHECK("20060830000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x3_v, y3_v);
|
||||
TEST_CHECK("20060830000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x4_v, y4_v);
|
||||
TEST_CHECK("20060830000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x5_v, y5_v);
|
||||
TEST_CHECK("20060830000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x6_v, y6_v);
|
||||
TEST_CHECK("20060830000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x7_v, y7_v);
|
||||
TEST_CHECK("20060830000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x8_v, y8_v);
|
||||
TEST_CHECK("20060830000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x9_v, y9_v);
|
||||
TEST_CHECK("20060830000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x10_v, y10_v);
|
||||
TEST_CHECK("20060830000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x11_v, y11_v);
|
||||
TEST_CHECK("20060830000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x12_v, y12_v);
|
||||
TEST_CHECK("20060830000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x13_v, y13_v);
|
||||
TEST_CHECK("20060830000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x14_v, y14_v);
|
||||
TEST_CHECK("20060830000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x15_v, y15_v);
|
||||
TEST_CHECK("20060830000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x16_v, y16_v);
|
||||
TEST_CHECK("20060830000016AAN", allequal_ullong2( res_v, r16_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x17_v, y17_v);
|
||||
TEST_CHECK("20060830000017AAN", allequal_ullong2( res_v, r17_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x18_v, y18_v);
|
||||
TEST_CHECK("20060830000018AAN", allequal_ullong2( res_v, r18_v ), 0);
|
||||
res_v = (vec_ullong2)isunorderedd2(x19_v, y19_v);
|
||||
TEST_CHECK("20060830000019AAN", allequal_ullong2( res_v, r19_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
150
Extras/simdmathlibrary/spu/tests/isunorderedf4.c
Normal file
150
Extras/simdmathlibrary/spu/tests/isunorderedf4.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Test isunorderedf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060822000000AAN","AAN", "isunorderedf4");
|
||||
|
||||
float x0 = hide_float(-0.0f);
|
||||
float y0 = hide_float( 0.0f);
|
||||
unsigned int r0 = 0x00000000;
|
||||
|
||||
float x1 = hide_float( 1.0/0.0); //+Smax
|
||||
float y1 = hide_float(-1.0/0.0); //-Smax
|
||||
unsigned int r1 = 0x00000000;
|
||||
|
||||
float x2 = hide_float(-0.0000000013152f);
|
||||
float y2 = hide_float(-234245.85323441f);
|
||||
unsigned int r2 = 0x00000000;
|
||||
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
float y3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0x00000000;
|
||||
|
||||
float x4 = hide_float(-83532.96153153f);
|
||||
float y4 = hide_float(-1e-999); //-Smin
|
||||
unsigned int r4 = 0x00000000;
|
||||
|
||||
float x5 = hide_float(-321.01234567f);
|
||||
float y5 = hide_float(876543.12345f);
|
||||
unsigned int r5 = 0x00000000;
|
||||
|
||||
float x6 = hide_float( 1e-999); // Smin
|
||||
float y6 = hide_float(0.0031529324f);
|
||||
unsigned int r6 = 0x00000000;
|
||||
|
||||
float x7 = hide_float(5172.2845321f);
|
||||
float y7 = hide_float(5172.2845321f);
|
||||
unsigned int r7 = 0x00000000;
|
||||
|
||||
float x8 = hide_float(264.345643345f);
|
||||
float y8 = hide_float(2353705.31415f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
float x9 = hide_float( 1.0/0.0); // Smax
|
||||
float y9 = hide_float(9.43574552184f);
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 y0_v = spu_splats(y0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 y1_v = spu_splats(y1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 y2_v = spu_splats(y2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 y3_v = spu_splats(y3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 y4_v = spu_splats(y4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 y5_v = spu_splats(y5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 y6_v = spu_splats(y6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 y7_v = spu_splats(y7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 y8_v = spu_splats(y8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 y9_v = spu_splats(y9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("isunorderedf4");
|
||||
|
||||
res_v = (vec_uint4)isunorderedf4(x0_v, y0_v);
|
||||
TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x1_v, y1_v);
|
||||
TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x2_v, y2_v);
|
||||
TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x3_v, y3_v);
|
||||
TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x4_v, y4_v);
|
||||
TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x5_v, y5_v);
|
||||
TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x6_v, y6_v);
|
||||
TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x7_v, y7_v);
|
||||
TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x8_v, y8_v);
|
||||
TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)isunorderedf4(x9_v, y9_v);
|
||||
TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
250
Extras/simdmathlibrary/spu/tests/ldexpd2.c
Normal file
250
Extras/simdmathlibrary/spu/tests/ldexpd2.c
Normal file
@@ -0,0 +1,250 @@
|
||||
/* Test ldexpd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ ldexpd2 - Multiply Double by 2 Raised to its Power
|
||||
* For large elements of ex (overflow), returns HUGE_VALF
|
||||
* For small elements of ex (underflow), returns 0.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for ldexpd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#undef LDEXPD2_ROUND
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int exp[2];
|
||||
unsigned long long int ans0[2];
|
||||
unsigned long long int ans1[2];
|
||||
unsigned long long int ans2[2];
|
||||
unsigned long long int ans3[2];
|
||||
} TestVec64_Ldexp;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_Ldexp test_a[] = {
|
||||
{
|
||||
// zero
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000400ULL,0xFFFFFFFFFFFFFC00ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// MIN , MAX
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// Inf , -Inf
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
|
||||
},{
|
||||
#ifdef LDEXPD2_ROUND
|
||||
// denotmalized
|
||||
{0x8000000000000003ULL,0x0000000000000003ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x8000000000000002ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000002ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000002ULL,0x0000000000000002ULL}
|
||||
},{
|
||||
// denotmalized -54
|
||||
{0x0010000000000001ULL,0x8010000000000001ULL},
|
||||
{0xFFFFFFFFFFFFFFCAULL,0xFFFFFFFFFFFFFFCAULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// max -> !
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0xFFFFFFFFFFFFF7CEULL,0xFFFFFFFFFFFFF7CEULL},
|
||||
{0x0000000000000001ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000001ULL}
|
||||
},{
|
||||
// max -> !
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0xFFFFFFFFFFFFF7CDULL,0xFFFFFFFFFFFFF7CDULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
#else // LDEXPD2_ROUND
|
||||
// denotmalized
|
||||
{0x8000000000000003ULL,0x0000000000000003ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL}
|
||||
},{
|
||||
|
||||
#endif // LDEXPD2_ROUND
|
||||
// denotmalized
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL}
|
||||
},{
|
||||
// denotmalized
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL}
|
||||
},{
|
||||
// 1.0
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x00000000000003ffULL,0x00000000000003ffULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL}
|
||||
},{
|
||||
// 1.0 -> max
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x0000000000000400ULL,0x0000000000000400ULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// max -> !
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0xFFFFFFFF00000000ULL,0xFFFFFFFF00000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// min->
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// NaN , -NaN
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060905160000NM","NM", "ldexpd2");
|
||||
|
||||
TEST_START("ldexpd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
spu_mtfpscr(((vec_uint4){0x0100,0,0,0}));
|
||||
res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090516%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0);
|
||||
|
||||
#ifdef LDEXPD2_ROUND
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0600,0,0,0}));
|
||||
res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090516%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0b00,0,0,0}));
|
||||
res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090516%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0c00,0,0,0}));
|
||||
res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090516%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0);
|
||||
#endif // LDEXPD2_ROUND
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
94
Extras/simdmathlibrary/spu/tests/llabsi2.c
Normal file
94
Extras/simdmathlibrary/spu/tests/llabsi2.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Test llabsi2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ llabsi2 - returns absolute value of input.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for llabsi2.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060831134500NM","NM", "llabsi2");
|
||||
|
||||
vec_llong2 x0_v = ((vec_llong2){ 0, 0});
|
||||
vec_llong2 r0_v = ((vec_llong2){ 0, 0});
|
||||
|
||||
vec_llong2 x1_v = ((vec_llong2){-1, 1});
|
||||
vec_llong2 r1_v = ((vec_llong2){ 1, 1});
|
||||
|
||||
vec_llong2 x2_v = ((vec_llong2){ 1,-1});
|
||||
vec_llong2 r2_v = ((vec_llong2){ 1, 1});
|
||||
// 0x7FFFFFFFFFFFFFFF
|
||||
vec_llong2 x3_v = ((vec_llong2){ 9223372036854775807LL,-9223372036854775807LL});
|
||||
vec_llong2 r3_v = ((vec_llong2){ 9223372036854775807LL, 9223372036854775807LL});
|
||||
// 0x8000000000000000
|
||||
vec_llong2 x4_v = ((vec_llong2){0x8000000000000000LL,0x8000000000000000LL});
|
||||
vec_llong2 r4_v = ((vec_llong2){0x8000000000000000LL,0x8000000000000000LL});
|
||||
|
||||
vec_llong2 res_v;
|
||||
|
||||
TEST_START("llabsi2");
|
||||
res_v = llabsi2 (x0_v);
|
||||
TEST_CHECK("20060831134501NM", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = llabsi2 (x1_v);
|
||||
TEST_CHECK("20060831134502NM", allequal_llong2( res_v, r1_v ), 0);
|
||||
res_v = llabsi2 (x2_v);
|
||||
TEST_CHECK("20060831134503NM", allequal_llong2( res_v, r2_v ), 0);
|
||||
res_v = llabsi2 (x3_v);
|
||||
TEST_CHECK("20060831134504NM", allequal_llong2( res_v, r3_v ), 0);
|
||||
res_v = llabsi2 (x4_v);
|
||||
TEST_CHECK("20060831134505NM", allequal_llong2( res_v, r4_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
126
Extras/simdmathlibrary/spu/tests/lldivi2.c
Normal file
126
Extras/simdmathlibrary/spu/tests/lldivi2.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/* Test lldivi2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060908152000MH","MH", "lldivi2");
|
||||
|
||||
signed long long x0n = 0x0c0e84c75f216c43ll;
|
||||
signed long long x0d = 0x00000000000abcdell;
|
||||
signed long long x0q = 0x0000011f71fb04cbll;
|
||||
signed long long x0r = 0x0000000000003039ll;
|
||||
signed long long x1n = 0x0c0e84c75f216c43ll;
|
||||
signed long long x1d = 0x0000011f71fb04cbll;
|
||||
signed long long x1q = 0x00000000000abcdell;
|
||||
signed long long x1r = 0x0000000000003039ll;
|
||||
|
||||
signed long long x2n = 0x08e732f9d4baf903ll;
|
||||
signed long long x2d = 0x0000000000976bb6ll;
|
||||
signed long long x2q = 0x0000000f0d55f4d9ll;
|
||||
signed long long x2r = 0x00000000004933bdll;
|
||||
signed long long x3n = 0x08e732f9d4baf903ll;
|
||||
signed long long x3d = 0x0000000f0d55f4d9ll;
|
||||
signed long long x3q = 0x0000000000976bb6ll;
|
||||
signed long long x3r = 0x00000000004933bdll;
|
||||
|
||||
signed long long x4n = 0xffffffffffffffffll;
|
||||
signed long long x4d = 0xfffffffffffffffell;
|
||||
signed long long x4q = 0x0000000000000000ll;
|
||||
signed long long x4r = 0xffffffffffffffffll;
|
||||
signed long long x5n = 0xffffffffffffffffll;
|
||||
signed long long x5d = 0x0000000000000001ll;
|
||||
signed long long x5q = 0xffffffffffffffffll;
|
||||
signed long long x5r = 0x0000000000000000ll;
|
||||
|
||||
signed long long x6n = 0xffffffffffffffffll;
|
||||
signed long long x6d = 0x0000000000000002ll;
|
||||
signed long long x6q = 0x0000000000000000ll;
|
||||
signed long long x6r = 0xffffffffffffffffll;
|
||||
signed long long x7n = 0xffffffffffffffffll;
|
||||
signed long long x7d = 0x7fffffffffffffffll;
|
||||
signed long long x7q = 0x0000000000000000ll;
|
||||
signed long long x7r = 0xffffffffffffffffll;
|
||||
|
||||
signed long long x8n = 0xf8c0d45d0ff344f0ll;
|
||||
signed long long x8d = 0x000019aa3e41e0bdll;
|
||||
signed long long x8q = 0xffffffffffffb7b8ll;
|
||||
signed long long x8r = 0xffffedc119afa218ll;
|
||||
signed long long x9n = 0xf8c0d45d0ff344f0ll;
|
||||
signed long long x9d = 0x000000000009b13bll;
|
||||
signed long long x9q = 0xffffff4097efb39ell;
|
||||
signed long long x9r = 0xfffffffffff6a186ll;
|
||||
|
||||
vec_llong2 x0n_v = (vec_llong2){ x0n, x1n };
|
||||
vec_llong2 x0d_v = (vec_llong2){ x0d, x1d };
|
||||
vec_llong2 x0q_v = (vec_llong2){ x0q, x1q };
|
||||
vec_llong2 x0r_v = (vec_llong2){ x0r, x1r };
|
||||
vec_llong2 x1n_v = (vec_llong2){ x2n, x3n };
|
||||
vec_llong2 x1d_v = (vec_llong2){ x2d, x3d };
|
||||
vec_llong2 x1q_v = (vec_llong2){ x2q, x3q };
|
||||
vec_llong2 x1r_v = (vec_llong2){ x2r, x3r };
|
||||
vec_llong2 x2n_v = (vec_llong2){ x4n, x5n };
|
||||
vec_llong2 x2d_v = (vec_llong2){ x4d, x5d };
|
||||
vec_llong2 x2q_v = (vec_llong2){ x4q, x5q };
|
||||
vec_llong2 x2r_v = (vec_llong2){ x4r, x5r };
|
||||
vec_llong2 x3n_v = (vec_llong2){ x6n, x7n };
|
||||
vec_llong2 x3d_v = (vec_llong2){ x6d, x7d };
|
||||
vec_llong2 x3q_v = (vec_llong2){ x6q, x7q };
|
||||
vec_llong2 x3r_v = (vec_llong2){ x6r, x7r };
|
||||
vec_llong2 x4n_v = (vec_llong2){ x8n, x9n };
|
||||
vec_llong2 x4d_v = (vec_llong2){ x8d, x9d };
|
||||
vec_llong2 x4q_v = (vec_llong2){ x8q, x9q };
|
||||
vec_llong2 x4r_v = (vec_llong2){ x8r, x9r };
|
||||
|
||||
lldivi2_t res;
|
||||
|
||||
TEST_START("lldivi2");
|
||||
res = lldivi2(x0n_v, x0d_v);
|
||||
TEST_CHECK("20060908152001MH", allequal_llong2( res.quot, x0q_v ) && allequal_llong2( res.rem, x0r_v ), 0);
|
||||
res = lldivi2(x1n_v, x1d_v);
|
||||
TEST_CHECK("20060908152002MH", allequal_llong2( res.quot, x1q_v ) && allequal_llong2( res.rem, x1r_v ), 0);
|
||||
res = lldivi2(x2n_v, x2d_v);
|
||||
TEST_CHECK("20060908152003MH", allequal_llong2( res.quot, x2q_v ) && allequal_llong2( res.rem, x2r_v ), 0);
|
||||
res = lldivi2(x3n_v, x3d_v);
|
||||
TEST_CHECK("20060908152004MH", allequal_llong2( res.quot, x3q_v ) && allequal_llong2( res.rem, x3r_v ), 0);
|
||||
res = lldivi2(x4n_v, x4d_v);
|
||||
TEST_CHECK("20060908152005MH", allequal_llong2( res.quot, x4q_v ) && allequal_llong2( res.rem, x4r_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
125
Extras/simdmathlibrary/spu/tests/lldivu2.c
Normal file
125
Extras/simdmathlibrary/spu/tests/lldivu2.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/* Test lldivu2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060904200000MH","MH", "lldivu2");
|
||||
|
||||
unsigned long long x0n = 0x0c0e84c75f216c43ull;
|
||||
unsigned long long x0d = 0x00000000000abcdeull;
|
||||
unsigned long long x0q = 0x0000011f71fb04cbull;
|
||||
unsigned long long x0r = 0x0000000000003039ull;
|
||||
unsigned long long x1n = 0x0c0e84c75f216c43ull;
|
||||
unsigned long long x1d = 0x0000011f71fb04cbull;
|
||||
unsigned long long x1q = 0x00000000000abcdeull;
|
||||
unsigned long long x1r = 0x0000000000003039ull;
|
||||
|
||||
unsigned long long x2n = 0x08e732f9d4baf903ull;
|
||||
unsigned long long x2d = 0x0000000000976bb6ull;
|
||||
unsigned long long x2q = 0x0000000f0d55f4d9ull;
|
||||
unsigned long long x2r = 0x00000000004933bdull;
|
||||
unsigned long long x3n = 0x08e732f9d4baf903ull;
|
||||
unsigned long long x3d = 0x0000000f0d55f4d9ull;
|
||||
unsigned long long x3q = 0x0000000000976bb6ull;
|
||||
unsigned long long x3r = 0x00000000004933bdull;
|
||||
|
||||
unsigned long long x4n = 0xffffffffffffffffull;
|
||||
unsigned long long x4d = 0xfffffffffffffffeull;
|
||||
unsigned long long x4q = 0x0000000000000001ull;
|
||||
unsigned long long x4r = 0x0000000000000001ull;
|
||||
unsigned long long x5n = 0xffffffffffffffffull;
|
||||
unsigned long long x5d = 0x0000000000000001ull;
|
||||
unsigned long long x5q = 0xffffffffffffffffull;
|
||||
unsigned long long x5r = 0x0000000000000000ull;
|
||||
|
||||
unsigned long long x6n = 0xffffffffffffffffull;
|
||||
unsigned long long x6d = 0x0000000000000002ull;
|
||||
unsigned long long x6q = 0x7fffffffffffffffull;
|
||||
unsigned long long x6r = 0x0000000000000001ull;
|
||||
unsigned long long x7n = 0xffffffffffffffffull;
|
||||
unsigned long long x7d = 0x7fffffffffffffffull;
|
||||
unsigned long long x7q = 0x0000000000000002ull;
|
||||
unsigned long long x7r = 0x0000000000000001ull;
|
||||
|
||||
unsigned long long x8n = 0xf8c0d45d0ff344f0ull;
|
||||
unsigned long long x8d = 0x000019aa3e41e0bdull;
|
||||
unsigned long long x8q = 0x000000000009b13bull;
|
||||
unsigned long long x8r = 0x000004c443bccc61ull;
|
||||
unsigned long long x9n = 0xf8c0d45d0ff344f0ull;
|
||||
unsigned long long x9d = 0x000000000009b13bull;
|
||||
unsigned long long x9q = 0x000019aa3ebfc739ull;
|
||||
unsigned long long x9r = 0x000000000000f1cdull;
|
||||
|
||||
vec_ullong2 x0n_v = (vec_ullong2){ x0n, x1n };
|
||||
vec_ullong2 x0d_v = (vec_ullong2){ x0d, x1d };
|
||||
vec_ullong2 x0q_v = (vec_ullong2){ x0q, x1q };
|
||||
vec_ullong2 x0r_v = (vec_ullong2){ x0r, x1r };
|
||||
vec_ullong2 x1n_v = (vec_ullong2){ x2n, x3n };
|
||||
vec_ullong2 x1d_v = (vec_ullong2){ x2d, x3d };
|
||||
vec_ullong2 x1q_v = (vec_ullong2){ x2q, x3q };
|
||||
vec_ullong2 x1r_v = (vec_ullong2){ x2r, x3r };
|
||||
vec_ullong2 x2n_v = (vec_ullong2){ x4n, x5n };
|
||||
vec_ullong2 x2d_v = (vec_ullong2){ x4d, x5d };
|
||||
vec_ullong2 x2q_v = (vec_ullong2){ x4q, x5q };
|
||||
vec_ullong2 x2r_v = (vec_ullong2){ x4r, x5r };
|
||||
vec_ullong2 x3n_v = (vec_ullong2){ x6n, x7n };
|
||||
vec_ullong2 x3d_v = (vec_ullong2){ x6d, x7d };
|
||||
vec_ullong2 x3q_v = (vec_ullong2){ x6q, x7q };
|
||||
vec_ullong2 x3r_v = (vec_ullong2){ x6r, x7r };
|
||||
vec_ullong2 x4n_v = (vec_ullong2){ x8n, x9n };
|
||||
vec_ullong2 x4d_v = (vec_ullong2){ x8d, x9d };
|
||||
vec_ullong2 x4q_v = (vec_ullong2){ x8q, x9q };
|
||||
vec_ullong2 x4r_v = (vec_ullong2){ x8r, x9r };
|
||||
|
||||
lldivu2_t res;
|
||||
|
||||
TEST_START("lldivu2");
|
||||
res = lldivu2(x0n_v, x0d_v);
|
||||
TEST_CHECK("20060904200001MH", allequal_ullong2( res.quot, x0q_v ) && allequal_ullong2( res.rem, x0r_v ), 0);
|
||||
res = lldivu2(x1n_v, x1d_v);
|
||||
TEST_CHECK("20060904200002MH", allequal_ullong2( res.quot, x1q_v ) && allequal_ullong2( res.rem, x1r_v ), 0);
|
||||
res = lldivu2(x2n_v, x2d_v);
|
||||
TEST_CHECK("20060904200003MH", allequal_ullong2( res.quot, x2q_v ) && allequal_ullong2( res.rem, x2r_v ), 0);
|
||||
res = lldivu2(x3n_v, x3d_v);
|
||||
TEST_CHECK("20060904200004MH", allequal_ullong2( res.quot, x3q_v ) && allequal_ullong2( res.rem, x3r_v ), 0);
|
||||
res = lldivu2(x4n_v, x4d_v);
|
||||
TEST_CHECK("20060904200005MH", allequal_ullong2( res.quot, x4q_v ) && allequal_ullong2( res.rem, x4r_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
215
Extras/simdmathlibrary/spu/tests/llrintd2.c
Normal file
215
Extras/simdmathlibrary/spu/tests/llrintd2.c
Normal file
@@ -0,0 +1,215 @@
|
||||
/* Test llrintd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ llrintd2 - rounds two doubles in to two nearest 64bit integer.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for llrintd2.
|
||||
* consistent with the current rounding mode.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef union {
|
||||
unsigned long long int ll;
|
||||
double x;
|
||||
} SrcType64;
|
||||
SrcType64 tmp64;
|
||||
TEST_SET_START("20060921101000NM","NM", "llrintd2");
|
||||
|
||||
// unsigned long long i11 = 0x7FFFFFFFFFFFFDFFull; //limit
|
||||
// unsigned long long i12 = 0xFFFFFFFFFFFFFDFFull; //limit
|
||||
|
||||
// double x0 = hide_double(-1.0/0.0); // -Inf
|
||||
// double x1 = hide_double(1.0/0.0); // Inf
|
||||
double x2 = hide_double(0.0); // +0
|
||||
double x3 = hide_double(-0.0); // -0
|
||||
// double x4 = hide_double(0.0/0.0); // NaN -> NaN
|
||||
double x5 = hide_double( 0.5);
|
||||
double x6 = hide_double(-0.5);
|
||||
double x7 = hide_double( 0.4999999999999999); // 0
|
||||
double x8 = hide_double(-0.4999999999999999); // 0
|
||||
double x9 = hide_double( 999999999999999.5); // 1000000000000000
|
||||
double x10 = hide_double(-999999999999999.5); //-1000000000000000
|
||||
// double x11 = hide_double(make_double(i11)); // 9223372036854774784
|
||||
// double x12 = hide_double(make_double(i12)); //-9223372036854774784
|
||||
double x11 = hide_double(9223372036854774784ll); // 9223372036854774784
|
||||
double x12 = hide_double(-9223372036854774784ll); //-9223372036854774784
|
||||
double x13 = DBL_MIN;
|
||||
double x14 = (0.0 - DBL_MIN);
|
||||
|
||||
double x15 = hide_double( 0.5000000000000001);
|
||||
double x16 = hide_double(-0.000001);
|
||||
|
||||
tmp64.ll = 0x3FEFFFFFFFFFFFFFULL;
|
||||
double x17 = tmp64.x;
|
||||
tmp64.ll = 0xC32FFFFFFFFFFFFFULL;
|
||||
double x18 = tmp64.x;
|
||||
|
||||
vec_double2 x0_v = ((vec_double2){x2, x3}); //+0,-0
|
||||
vec_llong2 r0_v = ((vec_llong2){0,0}); // 0, 0
|
||||
vec_double2 x1_v = ((vec_double2){x5, x8}); //+0.5,-0.4999999999999999
|
||||
vec_llong2 r10_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r11_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r12_v = ((vec_llong2){1,0});
|
||||
vec_llong2 r13_v = ((vec_llong2){0,-1});
|
||||
vec_double2 x2_v = ((vec_double2){x7, x6}); //+0.4999999999999999, -0.5
|
||||
vec_llong2 r20_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r21_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r22_v = ((vec_llong2){1,0});
|
||||
vec_llong2 r23_v = ((vec_llong2){0,-1});
|
||||
vec_double2 x3_v = ((vec_double2){x10, x11}); //-999999999999999.5, 9223372036854774784
|
||||
vec_llong2 r30_v = ((vec_llong2){-1000000000000000ll,9223372036854774784ll});
|
||||
vec_llong2 r31_v = ((vec_llong2){-999999999999999ll, 9223372036854774784ll});
|
||||
vec_llong2 r32_v = ((vec_llong2){-999999999999999ll, 9223372036854774784ll});
|
||||
vec_llong2 r33_v = ((vec_llong2){-1000000000000000ll,9223372036854774784ll});
|
||||
vec_double2 x4_v = ((vec_double2){x12, x9}); //-9223372036854774784, 999999999999999.5
|
||||
vec_llong2 r40_v = ((vec_llong2){-9223372036854774784ll,1000000000000000ll});
|
||||
vec_llong2 r41_v = ((vec_llong2){-9223372036854774784ll,999999999999999ll});
|
||||
vec_llong2 r42_v = ((vec_llong2){-9223372036854774784ll,1000000000000000ll});
|
||||
vec_llong2 r43_v = ((vec_llong2){-9223372036854774784ll,999999999999999ll});
|
||||
vec_double2 x5_v = ((vec_double2){x13, x14});
|
||||
vec_llong2 r50_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r51_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r52_v = ((vec_llong2){1,0});
|
||||
vec_llong2 r53_v = ((vec_llong2){0,-1});
|
||||
vec_double2 x6_v = ((vec_double2){x15, x16});
|
||||
vec_llong2 r60_v = ((vec_llong2){1,0});
|
||||
vec_llong2 r61_v = ((vec_llong2){0,0});
|
||||
vec_llong2 r62_v = ((vec_llong2){1,0});
|
||||
vec_llong2 r63_v = ((vec_llong2){0,-1});
|
||||
|
||||
vec_double2 x7_v = ((vec_double2){x17, x18});
|
||||
vec_llong2 r70_v = ((vec_llong2){1,-4503599627370496LL});
|
||||
vec_llong2 r71_v = ((vec_llong2){0,-4503599627370495LL});
|
||||
vec_llong2 r72_v = ((vec_llong2){1,-4503599627370495LL});
|
||||
vec_llong2 r73_v = ((vec_llong2){0,-4503599627370496LL});
|
||||
|
||||
vec_llong2 res_v;
|
||||
|
||||
TEST_START("llrintd2");
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0000,0,0,0})); //change FP mode
|
||||
res_v = llrintd2 (x0_v);
|
||||
TEST_CHECK("20060921101001NM", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = llrintd2 (x1_v);
|
||||
TEST_CHECK("20060921101002NM", allequal_llong2( res_v, r10_v ), 0);
|
||||
res_v = llrintd2 (x2_v);
|
||||
TEST_CHECK("20060921101003NM", allequal_llong2( res_v, r20_v ), 0);
|
||||
res_v = llrintd2 (x3_v);
|
||||
TEST_CHECK("20060921101004NM", allequal_llong2( res_v, r30_v ), 0);
|
||||
res_v = llrintd2 (x4_v);
|
||||
TEST_CHECK("20060921101005NM", allequal_llong2( res_v, r40_v ), 0);
|
||||
res_v = llrintd2 (x5_v);
|
||||
TEST_CHECK("20060921101006NM", allequal_llong2( res_v, r50_v ), 0);
|
||||
res_v = llrintd2 (x6_v);
|
||||
TEST_CHECK("20060921101007NM", allequal_llong2( res_v, r60_v ), 0);
|
||||
res_v = llrintd2 (x7_v);
|
||||
TEST_CHECK("20060921101017NM", allequal_llong2( res_v, r70_v ), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0500,0,0,0})); //change FP mode
|
||||
res_v = llrintd2 (x0_v);
|
||||
TEST_CHECK("20060921101008NM", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = llrintd2 (x1_v);
|
||||
TEST_CHECK("20060921101009NM", allequal_llong2( res_v, r11_v ), 0);
|
||||
res_v = llrintd2 (x2_v);
|
||||
TEST_CHECK("20060921101010NM", allequal_llong2( res_v, r21_v ), 0);
|
||||
res_v = llrintd2 (x3_v);
|
||||
TEST_CHECK("20060921101011NM", allequal_llong2( res_v, r31_v ), 0);
|
||||
res_v = llrintd2 (x4_v);
|
||||
TEST_CHECK("20060921101012NM", allequal_llong2( res_v, r41_v ), 0);
|
||||
res_v = llrintd2 (x5_v);
|
||||
TEST_CHECK("20060921101013NM", allequal_llong2( res_v, r51_v ), 0);
|
||||
res_v = llrintd2 (x6_v);
|
||||
TEST_CHECK("20060921101014NM", allequal_llong2( res_v, r61_v ), 0);
|
||||
res_v = llrintd2 (x7_v);
|
||||
TEST_CHECK("20060921101027NM", allequal_llong2( res_v, r71_v ), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0a00,0,0,0})); //change FP mode
|
||||
res_v = llrintd2 (x0_v);
|
||||
TEST_CHECK("20060921101015NM", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = llrintd2 (x1_v);
|
||||
TEST_CHECK("20060921101016NM", allequal_llong2( res_v, r12_v ), 0);
|
||||
res_v = llrintd2 (x2_v);
|
||||
TEST_CHECK("20060921101017NM", allequal_llong2( res_v, r22_v ), 0);
|
||||
res_v = llrintd2 (x3_v);
|
||||
TEST_CHECK("20060921101018NM", allequal_llong2( res_v, r32_v ), 0);
|
||||
res_v = llrintd2 (x4_v);
|
||||
TEST_CHECK("20060921101019NM", allequal_llong2( res_v, r42_v ), 0);
|
||||
res_v = llrintd2 (x5_v);
|
||||
TEST_CHECK("20060921101020NM", allequal_llong2( res_v, r52_v ), 0);
|
||||
res_v = llrintd2 (x6_v);
|
||||
TEST_CHECK("20060921101021NM", allequal_llong2( res_v, r62_v ), 0);
|
||||
res_v = llrintd2 (x7_v);
|
||||
TEST_CHECK("20060921101037NM", allequal_llong2( res_v, r72_v ), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0f00,0,0,0})); //change FP mode
|
||||
res_v = llrintd2 (x0_v);
|
||||
TEST_CHECK("20060921101022NM", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = llrintd2 (x1_v);
|
||||
TEST_CHECK("20060921101023NM", allequal_llong2( res_v, r13_v ), 0);
|
||||
res_v = llrintd2 (x2_v);
|
||||
TEST_CHECK("20060921101024NM", allequal_llong2( res_v, r23_v ), 0);
|
||||
res_v = llrintd2 (x3_v);
|
||||
TEST_CHECK("20060921101025NM", allequal_llong2( res_v, r33_v ), 0);
|
||||
res_v = llrintd2 (x4_v);
|
||||
TEST_CHECK("20060921101026NM", allequal_llong2( res_v, r43_v ), 0);
|
||||
res_v = llrintd2 (x5_v);
|
||||
TEST_CHECK("20060921101027NM", allequal_llong2( res_v, r53_v ), 0);
|
||||
res_v = llrintd2 (x6_v);
|
||||
TEST_CHECK("20060921101028NM", allequal_llong2( res_v, r63_v ), 0);
|
||||
res_v = llrintd2 (x7_v);
|
||||
TEST_CHECK("20060921101047NM", allequal_llong2( res_v, r73_v ), 0);
|
||||
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
124
Extras/simdmathlibrary/spu/tests/llrintf4.c
Normal file
124
Extras/simdmathlibrary/spu/tests/llrintf4.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Test llrintf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ llrintf4 - rounds four floats in to four nearest 64bit integer.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for llrintf4. On SPU the rounding mode for floats is always towards 0.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
static inline llroundf4_t set_llrintf4_t(long long int in0, long long int in1, long long int in2, long long int in3)
|
||||
{
|
||||
llroundf4_t res;
|
||||
|
||||
res.vll[0] = ((vec_llong2){in0,in1});
|
||||
res.vll[1] = ((vec_llong2){in2,in3});
|
||||
|
||||
return res;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060918101000NM","NM", "llrintf4");
|
||||
|
||||
// unsigned long i11 = 0x5efffffful; // 9223371487098961920
|
||||
// unsigned long i12 = 0xdefffffful; //-9223371487098961920
|
||||
// unsigned long i11 = 0x49fffffful; //2097151.875000
|
||||
// unsigned long i12 = 0x4a7ffffful; //4194303.750000
|
||||
|
||||
// float x0 = hide_float(-1.0/0.0); // -Inf
|
||||
// float x1 = hide_float(1.0/0.0); // Inf
|
||||
float x2 = hide_float(0.0); // +0
|
||||
float x3 = hide_float(-0.0); // -0
|
||||
// float x4 = hide_float(0.0/0.0); // NaN -> NaN
|
||||
float x5 = hide_float( 0.5);
|
||||
float x6 = hide_float(-0.5);
|
||||
float x7 = hide_float(-0.499999);
|
||||
float x8 = hide_float( 0.499999);
|
||||
float x9 = hide_float(-999999.5);
|
||||
float x10 = hide_float( 999999.5);
|
||||
// float x11 = hide_float(make_float(i11));
|
||||
// float x12 = hide_float(make_float(i12));
|
||||
float x11 = hide_float( 9223371487098961920.);
|
||||
float x12 = hide_float(-9223371487098961920.);
|
||||
float x13 = (0.0 - FLT_MIN);
|
||||
float x14 = FLT_MIN;
|
||||
float x15 = hide_float(-2097151.875000);
|
||||
float x16 = hide_float(-4194303.750000);
|
||||
float x17 = hide_float( 4194303.750000);
|
||||
float x18 = hide_float( 2097151.875000);
|
||||
|
||||
vec_float4 x0_v = ((vec_float4){ x2, x3, x5, x6});
|
||||
llroundf4_t r0_v = set_llrintf4_t(0, 0, 0, 0);
|
||||
|
||||
vec_float4 x1_v = ((vec_float4){ x7, x8, x9, x10});
|
||||
llroundf4_t r1_v = set_llrintf4_t(0, 0, -999999, 999999);
|
||||
|
||||
vec_float4 x2_v = ((vec_float4){ x11, x12, x13, x14});
|
||||
llroundf4_t r2_v = set_llrintf4_t(9223371487098961920ll, -9223371487098961920ll, 0, 0);
|
||||
|
||||
vec_float4 x3_v = ((vec_float4){ x15, x16, x17, x18});
|
||||
llroundf4_t r3_v = set_llrintf4_t(-2097151, -4194303, 4194303, 2097151);
|
||||
|
||||
llroundf4_t res_v;
|
||||
|
||||
TEST_START("llrintf4");
|
||||
res_v = llrintf4 (x0_v);
|
||||
TEST_CHECK("20060918101001NM", allequal_llroundf4( res_v, r0_v ), 0);
|
||||
res_v = llrintf4 (x1_v);
|
||||
TEST_CHECK("20060918101002NM", allequal_llroundf4( res_v, r1_v ), 0);
|
||||
res_v = llrintf4 (x2_v);
|
||||
TEST_CHECK("20060918101003NM", allequal_llroundf4( res_v, r2_v ), 0);
|
||||
res_v = llrintf4 (x3_v);
|
||||
TEST_CHECK("20060918101004NM", allequal_llroundf4( res_v, r3_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
114
Extras/simdmathlibrary/spu/tests/llroundd2.c
Normal file
114
Extras/simdmathlibrary/spu/tests/llroundd2.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/* Test llroundd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ llroundd2 - rounds two doubles in to two nearest 64bit integer.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for llroundd2. 0.5 will be rounded to far from 0.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060916101000NM","NM", "llroundd2");
|
||||
|
||||
// unsigned long long i11 = 0x7FFFFFFFFFFFFDFFull; //limit
|
||||
// unsigned long long i12 = 0xFFFFFFFFFFFFFDFFull; //limit
|
||||
|
||||
// double x0 = hide_double(-1.0/0.0); // -Inf
|
||||
// double x1 = hide_double(1.0/0.0); // Inf
|
||||
double x2 = hide_double(0.0); // +0
|
||||
double x3 = hide_double(-0.0); // -0
|
||||
// double x4 = hide_double(0.0/0.0); // NaN -> NaN
|
||||
double x5 = hide_double( 0.5);
|
||||
double x6 = hide_double(-0.5);
|
||||
double x7 = hide_double( 0.4999999999999999); // 0
|
||||
double x8 = hide_double(-0.4999999999999999); // 0
|
||||
double x9 = hide_double( 999999999999999.5); // 1000000000000000
|
||||
double x10 = hide_double(-999999999999999.5); //-1000000000000000
|
||||
// double x11 = hide_double(make_double(i11)); // 9223372036854774784
|
||||
// double x12 = hide_double(make_double(i12)); //-9223372036854774784
|
||||
double x11 = hide_double(9223372036854774784ll); // 9223372036854774784
|
||||
double x12 = hide_double(-9223372036854774784ll); //-9223372036854774784
|
||||
double x13 = DBL_MIN;
|
||||
double x14 = (0.0 - DBL_MIN);
|
||||
|
||||
vec_double2 x0_v = ((vec_double2){x2, x3}); //+0,-0
|
||||
vec_llong2 r0_v = ((vec_llong2){0,0}); // 0, 0
|
||||
vec_double2 x1_v = ((vec_double2){x5, x8}); //+0.5,-0.4999999999999999
|
||||
vec_llong2 r1_v = ((vec_llong2){1,0}); // 1, 0
|
||||
vec_double2 x2_v = ((vec_double2){x7, x6}); //+0.4999999999999999, -0.5
|
||||
vec_llong2 r2_v = ((vec_llong2){0,-1}); // 0, -1
|
||||
vec_double2 x3_v = ((vec_double2){x10, x11}); //-999999999999999.5, 9223372036854774784
|
||||
vec_llong2 r3_v = ((vec_llong2){-1000000000000000ll,9223372036854774784ll});
|
||||
vec_double2 x4_v = ((vec_double2){x12, x9}); //-9223372036854774784, 999999999999999.5
|
||||
vec_llong2 r4_v = ((vec_llong2){-9223372036854774784ll,1000000000000000ll});
|
||||
vec_double2 x5_v = ((vec_double2){x13, x14});
|
||||
vec_llong2 r5_v = ((vec_llong2){0,0});
|
||||
|
||||
vec_llong2 res_v;
|
||||
|
||||
TEST_START("llroundd2");
|
||||
res_v = llroundd2 (x0_v);
|
||||
TEST_CHECK("20060916101001NM", allequal_llong2( res_v, r0_v ), 0);
|
||||
res_v = llroundd2 (x1_v);
|
||||
TEST_CHECK("20060916101002NM", allequal_llong2( res_v, r1_v ), 0);
|
||||
res_v = llroundd2 (x2_v);
|
||||
TEST_CHECK("20060916101003NM", allequal_llong2( res_v, r2_v ), 0);
|
||||
res_v = llroundd2 (x3_v);
|
||||
TEST_CHECK("20060916101004NM", allequal_llong2( res_v, r3_v ), 0);
|
||||
res_v = llroundd2 (x4_v);
|
||||
TEST_CHECK("20060916101005NM", allequal_llong2( res_v, r4_v ), 0);
|
||||
res_v = llroundd2 (x5_v);
|
||||
TEST_CHECK("20060916101006NM", allequal_llong2( res_v, r5_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
126
Extras/simdmathlibrary/spu/tests/llroundf4.c
Normal file
126
Extras/simdmathlibrary/spu/tests/llroundf4.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/* Test llroundf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ llroundf4 - rounds four floats in to four nearest 64bit integer.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for llroundf4. 0.5 will be rounded to far from 0.
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
* when comparing with return of ppu scalar math library
|
||||
* answer of 0x??7fffff and 0x??ffffff was something strange
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
static inline llroundf4_t set_llroundf4_t(long long int in0, long long int in1, long long int in2, long long int in3)
|
||||
{
|
||||
llroundf4_t res;
|
||||
|
||||
res.vll[0] = ((vec_llong2){in0,in1});
|
||||
res.vll[1] = ((vec_llong2){in2,in3});
|
||||
|
||||
return res;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060917101000NM","NM", "llroundf4");
|
||||
|
||||
// unsigned long i11 = 0x5efffffful; // 9223371487098961920
|
||||
// unsigned long i12 = 0xdefffffful; //-9223371487098961920
|
||||
// unsigned long i11 = 0x49fffffful; //2097151.875000
|
||||
// unsigned long i12 = 0x4a7ffffful; //4194303.750000
|
||||
|
||||
// float x0 = hide_float(-1.0/0.0); // -Inf
|
||||
// float x1 = hide_float(1.0/0.0); // Inf
|
||||
float x2 = hide_float(0.0); // +0
|
||||
float x3 = hide_float(-0.0); // -0
|
||||
// float x4 = hide_float(0.0/0.0); // NaN -> NaN
|
||||
float x5 = hide_float( 0.5);
|
||||
float x6 = hide_float(-0.5);
|
||||
float x7 = hide_float(-0.499999);
|
||||
float x8 = hide_float( 0.499999);
|
||||
float x9 = hide_float(-999999.5);
|
||||
float x10 = hide_float( 999999.5);
|
||||
// float x11 = hide_float(make_float(i11));
|
||||
// float x12 = hide_float(make_float(i12));
|
||||
float x11 = hide_float( 9223371487098961920.);
|
||||
float x12 = hide_float(-9223371487098961920.);
|
||||
float x13 = (0.0 - FLT_MIN);
|
||||
float x14 = FLT_MIN;
|
||||
float x15 = hide_float(-2097151.875000);
|
||||
float x16 = hide_float(-4194303.750000);
|
||||
float x17 = hide_float( 4194303.750000);
|
||||
float x18 = hide_float( 2097151.875000);
|
||||
|
||||
vec_float4 x0_v = ((vec_float4){ x2, x3, x5, x6});
|
||||
llroundf4_t r0_v = set_llroundf4_t(0, 0, 1, -1);
|
||||
|
||||
vec_float4 x1_v = ((vec_float4){ x7, x8, x9, x10});
|
||||
llroundf4_t r1_v = set_llroundf4_t(0, 0, -1000000, 1000000);
|
||||
|
||||
vec_float4 x2_v = ((vec_float4){ x11, x12, x13, x14});
|
||||
llroundf4_t r2_v = set_llroundf4_t(9223371487098961920ll, -9223371487098961920ll, 0, 0);
|
||||
|
||||
vec_float4 x3_v = ((vec_float4){ x15, x16, x17, x18});
|
||||
llroundf4_t r3_v = set_llroundf4_t(-2097152, -4194304, 4194304, 2097152);
|
||||
|
||||
llroundf4_t res_v;
|
||||
|
||||
TEST_START("llroundf4");
|
||||
res_v = llroundf4 (x0_v);
|
||||
TEST_CHECK("20060916101001NM", allequal_llroundf4( res_v, r0_v ), 0);
|
||||
res_v = llroundf4 (x1_v);
|
||||
TEST_CHECK("20060916101002NM", allequal_llroundf4( res_v, r1_v ), 0);
|
||||
res_v = llroundf4 (x2_v);
|
||||
TEST_CHECK("20060916101003NM", allequal_llroundf4( res_v, r2_v ), 0);
|
||||
res_v = llroundf4 (x3_v);
|
||||
TEST_CHECK("20060916101004NM", allequal_llroundf4( res_v, r3_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
326
Extras/simdmathlibrary/spu/tests/logbd2.c
Normal file
326
Extras/simdmathlibrary/spu/tests/logbd2.c
Normal file
@@ -0,0 +1,326 @@
|
||||
/* Test logbd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#ifndef HUGE_VALL
|
||||
#define HUGE_VALL __builtin_huge_vall ()
|
||||
#endif
|
||||
|
||||
#ifndef DBL_INF
|
||||
#define DBL_INF ((long long)0x7FF0000000000000ull)
|
||||
#endif
|
||||
|
||||
#ifndef DBL_NAN
|
||||
#define DBL_NAN ((long long)0x7FF8000000000000ull)
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060905000000AAN","AAN", "logbd2");
|
||||
|
||||
// -Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
double r0 = hide_double( nan(""));
|
||||
|
||||
// -Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
double r1 = hide_double(make_double(DBL_INF));
|
||||
|
||||
// -Dmax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
double r2 = 1023.0;
|
||||
|
||||
// -Norm
|
||||
double x3 = hide_double(-824842.58421394);
|
||||
double r3 = 19.0;
|
||||
|
||||
// -Dmin
|
||||
double x4 = hide_double(-DBL_MIN);
|
||||
double r4 = -1022.0;
|
||||
|
||||
// -Denorm
|
||||
double x5 = hide_double(-2.40e-310);
|
||||
double r5 = -1029.0;
|
||||
|
||||
// -Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
double r6 = make_double(-((unsigned long long)HUGE_VALL));
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
double r7 = make_double(-((unsigned long long)HUGE_VALL));
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
double r8 = make_double(-((unsigned long long)HUGE_VALL));
|
||||
|
||||
// +Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
double r9 = make_double(-((unsigned long long)HUGE_VALL));
|
||||
|
||||
// +Denorm
|
||||
double x10 = hide_double( 2.40e-310);
|
||||
double r10 = -1029.0;
|
||||
|
||||
// +Dmin
|
||||
double x11 = hide_double( DBL_MIN);
|
||||
double r11 = -1022.0;
|
||||
|
||||
// +Norm
|
||||
double x12 = hide_double(3.14152634);
|
||||
double r12 = 1.0;
|
||||
|
||||
// +Norm
|
||||
double x13 = hide_double(7.0673903e149);
|
||||
double r13 = 497.0;
|
||||
|
||||
// +Norm
|
||||
double x14 = hide_double(2.4673e304);
|
||||
double r14 = 1011.0;
|
||||
|
||||
// +Norm
|
||||
double x15 = hide_double(7.235672e-25);
|
||||
double r15 = -81.0;
|
||||
|
||||
// +Denorm
|
||||
double x16 = hide_double(9.452854e-312);
|
||||
double r16 = -1034.0;
|
||||
|
||||
// +Demorm
|
||||
double x17 = hide_double(3.045784e-320);
|
||||
double r17 = -1062.0;
|
||||
|
||||
// -Norm
|
||||
double x18 = hide_double(-6.459273e7);
|
||||
double r18 = 25.0;
|
||||
|
||||
// -Norm
|
||||
double x19 = hide_double(-2.493472e-99);
|
||||
double r19 = -328.0;
|
||||
|
||||
// -Norm
|
||||
double x20 = hide_double(-1.4824543e128);
|
||||
double r20 = 425.0;
|
||||
|
||||
// -Denorm
|
||||
double x21 = hide_double(-5.53856231e-315);
|
||||
double r21 = -1044.0;
|
||||
|
||||
// -Demorm
|
||||
double x22 = hide_double(-2.5684367e-312);
|
||||
double r22 = -1036.0;
|
||||
|
||||
// +Dmax
|
||||
double x23 = hide_double(DBL_MAX);
|
||||
double r23 = 1023.0;
|
||||
|
||||
// +Inf
|
||||
double x24 = hide_double( 1.0/0.0);
|
||||
double r24 = hide_double(make_double(DBL_INF));
|
||||
|
||||
//+Nan
|
||||
double x25 = hide_double( nan(""));
|
||||
double r25 = hide_double( nan(""));
|
||||
|
||||
// Compound
|
||||
vec_double2 x26_v = (vec_double2) { -2.561286432e-317, -1.0e-999 };
|
||||
vec_double2 r26_v = (vec_double2) { -1052.0, make_double(-((unsigned long long)HUGE_VALL)) };
|
||||
|
||||
// Compound
|
||||
vec_double2 x27_v = (vec_double2) { 345.27533, -8.673e-310 };
|
||||
vec_double2 r27_v = (vec_double2) { 8.0, -1027.0 };
|
||||
|
||||
// Compound
|
||||
vec_double2 x28_v = (vec_double2) { nan(""), -3678342.8765343 };
|
||||
vec_double2 r28_v = (vec_double2) { nan(""), 21.0 };
|
||||
|
||||
// Compound
|
||||
vec_double2 x29_v = (vec_double2) { 1.0/0.0, -nan("") };
|
||||
vec_double2 r29_v = (vec_double2) { make_double(DBL_INF), nan("") };
|
||||
|
||||
// Compound
|
||||
vec_double2 x30_v = (vec_double2) { -1.2e-99, -1.0/0.0 } ;
|
||||
vec_double2 r30_v = (vec_double2) { -329.0, make_double(DBL_INF) };
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_double2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_double2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_double2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_double2 x16_v = spu_splats(x16);
|
||||
vec_double2 r16_v = spu_splats(r16);
|
||||
|
||||
vec_double2 x17_v = spu_splats(x17);
|
||||
vec_double2 r17_v = spu_splats(r17);
|
||||
|
||||
vec_double2 x18_v = spu_splats(x18);
|
||||
vec_double2 r18_v = spu_splats(r18);
|
||||
|
||||
vec_double2 x19_v = spu_splats(x19);
|
||||
vec_double2 r19_v = spu_splats(r19);
|
||||
|
||||
vec_double2 x20_v = spu_splats(x20);
|
||||
vec_double2 r20_v = spu_splats(r20);
|
||||
|
||||
vec_double2 x21_v = spu_splats(x21);
|
||||
vec_double2 r21_v = spu_splats(r21);
|
||||
|
||||
vec_double2 x22_v = spu_splats(x22);
|
||||
vec_double2 r22_v = spu_splats(r22);
|
||||
|
||||
vec_double2 x23_v = spu_splats(x23);
|
||||
vec_double2 r23_v = spu_splats(r23);
|
||||
|
||||
vec_double2 x24_v = spu_splats(x24);
|
||||
vec_double2 r24_v = spu_splats(r24);
|
||||
|
||||
vec_double2 x25_v = spu_splats(x25);
|
||||
vec_double2 r25_v = spu_splats(r25);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("logbd2");
|
||||
|
||||
res_v = (vec_double2)logbd2(x0_v);
|
||||
TEST_CHECK("20060905000000AAN", allnan_double2( res_v ), 0); (void)r0_v;
|
||||
res_v = (vec_double2)logbd2(x1_v);
|
||||
TEST_CHECK("20060905000001AAN", allequal_double2( res_v, r1_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x2_v);
|
||||
TEST_CHECK("20060905000002AAN", allequal_double2( res_v, r2_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x3_v);
|
||||
TEST_CHECK("20060905000003AAN", allequal_double2( res_v, r3_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x4_v);
|
||||
TEST_CHECK("20060905000004AAN", allequal_double2( res_v, r4_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x5_v);
|
||||
TEST_CHECK("20060905000005AAN", allequal_double2( res_v, r5_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x6_v);
|
||||
TEST_CHECK("20060905000006AAN", allequal_double2( res_v, r6_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x7_v);
|
||||
TEST_CHECK("20060905000007AAN", allequal_double2( res_v, r7_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x8_v);
|
||||
TEST_CHECK("20060905000008AAN", allequal_double2( res_v, r8_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x9_v);
|
||||
TEST_CHECK("20060905000009AAN", allequal_double2( res_v, r9_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x10_v);
|
||||
TEST_CHECK("20060905000010AAN", allequal_double2( res_v, r10_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x11_v);
|
||||
TEST_CHECK("20060905000011AAN", allequal_double2( res_v, r11_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x12_v);
|
||||
TEST_CHECK("20060905000012AAN", allequal_double2( res_v, r12_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x13_v);
|
||||
TEST_CHECK("20060905000013AAN", allequal_double2( res_v, r13_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x14_v);
|
||||
TEST_CHECK("20060905000014AAN", allequal_double2( res_v, r14_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x15_v);
|
||||
TEST_CHECK("20060905000015AAN", allequal_double2( res_v, r15_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x16_v);
|
||||
TEST_CHECK("20060905000016AAN", allequal_double2( res_v, r16_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x17_v);
|
||||
TEST_CHECK("20060905000017AAN", allequal_double2( res_v, r17_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x18_v);
|
||||
TEST_CHECK("20060905000018AAN", allequal_double2( res_v, r18_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x19_v);
|
||||
TEST_CHECK("20060905000019AAN", allequal_double2( res_v, r19_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x20_v);
|
||||
TEST_CHECK("20060905000020AAN", allequal_double2( res_v, r20_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x21_v);
|
||||
TEST_CHECK("20060905000021AAN", allequal_double2( res_v, r21_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x22_v);
|
||||
TEST_CHECK("20060905000022AAN", allequal_double2( res_v, r22_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x23_v);
|
||||
TEST_CHECK("20060905000023AAN", allequal_double2( res_v, r23_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x24_v);
|
||||
TEST_CHECK("20060905000024AAN", allequal_double2( res_v, r24_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x25_v);
|
||||
TEST_CHECK("20060905000025AAN", allnan_double2( res_v ), 0); (void)r25_v;
|
||||
res_v = (vec_double2)logbd2(x26_v);
|
||||
TEST_CHECK("20060905000026AAN", allequal_double2( res_v, r26_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x27_v);
|
||||
TEST_CHECK("20060905000027AAN", allequal_double2( res_v, r27_v ), 0);
|
||||
res_v = (vec_double2)logbd2(x28_v);
|
||||
TEST_CHECK("20060905000028AAN", allequal_ulps_double2( res_v, r28_v, 0 ), 0);
|
||||
res_v = (vec_double2)logbd2(x29_v);
|
||||
TEST_CHECK("20060905000029AAN", allequal_ulps_double2( res_v, r29_v, 0 ), 0);
|
||||
res_v = (vec_double2)logbd2(x30_v);
|
||||
TEST_CHECK("20060905000030AAN", allequal_double2( res_v, r30_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
320
Extras/simdmathlibrary/spu/tests/logbf4.c
Normal file
320
Extras/simdmathlibrary/spu/tests/logbf4.c
Normal file
@@ -0,0 +1,320 @@
|
||||
/* Test logbf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#ifndef HUGE_VALF
|
||||
#define HUGE_VALF __builtin_huge_valf ()
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060905000000AAN","AAN", "logbf4");
|
||||
|
||||
// -Norm (IEEE-754: -Nan)
|
||||
float x0 = hide_float(make_float(0xFFC00000));
|
||||
float r0 = 128.0f;
|
||||
|
||||
// -Norm (IEEE-754: -Inf)
|
||||
float x1 = hide_float(-1.0/0.0);
|
||||
float r1 = 128.0f;
|
||||
|
||||
// -Smax
|
||||
float x2 = hide_float(-FLT_MAX);
|
||||
float r2 = 128.0f;
|
||||
|
||||
// -Norm
|
||||
float x3 = hide_float(-824842.58421394);
|
||||
float r3 = 19.0f;
|
||||
|
||||
// -Smin
|
||||
float x4 = hide_float(make_float(0x80800000));
|
||||
float r4 = -126.0f;
|
||||
|
||||
// -Denorm
|
||||
float x5 = hide_float(make_float(0x807AAAAA));
|
||||
float r5 = (float)-HUGE_VALF;
|
||||
|
||||
// -Unf
|
||||
float x6 = hide_float(-1.0e-999);
|
||||
float r6 = (float)-HUGE_VALF;
|
||||
|
||||
// -0
|
||||
float x7 = hide_float(-0.0);
|
||||
float r7 = (float)-HUGE_VALF;
|
||||
|
||||
// 0
|
||||
float x8 = hide_float( 0.0);
|
||||
float r8 = (float)-HUGE_VALF;
|
||||
|
||||
// +Unf
|
||||
float x9 = hide_float( 1.0e-999);
|
||||
float r9 = (float)-HUGE_VALF;
|
||||
|
||||
// +Denorm
|
||||
float x10 = hide_float(make_float(0x007AAAAA));
|
||||
float r10 = (float)-HUGE_VALF;
|
||||
|
||||
// +Smin
|
||||
float x11 = hide_float(make_float(0x00800000));
|
||||
float r11 = -126.0f;
|
||||
|
||||
// +Norm
|
||||
float x12 = hide_float(3.14152634);
|
||||
float r12 = 1.0f;
|
||||
|
||||
// +Norm
|
||||
float x13 = hide_float(7.0673903e37);
|
||||
float r13 = 125.0f;
|
||||
|
||||
// +Norm
|
||||
float x14 = hide_float(2.4673e14);
|
||||
float r14 = 47.0f;
|
||||
|
||||
// +Norm
|
||||
float x15 = hide_float(7.235672e-25);
|
||||
float r15 = -81.0f;
|
||||
|
||||
// +Norm
|
||||
float x16 = hide_float(9.452854e17);
|
||||
float r16 = 59.0f;
|
||||
|
||||
// +Norm
|
||||
float x17 = hide_float(3.045784e-18);
|
||||
float r17 = -59.0f;
|
||||
|
||||
// -Norm
|
||||
float x18 = hide_float(-6.459273e7);
|
||||
float r18 = 25.0f;
|
||||
|
||||
// -Norm
|
||||
float x19 = hide_float(-2.493472e-9);
|
||||
float r19 = -29.0f;
|
||||
|
||||
// -Norm
|
||||
float x20 = hide_float(-1.4824543e28);
|
||||
float r20 = 93.0f;
|
||||
|
||||
// -Norm
|
||||
float x21 = hide_float(-5.53856231e-27);
|
||||
float r21 = -88.0f;
|
||||
|
||||
// -Norm
|
||||
float x22 = hide_float(-1.000001);
|
||||
float r22 = 0.0f;
|
||||
|
||||
// +Smax
|
||||
float x23 = hide_float(FLT_MAX);
|
||||
float r23 = 128.0f;
|
||||
|
||||
//+Norm (IEEE-754: +Inf)
|
||||
float x24 = hide_float( 1.0/0.0);
|
||||
float r24 = 128.0f;
|
||||
|
||||
//+Norm (IEEE-754: +Nan)
|
||||
float x25 = hide_float(make_float(0x7FC00000));
|
||||
float r25 = 128.0f;
|
||||
|
||||
// Compound
|
||||
vec_float4 x26_v = (vec_float4) { -2.561286432e10, FLT_MAX, -1.0e-999, 7.235672e-25 };
|
||||
vec_float4 r26_v = (vec_float4) { 34.0f, 128.0f, -HUGE_VALF, -81.0f };
|
||||
|
||||
// Compound
|
||||
vec_float4 x27_v = (vec_float4) { 345.27533f, 7.0673903e37, -0.0f, -2.40e-310 };
|
||||
vec_float4 r27_v = (vec_float4) { 8.0f, 125.0f, -HUGE_VALF, -HUGE_VALF };
|
||||
|
||||
// Compound
|
||||
vec_float4 x28_v = (vec_float4) { make_float(0x7FC00000), -824842.58421394f, -0.0f, -3678342.8765343f };
|
||||
vec_float4 r28_v = (vec_float4) { 128.0f, 19.0f, -HUGE_VALF, 21.0f };
|
||||
|
||||
// Compound
|
||||
vec_float4 x29_v = (vec_float4) { 1.0/0.0, 1.0e-99, -5.53856231e-27, make_float(0xFFC00000) };
|
||||
vec_float4 r29_v = (vec_float4) { 128.0f, -HUGE_VALF, -88.0f, 128.0f };
|
||||
|
||||
// Compound
|
||||
vec_float4 x30_v = (vec_float4) { 1.2e-57, -1.2e-19, 3.045784e-18, -1.0/0.0 } ;
|
||||
vec_float4 r30_v = (vec_float4) { -HUGE_VALF, -63.0f, -59.0f, 128.0f };
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_float4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_float4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_float4 r10_v = spu_splats(r10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_float4 r11_v = spu_splats(r11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_float4 r12_v = spu_splats(r12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_float4 r13_v = spu_splats(r13);
|
||||
|
||||
vec_float4 x14_v = spu_splats(x14);
|
||||
vec_float4 r14_v = spu_splats(r14);
|
||||
|
||||
vec_float4 x15_v = spu_splats(x15);
|
||||
vec_float4 r15_v = spu_splats(r15);
|
||||
|
||||
vec_float4 x16_v = spu_splats(x16);
|
||||
vec_float4 r16_v = spu_splats(r16);
|
||||
|
||||
vec_float4 x17_v = spu_splats(x17);
|
||||
vec_float4 r17_v = spu_splats(r17);
|
||||
|
||||
vec_float4 x18_v = spu_splats(x18);
|
||||
vec_float4 r18_v = spu_splats(r18);
|
||||
|
||||
vec_float4 x19_v = spu_splats(x19);
|
||||
vec_float4 r19_v = spu_splats(r19);
|
||||
|
||||
vec_float4 x20_v = spu_splats(x20);
|
||||
vec_float4 r20_v = spu_splats(r20);
|
||||
|
||||
vec_float4 x21_v = spu_splats(x21);
|
||||
vec_float4 r21_v = spu_splats(r21);
|
||||
|
||||
vec_float4 x22_v = spu_splats(x22);
|
||||
vec_float4 r22_v = spu_splats(r22);
|
||||
|
||||
vec_float4 x23_v = spu_splats(x23);
|
||||
vec_float4 r23_v = spu_splats(r23);
|
||||
|
||||
vec_float4 x24_v = spu_splats(x24);
|
||||
vec_float4 r24_v = spu_splats(r24);
|
||||
|
||||
vec_float4 x25_v = spu_splats(x25);
|
||||
vec_float4 r25_v = spu_splats(r25);
|
||||
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("logbf4");
|
||||
|
||||
res_v = (vec_float4)logbf4(x0_v);
|
||||
TEST_CHECK("20060905000000AAN", allequal_float4( res_v, r0_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x1_v);
|
||||
TEST_CHECK("20060905000001AAN", allequal_float4( res_v, r1_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x2_v);
|
||||
TEST_CHECK("20060905000002AAN", allequal_float4( res_v, r2_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x3_v);
|
||||
TEST_CHECK("20060905000003AAN", allequal_float4( res_v, r3_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x4_v);
|
||||
TEST_CHECK("20060905000004AAN", allequal_float4( res_v, r4_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x5_v);
|
||||
TEST_CHECK("20060905000005AAN", allequal_float4( res_v, r5_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x6_v);
|
||||
TEST_CHECK("20060905000006AAN", allequal_float4( res_v, r6_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x7_v);
|
||||
TEST_CHECK("20060905000007AAN", allequal_float4( res_v, r7_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x8_v);
|
||||
TEST_CHECK("20060905000008AAN", allequal_float4( res_v, r8_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x9_v);
|
||||
TEST_CHECK("20060905000009AAN", allequal_float4( res_v, r9_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x10_v);
|
||||
TEST_CHECK("20060905000010AAN", allequal_float4( res_v, r10_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x11_v);
|
||||
TEST_CHECK("20060905000011AAN", allequal_float4( res_v, r11_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x12_v);
|
||||
TEST_CHECK("20060905000012AAN", allequal_float4( res_v, r12_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x13_v);
|
||||
TEST_CHECK("20060905000013AAN", allequal_float4( res_v, r13_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x14_v);
|
||||
TEST_CHECK("20060905000014AAN", allequal_float4( res_v, r14_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x15_v);
|
||||
TEST_CHECK("20060905000015AAN", allequal_float4( res_v, r15_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x16_v);
|
||||
TEST_CHECK("20060905000016AAN", allequal_float4( res_v, r16_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x17_v);
|
||||
TEST_CHECK("20060905000017AAN", allequal_float4( res_v, r17_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x18_v);
|
||||
TEST_CHECK("20060905000018AAN", allequal_float4( res_v, r18_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x19_v);
|
||||
TEST_CHECK("20060905000019AAN", allequal_float4( res_v, r19_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x20_v);
|
||||
TEST_CHECK("20060905000020AAN", allequal_float4( res_v, r20_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x21_v);
|
||||
TEST_CHECK("20060905000021AAN", allequal_float4( res_v, r21_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x22_v);
|
||||
TEST_CHECK("20060905000022AAN", allequal_float4( res_v, r22_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x23_v);
|
||||
TEST_CHECK("20060905000023AAN", allequal_float4( res_v, r23_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x24_v);
|
||||
TEST_CHECK("20060905000024AAN", allequal_float4( res_v, r24_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x25_v);
|
||||
TEST_CHECK("20060905000025AAN", allequal_float4( res_v, r25_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x26_v);
|
||||
TEST_CHECK("20060905000026AAN", allequal_float4( res_v, r26_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x27_v);
|
||||
TEST_CHECK("20060905000027AAN", allequal_float4( res_v, r27_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x28_v);
|
||||
TEST_CHECK("20060905000028AAN", allequal_float4( res_v, r28_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x29_v);
|
||||
TEST_CHECK("20060905000029AAN", allequal_float4( res_v, r29_v ), 0);
|
||||
res_v = (vec_float4)logbf4(x30_v);
|
||||
TEST_CHECK("20060905000030AAN", allequal_float4( res_v, r30_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
109
Extras/simdmathlibrary/spu/tests/modfd2.c
Normal file
109
Extras/simdmathlibrary/spu/tests/modfd2.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/* Test modfd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060901173000MH", "MH", "modfd2");
|
||||
|
||||
unsigned long long i3 = 0x432fffffffffffffull; // 2^52 - 0.5, largest truncatable value.
|
||||
unsigned long long i3i = 0x432ffffffffffffeull;
|
||||
unsigned long long i4 = 0x4330000000000000ull; // 2^53, no fractional part.
|
||||
unsigned long long i5 = 0xcff0000000000001ull; // one more large, and negative, value.
|
||||
|
||||
double x0 = hide_double(0.91825);
|
||||
double x0i = hide_double(0.0);
|
||||
double x0f = hide_double(0.91825);
|
||||
|
||||
double x1 = hide_double(-0.12958);
|
||||
double x1i = hide_double(0.0);
|
||||
double x1f = hide_double(-0.12958);
|
||||
|
||||
double x2 = hide_double(-79615.1875);
|
||||
double x2i = hide_double(-79615.0);
|
||||
double x2f = hide_double(-0.1875);
|
||||
|
||||
double x3 = hide_double(make_double(i3));
|
||||
double x3i = hide_double(make_double(i3i));
|
||||
double x3f = hide_double(0.5);
|
||||
|
||||
double x4 = hide_double(make_double(i4));
|
||||
double x4i = hide_double(make_double(i4));
|
||||
double x4f = hide_double(0.0);
|
||||
|
||||
double x5 = hide_double(make_double(i5));
|
||||
double x5i = hide_double(make_double(i5));
|
||||
double x5f = hide_double(0.0);
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 x0i_v = spu_splats(x0i);
|
||||
vec_double2 x0f_v = spu_splats(x0f);
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 x1i_v = spu_splats(x1i);
|
||||
vec_double2 x1f_v = spu_splats(x1f);
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 x2i_v = spu_splats(x2i);
|
||||
vec_double2 x2f_v = spu_splats(x2f);
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 x3i_v = spu_splats(x3i);
|
||||
vec_double2 x3f_v = spu_splats(x3f);
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 x4i_v = spu_splats(x4i);
|
||||
vec_double2 x4f_v = spu_splats(x4f);
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 x5i_v = spu_splats(x5i);
|
||||
vec_double2 x5f_v = spu_splats(x5f);
|
||||
|
||||
vec_double2 integer_v, fraction_v;
|
||||
|
||||
TEST_START("modff4");
|
||||
fraction_v = modfd2(x0_v, &integer_v);
|
||||
TEST_CHECK("20040916170647EJL", allequal_double2( integer_v, x0i_v ) && allequal_double2( fraction_v, x0f_v ), 0);
|
||||
fraction_v = modfd2(x1_v, &integer_v);
|
||||
TEST_CHECK("20040916170650EJL", allequal_double2( integer_v, x1i_v ) && allequal_double2( fraction_v, x1f_v ), 0);
|
||||
fraction_v = modfd2(x2_v, &integer_v);
|
||||
TEST_CHECK("20040916170653EJL", allequal_double2( integer_v, x2i_v ) && allequal_double2( fraction_v, x2f_v ), 0);
|
||||
fraction_v = modfd2(x3_v, &integer_v);
|
||||
TEST_CHECK("20040916170656EJL", allequal_double2( integer_v, x3i_v ) && allequal_double2( fraction_v, x3f_v ), 0);
|
||||
fraction_v = modfd2(x4_v, &integer_v);
|
||||
TEST_CHECK("20040916170658EJL", allequal_double2( integer_v, x4i_v ) && allequal_double2( fraction_v, x4f_v ), 0);
|
||||
fraction_v = modfd2(x5_v, &integer_v);
|
||||
TEST_CHECK("20040916170701EJL", allequal_double2( integer_v, x5i_v ) && allequal_double2( fraction_v, x5f_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
124
Extras/simdmathlibrary/spu/tests/modff4.c
Normal file
124
Extras/simdmathlibrary/spu/tests/modff4.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Test modff4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040916170642EJL", "EJL", "modff");
|
||||
|
||||
unsigned int i3 = 0x4affffff; // 2^23 - 0.5, largest truncatable value.
|
||||
unsigned int i3i = 0x4afffffe;
|
||||
unsigned int i4 = 0x4b000000; // 2^23, no fractional part.
|
||||
unsigned int i5 = 0xcf000001; // -2^31, one more large, and negative, value.
|
||||
|
||||
float x0 = hide_float(0.91825f);
|
||||
float x0i = hide_float(0.0f);
|
||||
float x0f = hide_float(0.91825f);
|
||||
|
||||
float x1 = hide_float(-0.12958f);
|
||||
float x1i = hide_float(0.0f);
|
||||
float x1f = hide_float(-0.12958f);
|
||||
|
||||
float x2 = hide_float(-79615.1875f);
|
||||
float x2i = hide_float(-79615.0f);
|
||||
float x2f = hide_float(-0.1875f);
|
||||
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3i = hide_float(make_float(i3i));
|
||||
float x3f = hide_float(0.5f);
|
||||
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4i = hide_float(make_float(i4));
|
||||
float x4f = hide_float(0.0f);
|
||||
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5i = hide_float(make_float(i5));
|
||||
float x5f = hide_float(0.0f);
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 x0i_v = spu_splats(x0i);
|
||||
vec_float4 x0f_v = spu_splats(x0f);
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 x1i_v = spu_splats(x1i);
|
||||
vec_float4 x1f_v = spu_splats(x1f);
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 x2i_v = spu_splats(x2i);
|
||||
vec_float4 x2f_v = spu_splats(x2f);
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3i_v = spu_splats(x3i);
|
||||
vec_float4 x3f_v = spu_splats(x3f);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4i_v = spu_splats(x4i);
|
||||
vec_float4 x4f_v = spu_splats(x4f);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5i_v = spu_splats(x5i);
|
||||
vec_float4 x5f_v = spu_splats(x5f);
|
||||
|
||||
float integer, fraction;
|
||||
vec_float4 integer_v, fraction_v;
|
||||
|
||||
TEST_START("modff4");
|
||||
fraction_v = modff4(x0_v, &integer_v);
|
||||
TEST_CHECK("20040916170647EJL", allequal_float4( integer_v, x0i_v ) && allequal_float4( fraction_v, x0f_v ), 0);
|
||||
fraction_v = modff4(x1_v, &integer_v);
|
||||
TEST_CHECK("20040916170650EJL", allequal_float4( integer_v, x1i_v ) && allequal_float4( fraction_v, x1f_v ), 0);
|
||||
fraction_v = modff4(x2_v, &integer_v);
|
||||
TEST_CHECK("20040916170653EJL", allequal_float4( integer_v, x2i_v ) && allequal_float4( fraction_v, x2f_v ), 0);
|
||||
fraction_v = modff4(x3_v, &integer_v);
|
||||
TEST_CHECK("20040916170656EJL", allequal_float4( integer_v, x3i_v ) && allequal_float4( fraction_v, x3f_v ), 0);
|
||||
fraction_v = modff4(x4_v, &integer_v);
|
||||
TEST_CHECK("20040916170658EJL", allequal_float4( integer_v, x4i_v ) && allequal_float4( fraction_v, x4f_v ), 0);
|
||||
fraction_v = modff4(x5_v, &integer_v);
|
||||
TEST_CHECK("20040916170701EJL", allequal_float4( integer_v, x5i_v ) && allequal_float4( fraction_v, x5f_v ), 0);
|
||||
|
||||
TEST_START("modff");
|
||||
fraction = modff(x0, &integer);
|
||||
TEST_CHECK("20040916170704EJL", integer == x0i && fraction == x0f, 0);
|
||||
fraction = modff(x1, &integer);
|
||||
TEST_CHECK("20040916170706EJL", integer == x1i && fraction == x1f, 0);
|
||||
fraction = modff(x2, &integer);
|
||||
TEST_CHECK("20040916170709EJL", integer == x2i && fraction == x2f, 0);
|
||||
fraction = modff(x3, &integer);
|
||||
TEST_CHECK("20040916170711EJL", integer == x3i && fraction == x3f, 0);
|
||||
fraction = modff(x4, &integer);
|
||||
TEST_CHECK("20040916170714EJL", integer == x4i && fraction == x4f, 0);
|
||||
fraction = modff(x5, &integer);
|
||||
TEST_CHECK("20040916170716EJL", integer == x5i && fraction == x5f, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
178
Extras/simdmathlibrary/spu/tests/nearbyintd2.c
Normal file
178
Extras/simdmathlibrary/spu/tests/nearbyintd2.c
Normal file
@@ -0,0 +1,178 @@
|
||||
/* Test nearbyintd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ nearbyintd2 - Round the input to the nearest integer according to
|
||||
* the current rounding mode without raising an inexact exception.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for nearbyintd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int ans0[2];
|
||||
unsigned long long int ans1[2];
|
||||
unsigned long long int ans2[2];
|
||||
unsigned long long int ans3[2];
|
||||
} TestVec64_NerI;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_NerI test_a[] = {
|
||||
{
|
||||
// zero
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// border
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL}
|
||||
},{
|
||||
// MIN , MAX
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// Inf , -Inf
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
|
||||
},{
|
||||
// denotmalized
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x3ff0000000000000ULL},
|
||||
{0xbff0000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
// denotmalized
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0xbff0000000000000ULL}
|
||||
},{
|
||||
// 1.0
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL}
|
||||
},{
|
||||
// 1.5
|
||||
{0x3ff8000000000000ULL,0xbff8000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc000000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x4000000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xc000000000000000ULL}
|
||||
},{
|
||||
// 2.5
|
||||
{0x4004000000000000ULL,0xc004000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc000000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc000000000000000ULL},
|
||||
{0x4008000000000000ULL,0xc000000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc008000000000000ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060829200000NM","NM", "nearbyintd2");
|
||||
|
||||
TEST_START("nearbyintd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
spu_mtfpscr(((vec_uint4){0x0000,0,0,0}));
|
||||
res_v = nearbyintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006082920%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0500,0,0,0}));
|
||||
res_v = nearbyintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006082920%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0a00,0,0,0}));
|
||||
res_v = nearbyintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006082920%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0f00,0,0,0}));
|
||||
res_v = nearbyintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006082920%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
95
Extras/simdmathlibrary/spu/tests/nearbyintf4.c
Normal file
95
Extras/simdmathlibrary/spu/tests/nearbyintf4.c
Normal file
@@ -0,0 +1,95 @@
|
||||
/* Test nearbyintf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#define DEFINE_DATA(var,a,b) \
|
||||
float var = hide_float(a); \
|
||||
float var ## _out = hide_float(b); \
|
||||
vec_float4 var ## _v = spu_splats(var); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
/*
|
||||
*/
|
||||
#define DEFINE_DATA_UNSIGNED(var,a,b)\
|
||||
unsigned int var ## _ina = a ; \
|
||||
unsigned int var ## _inb = b ; \
|
||||
float var = make_float(var ## _ina); \
|
||||
float var ## _out = make_float(var ## _inb); \
|
||||
vec_float4 var ## _v = spu_splats(var); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
#define DO_TEST(var,id) \
|
||||
res_v = nearbyintf4(var ## _v); \
|
||||
TEST_CHECK(" #id ", allequal_float4( res_v, var ## _out_v ), 0);
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_SET_START("625018616200","NBI", "nearbyintf4");
|
||||
|
||||
|
||||
|
||||
|
||||
//s=0, e=100, f=7fffff --> s=0, e=100, f=7fffff
|
||||
DEFINE_DATA_UNSIGNED(x1,0x71ffffff,0x71ffffff)
|
||||
//s=0, e=22, f=0x7fffff --> s=0,e=22,f=0x7ffffe
|
||||
DEFINE_DATA_UNSIGNED(x2, 0x4affffff,0x4afffffe)
|
||||
//s=0, e=23, f=0 --> s=0,e=23,f=0
|
||||
DEFINE_DATA_UNSIGNED(x3, 0x4b000000,0x4b000000)
|
||||
//s=0, e=-126, f=0 --> 0
|
||||
DEFINE_DATA_UNSIGNED(x4, 0x800000,0x0)
|
||||
DEFINE_DATA(x5, 1.001f, 1.f)
|
||||
DEFINE_DATA(x6, -.05f, 0.f)
|
||||
DEFINE_DATA(x7, 0.9999f, 0.f)
|
||||
DEFINE_DATA(x8, 0.4999f, 0.f)
|
||||
|
||||
TEST_START("nearbyintf4");
|
||||
DO_TEST(x1,625018616201NBI)
|
||||
DO_TEST(x2,625018616202NBI)
|
||||
DO_TEST(x3,625018616203NBI)
|
||||
DO_TEST(x4,625018616204NBI)
|
||||
DO_TEST(x5,625018616205NBI)
|
||||
DO_TEST(x6,625018616206NBI)
|
||||
DO_TEST(x7,625018616207NBI)
|
||||
DO_TEST(x8,625018616208NBI)
|
||||
TEST_SET_DONE();
|
||||
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
83
Extras/simdmathlibrary/spu/tests/negated2.c
Normal file
83
Extras/simdmathlibrary/spu/tests/negated2.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/* Test negated2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040930102626EJL","EJL", "negated2");
|
||||
|
||||
double x0n = hide_double(-0.0);
|
||||
double x0p = hide_double(0.0);
|
||||
double x1n = hide_double(-83532.96153153);
|
||||
double x1p = hide_double(83532.96153153);
|
||||
double x2n = hide_double(-0.0000000013152);
|
||||
double x2p = hide_double(0.0000000013152);
|
||||
double x3n = hide_double(-1.0/0.0);
|
||||
double x3p = hide_double(1.0/0.0);
|
||||
|
||||
vec_double2 x0n_v = spu_splats(x0n);
|
||||
vec_double2 x0p_v = spu_splats(x0p);
|
||||
vec_double2 x1n_v = spu_splats(x1n);
|
||||
vec_double2 x1p_v = spu_splats(x1p);
|
||||
vec_double2 x2n_v = spu_splats(x2n);
|
||||
vec_double2 x2p_v = spu_splats(x2p);
|
||||
vec_double2 x3n_v = spu_splats(x3n);
|
||||
vec_double2 x3p_v = spu_splats(x3p);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("negated2");
|
||||
res_v = negated2(x0n_v);
|
||||
TEST_CHECK("20040930102629EJL", allequal_double2( res_v, x0p_v ), 0);
|
||||
res_v = negated2(x0p_v);
|
||||
TEST_CHECK("20040930102631EJL", allequal_double2( res_v, x0n_v ), 0);
|
||||
res_v = negated2(x1n_v);
|
||||
TEST_CHECK("20040930102632EJL", allequal_double2( res_v, x1p_v ), 0);
|
||||
res_v = negated2(x1p_v);
|
||||
TEST_CHECK("20040930102635EJL", allequal_double2( res_v, x1n_v ), 0);
|
||||
res_v = negated2(x2n_v);
|
||||
TEST_CHECK("20040930102637EJL", allequal_double2( res_v, x2p_v ), 0);
|
||||
res_v = negated2(x2p_v);
|
||||
TEST_CHECK("20040930102639EJL", allequal_double2( res_v, x2n_v ), 0);
|
||||
res_v = negated2(x3n_v);
|
||||
TEST_CHECK("20040930102641EJL", allposinf_double2( res_v ), 0);
|
||||
res_v = negated2(x3p_v);
|
||||
TEST_CHECK("20040930102643EJL", allneginf_double2( res_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
87
Extras/simdmathlibrary/spu/tests/negatef4.c
Normal file
87
Extras/simdmathlibrary/spu/tests/negatef4.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* Test negatef4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040930102649EJL","EJL", "negatef4");
|
||||
|
||||
unsigned int i3n = 0xffffffff;
|
||||
unsigned int i3p = 0x7fffffff;
|
||||
|
||||
float x0n = hide_float(-0.0f);
|
||||
float x0p = hide_float(0.0f);
|
||||
float x1n = hide_float(-83532.96153153f);
|
||||
float x1p = hide_float(83532.96153153f);
|
||||
float x2n = hide_float(-0.0000000013152f);
|
||||
float x2p = hide_float(0.0000000013152f);
|
||||
float x3n = hide_float(make_float(i3n));
|
||||
float x3p = hide_float(make_float(i3p));
|
||||
|
||||
vec_float4 x0n_v = spu_splats(x0n);
|
||||
vec_float4 x0p_v = spu_splats(x0p);
|
||||
vec_float4 x1n_v = spu_splats(x1n);
|
||||
vec_float4 x1p_v = spu_splats(x1p);
|
||||
vec_float4 x2n_v = spu_splats(x2n);
|
||||
vec_float4 x2p_v = spu_splats(x2p);
|
||||
vec_float4 x3n_v = spu_splats(x3n);
|
||||
vec_float4 x3p_v = spu_splats(x3p);
|
||||
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("negatef4");
|
||||
res_v = negatef4(x0n_v);
|
||||
TEST_CHECK("20040930102652EJL", allequal_float4( res_v, x0p_v ), 0);
|
||||
res_v = negatef4(x0p_v);
|
||||
TEST_CHECK("20040930102653EJL", allequal_float4( res_v, x0n_v ), 0);
|
||||
res_v = negatef4(x1n_v);
|
||||
TEST_CHECK("20040930102655EJL", allequal_float4( res_v, x1p_v ), 0);
|
||||
res_v = negatef4(x1p_v);
|
||||
TEST_CHECK("20040930102657EJL", allequal_float4( res_v, x1n_v ), 0);
|
||||
res_v = negatef4(x2n_v);
|
||||
TEST_CHECK("20040930102659EJL", allequal_float4( res_v, x2p_v ), 0);
|
||||
res_v = negatef4(x2p_v);
|
||||
TEST_CHECK("20040930102701EJL", allequal_float4( res_v, x2n_v ), 0);
|
||||
res_v = negatef4(x3n_v);
|
||||
TEST_CHECK("20040930102703EJL", allequal_float4( res_v, x3p_v ), 0);
|
||||
res_v = negatef4(x3p_v);
|
||||
TEST_CHECK("20040930102705EJL", allequal_float4( res_v, x3n_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
83
Extras/simdmathlibrary/spu/tests/negatei4.c
Normal file
83
Extras/simdmathlibrary/spu/tests/negatei4.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/* Test negatei4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040930102649EJL","EJL", "negatei4");
|
||||
|
||||
int x0n = hide_int(0);
|
||||
int x0p = hide_int(0);
|
||||
int x1n = hide_int(-83532);
|
||||
int x1p = hide_int(83532);
|
||||
int x2n = hide_int(-13152);
|
||||
int x2p = hide_int(13152);
|
||||
int x3n = hide_int(-1);
|
||||
int x3p = hide_int(1);
|
||||
|
||||
vec_int4 x0n_v = spu_splats(x0n);
|
||||
vec_int4 x0p_v = spu_splats(x0p);
|
||||
vec_int4 x1n_v = spu_splats(x1n);
|
||||
vec_int4 x1p_v = spu_splats(x1p);
|
||||
vec_int4 x2n_v = spu_splats(x2n);
|
||||
vec_int4 x2p_v = spu_splats(x2p);
|
||||
vec_int4 x3n_v = spu_splats(x3n);
|
||||
vec_int4 x3p_v = spu_splats(x3p);
|
||||
|
||||
vec_int4 res_v;
|
||||
|
||||
TEST_START("negatei4");
|
||||
res_v = negatei4(x0n_v);
|
||||
TEST_CHECK("20040930102652EJL", allequal_int4( res_v, x0p_v ), 0);
|
||||
res_v = negatei4(x0p_v);
|
||||
TEST_CHECK("20040930102653EJL", allequal_int4( res_v, x0n_v ), 0);
|
||||
res_v = negatei4(x1n_v);
|
||||
TEST_CHECK("20040930102655EJL", allequal_int4( res_v, x1p_v ), 0);
|
||||
res_v = negatei4(x1p_v);
|
||||
TEST_CHECK("20040930102657EJL", allequal_int4( res_v, x1n_v ), 0);
|
||||
res_v = negatei4(x2n_v);
|
||||
TEST_CHECK("20040930102659EJL", allequal_int4( res_v, x2p_v ), 0);
|
||||
res_v = negatei4(x2p_v);
|
||||
TEST_CHECK("20040930102701EJL", allequal_int4( res_v, x2n_v ), 0);
|
||||
res_v = negatei4(x3n_v);
|
||||
TEST_CHECK("20040930102703EJL", allequal_int4( res_v, x3p_v ), 0);
|
||||
res_v = negatei4(x3p_v);
|
||||
TEST_CHECK("20040930102705EJL", allequal_int4( res_v, x3n_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
86
Extras/simdmathlibrary/spu/tests/negatell2.c
Normal file
86
Extras/simdmathlibrary/spu/tests/negatell2.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* Test negatell2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060731203500MH","MH", "negatell2");
|
||||
|
||||
vec_llong2 x0n_v = spu_splats(0LL);
|
||||
vec_llong2 x0p_v = spu_splats(0LL);
|
||||
vec_llong2 x1n_v = spu_splats(-83582LL);
|
||||
vec_llong2 x1p_v = spu_splats(83582LL);
|
||||
vec_llong2 x2n_v = spu_splats(-13152LL);
|
||||
vec_llong2 x2p_v = spu_splats(13152LL);
|
||||
vec_llong2 x3n_v = spu_splats(-1LL);
|
||||
vec_llong2 x3p_v = spu_splats(1LL);
|
||||
vec_llong2 x4n_v = spu_splats((long long)0x8000000000000001ULL);
|
||||
vec_llong2 x4p_v = spu_splats(0x7fffffffffffffffLL);
|
||||
vec_llong2 x5n_v = spu_splats((long long)0x8000000100000000ULL);
|
||||
vec_llong2 x5p_v = spu_splats(0x7fffffff00000000LL);
|
||||
|
||||
vec_llong2 res_v;
|
||||
|
||||
TEST_START("negatell2");
|
||||
res_v = negatell2(x0n_v);
|
||||
TEST_CHECK("20060731203501MH", allequal_llong2( res_v, x0p_v ), 0);
|
||||
res_v = negatell2(x0p_v);
|
||||
TEST_CHECK("20060731203502MH", allequal_llong2( res_v, x0n_v ), 0);
|
||||
res_v = negatell2(x1n_v);
|
||||
TEST_CHECK("20060731203503MH", allequal_llong2( res_v, x1p_v ), 0);
|
||||
res_v = negatell2(x1p_v);
|
||||
TEST_CHECK("20060731203504MH", allequal_llong2( res_v, x1n_v ), 0);
|
||||
res_v = negatell2(x2n_v);
|
||||
TEST_CHECK("20060731203505MH", allequal_llong2( res_v, x2p_v ), 0);
|
||||
res_v = negatell2(x2p_v);
|
||||
TEST_CHECK("20060731203506MH", allequal_llong2( res_v, x2n_v ), 0);
|
||||
res_v = negatell2(x3n_v);
|
||||
TEST_CHECK("20060731203507MH", allequal_llong2( res_v, x3p_v ), 0);
|
||||
res_v = negatell2(x3p_v);
|
||||
TEST_CHECK("20060731203508MH", allequal_llong2( res_v, x3n_v ), 0);
|
||||
res_v = negatell2(x4n_v);
|
||||
TEST_CHECK("20060731203509MH", allequal_llong2( res_v, x4p_v ), 0);
|
||||
res_v = negatell2(x4p_v);
|
||||
TEST_CHECK("20060731203510MH", allequal_llong2( res_v, x4n_v ), 0);
|
||||
res_v = negatell2(x5n_v);
|
||||
TEST_CHECK("20060731203511MH", allequal_llong2( res_v, x5p_v ), 0);
|
||||
res_v = negatell2(x5p_v);
|
||||
TEST_CHECK("20060731203512MH", allequal_llong2( res_v, x5n_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
153
Extras/simdmathlibrary/spu/tests/nextafterd2.c
Normal file
153
Extras/simdmathlibrary/spu/tests/nextafterd2.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* Test nextafterd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ nextafterd2 - find next representable floating-point value towards 2nd param.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for nextafterd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int yyy[2];
|
||||
unsigned long long int ans[2];
|
||||
} TestVec64_NexA;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_NexA test_a[] = {
|
||||
{
|
||||
// -1 -> -0 , 0 -> -1
|
||||
{0x8000000000000001ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x8000000000000001ULL},
|
||||
{0x8000000000000000ULL,0x8000000000000001ULL}
|
||||
},{
|
||||
// -1 -> -0 , 0 -> -1
|
||||
{0x8000000000000001ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000001ULL},
|
||||
{0x8000000000000000ULL,0x8000000000000001ULL}
|
||||
},{
|
||||
// 0 -> -0 , -0 -> 0
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
// -Inf -> MIN , Inf -> MAX
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0x0010000000000000ULL,0x0000000000000000ULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// MAX -> Inf , MIN -> -Inf
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
|
||||
},{
|
||||
// Denormalize -> Denormalize
|
||||
{0x0000000000000001ULL,0x8000000000000010ULL},
|
||||
{0x0000000000000003ULL,0x8000000000000020ULL},
|
||||
{0x0000000000000002ULL,0x8000000000000011ULL}
|
||||
},{
|
||||
// Denormalize -> Normalize
|
||||
{0x000FFFFFFFFFFFFFULL,0x800FFFFFFFFFFFFFULL},
|
||||
{0x0020000000000000ULL,0x8020000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL}
|
||||
},{
|
||||
// Normalize -> Denormalize
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x8010000000000000ULL,0x0020000000000000ULL},
|
||||
{0x000FFFFFFFFFFFFFULL,0x800FFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// equal
|
||||
{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
|
||||
{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
|
||||
{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
//
|
||||
{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
|
||||
{0x9FFFFFFFFFFFFFFFULL,0x1FFFFFFFFFFFFFFFULL},
|
||||
{0x9000000000000000ULL,0x1000000000000000ULL}
|
||||
},{
|
||||
//
|
||||
{0x7000000000000000ULL,0xF000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x6FFFFFFFFFFFFFFFULL,0xEFFFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// Nan
|
||||
{0x7000000000000000ULL,0xF000000000000000ULL},
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL},
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060828130000NM","NM", "nextafterd2");
|
||||
|
||||
TEST_START("nextafterd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
res_v = nextafterd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_double2 *)&test_a[ii].yyy[0]));
|
||||
sprintf(msg,"2006082813%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
162
Extras/simdmathlibrary/spu/tests/nextafterf4.c
Normal file
162
Extras/simdmathlibrary/spu/tests/nextafterf4.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/* Test nextafterf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
//a :float, b: float: c:bit pattern
|
||||
#define DEFINE_DATA(var,a,b,c) \
|
||||
float var ## _a = a;\
|
||||
vec_float4 var ## _a_v = spu_splats(var ## _a); \
|
||||
float var ## _b = b;\
|
||||
vec_float4 var ## _b_v = spu_splats(var ## _b); \
|
||||
unsigned int var ## _inc = c ; \
|
||||
float var ## _out = make_float(var ## _inc);\
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);\
|
||||
|
||||
//a :bit pattern, b: bit pattern: c:bit pattern
|
||||
#define DEFINE_DATA_UNSIGNED(var,a,b,c) \
|
||||
unsigned int var ## _ina = a ; \
|
||||
float var ## _a = make_float(var ## _ina); \
|
||||
vec_float4 var ## _a_v = spu_splats(var ## _a); \
|
||||
unsigned int var ## _inb = b ; \
|
||||
float var ## _b = make_float(var ## _inb); \
|
||||
vec_float4 var ## _b_v = spu_splats(var ## _b); \
|
||||
unsigned int var ## _inc = c ; \
|
||||
float var ## _out = make_float(var ## _inc); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
#define DO_TEST(var,id) \
|
||||
res_v = nextafterf4(var ## _a_v, var ## _b_v);\
|
||||
TEST_CHECK(" #id ", allequal_float4( res_v, var ## _out_v ), 0);
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_SET_START("958726589700","NAR", "nextafterf4");
|
||||
|
||||
|
||||
|
||||
// ==
|
||||
// 1.0f --> 1.0f
|
||||
DEFINE_DATA(x1, 1.0f, 1.0f, 0x3f800000)
|
||||
DEFINE_DATA(x2, 0.0f, 0.0f, 0x0)
|
||||
|
||||
// * Icrement *
|
||||
|
||||
// -FLT_MAX ->
|
||||
DEFINE_DATA_UNSIGNED(x3,0xffffffff, 0x0, 0xfffffffe)
|
||||
//(1, 40, 0) --> (1, 39, 7fffff)
|
||||
DEFINE_DATA_UNSIGNED(x4,0xd3800000, 0x0, 0xd37fffff)
|
||||
// (1,-40,0 ) --> (1,-41,0x7fffff)
|
||||
DEFINE_DATA_UNSIGNED(x5,0xab800000, 0x0, 0xab7fffff)
|
||||
//-FLT_MIN --> 0
|
||||
DEFINE_DATA_UNSIGNED(x6,0x80800000, 0x0, 0x0)
|
||||
//0.0f --> FLT_MIN
|
||||
DEFINE_DATA(x7, 0.0f, 1.0f, 0x800000)
|
||||
//-0.0f --> FLT_MIN
|
||||
DEFINE_DATA_UNSIGNED(x8, 0x80000000, 0x7fffffff, 0x800000)
|
||||
//FLT_MIN -->
|
||||
DEFINE_DATA_UNSIGNED(x9, 0x800000, 0x7fffffff, 0x800001)
|
||||
// (0, -41, 7fffff) --> (0, -40, 0)
|
||||
DEFINE_DATA_UNSIGNED(x10, 0x2b7fffff, 0x7fffffff, 0x2b800000)
|
||||
// (0, 40, 7fffff) --> (0, 41, 0)
|
||||
DEFINE_DATA_UNSIGNED(x11, 0x53ffffff, 0x7fffffff, 0x54000000)
|
||||
// FLT_MAX -->
|
||||
DEFINE_DATA_UNSIGNED(x12,0x7fffffff,0x7fffffff,0x7fffffff)
|
||||
|
||||
// * Decrement *
|
||||
|
||||
// FLT_MAX --> FLT_MAX
|
||||
DEFINE_DATA_UNSIGNED(x13,0x7fffffff,0x7fffffff,0x7fffffff)
|
||||
// FLT_MAX -->
|
||||
DEFINE_DATA_UNSIGNED(x14,0x7fffffff,0x0,0x7ffffffe)
|
||||
// (0, 41, 0) --> (0, 40, 7fffff)
|
||||
DEFINE_DATA_UNSIGNED(x15, 0x54000000, 0x0, 0x53ffffff)
|
||||
// (0, -40, 0) --> (0, -41, 7fffff)
|
||||
DEFINE_DATA_UNSIGNED(x16, 0x2b800000,0x0, 0x2b7fffff)
|
||||
// -> FLT_MIN
|
||||
DEFINE_DATA_UNSIGNED(x17, 0x800001, 0x800000, 0x800000)
|
||||
// FLT_MIN --> 0
|
||||
DEFINE_DATA_UNSIGNED(x18, 0x800000, 0x0, 0x0)
|
||||
// 0.0 -> -FLT_MIN
|
||||
DEFINE_DATA_UNSIGNED(x19, 0x0, 0xffffffff, 0x80800000)
|
||||
// -0.0 -> FLT_MIN
|
||||
DEFINE_DATA_UNSIGNED(x20, 0x80000000, 0xffffffff, 0x80800000)
|
||||
//-FLT_MIN -->
|
||||
DEFINE_DATA_UNSIGNED(x21, 0x80800000, 0xffffffff, 0x80800001)
|
||||
// (1,-41,0x7fffff) --> (1,-40,0 )
|
||||
DEFINE_DATA_UNSIGNED(x22, 0xab7fffff, 0xffffffff, 0xab800000)
|
||||
//(1, 40, 0) --> (1, 39, 7fffff)
|
||||
DEFINE_DATA_UNSIGNED(x23, 0xd37fffff, 0xffffffff, 0xd3800000)
|
||||
// --> -FLT_MAX
|
||||
DEFINE_DATA_UNSIGNED(x24,0xfffffffe, 0xffffffff, 0xffffffff)
|
||||
|
||||
|
||||
//TEST
|
||||
TEST_START("nextafterf4");
|
||||
DO_TEST(x1,958726589701NAR)
|
||||
DO_TEST(x2,958726589702NAR)
|
||||
DO_TEST(x3,958726589703NAR)
|
||||
DO_TEST(x4,958726589704NAR)
|
||||
DO_TEST(x5,958726589705NAR)
|
||||
DO_TEST(x6,958726589706NAR)
|
||||
DO_TEST(x7,958726589707NAR)
|
||||
DO_TEST(x8,958726589708NAR)
|
||||
DO_TEST(x9,958726589709NAR)
|
||||
DO_TEST(x10,958726589710NAR)
|
||||
DO_TEST(x11,958726589711NAR)
|
||||
DO_TEST(x12,958726589712NAR)
|
||||
DO_TEST(x13,958726589713NAR)
|
||||
DO_TEST(x14,958726589714NAR)
|
||||
DO_TEST(x15,958726589715NAR)
|
||||
DO_TEST(x16,958726589716NAR)
|
||||
DO_TEST(x17,958726589717NAR)
|
||||
DO_TEST(x18,958726589718NAR)
|
||||
DO_TEST(x19,958726589719NAR)
|
||||
DO_TEST(x20,958726589720NAR)
|
||||
DO_TEST(x21,958726589721NAR)
|
||||
DO_TEST(x22,958726589722NAR)
|
||||
DO_TEST(x23,958726589723NAR)
|
||||
DO_TEST(x24,958726589724NAR)
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
131
Extras/simdmathlibrary/spu/tests/recipd2.c
Normal file
131
Extras/simdmathlibrary/spu/tests/recipd2.c
Normal file
@@ -0,0 +1,131 @@
|
||||
/* Test recipd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040920095218EJL","EJL", "recipd2");
|
||||
|
||||
unsigned long long i6 = 0x7fd0000000000001ull; // 2^1022 + 1 ulp
|
||||
unsigned long long i7 = 0xffd0000000000000ull; // -2^1022
|
||||
unsigned long long i7r = 0x8010000000000000ull; // -2^-1022
|
||||
unsigned long long i8 = 0x7606a4533cf5605eull; // random values
|
||||
unsigned long long i8r = 0x09d69cea2b5b5b57ull;
|
||||
unsigned long long i9 = 0x4c042c295376566eull;
|
||||
unsigned long long i9r = 0x33d9618e87b961f4ull;
|
||||
unsigned long long i10 = 0x39b3720562510408ull;
|
||||
unsigned long long i10r = 0x462a54842d7f9b5dull;
|
||||
unsigned long long i11 = 0x6911a64538a389aeull;
|
||||
unsigned long long i11r = 0x16cd02637ed13ff2ull;
|
||||
unsigned long long i12 = 0x1ac4d062d451c99dull;
|
||||
unsigned long long i12r = 0x6518994c26ebbb3eull;
|
||||
|
||||
double x0 = hide_double(-1.0/0.0); // -Inf
|
||||
double x1 = hide_double(1.0/0.0); // Inf
|
||||
double x2 = hide_double(0.0); // 0
|
||||
double x3 = hide_double(-0.0); // -0
|
||||
double x4 = hide_double(0.0/0.0); // NaN
|
||||
double x5 = hide_double(2.0);
|
||||
double x5r = hide_double(0.5);
|
||||
double x6 = hide_double(make_double(i6));
|
||||
double x7 = hide_double(make_double(i7));
|
||||
double x7r = hide_double(make_double(i7r));
|
||||
double x8 = hide_double(make_double(i8));
|
||||
double x8r = hide_double(make_double(i8r));
|
||||
double x9 = hide_double(make_double(i9));
|
||||
double x9r = hide_double(make_double(i9r));
|
||||
double x10 = hide_double(make_double(i10));
|
||||
double x10r = hide_double(make_double(i10r));
|
||||
double x11 = hide_double(make_double(i11));
|
||||
double x11r = hide_double(make_double(i11r));
|
||||
double x12 = hide_double(make_double(i12));
|
||||
double x12r = hide_double(make_double(i12r));
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 x5r_v = spu_splats(x5r);
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 x7r_v = spu_splats(x7r);
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 x8r_v = spu_splats(x8r);
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 x9r_v = spu_splats(x9r);
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 x10r_v = spu_splats(x10r);
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 x11r_v = spu_splats(x11r);
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_double2 x12r_v = spu_splats(x12r);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("recipd2");
|
||||
res_v = recipd2(x0_v);
|
||||
TEST_CHECK("20040920095224EJL", allnegzero_double2( res_v ), 0);
|
||||
res_v = recipd2(x1_v);
|
||||
TEST_CHECK("20040920095226EJL", allposzero_double2( res_v ), 0);
|
||||
res_v = recipd2(x2_v);
|
||||
TEST_CHECK("20040920095228EJL", allposinf_double2( res_v ), 0);
|
||||
res_v = recipd2(x3_v);
|
||||
TEST_CHECK("20040920095233EJL", allneginf_double2( res_v ), 0);
|
||||
res_v = recipd2(x4_v);
|
||||
TEST_CHECK("20040920095235EJL", allnan_double2( res_v ), 0);
|
||||
res_v = recipd2(x5_v);
|
||||
TEST_CHECK("20040920095237EJL", allequal_double2( res_v, x5r_v ), 0);
|
||||
res_v = recipd2(x6_v);
|
||||
TEST_CHECK("20040920095239EJL", allzerodenorm_double2( res_v ), 0);
|
||||
res_v = recipd2(x7_v);
|
||||
TEST_CHECK("20040920095242EJL", allequal_double2( res_v, x7r_v ), 0);
|
||||
res_v = recipd2(x8_v);
|
||||
TEST_CHECK("20040920095245EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0);
|
||||
res_v = recipd2(x9_v);
|
||||
TEST_CHECK("20040920095247EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0);
|
||||
res_v = recipd2(x10_v);
|
||||
TEST_CHECK("20040920095248EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0);
|
||||
res_v = recipd2(x11_v);
|
||||
TEST_CHECK("20040920095250EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0);
|
||||
res_v = recipd2(x12_v);
|
||||
TEST_CHECK("20040920095252EJL", allequal_ulps_double2( res_v, x12r_v, 1 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
114
Extras/simdmathlibrary/spu/tests/recipf4.c
Normal file
114
Extras/simdmathlibrary/spu/tests/recipf4.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/* Test recipf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040920142553EJL","EJL", "recipf4");
|
||||
|
||||
unsigned int i0r = 0x7fffffff;
|
||||
unsigned int i1 = 0xff000000; // -2^127
|
||||
unsigned int i2 = 0xfe7fffff; // -2^126 - 1 ulp
|
||||
unsigned int i2r = 0x80800001;
|
||||
unsigned int i3 = 0x75013340; // random values
|
||||
unsigned int i3r = 0x09fd9f35;
|
||||
unsigned int i4 = 0x75e7753f;
|
||||
unsigned int i4r = 0x090d9277;
|
||||
unsigned int i5 = 0x4c7fed5a;
|
||||
unsigned int i5r = 0x32800954;
|
||||
unsigned int i6 = 0x3a0731f0;
|
||||
unsigned int i6r = 0x44f2602e;
|
||||
unsigned int i7 = 0x69784a07;
|
||||
unsigned int i7r = 0x1583f9a3;
|
||||
|
||||
float x0 = hide_float(0.0f);
|
||||
float x0r = hide_float(make_float(i0r));
|
||||
float x1 = hide_float(make_float(i1));
|
||||
float x1r = hide_float(0.0f);
|
||||
float x2 = hide_float(make_float(i2));
|
||||
float x2r = hide_float(make_float(i2r));
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
float x6 = hide_float(make_float(i6));
|
||||
float x6r = hide_float(make_float(i6r));
|
||||
float x7 = hide_float(make_float(i7));
|
||||
float x7r = hide_float(make_float(i7r));
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 x0r_v = spu_splats(x0r);
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 x1r_v = spu_splats(x1r);
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 x2r_v = spu_splats(x2r);
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 x6r_v = spu_splats(x6r);
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 x7r_v = spu_splats(x7r);
|
||||
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("recipf4");
|
||||
res_v = recipf4(x0_v);
|
||||
TEST_CHECK("20040920142558EJL", allequal_float4( res_v, x0r_v ), 0);
|
||||
res_v = recipf4(x1_v);
|
||||
TEST_CHECK("20040920142600EJL", allequal_float4( res_v, x1r_v), 0);
|
||||
res_v = recipf4(x2_v);
|
||||
TEST_CHECK("20040920142602EJL", allequal_ulps_float4( res_v, x2r_v, 2 ), 0);
|
||||
res_v = recipf4(x3_v);
|
||||
TEST_CHECK("20040920142604EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
|
||||
res_v = recipf4(x4_v);
|
||||
TEST_CHECK("20040920142606EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
|
||||
res_v = recipf4(x5_v);
|
||||
TEST_CHECK("20040920142608EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
|
||||
res_v = recipf4(x6_v);
|
||||
TEST_CHECK("20040920142609EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
|
||||
res_v = recipf4(x7_v);
|
||||
TEST_CHECK("20040920142611EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
125
Extras/simdmathlibrary/spu/tests/remainderd2.c
Normal file
125
Extras/simdmathlibrary/spu/tests/remainderd2.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/* Test remainderd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int yyy[2];
|
||||
unsigned long long int a_res[2];
|
||||
} TestVec64_RemqD;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_RemqD test_a[] = {
|
||||
{
|
||||
// normal 2.5/1.5 29/3
|
||||
{0x4004000000000000ULL,0x403d000000000000ULL},
|
||||
{0x3ff8000000000000ULL,0x4008000000000000ULL},
|
||||
{0xbfe0000000000000ULL,0xbff0000000000000ULL}
|
||||
},{
|
||||
// normal
|
||||
{0x09d0000000000006ULL,0x1000000000000000ULL},
|
||||
{0x8010000000000005ULL,0x0010000000000007ULL},
|
||||
{0x800000000000007dULL,0x80037ffffffff1a5ULL}
|
||||
},{
|
||||
// denorm
|
||||
{0x0000000000000001ULL,0x800ffffffffffff3ULL},
|
||||
{0x8000000000000001ULL,0x8000000000000005ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000002ULL}
|
||||
},{
|
||||
// divide by inf
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x0001000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x0001000000000000ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
TestVec64_RemqD test_b[] = {
|
||||
{
|
||||
// divide by zero -> nan
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x7ff8000000000000ULL,0x7ff8000000000000ULL}
|
||||
},{
|
||||
// Inf , -Inf
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7ff8000000000000ULL,0x7ff8000000000000ULL}
|
||||
},{
|
||||
// border
|
||||
{0xFFE0000000000000ULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0x0008000000000000ULL,0x0010000000000000ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060919210000NM","NM", "remquod2");
|
||||
|
||||
TEST_START("remquod2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
res_v = remainderd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_double2 *)&test_a[ii].yyy[0]));
|
||||
sprintf(msg,"2006092621%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].a_res[0])), 0);
|
||||
}
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_b[ii].xxx[0] == 0) && (test_b[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
res_v = remainderd2 (*((vec_double2 *)&test_b[ii].xxx[0]), *((vec_double2 *)&test_b[ii].yyy[0]));
|
||||
sprintf(msg,"2006092623%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_b[ii].a_res[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
143
Extras/simdmathlibrary/spu/tests/remainderf4.c
Normal file
143
Extras/simdmathlibrary/spu/tests/remainderf4.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/* Test remainderf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928191927EJL","EJL", "remainderf4");
|
||||
|
||||
unsigned int i0n = 0x449edbc6;
|
||||
unsigned int i0d = 0x40cf799d;
|
||||
unsigned int i0r = 0x3daa7300;
|
||||
unsigned int i1n = 0x6bca107a;
|
||||
unsigned int i1d = 0x6c4a107a;
|
||||
unsigned int i1r = 0x6bca107a;
|
||||
unsigned int i2n = 0x1c123605;
|
||||
unsigned int i2d = 0x1c923602;
|
||||
unsigned int i2r = 0x9c1235ff;
|
||||
unsigned int i3n = 0x2b4c50fa;
|
||||
unsigned int i3d = 0x253a3ae3;
|
||||
unsigned int i3r = 0xa41873a8;
|
||||
unsigned int i4n = 0x73addffc;
|
||||
unsigned int i4d = 0x742ddffc;
|
||||
unsigned int i4r = 0x73addffc;
|
||||
unsigned int i5n = 0x29d4d97c;
|
||||
unsigned int i5d = 0x2a546e77;
|
||||
unsigned int i5r = 0xa9d40372;
|
||||
|
||||
float x0n = hide_float(make_float(i0n));
|
||||
float x0d = hide_float(make_float(i0d));
|
||||
float x0r = hide_float(make_float(i0r));
|
||||
|
||||
float x1n = hide_float(make_float(i1n));
|
||||
float x1d = hide_float(make_float(i1d));
|
||||
float x1r = hide_float(make_float(i1r));
|
||||
|
||||
float x2n = hide_float(make_float(i2n));
|
||||
float x2d = hide_float(make_float(i2d));
|
||||
float x2r = hide_float(make_float(i2r));
|
||||
|
||||
float x3n = hide_float(make_float(i3n));
|
||||
float x3d = hide_float(make_float(i3d));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
|
||||
float x4n = hide_float(make_float(i4n));
|
||||
float x4d = hide_float(make_float(i4d));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
|
||||
float x5n = hide_float(make_float(i5n));
|
||||
float x5d = hide_float(make_float(i5d));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
|
||||
vec_float4 x0n_v = spu_splats(x0n);
|
||||
vec_float4 x0d_v = spu_splats(x0d);
|
||||
vec_float4 x0r_v = spu_splats(x0r);
|
||||
|
||||
vec_float4 x1n_v = spu_splats(x1n);
|
||||
vec_float4 x1d_v = spu_splats(x1d);
|
||||
vec_float4 x1r_v = spu_splats(x1r);
|
||||
|
||||
vec_float4 x2n_v = spu_splats(x2n);
|
||||
vec_float4 x2d_v = spu_splats(x2d);
|
||||
vec_float4 x2r_v = spu_splats(x2r);
|
||||
|
||||
vec_float4 x3n_v = spu_splats(x3n);
|
||||
vec_float4 x3d_v = spu_splats(x3d);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
|
||||
vec_float4 x4n_v = spu_splats(x4n);
|
||||
vec_float4 x4d_v = spu_splats(x4d);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
|
||||
vec_float4 x5n_v = spu_splats(x5n);
|
||||
vec_float4 x5d_v = spu_splats(x5d);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("remainderf4");
|
||||
res_v = remainderf4(x0n_v, x0d_v);
|
||||
TEST_CHECK("20040928191931EJL", allequal_ulps_float4( res_v, x0r_v, 1 ), 0);
|
||||
res_v = remainderf4(x1n_v, x1d_v);
|
||||
TEST_CHECK("20040928191933EJL", allequal_ulps_float4( res_v, x1r_v, 1 ), 0);
|
||||
res_v = remainderf4(x2n_v, x2d_v);
|
||||
TEST_CHECK("20040928191934EJL", allequal_ulps_float4( res_v, x2r_v, 1 ), 0);
|
||||
res_v = remainderf4(x3n_v, x3d_v);
|
||||
TEST_CHECK("20040928191936EJL", allequal_ulps_float4( res_v, x3r_v, 1 ), 0);
|
||||
res_v = remainderf4(x4n_v, x4d_v);
|
||||
TEST_CHECK("20040928191937EJL", allequal_ulps_float4( res_v, x4r_v, 1 ), 0);
|
||||
res_v = remainderf4(x5n_v, x5d_v);
|
||||
TEST_CHECK("20040928191938EJL", allequal_ulps_float4( res_v, x5r_v, 1 ), 0);
|
||||
|
||||
TEST_START("remainderf");
|
||||
res = remainderf(x0n, x0d);
|
||||
TEST_CHECK("20040928191941EJL", ulpDiff_f( res, x0r ) <= 1, 0);
|
||||
res = remainderf(x1n, x1d);
|
||||
TEST_CHECK("20040928191942EJL", ulpDiff_f( res, x1r ) <= 1, 0);
|
||||
res = remainderf(x2n, x2d);
|
||||
TEST_CHECK("20040928191943EJL", ulpDiff_f( res, x2r ) <= 1, 0);
|
||||
res = remainderf(x3n, x3d);
|
||||
TEST_CHECK("20040928191948EJL", ulpDiff_f( res, x3r ) <= 1, 0);
|
||||
res = remainderf(x4n, x4d);
|
||||
TEST_CHECK("20040928191949EJL", ulpDiff_f( res, x4r ) <= 1, 0);
|
||||
res = remainderf(x5n, x5d);
|
||||
TEST_CHECK("20040928191950EJL", ulpDiff_f( res, x5r ) <= 1, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
151
Extras/simdmathlibrary/spu/tests/remquod2.c
Normal file
151
Extras/simdmathlibrary/spu/tests/remquod2.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* Test remquod2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* note: cannot calc too far numbers correctry
|
||||
* ex. x=0xFFE0000000000000,y=0x0008000000000000
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int yyy[2];
|
||||
unsigned long long int quo[2];
|
||||
unsigned long long int a_res[2];
|
||||
unsigned long long int a_quo[2];
|
||||
} TestVec64_RemqD;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_RemqD test_a[] = {
|
||||
{
|
||||
// normal 2.5/1.5 29/3
|
||||
{0x4004000000000000ULL,0x403d000000000000ULL},
|
||||
{0x3ff8000000000000ULL,0x4008000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0xbfe0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x0000000000000002ULL,0x0000000000000002ULL}
|
||||
},{
|
||||
// normal
|
||||
{0x09d0000000000006ULL,0x1000000000000000ULL},
|
||||
{0x8010000000000005ULL,0x0010000000000007ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x800000000000007dULL,0x80037ffffffff1a5ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0x0000000000000003ULL}
|
||||
},{
|
||||
// denorm
|
||||
{0x0000000000000001ULL,0x800ffffffffffff3ULL},
|
||||
{0x8000000000000001ULL,0x8000000000000005ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000002ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0x0000000000000001ULL}
|
||||
},{
|
||||
// divide by inf
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x0001000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x0001000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
TestVec64_RemqD test_b[] = {
|
||||
{
|
||||
// divide by zero -> nan
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x7ff8000000000000ULL,0x7ff8000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
// Inf , -Inf
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x7ff8000000000000ULL,0x7ff8000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
// border
|
||||
{0xFFE0000000000000ULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0x0008000000000000ULL,0x0010000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060919210000NM","NM", "remquod2");
|
||||
|
||||
TEST_START("remquod2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
res_v = remquod2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_double2 *)&test_a[ii].yyy[0]), ((vec_llong2 *)&test_a[ii].quo[0]));
|
||||
sprintf(msg,"2006091921%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].a_res[0])), 0);
|
||||
sprintf(msg,"2006091922%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( *((vec_llong2 *)&test_a[ii].quo[0]), *((vec_llong2 *)&test_a[ii].a_quo[0])), 0);
|
||||
}
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_b[ii].xxx[0] == 0) && (test_b[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
res_v = remquod2 (*((vec_double2 *)&test_b[ii].xxx[0]), *((vec_double2 *)&test_b[ii].yyy[0]), ((vec_llong2 *)&test_b[ii].quo[0]));
|
||||
sprintf(msg,"2006091923%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_b[ii].a_res[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
167
Extras/simdmathlibrary/spu/tests/remquof4.c
Normal file
167
Extras/simdmathlibrary/spu/tests/remquof4.c
Normal file
@@ -0,0 +1,167 @@
|
||||
/* Test remquof4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* copied test data from remainderf4
|
||||
* wrong quotient returns in scalar function
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060912170027NM","NM", "remquof4");
|
||||
|
||||
unsigned int i0n = 0x449edbc6;
|
||||
unsigned int i0d = 0x40cf799d;
|
||||
unsigned int i0r = 0x3daa7300;
|
||||
unsigned int i0q = 4;
|
||||
unsigned int i1n = 0x6bca107a;
|
||||
unsigned int i1d = 0x6c4a107a;
|
||||
unsigned int i1r = 0x6bca107a;
|
||||
unsigned int i1q = 0;
|
||||
unsigned int i2n = 0x1c123605;
|
||||
unsigned int i2d = 0x1c923602;
|
||||
unsigned int i2r = 0x9c1235ff;
|
||||
unsigned int i2q = 1;
|
||||
unsigned int i3n = 0x2b4c50fa;
|
||||
unsigned int i3d = 0x253a3ae3;
|
||||
unsigned int i3r = 0xa41873a8;
|
||||
unsigned int i3q = 6;
|
||||
unsigned int i4n = 0x73addffc;
|
||||
unsigned int i4d = 0x742ddffc;
|
||||
unsigned int i4r = 0x73addffc;
|
||||
unsigned int i4q = 0;
|
||||
unsigned int i5n = 0x29d4d97c;
|
||||
unsigned int i5d = 0x2a546e77;
|
||||
unsigned int i5r = 0xa9d40372;
|
||||
unsigned int i5q = 1;
|
||||
|
||||
float x0n = hide_float(make_float(i0n));
|
||||
float x0d = hide_float(make_float(i0d));
|
||||
float x0r = hide_float(make_float(i0r));
|
||||
|
||||
float x1n = hide_float(make_float(i1n));
|
||||
float x1d = hide_float(make_float(i1d));
|
||||
float x1r = hide_float(make_float(i1r));
|
||||
|
||||
float x2n = hide_float(make_float(i2n));
|
||||
float x2d = hide_float(make_float(i2d));
|
||||
float x2r = hide_float(make_float(i2r));
|
||||
|
||||
float x3n = hide_float(make_float(i3n));
|
||||
float x3d = hide_float(make_float(i3d));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
|
||||
float x4n = hide_float(make_float(i4n));
|
||||
float x4d = hide_float(make_float(i4d));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
|
||||
float x5n = hide_float(make_float(i5n));
|
||||
float x5d = hide_float(make_float(i5d));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
|
||||
vec_float4 x0n_v = spu_splats(x0n);
|
||||
vec_float4 x0d_v = spu_splats(x0d);
|
||||
vec_float4 x0r_v = spu_splats(x0r);
|
||||
|
||||
vec_float4 x1n_v = spu_splats(x1n);
|
||||
vec_float4 x1d_v = spu_splats(x1d);
|
||||
vec_float4 x1r_v = spu_splats(x1r);
|
||||
|
||||
vec_float4 x2n_v = spu_splats(x2n);
|
||||
vec_float4 x2d_v = spu_splats(x2d);
|
||||
vec_float4 x2r_v = spu_splats(x2r);
|
||||
|
||||
vec_float4 x3n_v = spu_splats(x3n);
|
||||
vec_float4 x3d_v = spu_splats(x3d);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
|
||||
vec_float4 x4n_v = spu_splats(x4n);
|
||||
vec_float4 x4d_v = spu_splats(x4d);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
|
||||
vec_float4 x5n_v = spu_splats(x5n);
|
||||
vec_float4 x5d_v = spu_splats(x5d);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
|
||||
float res;
|
||||
int quo;
|
||||
vec_float4 res_v;
|
||||
vec_int4 quo_v;
|
||||
|
||||
TEST_START("remquof4");
|
||||
res_v = remquof4(x0n_v, x0d_v, &quo_v);
|
||||
TEST_CHECK("20060912170031NM", allequal_ulps_float4( res_v, x0r_v, 1 ), 0);
|
||||
TEST_CHECK("20060912170131NM", allequal_int4( quo_v, spu_splats((int)i0q) ), 0);
|
||||
res_v = remquof4(x1n_v, x1d_v, &quo_v);
|
||||
TEST_CHECK("20060912170033NM", allequal_ulps_float4( res_v, x1r_v, 1 ), 0);
|
||||
TEST_CHECK("20060912170133NM", allequal_int4( quo_v, spu_splats((int)i1q) ), 0);
|
||||
res_v = remquof4(x2n_v, x2d_v, &quo_v);
|
||||
TEST_CHECK("20060912170034NM", allequal_ulps_float4( res_v, x2r_v, 1 ), 0);
|
||||
TEST_CHECK("20060912170134NM", allequal_int4( quo_v, spu_splats((int)i2q) ), 0);
|
||||
res_v = remquof4(x3n_v, x3d_v, &quo_v);
|
||||
TEST_CHECK("20060912170036NM", allequal_ulps_float4( res_v, x3r_v, 1 ), 0);
|
||||
TEST_CHECK("20060912170136NM", allequal_int4( quo_v, spu_splats((int)i3q) ), 0);
|
||||
res_v = remquof4(x4n_v, x4d_v, &quo_v);
|
||||
TEST_CHECK("20060912170037NM", allequal_ulps_float4( res_v, x4r_v, 1 ), 0);
|
||||
TEST_CHECK("20060912170137NM", allequal_int4( quo_v, spu_splats((int)i4q) ), 0);
|
||||
res_v = remquof4(x5n_v, x5d_v, &quo_v);
|
||||
TEST_CHECK("20060912170038NM", allequal_ulps_float4( res_v, x5r_v, 1 ), 0);
|
||||
TEST_CHECK("20060912170138NM", allequal_int4( quo_v, spu_splats((int)i5q) ), 0);
|
||||
|
||||
TEST_START("remquof");
|
||||
res = remquof(x0n, x0d, &quo);
|
||||
TEST_CHECK("20060912170041NM", ulpDiff_f( res, x0r ) <= 1, 0);
|
||||
TEST_CHECK("20060912170141NM", (quo == (int)i0q), 0);
|
||||
res = remquof(x1n, x1d, &quo);
|
||||
TEST_CHECK("20060912170042NM", ulpDiff_f( res, x1r ) <= 1, 0);
|
||||
TEST_CHECK("20060912170142NM", (quo == (int)i1q), 0);
|
||||
res = remquof(x2n, x2d, &quo);
|
||||
TEST_CHECK("20060912170043NM", ulpDiff_f( res, x2r ) <= 1, 0);
|
||||
TEST_CHECK("20060912170143NM", (quo == (int)i2q), 0);
|
||||
res = remquof(x3n, x3d, &quo);
|
||||
TEST_CHECK("20060912170048NM", ulpDiff_f( res, x3r ) <= 1, 0);
|
||||
TEST_CHECK("20060912170144NM", (quo == (int)i3q), 0);
|
||||
res = remquof(x4n, x4d, &quo);
|
||||
TEST_CHECK("20060912170049NM", ulpDiff_f( res, x4r ) <= 1, 0);
|
||||
TEST_CHECK("20060912170149NM", (quo == (int)i4q), 0);
|
||||
res = remquof(x5n, x5d, &quo);
|
||||
TEST_CHECK("20060912170050NM", ulpDiff_f( res, x5r ) <= 1, 0);
|
||||
TEST_CHECK("20060912170150NM", (quo == (int)i5q), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
180
Extras/simdmathlibrary/spu/tests/rintd2.c
Normal file
180
Extras/simdmathlibrary/spu/tests/rintd2.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/* Test rintd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ rintd2 - Round the input to the nearest integer according to
|
||||
* the current rounding mode.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for rintd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
* add Denormalized handling
|
||||
* changed over 0x4330000000000000(ABS) handling
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int ans0[2];
|
||||
unsigned long long int ans1[2];
|
||||
unsigned long long int ans2[2];
|
||||
unsigned long long int ans3[2];
|
||||
} TestVec64_NerI;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_NerI test_a[] = {
|
||||
{
|
||||
// zero
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// border
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL},
|
||||
{0xc330000000000000ULL,0x4330000000000000ULL}
|
||||
},{
|
||||
// MIN , MAX
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// Inf , -Inf
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
|
||||
},{
|
||||
// denotmalized
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL},
|
||||
{0x8000000000000000ULL,0x3ff0000000000000ULL},
|
||||
{0xbff0000000000000ULL,0x0000000000000000ULL}
|
||||
},{
|
||||
// denotmalized
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0xbff0000000000000ULL}
|
||||
},{
|
||||
// 1.0
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL}
|
||||
},{
|
||||
// 1.5
|
||||
{0x3ff8000000000000ULL,0xbff8000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc000000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x4000000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x3ff0000000000000ULL,0xc000000000000000ULL}
|
||||
},{
|
||||
// 2.5
|
||||
{0x4004000000000000ULL,0xc004000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc000000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc000000000000000ULL},
|
||||
{0x4008000000000000ULL,0xc000000000000000ULL},
|
||||
{0x4000000000000000ULL,0xc008000000000000ULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060831210000NM","NM", "rintd2");
|
||||
|
||||
TEST_START("rintd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
spu_mtfpscr(((vec_uint4){0x0000,0,0,0}));
|
||||
res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006083121%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0500,0,0,0}));
|
||||
res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006083121%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0a00,0,0,0}));
|
||||
res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006083121%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0f00,0,0,0}));
|
||||
res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
|
||||
sprintf(msg,"2006083121%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
94
Extras/simdmathlibrary/spu/tests/rintf4.c
Normal file
94
Extras/simdmathlibrary/spu/tests/rintf4.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Test rintf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#define DEFINE_DATA(var,a,b) \
|
||||
float var = hide_float(a); \
|
||||
float var ## _out = hide_float(b); \
|
||||
vec_float4 var ## _v = spu_splats(var); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
/*
|
||||
*/
|
||||
#define DEFINE_DATA_UNSIGNED(var,a,b)\
|
||||
unsigned int var ## _ina = a ; \
|
||||
unsigned int var ## _inb = b ; \
|
||||
float var = make_float(var ## _ina); \
|
||||
float var ## _out = make_float(var ## _inb); \
|
||||
vec_float4 var ## _v = spu_splats(var); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
#define DO_TEST(var,id) \
|
||||
res_v = rintf4(var ## _v); \
|
||||
TEST_CHECK(" #id ", allequal_float4( res_v, var ## _out_v ), 0);
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_SET_START("184604792300","RNT", "rintf4");
|
||||
|
||||
|
||||
|
||||
|
||||
//s=0, e=100, f=7fffff --> s=0, e=100, f=7fffff
|
||||
DEFINE_DATA_UNSIGNED(x1,0x71ffffff,0x71ffffff)
|
||||
//s=0, e=22, f=0x7fffff --> s=0,e=22,f=0x7ffffe
|
||||
DEFINE_DATA_UNSIGNED(x2, 0x4affffff,0x4afffffe)
|
||||
//s=0, e=23, f=0 --> s=0,e=23,f=0
|
||||
DEFINE_DATA_UNSIGNED(x3, 0x4b000000,0x4b000000)
|
||||
//s=0, e=-126, f=0 --> 0
|
||||
DEFINE_DATA_UNSIGNED(x4, 0x800000,0x0)
|
||||
DEFINE_DATA(x5, 1.001f, 1.f)
|
||||
DEFINE_DATA(x6, -.05f, 0.f)
|
||||
DEFINE_DATA(x7, 0.9999f, 0.f)
|
||||
DEFINE_DATA(x8, 0.4999f, 0.f)
|
||||
|
||||
TEST_START("rintf4");
|
||||
DO_TEST(x1,184604792301RNT)
|
||||
DO_TEST(x2,184604792302RNT)
|
||||
DO_TEST(x3,184604792303RNT)
|
||||
DO_TEST(x4,184604792304RNT)
|
||||
DO_TEST(x5,184604792305RNT)
|
||||
DO_TEST(x6,184604792306RNT)
|
||||
DO_TEST(x7,184604792307RNT)
|
||||
DO_TEST(x8,184604792308RNT)
|
||||
TEST_SET_DONE();
|
||||
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
151
Extras/simdmathlibrary/spu/tests/roundd2.c
Normal file
151
Extras/simdmathlibrary/spu/tests/roundd2.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* Test roundd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ roundd2 - Round the input to the nearest integer.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for nextafterd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
double xxx[2];
|
||||
double ans[2];
|
||||
} dbl;
|
||||
struct {
|
||||
unsigned long long xxx[2];
|
||||
unsigned long long ans[2];
|
||||
} ull;
|
||||
} TestVec_Roundd2;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec_Roundd2 test_a[] = {
|
||||
{
|
||||
ull:{
|
||||
// 0 -> 0 , -0 -> -0
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// -Inf -> -Inf , Inf -> Inf
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// MAX -> MAX , MIN -> MIN
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Denormalize -> 0
|
||||
{0x0000000000000001ULL,0x8000000000000010ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Denormalize -> 0
|
||||
{0x800FFFFFFFFFFFFFULL,0x000FFFFFFFFFFFFFULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// border
|
||||
{0x4320000000000001ULL,0xC320000000000001ULL},
|
||||
{0x4320000000000002ULL,0xC320000000000002ULL}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{1.0, -1.0},
|
||||
{1.0, -1.0}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{-2.5, 3.5},
|
||||
{-3.0, 4.0}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Nan
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL},
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060831200000NM","NM", "roundd2");
|
||||
|
||||
TEST_START("roundd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].ull.xxx[0] == 0) && (test_a[ii].ull.xxx[1] == 0) ) break;
|
||||
|
||||
res_v = roundd2 (*((vec_double2 *)&test_a[ii].dbl.xxx[0]) );
|
||||
sprintf(msg,"2006083120%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, (vec_llong2)*((vec_double2 *)&test_a[ii].dbl.ans[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
100
Extras/simdmathlibrary/spu/tests/roundf4.c
Normal file
100
Extras/simdmathlibrary/spu/tests/roundf4.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* Test roundf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
// a: float b:float
|
||||
#define DEFINE_DATA(var,a,b) \
|
||||
float var = hide_float(a); \
|
||||
float var ## _out = hide_float(b); \
|
||||
vec_float4 var ## _v = spu_splats(var); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
// a: bit pattern b: bit pattern
|
||||
#define DEFINE_DATA_UNSIGNED(var,a,b) \
|
||||
unsigned int var ## _ina = a ; \
|
||||
unsigned int var ## _inb = b ; \
|
||||
float var = make_float (var ## _ina); \
|
||||
float var ## _out = make_float(var ## _inb); \
|
||||
vec_float4 var ## _v = spu_splats(var); \
|
||||
vec_float4 var ## _out_v = spu_splats(var ## _out);
|
||||
|
||||
#define DO_TEST(var,id) \
|
||||
res_v = roundf4(var ## _v); \
|
||||
TEST_CHECK(" #id ", allequal_float4( res_v, var ## _out_v ), 0);
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_SET_START("164260798500","RUD", "roundf4");
|
||||
|
||||
|
||||
|
||||
//s=0
|
||||
DEFINE_DATA(x1, 1.0, 1.0f)
|
||||
DEFINE_DATA(x2, -1.0,-1.0f)
|
||||
//s=-1
|
||||
DEFINE_DATA(x3, 0.5, 1.0f)
|
||||
DEFINE_DATA(x4, -0.5, -1.0f)
|
||||
//s=-2
|
||||
DEFINE_DATA(x5, 0.25, 0.0f)
|
||||
//s=-3
|
||||
DEFINE_DATA(x6, 0.125, 0.0f)
|
||||
//s=0, e=128, f=7fffff --> s=0, e=128, f=7fffff
|
||||
DEFINE_DATA_UNSIGNED(x7,0x7fffffff,0x7fffffff)
|
||||
//s=0, e=-126, f=0 --> 0
|
||||
DEFINE_DATA_UNSIGNED(x8, 0x800000,0x0)
|
||||
DEFINE_DATA(x9, 0.4999, 0.f)
|
||||
DEFINE_DATA(x10, 0.9999, 1.f)
|
||||
|
||||
//TEST
|
||||
TEST_START("roundf4");
|
||||
DO_TEST(x1,164260798501RUD)
|
||||
DO_TEST(x2,164260798502RUD)
|
||||
DO_TEST(x3,164260798503RUD)
|
||||
DO_TEST(x4,164260798504RUD)
|
||||
DO_TEST(x5,164260798505RUD)
|
||||
DO_TEST(x6,164260798506RUD)
|
||||
DO_TEST(x7,164260798507RUD)
|
||||
DO_TEST(x8,164260798508RUD)
|
||||
DO_TEST(x9,164260798509RUD)
|
||||
DO_TEST(x10,164260798510RUD)
|
||||
TEST_SET_DONE();
|
||||
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
126
Extras/simdmathlibrary/spu/tests/rsqrtd2.c
Normal file
126
Extras/simdmathlibrary/spu/tests/rsqrtd2.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/* Test rsqrtd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928174038EJL","EJL", "rsqrtd2");
|
||||
|
||||
unsigned long long i6 = 0x7464fff515d76f87ull;
|
||||
unsigned long long i6r = 0x25b3c03b72dba06cull;
|
||||
unsigned long long i7 = 0x7606a4533cf5605eull;
|
||||
unsigned long long i7r = 0x24e3056f4b45f6a9ull;
|
||||
unsigned long long i8 = 0x4beae58c6f48733eull;
|
||||
unsigned long long i8r = 0x39f173b787396c5full;
|
||||
unsigned long long i9 = 0x3999ed5c8316b00bull;
|
||||
unsigned long long i9r = 0x43192359a70ec761ull;
|
||||
unsigned long long i10 = 0x68f7885c4b84b793ull;
|
||||
unsigned long long i10r = 0x2b6a62d48c269d90ull;
|
||||
unsigned long long i11 = 0x1aabc083c5c26227ull;
|
||||
unsigned long long i11r = 0x52912e543817fabbull;
|
||||
|
||||
double x0 = hide_double(-1.0/0.0); // -Inf -> NaN
|
||||
double x1 = hide_double(1.0/0.0); // Inf -> +0
|
||||
double x2 = hide_double(0.0); // +0 -> Inf
|
||||
double x3 = hide_double(-0.0); // -0 -> -Inf
|
||||
double x4 = hide_double(0.0/0.0); // NaN -> NaN
|
||||
double x5 = hide_double(4.0);
|
||||
double x5r = hide_double(0.5);
|
||||
double x6 = hide_double(make_double(i6));
|
||||
double x6r = hide_double(make_double(i6r));
|
||||
double x7 = hide_double(make_double(i7));
|
||||
double x7r = hide_double(make_double(i7r));
|
||||
double x8 = hide_double(make_double(i8));
|
||||
double x8r = hide_double(make_double(i8r));
|
||||
double x9 = hide_double(make_double(i9));
|
||||
double x9r = hide_double(make_double(i9r));
|
||||
double x10 = hide_double(make_double(i10));
|
||||
double x10r = hide_double(make_double(i10r));
|
||||
double x11 = hide_double(make_double(i11));
|
||||
double x11r = hide_double(make_double(i11r));
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 x5r_v = spu_splats(x5r);
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 x6r_v = spu_splats(x6r);
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 x7r_v = spu_splats(x7r);
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 x8r_v = spu_splats(x8r);
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 x9r_v = spu_splats(x9r);
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 x10r_v = spu_splats(x10r);
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 x11r_v = spu_splats(x11r);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("rsqrtd2");
|
||||
res_v = rsqrtd2(x0_v);
|
||||
TEST_CHECK("20040928174042EJL", allnan_double2( res_v ), 0);
|
||||
res_v = rsqrtd2(x1_v);
|
||||
TEST_CHECK("20040928174045EJL", allposzero_double2( res_v ), 0);
|
||||
res_v = rsqrtd2(x2_v);
|
||||
TEST_CHECK("20040928174047EJL", allposinf_double2( res_v ), 0);
|
||||
res_v = rsqrtd2(x3_v);
|
||||
TEST_CHECK("20040928174049EJL", allneginf_double2( res_v ), 0);
|
||||
res_v = rsqrtd2(x4_v);
|
||||
TEST_CHECK("20040928174054EJL", allnan_double2( res_v ), 0);
|
||||
res_v = rsqrtd2(x5_v);
|
||||
TEST_CHECK("20040928174058EJL", allequal_double2( res_v, x5r_v ), 0);
|
||||
res_v = rsqrtd2(x6_v);
|
||||
TEST_CHECK("20040928174101EJL", allequal_ulps_double2( res_v, x6r_v, 1 ), 0);
|
||||
res_v = rsqrtd2(x7_v);
|
||||
TEST_CHECK("20040928174104EJL", allequal_ulps_double2( res_v, x7r_v, 1 ), 0);
|
||||
res_v = rsqrtd2(x8_v);
|
||||
TEST_CHECK("20040928174106EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0);
|
||||
res_v = rsqrtd2(x9_v);
|
||||
TEST_CHECK("20040928174108EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0);
|
||||
res_v = rsqrtd2(x10_v);
|
||||
TEST_CHECK("20040928174110EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0);
|
||||
res_v = rsqrtd2(x11_v);
|
||||
TEST_CHECK("20040928174113EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
93
Extras/simdmathlibrary/spu/tests/rsqrtf4.c
Normal file
93
Extras/simdmathlibrary/spu/tests/rsqrtf4.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/* Test rsqrtf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928182349EJL","EJL", "rsqrtf4");
|
||||
|
||||
unsigned int i3 = 0x742c4455;
|
||||
unsigned int i3r = 0x251c099a;
|
||||
unsigned int i4 = 0x75e7753f;
|
||||
unsigned int i4r = 0x243e5fe2;
|
||||
unsigned int i5 = 0x4baa9e3c;
|
||||
unsigned int i5r = 0x395dbbeb;
|
||||
unsigned int i6 = 0x39344296;
|
||||
unsigned int i6r = 0x429889eb;
|
||||
unsigned int i7 = 0x68a586b0;
|
||||
unsigned int i7r = 0x2ae11e67;
|
||||
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
float x6 = hide_float(make_float(i6));
|
||||
float x6r = hide_float(make_float(i6r));
|
||||
float x7 = hide_float(make_float(i7));
|
||||
float x7r = hide_float(make_float(i7r));
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 x6r_v = spu_splats(x6r);
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 x7r_v = spu_splats(x7r);
|
||||
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("rsqrtf4");
|
||||
res_v = rsqrtf4(x3_v);
|
||||
TEST_CHECK("20040928182352EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
|
||||
res_v = rsqrtf4(x4_v);
|
||||
TEST_CHECK("20040928182355EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
|
||||
res_v = rsqrtf4(x5_v);
|
||||
TEST_CHECK("20040928182357EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
|
||||
res_v = rsqrtf4(x6_v);
|
||||
TEST_CHECK("20040928182358EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
|
||||
res_v = rsqrtf4(x7_v);
|
||||
TEST_CHECK("20040928182401EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
251
Extras/simdmathlibrary/spu/tests/scalbllnd2.c
Normal file
251
Extras/simdmathlibrary/spu/tests/scalbllnd2.c
Normal file
@@ -0,0 +1,251 @@
|
||||
/* Test scalbllnd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ scalbllnd2 - Multiply Double by 2 Raised to its Power
|
||||
* For large elements of ex (overflow), returns HUGE_VALF
|
||||
* For small elements of ex (underflow), returns 0.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for scalbllnd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
* add Denormalized handling
|
||||
* Round mode was passed because of spec. (underflow returns 0)
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#undef SCALBLLND2_ROUND
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned long long int xxx[2];
|
||||
unsigned long long int exp[2];
|
||||
unsigned long long int ans0[2];
|
||||
unsigned long long int ans1[2];
|
||||
unsigned long long int ans2[2];
|
||||
unsigned long long int ans3[2];
|
||||
} TestVec64_Ldexp;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec64_Ldexp test_a[] = {
|
||||
{
|
||||
// zero
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000400ULL,0xFFFFFFFFFFFFFC00ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// MIN , MAX
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
|
||||
{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// Inf , -Inf
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
|
||||
{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
|
||||
},{
|
||||
#ifdef SCALBLLND2_ROUND
|
||||
// denotmalized
|
||||
{0x8000000000000003ULL,0x0000000000000003ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x8000000000000002ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000002ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000002ULL,0x0000000000000002ULL}
|
||||
},{
|
||||
// denotmalized -54
|
||||
{0x0010000000000001ULL,0x8010000000000001ULL},
|
||||
{0xFFFFFFFFFFFFFFCAULL,0xFFFFFFFFFFFFFFCAULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// max -> !
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0xFFFFFFFFFFFFF7CEULL,0xFFFFFFFFFFFFF7CEULL},
|
||||
{0x0000000000000001ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000001ULL}
|
||||
},{
|
||||
// max -> !
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0xFFFFFFFFFFFFF7CDULL,0xFFFFFFFFFFFFF7CDULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
#else // SCALBLLND2_ROUND
|
||||
// denotmalized
|
||||
{0x8000000000000003ULL,0x0000000000000003ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x8000000000000001ULL,0x0000000000000001ULL}
|
||||
},{
|
||||
|
||||
#endif // SCALBLLND2_ROUND
|
||||
// denotmalized
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL}
|
||||
},{
|
||||
// denotmalized
|
||||
{0x0008000000000000ULL,0x8008000000000000ULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL},
|
||||
{0x0010000000000000ULL,0x8010000000000000ULL}
|
||||
},{
|
||||
// 1.0
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x00000000000003ffULL,0x00000000000003ffULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
|
||||
{0x7FE0000000000000ULL,0xFFE0000000000000ULL}
|
||||
},{
|
||||
// 1.0 -> max
|
||||
{0x3ff0000000000000ULL,0xbff0000000000000ULL},
|
||||
{0x0000000000000400ULL,0x0000000000000400ULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// max -> !
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0xFFFFFFFF00000000ULL,0xFFFFFFFF00000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
},{
|
||||
// min->
|
||||
{0x0000000000000001ULL,0x8000000000000001ULL},
|
||||
{0x0FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
// NaN , -NaN
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x0000000000000001ULL,0x0000000000000001ULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
|
||||
{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}
|
||||
},{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060907180000NM","NM", "scalbllnd2");
|
||||
|
||||
TEST_START("scalbllnd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
|
||||
|
||||
// set Floating point round mode
|
||||
spu_mtfpscr(((vec_uint4){0x0100,0,0,0}));
|
||||
res_v = scalbllnd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090718%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0);
|
||||
|
||||
#ifdef SCALBLLND2_ROUND
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0600,0,0,0}));
|
||||
res_v = scalbllnd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090718%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0b00,0,0,0}));
|
||||
res_v = scalbllnd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090718%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0);
|
||||
|
||||
spu_mtfpscr(((vec_uint4){0x0c00,0,0,0}));
|
||||
res_v = scalbllnd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
|
||||
sprintf(msg,"2006090718%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0);
|
||||
#endif // SCALBLLND2_ROUND
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
117
Extras/simdmathlibrary/spu/tests/scalbnf4.c
Normal file
117
Extras/simdmathlibrary/spu/tests/scalbnf4.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* Test nextafterf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
float xxx[4];
|
||||
int exp[4];
|
||||
float ans[4];
|
||||
} flt;
|
||||
struct {
|
||||
unsigned int xxx[4];
|
||||
unsigned int exp[4];
|
||||
unsigned int ans[4];
|
||||
} ui;
|
||||
} TestVec_ScalF4;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec_ScalF4 test_a[] = {
|
||||
{
|
||||
ui:{
|
||||
// 0 -> 0 , -0 -> -0
|
||||
{0x00000000,0x80000000,0x80000000,0x00000000},
|
||||
{0x000000FF,0x00000001,0xFFFFFFFF,0xFFFFFF00},
|
||||
{0x00000000,0x80000000,0x80000000,0x00000000}
|
||||
}
|
||||
},{
|
||||
ui:{
|
||||
// Inf
|
||||
{0xFF800000,0x7F800000,0x7F800000,0xFF800000},
|
||||
{0x000000FF,0x00000001,0xFFFFFFFF,0xFFFFFF00},
|
||||
{0xFFFFFFFF,0x7FFFFFFF,0x7F000000,0x80000000}
|
||||
}
|
||||
},{
|
||||
ui:{
|
||||
// MAX MIN
|
||||
{0x7F7FFFFF,0xFF7FFFFF,0x7F7FFFFF,0xFF7FFFFF},
|
||||
{0x00000001,0x00000001,0xFFFFFFFF,0xFFFFFF00},
|
||||
{0x7FFFFFFF,0xFFFFFFFF,0x7EFFFFFF,0x00000000}
|
||||
}
|
||||
},{
|
||||
flt:{
|
||||
{-1.0, 1.0, -1.0, 1.0},
|
||||
{ 1, 1, -1, -1},
|
||||
{-2.0, 2.0, -0.5, 0.5}
|
||||
}
|
||||
},{
|
||||
ui:{
|
||||
//
|
||||
{0x80ffffff,0x80ffffff,0x00ffffff,0x00ffffff},
|
||||
{0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
|
||||
{0x80000000,0x80000000,0x00000000,0x00000000}
|
||||
}
|
||||
},{
|
||||
ui:{
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0}
|
||||
}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_SET_START("20060907150000NM","NM", "scalbnf4");
|
||||
|
||||
TEST_START("scalbnf4");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].ui.xxx[0] == 0) && (test_a[ii].ui.xxx[1] == 0) ) break;
|
||||
|
||||
res_v = scalbnf4 (*((vec_float4 *)&test_a[ii].flt.xxx[0]), *((vec_int4 *)&test_a[ii].flt.exp[0]) );
|
||||
sprintf(msg,"2006090715%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_float4( res_v, *((vec_float4 *)&test_a[ii].flt.ans[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
195
Extras/simdmathlibrary/spu/tests/signbitd2.c
Normal file
195
Extras/simdmathlibrary/spu/tests/signbitd2.c
Normal file
@@ -0,0 +1,195 @@
|
||||
/* Test signbitd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060829000000AAN","AAN", "signbitd2");
|
||||
|
||||
//-Nan
|
||||
double x0 = hide_double(-nan(""));
|
||||
unsigned long long r0 = 0xffffffffffffffffull;
|
||||
|
||||
//-Inf
|
||||
double x1 = hide_double(-1.0/0.0);
|
||||
unsigned long long r1 = 0xffffffffffffffffull;
|
||||
|
||||
//-Smax
|
||||
double x2 = hide_double(-DBL_MAX);
|
||||
unsigned long long r2 = 0xffffffffffffffffull;
|
||||
|
||||
//-Norm
|
||||
double x3 = hide_double(-168.97345223013);
|
||||
unsigned long long r3 = 0xffffffffffffffffull;
|
||||
|
||||
//-Denorm
|
||||
double x4 = hide_double(make_double(0x803AAAAAAAAAAAAAull));
|
||||
unsigned long long r4 = 0xffffffffffffffffull;
|
||||
|
||||
//-Smin
|
||||
double x5 = hide_double(-DBL_MIN);
|
||||
unsigned long long r5 = 0xffffffffffffffffull;
|
||||
|
||||
//-Unf
|
||||
double x6 = hide_double(-1.0e-999);
|
||||
unsigned long long r6 = 0xffffffffffffffffull;
|
||||
|
||||
// -0
|
||||
double x7 = hide_double(-0.0);
|
||||
unsigned long long r7 = 0xffffffffffffffffull;
|
||||
|
||||
// 0
|
||||
double x8 = hide_double( 0.0);
|
||||
unsigned long long r8 = 0x0000000000000000ull;
|
||||
|
||||
//+Unf
|
||||
double x9 = hide_double( 1.0e-999);
|
||||
unsigned long long r9 = 0x0000000000000000ull;
|
||||
|
||||
//+Smin
|
||||
double x10 = hide_double( DBL_MIN);
|
||||
unsigned long long r10 = 0x0000000000000000ull;
|
||||
|
||||
//+Denorm
|
||||
double x11 = hide_double(make_double(0x007AAAAAAAAAAAAAull));
|
||||
unsigned long long r11 = 0x0000000000000000ull;
|
||||
|
||||
//+Norm
|
||||
double x12 = hide_double( 672953.74593);
|
||||
unsigned long long r12 = 0x0000000000000000ull;
|
||||
|
||||
//+Smax
|
||||
double x13 = hide_double( DBL_MAX);
|
||||
unsigned long long r13 = 0x0000000000000000ull;
|
||||
|
||||
//+Inf
|
||||
double x14 = hide_double( 1.0/0.0);
|
||||
unsigned long long r14 = 0x0000000000000000ull;
|
||||
|
||||
//+NaN
|
||||
double x15 = hide_double( nan(""));
|
||||
unsigned long long r15 = 0x0000000000000000ull;
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_ullong2 r0_v = spu_splats(r0);
|
||||
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_ullong2 r1_v = spu_splats(r1);
|
||||
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_ullong2 r2_v = spu_splats(r2);
|
||||
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_ullong2 r3_v = spu_splats(r3);
|
||||
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_ullong2 r4_v = spu_splats(r4);
|
||||
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_ullong2 r5_v = spu_splats(r5);
|
||||
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_ullong2 r6_v = spu_splats(r6);
|
||||
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_ullong2 r7_v = spu_splats(r7);
|
||||
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_ullong2 r8_v = spu_splats(r8);
|
||||
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_ullong2 r9_v = spu_splats(r9);
|
||||
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_ullong2 r10_v = spu_splats(r10);
|
||||
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_ullong2 r11_v = spu_splats(r11);
|
||||
|
||||
vec_double2 x12_v = spu_splats(x12);
|
||||
vec_ullong2 r12_v = spu_splats(r12);
|
||||
|
||||
vec_double2 x13_v = spu_splats(x13);
|
||||
vec_ullong2 r13_v = spu_splats(r13);
|
||||
|
||||
vec_double2 x14_v = spu_splats(x14);
|
||||
vec_ullong2 r14_v = spu_splats(r14);
|
||||
|
||||
vec_double2 x15_v = spu_splats(x15);
|
||||
vec_ullong2 r15_v = spu_splats(r15);
|
||||
|
||||
vec_ullong2 res_v;
|
||||
|
||||
TEST_START("signbitd2");
|
||||
|
||||
res_v = (vec_ullong2)signbitd2(x0_v);
|
||||
TEST_CHECK("20060829000000AAN", allequal_ullong2( res_v, r0_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x1_v);
|
||||
TEST_CHECK("20060829000001AAN", allequal_ullong2( res_v, r1_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x2_v);
|
||||
TEST_CHECK("20060829000002AAN", allequal_ullong2( res_v, r2_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x3_v);
|
||||
TEST_CHECK("20060829000003AAN", allequal_ullong2( res_v, r3_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x4_v);
|
||||
TEST_CHECK("20060829000004AAN", allequal_ullong2( res_v, r4_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x5_v);
|
||||
TEST_CHECK("20060829000005AAN", allequal_ullong2( res_v, r5_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x6_v);
|
||||
TEST_CHECK("20060829000006AAN", allequal_ullong2( res_v, r6_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x7_v);
|
||||
TEST_CHECK("20060829000007AAN", allequal_ullong2( res_v, r7_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x8_v);
|
||||
TEST_CHECK("20060829000008AAN", allequal_ullong2( res_v, r8_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x9_v);
|
||||
TEST_CHECK("20060829000009AAN", allequal_ullong2( res_v, r9_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x10_v);
|
||||
TEST_CHECK("20060829000010AAN", allequal_ullong2( res_v, r10_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x11_v);
|
||||
TEST_CHECK("20060829000011AAN", allequal_ullong2( res_v, r11_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x12_v);
|
||||
TEST_CHECK("20060829000012AAN", allequal_ullong2( res_v, r12_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x13_v);
|
||||
TEST_CHECK("20060829000013AAN", allequal_ullong2( res_v, r13_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x14_v);
|
||||
TEST_CHECK("20060829000014AAN", allequal_ullong2( res_v, r14_v ), 0);
|
||||
res_v = (vec_ullong2)signbitd2(x15_v);
|
||||
TEST_CHECK("20060829000015AAN", allequal_ullong2( res_v, r15_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
195
Extras/simdmathlibrary/spu/tests/signbitf4.c
Normal file
195
Extras/simdmathlibrary/spu/tests/signbitf4.c
Normal file
@@ -0,0 +1,195 @@
|
||||
/* Test signbitf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20060829000000AAN","AAN", "signbitf4");
|
||||
|
||||
//-Nan
|
||||
float x0 = hide_float(-nan(""));
|
||||
unsigned int r0 = 0xffffffff;
|
||||
|
||||
//-Inf
|
||||
float x1 = hide_float(-1.0/0.0);
|
||||
unsigned int r1 = 0xffffffff;
|
||||
|
||||
//-Smax
|
||||
float x2 = hide_float(-FLT_MAX);
|
||||
unsigned int r2 = 0xffffffff;
|
||||
|
||||
//-Norm
|
||||
float x3 = hide_float(-168.97345223013f);
|
||||
unsigned int r3 = 0xffffffff;
|
||||
|
||||
//-Denorm
|
||||
float x4 = hide_float(make_float(0x803AAAAA));
|
||||
unsigned int r4 = 0xffffffff;
|
||||
|
||||
//-Smin
|
||||
float x5 = hide_float(-FLT_MIN);
|
||||
unsigned int r5 = 0xffffffff;
|
||||
|
||||
//-Unf
|
||||
float x6 = hide_float(-1.0e-999);
|
||||
unsigned int r6 = 0xffffffff;
|
||||
|
||||
// -0
|
||||
float x7 = hide_float(-0.0f);
|
||||
unsigned int r7 = 0xffffffff;
|
||||
|
||||
// 0
|
||||
float x8 = hide_float( 0.0f);
|
||||
unsigned int r8 = 0x00000000;
|
||||
|
||||
//+Unf
|
||||
float x9 = hide_float( 1.0e-999);
|
||||
unsigned int r9 = 0x00000000;
|
||||
|
||||
//+Smin
|
||||
float x10 = hide_float( FLT_MIN);
|
||||
unsigned int r10 = 0x00000000;
|
||||
|
||||
//+Denorm
|
||||
float x11 = hide_float(make_float(0x007AAAAA));
|
||||
unsigned int r11 = 0x00000000;
|
||||
|
||||
//+Norm
|
||||
float x12 = hide_float( 672953.74593f);
|
||||
unsigned int r12 = 0x00000000;
|
||||
|
||||
//+Smax
|
||||
float x13 = hide_float( FLT_MAX);
|
||||
unsigned int r13 = 0x00000000;
|
||||
|
||||
//+Inf
|
||||
float x14 = hide_float( 1.0/0.0);
|
||||
unsigned int r14 = 0x00000000;
|
||||
|
||||
//+NaN
|
||||
float x15 = hide_float( nan(""));
|
||||
unsigned int r15 = 0x00000000;
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_uint4 r0_v = spu_splats(r0);
|
||||
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_uint4 r1_v = spu_splats(r1);
|
||||
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_uint4 r2_v = spu_splats(r2);
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_uint4 r3_v = spu_splats(r3);
|
||||
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_uint4 r4_v = spu_splats(r4);
|
||||
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_uint4 r5_v = spu_splats(r5);
|
||||
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_uint4 r6_v = spu_splats(r6);
|
||||
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_uint4 r7_v = spu_splats(r7);
|
||||
|
||||
vec_float4 x8_v = spu_splats(x8);
|
||||
vec_uint4 r8_v = spu_splats(r8);
|
||||
|
||||
vec_float4 x9_v = spu_splats(x9);
|
||||
vec_uint4 r9_v = spu_splats(r9);
|
||||
|
||||
vec_float4 x10_v = spu_splats(x10);
|
||||
vec_uint4 r10_v = spu_splats(r10);
|
||||
|
||||
vec_float4 x11_v = spu_splats(x11);
|
||||
vec_uint4 r11_v = spu_splats(r11);
|
||||
|
||||
vec_float4 x12_v = spu_splats(x12);
|
||||
vec_uint4 r12_v = spu_splats(r12);
|
||||
|
||||
vec_float4 x13_v = spu_splats(x13);
|
||||
vec_uint4 r13_v = spu_splats(r13);
|
||||
|
||||
vec_float4 x14_v = spu_splats(x14);
|
||||
vec_uint4 r14_v = spu_splats(r14);
|
||||
|
||||
vec_float4 x15_v = spu_splats(x15);
|
||||
vec_uint4 r15_v = spu_splats(r15);
|
||||
|
||||
vec_uint4 res_v;
|
||||
|
||||
TEST_START("signbitf4");
|
||||
|
||||
res_v = (vec_uint4)signbitf4(x0_v);
|
||||
TEST_CHECK("20060829000000AAN", allequal_uint4( res_v, r0_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x1_v);
|
||||
TEST_CHECK("20060829000001AAN", allequal_uint4( res_v, r1_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x2_v);
|
||||
TEST_CHECK("20060829000002AAN", allequal_uint4( res_v, r2_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x3_v);
|
||||
TEST_CHECK("20060829000003AAN", allequal_uint4( res_v, r3_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x4_v);
|
||||
TEST_CHECK("20060829000004AAN", allequal_uint4( res_v, r4_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x5_v);
|
||||
TEST_CHECK("20060829000005AAN", allequal_uint4( res_v, r5_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x6_v);
|
||||
TEST_CHECK("20060829000006AAN", allequal_uint4( res_v, r6_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x7_v);
|
||||
TEST_CHECK("20060829000007AAN", allequal_uint4( res_v, r7_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x8_v);
|
||||
TEST_CHECK("20060829000008AAN", allequal_uint4( res_v, r8_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x9_v);
|
||||
TEST_CHECK("20060829000009AAN", allequal_uint4( res_v, r9_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x10_v);
|
||||
TEST_CHECK("20060829000010AAN", allequal_uint4( res_v, r10_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x11_v);
|
||||
TEST_CHECK("20060829000011AAN", allequal_uint4( res_v, r11_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x12_v);
|
||||
TEST_CHECK("20060829000012AAN", allequal_uint4( res_v, r12_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x13_v);
|
||||
TEST_CHECK("20060829000013AAN", allequal_uint4( res_v, r13_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x14_v);
|
||||
TEST_CHECK("20060829000014AAN", allequal_uint4( res_v, r14_v ), 0);
|
||||
res_v = (vec_uint4)signbitf4(x15_v);
|
||||
TEST_CHECK("20060829000015AAN", allequal_uint4( res_v, r15_v ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
128
Extras/simdmathlibrary/spu/tests/sqrtd2.c
Normal file
128
Extras/simdmathlibrary/spu/tests/sqrtd2.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* Test sqrtd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928181417EJL","EJL", "sqrtd2");
|
||||
|
||||
unsigned long long i6 = 0x7464fff515d76f87ull;
|
||||
unsigned long long i6r = 0x5a29ec408d8da268ull;
|
||||
unsigned long long i7 = 0x7606a4533cf5605eull;
|
||||
unsigned long long i7r = 0x5afaead3b0ed2de5ull;
|
||||
unsigned long long i8 = 0x4beae58c6f48733eull;
|
||||
unsigned long long i8r = 0x45ed566b9c6464d6ull;
|
||||
unsigned long long i9 = 0x3999ed5c8316b00bull;
|
||||
unsigned long long i9r = 0x3cc45e14871d1b1full;
|
||||
unsigned long long i10 = 0x68f7885c4b84b793ull;
|
||||
unsigned long long i10r = 0x54736778e6778980ull;
|
||||
unsigned long long i11 = 0x1aabc083c5c26227ull;
|
||||
unsigned long long i11r = 0x2d4dcce790f64a35ull;
|
||||
|
||||
double x0 = hide_double(-1.0/0.0); // -Inf -> NaN
|
||||
double x1 = hide_double(1.0/0.0); // Inf -> Inf
|
||||
double x2 = hide_double(0.0); // +0 -> +0
|
||||
double x3 = hide_double(-0.0); // -0 -> -0
|
||||
double x4 = hide_double(0.0/0.0); // NaN -> NaN
|
||||
double x5 = hide_double(4.0);
|
||||
double x5r = hide_double(2.0);
|
||||
double x6 = hide_double(make_double(i6));
|
||||
double x6r = hide_double(make_double(i6r));
|
||||
double x7 = hide_double(make_double(i7));
|
||||
double x7r = hide_double(make_double(i7r));
|
||||
double x8 = hide_double(make_double(i8));
|
||||
double x8r = hide_double(make_double(i8r));
|
||||
double x9 = hide_double(make_double(i9));
|
||||
double x9r = hide_double(make_double(i9r));
|
||||
double x10 = hide_double(make_double(i10));
|
||||
double x10r = hide_double(make_double(i10r));
|
||||
double x11 = hide_double(make_double(i11));
|
||||
double x11r = hide_double(make_double(i11r));
|
||||
|
||||
vec_double2 x0_v = spu_splats(x0);
|
||||
vec_double2 x1_v = spu_splats(x1);
|
||||
vec_double2 x2_v = spu_splats(x2);
|
||||
vec_double2 x3_v = spu_splats(x3);
|
||||
vec_double2 x4_v = spu_splats(x4);
|
||||
vec_double2 x5_v = spu_splats(x5);
|
||||
vec_double2 x5r_v = spu_splats(x5r);
|
||||
vec_double2 x6_v = spu_splats(x6);
|
||||
vec_double2 x6r_v = spu_splats(x6r);
|
||||
vec_double2 x7_v = spu_splats(x7);
|
||||
vec_double2 x7r_v = spu_splats(x7r);
|
||||
vec_double2 x8_v = spu_splats(x8);
|
||||
vec_double2 x8r_v = spu_splats(x8r);
|
||||
vec_double2 x9_v = spu_splats(x9);
|
||||
vec_double2 x9r_v = spu_splats(x9r);
|
||||
vec_double2 x10_v = spu_splats(x10);
|
||||
vec_double2 x10r_v = spu_splats(x10r);
|
||||
vec_double2 x11_v = spu_splats(x11);
|
||||
vec_double2 x11r_v = spu_splats(x11r);
|
||||
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_START("sqrtd2");
|
||||
res_v = sqrtd2(x0_v);
|
||||
TEST_CHECK("20040928181422EJL", allnan_double2( res_v ), 0);
|
||||
res_v = sqrtd2(x1_v);
|
||||
TEST_CHECK("20040928181424EJL", allposinf_double2( res_v ), 0);
|
||||
res_v = sqrtd2(x2_v);
|
||||
TEST_CHECK("20040928181426EJL", allposzero_double2( res_v ), 0);
|
||||
res_v = sqrtd2(x3_v);
|
||||
TEST_CHECK("20040928181430EJL", allnegzero_double2( res_v ), 0);
|
||||
res_v = sqrtd2(x4_v);
|
||||
TEST_CHECK("20040928181432EJL", allnan_double2( res_v ), 0);
|
||||
res_v = sqrtd2(x5_v);
|
||||
TEST_CHECK("20040928181434EJL", allequal_double2( res_v, x5r_v ), 0);
|
||||
res_v = sqrtd2(x6_v);
|
||||
TEST_CHECK("20040928181436EJL", allequal_ulps_double2( res_v, x6r_v, 1 ), 0);
|
||||
res_v = sqrtd2(x7_v);
|
||||
TEST_CHECK("20040928181438EJL", allequal_ulps_double2( res_v, x7r_v, 1 ), 0);
|
||||
res_v = sqrtd2(x8_v);
|
||||
TEST_CHECK("20040928181440EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0);
|
||||
res_v = sqrtd2(x9_v);
|
||||
TEST_CHECK("20040928181442EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0);
|
||||
res_v = sqrtd2(x10_v);
|
||||
TEST_CHECK("20040928181444EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0);
|
||||
res_v = sqrtd2(x11_v);
|
||||
TEST_CHECK("20040928181446EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
92
Extras/simdmathlibrary/spu/tests/sqrtf4.c
Normal file
92
Extras/simdmathlibrary/spu/tests/sqrtf4.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* Test sqrtf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040928182549EJL","EJL", "sqrtf4");
|
||||
|
||||
unsigned int i3 = 0x742c4455;
|
||||
unsigned int i3r = 0x59d20034;
|
||||
unsigned int i4 = 0x75e7753f;
|
||||
unsigned int i4r = 0x5aac1fb5;
|
||||
unsigned int i5 = 0x4baa9e3c;
|
||||
unsigned int i5r = 0x4593c7d8;
|
||||
unsigned int i6 = 0x39344296;
|
||||
unsigned int i6r = 0x3c56d14c;
|
||||
unsigned int i7 = 0x68a586b0;
|
||||
unsigned int i7r = 0x54118f09;
|
||||
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3r = hide_float(make_float(i3r));
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4r = hide_float(make_float(i4r));
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5r = hide_float(make_float(i5r));
|
||||
float x6 = hide_float(make_float(i6));
|
||||
float x6r = hide_float(make_float(i6r));
|
||||
float x7 = hide_float(make_float(i7));
|
||||
float x7r = hide_float(make_float(i7r));
|
||||
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3r_v = spu_splats(x3r);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4r_v = spu_splats(x4r);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5r_v = spu_splats(x5r);
|
||||
vec_float4 x6_v = spu_splats(x6);
|
||||
vec_float4 x6r_v = spu_splats(x6r);
|
||||
vec_float4 x7_v = spu_splats(x7);
|
||||
vec_float4 x7r_v = spu_splats(x7r);
|
||||
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("sqrtf4");
|
||||
res_v = sqrtf4(x3_v);
|
||||
TEST_CHECK("20040928182552EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
|
||||
res_v = sqrtf4(x4_v);
|
||||
TEST_CHECK("20040928182554EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
|
||||
res_v = sqrtf4(x5_v);
|
||||
TEST_CHECK("20040928182556EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
|
||||
res_v = sqrtf4(x6_v);
|
||||
TEST_CHECK("20040928182557EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
|
||||
res_v = sqrtf4(x7_v);
|
||||
TEST_CHECK("20040928182559EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
321
Extras/simdmathlibrary/spu/tests/testutils.c
Normal file
321
Extras/simdmathlibrary/spu/tests/testutils.c
Normal file
@@ -0,0 +1,321 @@
|
||||
/* Common part of testsuite for SPU SIMD Math library
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <spu_intrinsics.h>
|
||||
#include <simdmath.h>
|
||||
#include "testutils.h"
|
||||
|
||||
typedef union {
|
||||
unsigned int ui;
|
||||
float f;
|
||||
} conv4_t;
|
||||
|
||||
typedef union {
|
||||
unsigned long long ull;
|
||||
double df;
|
||||
} conv8_t;
|
||||
|
||||
unsigned int
|
||||
hide_uint( unsigned int x )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
hide_int( int x )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
float
|
||||
hide_float( float x )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
double
|
||||
hide_double( double x )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
float
|
||||
make_float( unsigned int x )
|
||||
{
|
||||
conv4_t val;
|
||||
val.ui = x;
|
||||
return val.f;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
make_uint( float x )
|
||||
{
|
||||
conv4_t val;
|
||||
val.f = x;
|
||||
return val.ui;
|
||||
}
|
||||
|
||||
double
|
||||
make_double( unsigned long long x )
|
||||
{
|
||||
conv8_t val;
|
||||
val.ull = x;
|
||||
return val.df;
|
||||
}
|
||||
|
||||
unsigned long long
|
||||
make_ulonglong( double x )
|
||||
{
|
||||
conv8_t val;
|
||||
val.df = x;
|
||||
return val.ull;
|
||||
}
|
||||
|
||||
vec_uint4 bitDiff_f4(vec_float4 ref, vec_float4 vals) {
|
||||
vec_int4 refi = (vec_int4)ref;
|
||||
vec_int4 valsi = (vec_int4)vals;
|
||||
vec_int4 diff = spu_sub(refi, valsi);
|
||||
vec_int4 negdiff = spu_sub(spu_splats((int)0), diff);
|
||||
|
||||
return spu_sub((vec_uint4)spu_splats(32), spu_cntlz(spu_sel(negdiff, diff, (vec_uchar16)spu_cmpgt(diff, 0))));
|
||||
}
|
||||
|
||||
unsigned int bitDiff_f(float ref, float val) {
|
||||
return spu_extract(bitDiff_f4(spu_promote(ref,0), spu_promote(val,0)), 0);
|
||||
}
|
||||
|
||||
vec_ullong2 bitDiff_d2(vec_double2 ref, vec_double2 vals) {
|
||||
double ref0, ref1, vals0, vals1;
|
||||
long long refi0, refi1, valsi0, valsi1, diff0, diff1;
|
||||
vec_ullong2 bits;
|
||||
|
||||
ref0 = spu_extract(ref,0);
|
||||
ref1 = spu_extract(ref,1);
|
||||
vals0 = spu_extract(vals,0);
|
||||
vals1 = spu_extract(vals,1);
|
||||
|
||||
refi0 = make_ulonglong(ref0);
|
||||
refi1 = make_ulonglong(ref1);
|
||||
valsi0 = make_ulonglong(vals0);
|
||||
valsi1 = make_ulonglong(vals1);
|
||||
|
||||
diff0 = refi0 - valsi0;
|
||||
diff1 = refi1 - valsi1;
|
||||
|
||||
if ( diff0 < 0 )
|
||||
{
|
||||
diff0 = valsi0 - refi0;
|
||||
}
|
||||
|
||||
if ( diff1 < 0 )
|
||||
{
|
||||
diff1 = valsi1 - refi1;
|
||||
}
|
||||
|
||||
bits = spu_promote( (unsigned long long)ceil(log2((double)diff0)), 0 );
|
||||
bits = spu_insert( (unsigned long long)ceil(log2((double)diff1)), bits, 1 );
|
||||
|
||||
return bits;
|
||||
}
|
||||
|
||||
unsigned long long bitDiff_d(double ref, double val) {
|
||||
return spu_extract(bitDiff_d2(spu_promote(ref,0), spu_promote(val,0)), 0);
|
||||
}
|
||||
|
||||
vec_uint4 ulpDiff_f4(vec_float4 ref, vec_float4 vals) {
|
||||
vec_int4 refi = (vec_int4)ref;
|
||||
vec_int4 valsi = (vec_int4)vals;
|
||||
vec_int4 diff = spu_sub(refi, valsi);
|
||||
vec_int4 negdiff = spu_sub(spu_splats((int)0), diff);
|
||||
|
||||
return (vec_uint4)(spu_sel(negdiff, diff, (vec_uchar16)spu_cmpgt(diff, 0)));
|
||||
}
|
||||
|
||||
unsigned int ulpDiff_f(float ref, float val) {
|
||||
return spu_extract(ulpDiff_f4(spu_promote(ref,0), spu_promote(val,0)), 0);
|
||||
}
|
||||
|
||||
vec_ullong2 ulpDiff_d2(vec_double2 ref, vec_double2 vals) {
|
||||
double ref0, ref1, vals0, vals1;
|
||||
long long refi0, refi1, valsi0, valsi1, diff0, diff1;
|
||||
vec_ullong2 ulps;
|
||||
|
||||
ref0 = spu_extract(ref,0);
|
||||
ref1 = spu_extract(ref,1);
|
||||
vals0 = spu_extract(vals,0);
|
||||
vals1 = spu_extract(vals,1);
|
||||
|
||||
refi0 = make_ulonglong(ref0);
|
||||
refi1 = make_ulonglong(ref1);
|
||||
valsi0 = make_ulonglong(vals0);
|
||||
valsi1 = make_ulonglong(vals1);
|
||||
|
||||
diff0 = refi0 - valsi0;
|
||||
diff1 = refi1 - valsi1;
|
||||
|
||||
if ( diff0 < 0 )
|
||||
{
|
||||
diff0 = valsi0 - refi0;
|
||||
}
|
||||
|
||||
if ( diff1 < 0 )
|
||||
{
|
||||
diff1 = valsi1 - refi1;
|
||||
}
|
||||
|
||||
ulps = spu_promote( (unsigned long long)diff0, 0 );
|
||||
ulps = spu_insert( (unsigned long long)diff1, ulps, 1 );
|
||||
|
||||
return ulps;
|
||||
}
|
||||
|
||||
unsigned long long ulpDiff_d(double ref, double val) {
|
||||
return spu_extract(ulpDiff_d2(spu_promote(ref,0), spu_promote(val,0)), 0);
|
||||
}
|
||||
|
||||
vec_ullong2 cmpposzerod2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 cmp;
|
||||
vec_uchar16 even = (vec_uchar16)(vec_uint4){ 0x00010203, 0x00010203, 0x08090a0b, 0x08090a0b };
|
||||
vec_uchar16 odd = (vec_uchar16)(vec_uint4){ 0x04050607, 0x04050607, 0x0c0d0e0f, 0x0c0d0e0f };
|
||||
|
||||
cmp = (vec_ullong2)spu_cmpeq( (vec_int4)x, spu_splats(0) );
|
||||
cmp = spu_and( spu_shuffle( cmp, cmp, even ), spu_shuffle( cmp, cmp, odd ) );
|
||||
|
||||
return cmp;
|
||||
}
|
||||
|
||||
vec_ullong2 cmpnegzerod2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 cmp;
|
||||
vec_uchar16 even = (vec_uchar16)(vec_uint4){ 0x00010203, 0x00010203, 0x08090a0b, 0x08090a0b };
|
||||
vec_uchar16 odd = (vec_uchar16)(vec_uint4){ 0x04050607, 0x04050607, 0x0c0d0e0f, 0x0c0d0e0f };
|
||||
|
||||
cmp = (vec_ullong2)spu_cmpeq( (vec_int4)x, (vec_int4)spu_splats(0x8000000000000000ull) );
|
||||
cmp = spu_and( spu_shuffle( cmp, cmp, even ), spu_shuffle( cmp, cmp, odd ) );
|
||||
|
||||
return cmp;
|
||||
}
|
||||
|
||||
int allequal_int4( vec_int4 x, vec_int4 y )
|
||||
{
|
||||
return ( spu_extract( spu_gather( spu_cmpeq( x, y ) ), 0 ) == 0xf );
|
||||
}
|
||||
int allequal_llong2( vec_llong2 x, vec_llong2 y )
|
||||
{
|
||||
return spu_extract( spu_gather( spu_cmpeq ((vec_int4)(x - y), spu_splats((int)0) )), 0) == 0xF;
|
||||
}
|
||||
|
||||
int allequal_float4( vec_float4 x, vec_float4 y )
|
||||
{
|
||||
return ( spu_extract( spu_gather( (vec_uint4)spu_cmpeq( x, y ) ), 0 ) == 0xf );
|
||||
}
|
||||
|
||||
int allequal_double2( vec_double2 x, vec_double2 y )
|
||||
{
|
||||
return ( spu_extract(x,0) == spu_extract(y,0) && spu_extract(x,1) == spu_extract(y,1) );
|
||||
}
|
||||
|
||||
int allequal_llroundf4( llroundf4_t x, llroundf4_t y )
|
||||
{
|
||||
return ( spu_extract(x.vll[0],0) == spu_extract(y.vll[0],0) &&
|
||||
spu_extract(x.vll[0],1) == spu_extract(y.vll[0],1) &&
|
||||
spu_extract(x.vll[1],0) == spu_extract(y.vll[1],0) &&
|
||||
spu_extract(x.vll[1],1) == spu_extract(y.vll[1],1) );
|
||||
}
|
||||
|
||||
int allequal_ulps_float4( vec_float4 x, vec_float4 y, int tolerance )
|
||||
{
|
||||
vec_uint4 ulps = ulpDiff_f4( x, y );
|
||||
return ( (int)spu_extract(ulps,0) <= tolerance &&
|
||||
(int)spu_extract(ulps,1) <= tolerance &&
|
||||
(int)spu_extract(ulps,2) <= tolerance &&
|
||||
(int)spu_extract(ulps,3) <= tolerance );
|
||||
}
|
||||
|
||||
int allequal_ulps_double2( vec_double2 x, vec_double2 y, int tolerance )
|
||||
{
|
||||
vec_ullong2 ulps = ulpDiff_d2( x, y );
|
||||
return ( (int)spu_extract(ulps,0) <= tolerance && (int)spu_extract(ulps,1) <= tolerance );
|
||||
}
|
||||
|
||||
int allequal_bits_float4( vec_float4 x, vec_float4 y, int tolerance )
|
||||
{
|
||||
vec_uint4 bits = bitDiff_f4( x, y );
|
||||
return ( (int)spu_extract(bits,0) <= tolerance &&
|
||||
(int)spu_extract(bits,1) <= tolerance &&
|
||||
(int)spu_extract(bits,2) <= tolerance &&
|
||||
(int)spu_extract(bits,3) <= tolerance );
|
||||
}
|
||||
|
||||
int allequal_bits_double2( vec_double2 x, vec_double2 y, int tolerance )
|
||||
{
|
||||
vec_ullong2 bits = bitDiff_d2( x, y );
|
||||
return ( (int)spu_extract(bits,0) <= tolerance && (int)spu_extract(bits,1) <= tolerance );
|
||||
}
|
||||
|
||||
int allposinf_double2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 posinf = spu_andc( isinfd2 ( x ), signbitd2 ( x ) );
|
||||
return ( spu_extract(posinf,0) != 0 && spu_extract(posinf,1) != 0 );
|
||||
}
|
||||
|
||||
int allneginf_double2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 neginf = spu_and( isinfd2 ( x ), signbitd2 ( x ) );
|
||||
return ( spu_extract(neginf,0) != 0 && spu_extract(neginf,1) != 0 );
|
||||
}
|
||||
|
||||
int allzerodenorm_double2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 zero = is0denormd2 ( x );
|
||||
return ( spu_extract(zero,0) != 0 && spu_extract(zero,1) != 0 );
|
||||
}
|
||||
|
||||
int allposzero_double2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 poszero = cmpposzerod2( x );
|
||||
return ( spu_extract(poszero,0) != 0 && spu_extract(poszero,1) != 0 );
|
||||
}
|
||||
|
||||
int allnegzero_double2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 negzero = cmpnegzerod2( x );
|
||||
return ( spu_extract(negzero,0) != 0 && spu_extract(negzero,1) != 0 );
|
||||
}
|
||||
|
||||
int allnan_double2( vec_double2 x )
|
||||
{
|
||||
vec_ullong2 nan = isnand2 ( x );
|
||||
return ( spu_extract(nan,0) != 0 && spu_extract(nan,1) != 0 );
|
||||
}
|
||||
|
||||
|
||||
85
Extras/simdmathlibrary/spu/tests/testutils.h
Normal file
85
Extras/simdmathlibrary/spu/tests/testutils.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Common part for SPU SIMD Math library testsuite
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _TESTUTILS_H_
|
||||
|
||||
#include "floatingpoint_tests.h"
|
||||
|
||||
extern unsigned int hide_uint( unsigned int x );
|
||||
extern int hide_int( int x );
|
||||
extern float hide_float( float x );
|
||||
extern double hide_double( double x );
|
||||
|
||||
extern float make_float( unsigned int x );
|
||||
extern unsigned int make_uint( float x );
|
||||
extern double make_double( unsigned long long x );
|
||||
extern unsigned long long make_ulonglong( double x );
|
||||
|
||||
extern vec_uint4 bitDiff_f4(vec_float4 ref, vec_float4 vals);
|
||||
extern unsigned int bitDiff_f(float ref, float val);
|
||||
|
||||
extern vec_ullong2 bitDiff_d2(vec_double2 ref, vec_double2 vals);
|
||||
extern unsigned long long bitDiff_d(double ref, double val);
|
||||
|
||||
extern vec_uint4 ulpDiff_f4(vec_float4 ref, vec_float4 vals);
|
||||
extern unsigned int ulpDiff_f(float ref, float val);
|
||||
|
||||
extern vec_ullong2 ulpDiff_d2(vec_double2 ref, vec_double2 vals);
|
||||
extern unsigned long long ulpDiff_d(double ref, double val);
|
||||
|
||||
extern vec_ullong2 cmpposzerod2( vec_double2 x );
|
||||
extern vec_ullong2 cmpnegzerod2( vec_double2 x );
|
||||
extern int allequal_int4( vec_int4 x, vec_int4 y );
|
||||
static inline int allequal_uint4( vec_uint4 x, vec_uint4 y )
|
||||
{
|
||||
return allequal_int4 ((vec_int4)x, (vec_int4)y);
|
||||
}
|
||||
extern int allequal_llong2( vec_llong2 x, vec_llong2 y );
|
||||
static inline int allequal_ullong2( vec_ullong2 x, vec_ullong2 y )
|
||||
{
|
||||
return allequal_llong2((vec_llong2)x, (vec_llong2)y);
|
||||
}
|
||||
extern int allequal_float4( vec_float4 x, vec_float4 y );
|
||||
extern int allequal_double2( vec_double2 x, vec_double2 y );
|
||||
extern int allequal_llroundf4( llroundf4_t x, llroundf4_t y );
|
||||
extern int allequal_ulps_float4( vec_float4 x, vec_float4 y, int tolerance );
|
||||
extern int allequal_ulps_double2( vec_double2 x, vec_double2 y, int tolerance );
|
||||
extern int allequal_bits_float4( vec_float4 x, vec_float4 y, int tolerance );
|
||||
extern int allequal_bits_double2( vec_double2 x, vec_double2 y, int tolerance );
|
||||
extern int allposinf_double2( vec_double2 x );
|
||||
extern int allneginf_double2( vec_double2 x );
|
||||
extern int allzerodenorm_double2( vec_double2 x );
|
||||
extern int allposzero_double2( vec_double2 x );
|
||||
extern int allnegzero_double2( vec_double2 x );
|
||||
extern int allnan_double2( vec_double2 x );
|
||||
|
||||
#endif
|
||||
145
Extras/simdmathlibrary/spu/tests/truncd2.c
Normal file
145
Extras/simdmathlibrary/spu/tests/truncd2.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/* Test truncd2 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*@@ truncd2 - Round the input to the nearest integer.
|
||||
* Always rounds towards 0.
|
||||
*
|
||||
*@brief
|
||||
* boundary test for nextafterd2.
|
||||
*
|
||||
*
|
||||
*@pre
|
||||
*
|
||||
*@criteria
|
||||
* Run this program and check no error will be occurred.
|
||||
*
|
||||
*@note
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <fenv.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
double xxx[2];
|
||||
double ans[2];
|
||||
} dbl;
|
||||
struct {
|
||||
unsigned long long xxx[2];
|
||||
unsigned long long ans[2];
|
||||
} ull;
|
||||
} TestVec_TruncD2;
|
||||
|
||||
int main()
|
||||
{
|
||||
TestVec_TruncD2 test_a[] = {
|
||||
{
|
||||
ull:{
|
||||
// 0 -> 0 , -0 -> -0
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// -Inf -> -Inf , Inf -> Inf
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL},
|
||||
{0xFFF0000000000000ULL,0x7FF0000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// MAX -> MAX , MIN -> MIN
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
|
||||
{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Denormalize -> 0
|
||||
{0x0000000000000001ULL,0x8000000000000010ULL},
|
||||
{0x0000000000000000ULL,0x8000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Denormalize -> 0
|
||||
{0x800FFFFFFFFFFFFFULL,0x000FFFFFFFFFFFFFULL},
|
||||
{0x8000000000000000ULL,0x0000000000000000ULL}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{1.0, -1.0},
|
||||
{1.0, -1.0}
|
||||
}
|
||||
},{
|
||||
dbl:{
|
||||
{-2.5, 3.5},
|
||||
{-2.0, 3.0}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
// Nan
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL},
|
||||
{0xFFF0000000000001ULL,0x7FF0000000000001ULL}
|
||||
}
|
||||
},{
|
||||
ull:{
|
||||
{0ULL,0ULL},
|
||||
{0ULL,0ULL}
|
||||
}
|
||||
}
|
||||
};
|
||||
int ii, test_ctr = 1;
|
||||
char msg[80];
|
||||
vec_double2 res_v;
|
||||
|
||||
TEST_SET_START("20060831180000NM","NM", "truncd2");
|
||||
|
||||
TEST_START("truncd2");
|
||||
|
||||
for (ii=0; ; ii++) {
|
||||
if ( (test_a[ii].ull.xxx[0] == 0) && (test_a[ii].ull.xxx[1] == 0) ) break;
|
||||
|
||||
res_v = truncd2 (*((vec_double2 *)&test_a[ii].dbl.xxx[0]) );
|
||||
sprintf(msg,"2006083118%04dNM", test_ctr++);
|
||||
TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, (vec_llong2)*((vec_double2 *)&test_a[ii].dbl.ans[0])), 0);
|
||||
}
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
|
||||
}
|
||||
108
Extras/simdmathlibrary/spu/tests/truncf4.c
Normal file
108
Extras/simdmathlibrary/spu/tests/truncf4.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* Test trunf4 for SPU
|
||||
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Sony Computer Entertainment Inc nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "simdmath.h"
|
||||
#include "common-test.h"
|
||||
#include "testutils.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
TEST_SET_START("20040916100012EJL","EJL", "truncf");
|
||||
|
||||
unsigned int i3 = 0x4affffff; // 2^23 - 0.5, largest truncatable value.
|
||||
unsigned int i3i = 0x4afffffe;
|
||||
unsigned int i4 = 0x4b000000; // 2^23, no fractional part.
|
||||
unsigned int i5 = 0xcf000001; // -2^31, one more large, and negative, value.
|
||||
|
||||
float x0 = hide_float(0.91825f);
|
||||
float x0i = hide_float(0.0f);
|
||||
float x1 = hide_float(-0.12958f);
|
||||
float x1i = hide_float(0.0f);
|
||||
float x2 = hide_float(-79615.1875f);
|
||||
float x2i = hide_float(-79615.0f);
|
||||
float x3 = hide_float(make_float(i3));
|
||||
float x3i = hide_float(make_float(i3i));
|
||||
float x4 = hide_float(make_float(i4));
|
||||
float x4i = hide_float(make_float(i4));
|
||||
float x5 = hide_float(make_float(i5));
|
||||
float x5i = hide_float(make_float(i5));
|
||||
|
||||
vec_float4 x0_v = spu_splats(x0);
|
||||
vec_float4 x0i_v = spu_splats(x0i);
|
||||
vec_float4 x1_v = spu_splats(x1);
|
||||
vec_float4 x1i_v = spu_splats(x1i);
|
||||
vec_float4 x2_v = spu_splats(x2);
|
||||
vec_float4 x2i_v = spu_splats(x2i);
|
||||
vec_float4 x3_v = spu_splats(x3);
|
||||
vec_float4 x3i_v = spu_splats(x3i);
|
||||
vec_float4 x4_v = spu_splats(x4);
|
||||
vec_float4 x4i_v = spu_splats(x4i);
|
||||
vec_float4 x5_v = spu_splats(x5);
|
||||
vec_float4 x5i_v = spu_splats(x5i);
|
||||
|
||||
float res;
|
||||
vec_float4 res_v;
|
||||
|
||||
TEST_START("truncf4");
|
||||
res_v = truncf4(x0_v);
|
||||
TEST_CHECK("20040916100023EJL", allequal_float4( res_v, x0i_v ), 0);
|
||||
res_v = truncf4(x1_v);
|
||||
TEST_CHECK("20040916100034EJL", allequal_float4( res_v, x1i_v ), 0);
|
||||
res_v = truncf4(x2_v);
|
||||
TEST_CHECK("20040916100043EJL", allequal_float4( res_v, x2i_v ), 0);
|
||||
res_v = truncf4(x3_v);
|
||||
TEST_CHECK("20040916100054EJL", allequal_float4( res_v, x3i_v ), 0);
|
||||
res_v = truncf4(x4_v);
|
||||
TEST_CHECK("20040916100103EJL", allequal_float4( res_v, x4i_v ), 0);
|
||||
res_v = truncf4(x5_v);
|
||||
TEST_CHECK("20040916100111EJL", allequal_float4( res_v, x5i_v ), 0);
|
||||
|
||||
TEST_START("truncf");
|
||||
res = truncf(x0);
|
||||
TEST_CHECK("20040916100121EJL", res == x0i, 0);
|
||||
res = truncf(x1);
|
||||
TEST_CHECK("20040916100129EJL", res == x1i, 0);
|
||||
res = truncf(x2);
|
||||
TEST_CHECK("20040916100136EJL", res == x2i, 0);
|
||||
res = truncf(x3);
|
||||
TEST_CHECK("20040916100144EJL", res == x3i, 0);
|
||||
res = truncf(x4);
|
||||
TEST_CHECK("20040916100153EJL", res == x4i, 0);
|
||||
res = truncf(x5);
|
||||
TEST_CHECK("20040916100200EJL", res == x5i, 0);
|
||||
|
||||
TEST_SET_DONE();
|
||||
|
||||
TEST_EXIT();
|
||||
}
|
||||
Reference in New Issue
Block a user