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 *@@ rintd2 - Round the input to the nearest integer according to
32 * the current rounding mode.
35 * boundary test for rintd2.
41 * Run this program and check no error will be occurred.
44 * add Denormalized handling
45 * changed over 0x4330000000000000(ABS) handling
57 #include "common-test.h"
58 #include "testutils.h"
61 unsigned long long int xxx[2];
62 unsigned long long int ans0[2];
63 unsigned long long int ans1[2];
64 unsigned long long int ans2[2];
65 unsigned long long int ans3[2];
70 TestVec64_NerI test_a[] = {
73 {0x0000000000000000ULL,0x8000000000000000ULL},
74 {0x0000000000000000ULL,0x8000000000000000ULL},
75 {0x0000000000000000ULL,0x8000000000000000ULL},
76 {0x0000000000000000ULL,0x8000000000000000ULL},
77 {0x0000000000000000ULL,0x8000000000000000ULL}
80 {0xc330000000000000ULL,0x4330000000000000ULL},
81 {0xc330000000000000ULL,0x4330000000000000ULL},
82 {0xc330000000000000ULL,0x4330000000000000ULL},
83 {0xc330000000000000ULL,0x4330000000000000ULL},
84 {0xc330000000000000ULL,0x4330000000000000ULL}
87 {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
88 {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
89 {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
90 {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
91 {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
94 {0x7FF0000000000000ULL,0xFFF0000000000000ULL},
95 {0x7FF0000000000000ULL,0xFFF0000000000000ULL},
96 {0x7FF0000000000000ULL,0xFFF0000000000000ULL},
97 {0x7FF0000000000000ULL,0xFFF0000000000000ULL},
98 {0x7FF0000000000000ULL,0xFFF0000000000000ULL}
101 {0x8000000000000001ULL,0x0000000000000001ULL},
102 {0x8000000000000000ULL,0x0000000000000000ULL},
103 {0x8000000000000000ULL,0x0000000000000000ULL},
104 {0x8000000000000000ULL,0x3ff0000000000000ULL},
105 {0xbff0000000000000ULL,0x0000000000000000ULL}
108 {0x0008000000000000ULL,0x8008000000000000ULL},
109 {0x0000000000000000ULL,0x8000000000000000ULL},
110 {0x0000000000000000ULL,0x8000000000000000ULL},
111 {0x3ff0000000000000ULL,0x8000000000000000ULL},
112 {0x0000000000000000ULL,0xbff0000000000000ULL}
115 {0x3ff0000000000000ULL,0xbff0000000000000ULL},
116 {0x3ff0000000000000ULL,0xbff0000000000000ULL},
117 {0x3ff0000000000000ULL,0xbff0000000000000ULL},
118 {0x3ff0000000000000ULL,0xbff0000000000000ULL},
119 {0x3ff0000000000000ULL,0xbff0000000000000ULL}
122 {0x3ff8000000000000ULL,0xbff8000000000000ULL},
123 {0x4000000000000000ULL,0xc000000000000000ULL},
124 {0x3ff0000000000000ULL,0xbff0000000000000ULL},
125 {0x4000000000000000ULL,0xbff0000000000000ULL},
126 {0x3ff0000000000000ULL,0xc000000000000000ULL}
129 {0x4004000000000000ULL,0xc004000000000000ULL},
130 {0x4000000000000000ULL,0xc000000000000000ULL},
131 {0x4000000000000000ULL,0xc000000000000000ULL},
132 {0x4008000000000000ULL,0xc000000000000000ULL},
133 {0x4000000000000000ULL,0xc008000000000000ULL}
143 int ii, test_ctr = 1;
147 TEST_SET_START("20060831210000NM","NM", "rintd2");
149 TEST_START("rintd2");
152 if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;
154 // set Floating point round mode
155 spu_mtfpscr(((vec_uint4){0x0000,0,0,0}));
156 res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
157 sprintf(msg,"2006083121%04dNM", test_ctr++);
158 TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0);
160 spu_mtfpscr(((vec_uint4){0x0500,0,0,0}));
161 res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
162 sprintf(msg,"2006083121%04dNM", test_ctr++);
163 TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0);
165 spu_mtfpscr(((vec_uint4){0x0a00,0,0,0}));
166 res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
167 sprintf(msg,"2006083121%04dNM", test_ctr++);
168 TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0);
170 spu_mtfpscr(((vec_uint4){0x0f00,0,0,0}));
171 res_v = rintd2 (*((vec_double2 *)&test_a[ii].xxx[0]));
172 sprintf(msg,"2006083121%04dNM", test_ctr++);
173 TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0);