Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / simdmathlibrary / spu / tests / isgreaterf4.c
1 /* Test isgreaterf4 for SPU
2    Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
3    All rights reserved.
4
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.
16
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.
28  */
29
30
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <math.h>
34 #include <float.h>
35 #include "simdmath.h"
36 #include "common-test.h"
37 #include "testutils.h"
38
39 int main()
40 {
41    TEST_SET_START("20060817000000AAN","AAN", "isgreaterf4");
42    
43    float x0 = hide_float(-0.0f);
44    float y0 = hide_float( 0.0f);
45    unsigned int r0 = 0x00000000;
46
47    float x1 = hide_float(FLT_MAX);  //+Smax
48    float y1 = hide_float(-FLT_MAX);  //-Smax
49    unsigned int r1 = 0xffffffff;
50
51    float x2 = hide_float(-0.0000000013152f);
52    float y2 = hide_float(-234245.85323441f);
53    unsigned int r2 = 0xffffffff;
54
55    float x3 = hide_float(-168.97345223013f);
56    float y3 = hide_float(-168.97345223013f);
57    unsigned int r3 = 0x00000000;
58
59    float x4 = hide_float(-83532.96153153f);
60    float y4 = hide_float(-FLT_MIN);  //-Smin
61    unsigned int r4 = 0x00000000;
62
63    float x5 = hide_float(-321.01234567f);
64    float y5 = hide_float(876543.12345f);
65    unsigned int r5 = 0x00000000;
66
67    float x6 = hide_float(FLT_MIN);  // Smin
68    float y6 = hide_float(0.0031529324f);
69    unsigned int r6 = 0x00000000;
70
71    float x7 = hide_float(5172.2845321f);
72    float y7 = hide_float(5172.2845321f);
73    unsigned int r7 = 0x00000000;
74
75    float x8 = hide_float(264.345643345f);
76    float y8 = hide_float(2353705.31415f);
77    unsigned int r8 = 0x00000000;
78
79    float x9 = hide_float(FLT_MAX);  // Smax
80    float y9 = hide_float(9.43574552184f);
81    unsigned int r9 = 0xffffffff;
82
83    vec_float4 x0_v = spu_splats(x0);
84    vec_float4 y0_v = spu_splats(y0);
85    vec_uint4  r0_v = spu_splats(r0);
86
87    vec_float4 x1_v = spu_splats(x1);
88    vec_float4 y1_v = spu_splats(y1);
89    vec_uint4  r1_v = spu_splats(r1);
90
91    vec_float4 x2_v = spu_splats(x2);
92    vec_float4 y2_v = spu_splats(y2);
93    vec_uint4  r2_v = spu_splats(r2);
94
95    vec_float4 x3_v = spu_splats(x3);
96    vec_float4 y3_v = spu_splats(y3);
97    vec_uint4  r3_v = spu_splats(r3);
98
99    vec_float4 x4_v = spu_splats(x4);
100    vec_float4 y4_v = spu_splats(y4);
101    vec_uint4  r4_v = spu_splats(r4);
102
103    vec_float4 x5_v = spu_splats(x5);
104    vec_float4 y5_v = spu_splats(y5);
105    vec_uint4  r5_v = spu_splats(r5);
106
107    vec_float4 x6_v = spu_splats(x6);
108    vec_float4 y6_v = spu_splats(y6);
109    vec_uint4  r6_v = spu_splats(r6);
110
111    vec_float4 x7_v = spu_splats(x7);
112    vec_float4 y7_v = spu_splats(y7);
113    vec_uint4  r7_v = spu_splats(r7);
114
115    vec_float4 x8_v = spu_splats(x8);
116    vec_float4 y8_v = spu_splats(y8);
117    vec_uint4  r8_v = spu_splats(r8);
118
119    vec_float4 x9_v = spu_splats(x9);
120    vec_float4 y9_v = spu_splats(y9);
121    vec_uint4  r9_v = spu_splats(r9);
122    
123    vec_uint4 res_v;
124
125    TEST_START("isgreaterf4");
126
127    res_v = (vec_uint4)isgreaterf4(x0_v, y0_v);
128    TEST_CHECK("20060817000000AAN", allequal_uint4( res_v, r0_v ), 0);
129    res_v = (vec_uint4)isgreaterf4(x1_v, y1_v);
130    TEST_CHECK("20060817000001AAN", allequal_uint4( res_v, r1_v ), 0);
131    res_v = (vec_uint4)isgreaterf4(x2_v, y2_v);
132    TEST_CHECK("20060817000002AAN", allequal_uint4( res_v, r2_v ), 0);
133    res_v = (vec_uint4)isgreaterf4(x3_v, y3_v);
134    TEST_CHECK("20060817000003AAN", allequal_uint4( res_v, r3_v ), 0);
135    res_v = (vec_uint4)isgreaterf4(x4_v, y4_v);
136    TEST_CHECK("20060817000004AAN", allequal_uint4( res_v, r4_v ), 0);
137    res_v = (vec_uint4)isgreaterf4(x5_v, y5_v);
138    TEST_CHECK("20060817000005AAN", allequal_uint4( res_v, r5_v ), 0);
139    res_v = (vec_uint4)isgreaterf4(x6_v, y6_v);
140    TEST_CHECK("20060817000006AAN", allequal_uint4( res_v, r6_v ), 0);
141    res_v = (vec_uint4)isgreaterf4(x7_v, y7_v);
142    TEST_CHECK("20060817000007AAN", allequal_uint4( res_v, r7_v ), 0);
143    res_v = (vec_uint4)isgreaterf4(x8_v, y8_v);
144    TEST_CHECK("20060817000008AAN", allequal_uint4( res_v, r8_v ), 0);
145    res_v = (vec_uint4)isgreaterf4(x9_v, y9_v);
146    TEST_CHECK("20060817000009AAN", allequal_uint4( res_v, r9_v ), 0);
147    
148    TEST_SET_DONE();
149    
150    TEST_EXIT();
151 }