2 # Copyright 2013 Advanced Micro Devices, Inc.
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # Authors: Tom Stellard <thomas.stellard@amd.com>
24 # Aaron Watry <awatry@gmail.com>
29 from genclbuiltins
import gen
, TRUE
, NEGNAN
36 'isgreaterequal' : 10,
48 DATA_TYPES
= ['float']
61 'function_type': 'ttt',
63 [0, TRUE
, 0, 0], # Result
64 [0.0, float("nan"), 1.0, float("inf") ] # Arg0
68 'arg_types': [I
, F
, F
],
69 'function_type': 'ttt',
71 [TRUE
, 0, TRUE
, 0, 0, TRUE
, 0, TRUE
], # Result
72 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 123.0 ], # Arg0
73 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 123.0 ] # Arg1
78 'function_type': 'ttt',
80 [TRUE
, 0, TRUE
, TRUE
, 0, 0, TRUE
], # Result
81 [0.0, float("nan"), 1.0, 1.0, float("inf"), float("-inf"), -123.0 ], # Arg0
85 'arg_types': [I
, F
, F
],
86 'function_type': 'ttt',
88 [0, 0, 0, 0, 0, 0, TRUE
, 0], # Result
89 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
90 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
94 'arg_types': [I
, F
, F
],
95 'function_type': 'ttt',
97 [TRUE
, 0, TRUE
, 0, 0, TRUE
, TRUE
, 0], # Result
98 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
99 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
104 'function_type': 'ttt',
106 [0, 0, 0, 0, TRUE
, TRUE
, 0 ], # Result
107 [0.0, float("nan"), 1.0, 1.0, float("inf"), float("-inf"), -123.0 ], # Arg0
111 'arg_types': [I
, F
, F
],
112 'function_type': 'ttt',
114 [0, 0, 0, 0, 0, 0, 0, TRUE
], # Result
115 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
116 [0.0, float("nan"), 1.0, float("nan"), 1.0, 1.0, 0.5, 1.0 ] # Arg1
120 'arg_types': [I
, F
, F
],
121 'function_type': 'ttt',
123 [TRUE
, 0, TRUE
, 0, 0, 0, 0, TRUE
], # Result
124 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
125 [0.0, float("nan"), 1.0, float("nan"), 1.0, 1.0, 0.5, 1.0 ] # Arg1
129 'arg_types': [I
, F
, F
],
130 'function_type': 'ttt',
132 [0, 0, 0, 0, 0, TRUE
, TRUE
, TRUE
], # Result
133 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
134 [0.0, float("nan"), 1.0, float("nan"), 1.0, 1.0, 0.5, 1.0 ] # Arg1
139 'function_type': 'ttt',
141 [0, 0, TRUE
, TRUE
, 0, 0, TRUE
, 0], # Result
142 [0.0, float("nan"), 1.0, 1.0, float("inf"), float("-inf"), -123.0, 1e-126], # Arg0
146 'arg_types': [I
, F
, F
],
147 'function_type': 'ttt',
149 [0, TRUE
, 0, TRUE
, TRUE
, 0, TRUE
, TRUE
], # Result
150 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
151 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
155 'arg_types': [I
, F
, F
],
156 'function_type': 'ttt',
158 [TRUE
, 0, TRUE
, 0, 0, TRUE
, TRUE
, TRUE
], # Result
159 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
160 [0.0, float("nan"), 1.0, float("nan"), 1.0, float("inf"), 0.5, 1.0 ] # Arg1
164 'arg_types': [I
, F
, F
],
165 'function_type': 'ttt',
167 [0, TRUE
, 0, TRUE
, TRUE
, 0, 0, 0], # Result
168 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
169 [0.0, float("nan"), 1.0, float("nan"), 1.0, float("inf"), 0.5, 1.0 ] # Arg1
174 'function_type': 'ttt',
176 [0, TRUE
, 0, 0, TRUE
, 0, TRUE
, 0 , TRUE
], # Result
177 [0.0, float(0)*-1, 1.0, 1, float("-inf"), float("inf"), -1.0, float("nan"), NEGNAN
] # Arg0
184 dirName
= os
.path
.join("cl", "builtin", "relational")
187 functions
= sorted(tests
.keys())
188 for dataType
in DATA_TYPES
:
189 for fnName
in functions
:
190 testDefs
[(dataType
, fnName
)] = tests
[fnName
]
192 gen(DATA_TYPES
, CLC_VERSION_MIN
, functions
, testDefs
, dirName
)
195 if __name__
== '__main__':