1 /* Test remquof4 for SPU
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.
31 * copied test data from remainderf4
32 * wrong quotient returns in scalar function
39 #include "common-test.h"
40 #include "testutils.h"
44 TEST_SET_START("20060912170027NM","NM", "remquof4");
46 unsigned int i0n = 0x449edbc6;
47 unsigned int i0d = 0x40cf799d;
48 unsigned int i0r = 0x3daa7300;
50 unsigned int i1n = 0x6bca107a;
51 unsigned int i1d = 0x6c4a107a;
52 unsigned int i1r = 0x6bca107a;
54 unsigned int i2n = 0x1c123605;
55 unsigned int i2d = 0x1c923602;
56 unsigned int i2r = 0x9c1235ff;
58 unsigned int i3n = 0x2b4c50fa;
59 unsigned int i3d = 0x253a3ae3;
60 unsigned int i3r = 0xa41873a8;
62 unsigned int i4n = 0x73addffc;
63 unsigned int i4d = 0x742ddffc;
64 unsigned int i4r = 0x73addffc;
66 unsigned int i5n = 0x29d4d97c;
67 unsigned int i5d = 0x2a546e77;
68 unsigned int i5r = 0xa9d40372;
71 float x0n = hide_float(make_float(i0n));
72 float x0d = hide_float(make_float(i0d));
73 float x0r = hide_float(make_float(i0r));
75 float x1n = hide_float(make_float(i1n));
76 float x1d = hide_float(make_float(i1d));
77 float x1r = hide_float(make_float(i1r));
79 float x2n = hide_float(make_float(i2n));
80 float x2d = hide_float(make_float(i2d));
81 float x2r = hide_float(make_float(i2r));
83 float x3n = hide_float(make_float(i3n));
84 float x3d = hide_float(make_float(i3d));
85 float x3r = hide_float(make_float(i3r));
87 float x4n = hide_float(make_float(i4n));
88 float x4d = hide_float(make_float(i4d));
89 float x4r = hide_float(make_float(i4r));
91 float x5n = hide_float(make_float(i5n));
92 float x5d = hide_float(make_float(i5d));
93 float x5r = hide_float(make_float(i5r));
95 vec_float4 x0n_v = spu_splats(x0n);
96 vec_float4 x0d_v = spu_splats(x0d);
97 vec_float4 x0r_v = spu_splats(x0r);
99 vec_float4 x1n_v = spu_splats(x1n);
100 vec_float4 x1d_v = spu_splats(x1d);
101 vec_float4 x1r_v = spu_splats(x1r);
103 vec_float4 x2n_v = spu_splats(x2n);
104 vec_float4 x2d_v = spu_splats(x2d);
105 vec_float4 x2r_v = spu_splats(x2r);
107 vec_float4 x3n_v = spu_splats(x3n);
108 vec_float4 x3d_v = spu_splats(x3d);
109 vec_float4 x3r_v = spu_splats(x3r);
111 vec_float4 x4n_v = spu_splats(x4n);
112 vec_float4 x4d_v = spu_splats(x4d);
113 vec_float4 x4r_v = spu_splats(x4r);
115 vec_float4 x5n_v = spu_splats(x5n);
116 vec_float4 x5d_v = spu_splats(x5d);
117 vec_float4 x5r_v = spu_splats(x5r);
122 TEST_START("remquof4");
123 res_v = remquof4(x0n_v, x0d_v, &quo_v);
124 TEST_CHECK("20060912170031NM", allequal_ulps_float4( res_v, x0r_v, 1 ), 0);
125 TEST_CHECK("20060912170131NM", allequal_int4( quo_v, spu_splats((int)i0q) ), 0);
126 res_v = remquof4(x1n_v, x1d_v, &quo_v);
127 TEST_CHECK("20060912170033NM", allequal_ulps_float4( res_v, x1r_v, 1 ), 0);
128 TEST_CHECK("20060912170133NM", allequal_int4( quo_v, spu_splats((int)i1q) ), 0);
129 res_v = remquof4(x2n_v, x2d_v, &quo_v);
130 TEST_CHECK("20060912170034NM", allequal_ulps_float4( res_v, x2r_v, 1 ), 0);
131 TEST_CHECK("20060912170134NM", allequal_int4( quo_v, spu_splats((int)i2q) ), 0);
132 res_v = remquof4(x3n_v, x3d_v, &quo_v);
133 TEST_CHECK("20060912170036NM", allequal_ulps_float4( res_v, x3r_v, 1 ), 0);
134 TEST_CHECK("20060912170136NM", allequal_int4( quo_v, spu_splats((int)i3q) ), 0);
135 res_v = remquof4(x4n_v, x4d_v, &quo_v);
136 TEST_CHECK("20060912170037NM", allequal_ulps_float4( res_v, x4r_v, 1 ), 0);
137 TEST_CHECK("20060912170137NM", allequal_int4( quo_v, spu_splats((int)i4q) ), 0);
138 res_v = remquof4(x5n_v, x5d_v, &quo_v);
139 TEST_CHECK("20060912170038NM", allequal_ulps_float4( res_v, x5r_v, 1 ), 0);
140 TEST_CHECK("20060912170138NM", allequal_int4( quo_v, spu_splats((int)i5q) ), 0);