2 Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
5 Redistribution and use in source and binary forms,
6 with or without modification, are permitted provided that the
7 following conditions are met:
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of the Sony Computer Entertainment Inc nor the names
14 of its contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
36 #include "common-test.h"
37 #include "testutils.h"
41 TEST_SET_START("20040908022501EJL","EJL", "fabs");
43 double x0n = hide_double(-0.0);
44 double x0p = hide_double(0.0);
45 double x1n = hide_double(-83532.96153153);
46 double x1p = hide_double(83532.96153153);
47 double x2n = hide_double(-0.0000000013152);
48 double x2p = hide_double(0.0000000013152);
49 double x3n = hide_double(-HUGE_VAL);
50 double x3p = hide_double(HUGE_VAL);
52 vec_double2 x0n_v = spu_splats(x0n);
53 vec_double2 x0p_v = spu_splats(x0p);
54 vec_double2 x1n_v = spu_splats(x1n);
55 vec_double2 x1p_v = spu_splats(x1p);
56 vec_double2 x2n_v = spu_splats(x2n);
57 vec_double2 x2p_v = spu_splats(x2p);
58 vec_double2 x3n_v = spu_splats(x3n);
59 vec_double2 x3p_v = spu_splats(x3p);
65 res_v = fabsd2(x0n_v);
66 TEST_CHECK("20040908022502EJL", allequal_double2( res_v, x0p_v ), 0);
67 res_v = fabsd2(x0p_v);
68 TEST_CHECK("20040908022503EJL", allequal_double2( res_v, x0p_v ), 0);
69 res_v = fabsd2(x1n_v);
70 TEST_CHECK("20040908022504EJL", allequal_double2( res_v, x1p_v ), 0);
71 res_v = fabsd2(x1p_v);
72 TEST_CHECK("20040908022505EJL", allequal_double2( res_v, x1p_v ), 0);
73 res_v = fabsd2(x2n_v);
74 TEST_CHECK("20040908022506EJL", allequal_double2( res_v, x2p_v ), 0);
75 res_v = fabsd2(x2p_v);
76 TEST_CHECK("20040908022507EJL", allequal_double2( res_v, x2p_v ), 0);
77 res_v = fabsd2(x3n_v);
78 TEST_CHECK("20040908022508EJL", allposinf_double2( res_v ), 0);
79 res_v = fabsd2(x3p_v);
80 TEST_CHECK("20040908022509EJL", allposinf_double2( res_v ), 0);
84 TEST_CHECK("20040908022510EJL", res == x0p, 0);
86 TEST_CHECK("20040908022511EJL", res == x0p, 0);
88 TEST_CHECK("20040908022512EJL", res == x1p, 0);
90 TEST_CHECK("20040908022513EJL", res == x1p, 0);
92 TEST_CHECK("20040908022514EJL", res == x2p, 0);
94 TEST_CHECK("20040908022515EJL", res == x2p, 0);
96 TEST_CHECK("20040908022516EJL", isinf(res) == 1, 0);
98 TEST_CHECK("20040908022517EJL", isinf(res) == 1, 0);