1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.renderscript.cts; 18 19 import android.util.Log; 20 21 public class CoreMathVerifier { 22 static { 23 System.loadLibrary("coremathtestcpp_jni"); 24 } 25 26 /* The level of precision we expect out of the half_* functions. floats (f32) have 23 bits of 27 * mantissa and halfs (f16) have 10 bits. 8192 = 2 ^ (23 - 10). 28 */ 29 private static final int HALF_PRECISION = 8192; 30 // The level of precision we expect out of the fast_* functions. 31 private static final int FAST_PRECISION = 8192; 32 // The level of precision we expect out of the native_* functions. 33 private static final int NATIVE_PRECISION = 8192; 34 35 // Static classes used to return multiple values from a few JNI functions. 36 static public class FrexpResult { 37 public float significand; 38 public int exponent; 39 } 40 41 static public class LgammaResult { 42 public float lgamma; 43 public int gammaSign; 44 } 45 46 static public class RemquoResult { 47 public float remainder; 48 public int quotient; 49 } 50 51 /* We're calling into native: 52 * - not all functions are available in Java, notably gamma and erf, 53 * - Java lacks float version of these functions, so we can compare implementations with 54 * similar constraints, and 55 * - handling unsigned integers, especially longs, is painful and error prone in Java. 56 */ acos(float x)57 static native float acos(float x); acosh(float x)58 static native float acosh(float x); asin(float x)59 static native float asin(float x); asinh(float x)60 static native float asinh(float x); atan(float x)61 static native float atan(float x); atan2(float x, float y)62 static native float atan2(float x, float y); atanh(float x)63 static native float atanh(float x); cbrt(float x)64 static native float cbrt(float x); ceil(float x)65 static native float ceil(float x); cos(float x)66 static native float cos(float x); cosh(float x)67 static native float cosh(float x); erf(float x)68 static native float erf(float x); erfc(float x)69 static native float erfc(float x); exp(float x)70 static native float exp(float x); exp10(float x)71 static native float exp10(float x); exp2(float x)72 static native float exp2(float x); expm1(float x)73 static native float expm1(float x); floor(float x)74 static native float floor(float x); frexp(float x)75 static native FrexpResult frexp(float x); hypot(float x, float y)76 static native float hypot(float x, float y); ilogb(float x)77 static native int ilogb(float x); ldexp(float x, int exp)78 static native float ldexp(float x, int exp); lgamma(float x)79 static native float lgamma(float x); lgamma2(float x)80 static native LgammaResult lgamma2(float x); log(float x)81 static native float log(float x); logb(float x)82 static native float logb(float x); log10(float x)83 static native float log10(float x); log1p(float x)84 static native float log1p(float x); log2(float x)85 static native float log2(float x); maxI8(byte x, byte y)86 static native byte maxI8(byte x, byte y); maxU8(byte x, byte y)87 static native byte maxU8(byte x, byte y); maxI16(short x, short y)88 static native short maxI16(short x, short y); maxU16(short x, short y)89 static native short maxU16(short x, short y); maxI32(int x, int y)90 static native int maxI32(int x, int y); maxU32(int x, int y)91 static native int maxU32(int x, int y); maxI64(long x, long y)92 static native long maxI64(long x, long y); maxU64(long x, long y)93 static native long maxU64(long x, long y); minI8(byte x, byte y)94 static native byte minI8(byte x, byte y); minU8(byte x, byte y)95 static native byte minU8(byte x, byte y); minI16(short x, short y)96 static native short minI16(short x, short y); minU16(short x, short y)97 static native short minU16(short x, short y); minI32(int x, int y)98 static native int minI32(int x, int y); minU32(int x, int y)99 static native int minU32(int x, int y); minI64(long x, long y)100 static native long minI64(long x, long y); minU64(long x, long y)101 static native long minU64(long x, long y); pow(float x, float y)102 static native float pow(float x, float y); remquo(float numerator, float denominator)103 static native RemquoResult remquo(float numerator, float denominator); rint(float x)104 static native float rint(float x); round(float x)105 static native float round(float x); sin(float x)106 static native float sin(float x); sinh(float x)107 static native float sinh(float x); sqrt(float x)108 static native float sqrt(float x); tan(float x)109 static native float tan(float x); tanh(float x)110 static native float tanh(float x); tgamma(float x)111 static native float tgamma(float x); trunc(float x)112 static native float trunc(float x); 113 convertCharToChar(byte x)114 static native byte convertCharToChar(byte x); convertCharToUchar(byte x)115 static native byte convertCharToUchar(byte x); convertCharToShort(byte x)116 static native short convertCharToShort(byte x); convertCharToUshort(byte x)117 static native short convertCharToUshort(byte x); convertCharToInt(byte x)118 static native int convertCharToInt(byte x); convertCharToUint(byte x)119 static native int convertCharToUint(byte x); convertCharToLong(byte x)120 static native long convertCharToLong(byte x); convertCharToUlong(byte x)121 static native long convertCharToUlong(byte x); convertCharToFloat(byte x)122 static native float convertCharToFloat(byte x); convertCharToDouble(byte x)123 static native double convertCharToDouble(byte x); 124 convertUcharToChar(byte x)125 static native byte convertUcharToChar(byte x); convertUcharToUchar(byte x)126 static native byte convertUcharToUchar(byte x); convertUcharToShort(byte x)127 static native short convertUcharToShort(byte x); convertUcharToUshort(byte x)128 static native short convertUcharToUshort(byte x); convertUcharToInt(byte x)129 static native int convertUcharToInt(byte x); convertUcharToUint(byte x)130 static native int convertUcharToUint(byte x); convertUcharToLong(byte x)131 static native long convertUcharToLong(byte x); convertUcharToUlong(byte x)132 static native long convertUcharToUlong(byte x); convertUcharToFloat(byte x)133 static native float convertUcharToFloat(byte x); convertUcharToDouble(byte x)134 static native double convertUcharToDouble(byte x); 135 convertShortToChar(short x)136 static native byte convertShortToChar(short x); convertShortToUchar(short x)137 static native byte convertShortToUchar(short x); convertShortToShort(short x)138 static native short convertShortToShort(short x); convertShortToUshort(short x)139 static native short convertShortToUshort(short x); convertShortToInt(short x)140 static native int convertShortToInt(short x); convertShortToUint(short x)141 static native int convertShortToUint(short x); convertShortToLong(short x)142 static native long convertShortToLong(short x); convertShortToUlong(short x)143 static native long convertShortToUlong(short x); convertShortToFloat(short x)144 static native float convertShortToFloat(short x); convertShortToDouble(short x)145 static native double convertShortToDouble(short x); 146 convertUshortToChar(short x)147 static native byte convertUshortToChar(short x); convertUshortToUchar(short x)148 static native byte convertUshortToUchar(short x); convertUshortToShort(short x)149 static native short convertUshortToShort(short x); convertUshortToUshort(short x)150 static native short convertUshortToUshort(short x); convertUshortToInt(short x)151 static native int convertUshortToInt(short x); convertUshortToUint(short x)152 static native int convertUshortToUint(short x); convertUshortToLong(short x)153 static native long convertUshortToLong(short x); convertUshortToUlong(short x)154 static native long convertUshortToUlong(short x); convertUshortToFloat(short x)155 static native float convertUshortToFloat(short x); convertUshortToDouble(short x)156 static native double convertUshortToDouble(short x); 157 convertIntToChar(int x)158 static native byte convertIntToChar(int x); convertIntToUchar(int x)159 static native byte convertIntToUchar(int x); convertIntToShort(int x)160 static native short convertIntToShort(int x); convertIntToUshort(int x)161 static native short convertIntToUshort(int x); convertIntToInt(int x)162 static native int convertIntToInt(int x); convertIntToUint(int x)163 static native int convertIntToUint(int x); convertIntToLong(int x)164 static native long convertIntToLong(int x); convertIntToUlong(int x)165 static native long convertIntToUlong(int x); convertIntToFloat(int x)166 static native float convertIntToFloat(int x); convertIntToDouble(int x)167 static native double convertIntToDouble(int x); 168 convertUintToChar(int x)169 static native byte convertUintToChar(int x); convertUintToUchar(int x)170 static native byte convertUintToUchar(int x); convertUintToShort(int x)171 static native short convertUintToShort(int x); convertUintToUshort(int x)172 static native short convertUintToUshort(int x); convertUintToInt(int x)173 static native int convertUintToInt(int x); convertUintToUint(int x)174 static native int convertUintToUint(int x); convertUintToLong(int x)175 static native long convertUintToLong(int x); convertUintToUlong(int x)176 static native long convertUintToUlong(int x); convertUintToFloat(int x)177 static native float convertUintToFloat(int x); convertUintToDouble(int x)178 static native double convertUintToDouble(int x); 179 convertLongToChar(long x)180 static native byte convertLongToChar(long x); convertLongToUchar(long x)181 static native byte convertLongToUchar(long x); convertLongToShort(long x)182 static native short convertLongToShort(long x); convertLongToUshort(long x)183 static native short convertLongToUshort(long x); convertLongToInt(long x)184 static native int convertLongToInt(long x); convertLongToUint(long x)185 static native int convertLongToUint(long x); convertLongToLong(long x)186 static native long convertLongToLong(long x); convertLongToUlong(long x)187 static native long convertLongToUlong(long x); convertLongToFloat(long x)188 static native float convertLongToFloat(long x); convertLongToDouble(long x)189 static native double convertLongToDouble(long x); 190 convertUlongToChar(long x)191 static native byte convertUlongToChar(long x); convertUlongToUchar(long x)192 static native byte convertUlongToUchar(long x); convertUlongToShort(long x)193 static native short convertUlongToShort(long x); convertUlongToUshort(long x)194 static native short convertUlongToUshort(long x); convertUlongToInt(long x)195 static native int convertUlongToInt(long x); convertUlongToUint(long x)196 static native int convertUlongToUint(long x); convertUlongToLong(long x)197 static native long convertUlongToLong(long x); convertUlongToUlong(long x)198 static native long convertUlongToUlong(long x); convertUlongToFloat(long x)199 static native float convertUlongToFloat(long x); convertUlongToDouble(long x)200 static native double convertUlongToDouble(long x); 201 convertFloatToChar(float x)202 static native byte convertFloatToChar(float x); convertFloatToUchar(float x)203 static native byte convertFloatToUchar(float x); convertFloatToShort(float x)204 static native short convertFloatToShort(float x); convertFloatToUshort(float x)205 static native short convertFloatToUshort(float x); convertFloatToInt(float x)206 static native int convertFloatToInt(float x); convertFloatToUint(float x)207 static native int convertFloatToUint(float x); convertFloatToLong(float x)208 static native long convertFloatToLong(float x); convertFloatToUlong(float x)209 static native long convertFloatToUlong(float x); convertFloatToFloat(float x)210 static native float convertFloatToFloat(float x); convertFloatToDouble(float x)211 static native double convertFloatToDouble(float x); 212 convertDoubleToChar(double x)213 static native byte convertDoubleToChar(double x); convertDoubleToUchar(double x)214 static native byte convertDoubleToUchar(double x); convertDoubleToShort(double x)215 static native short convertDoubleToShort(double x); convertDoubleToUshort(double x)216 static native short convertDoubleToUshort(double x); convertDoubleToInt(double x)217 static native int convertDoubleToInt(double x); convertDoubleToUint(double x)218 static native int convertDoubleToUint(double x); convertDoubleToLong(double x)219 static native long convertDoubleToLong(double x); convertDoubleToUlong(double x)220 static native long convertDoubleToUlong(double x); convertDoubleToFloat(double x)221 static native float convertDoubleToFloat(double x); convertDoubleToDouble(double x)222 static native double convertDoubleToDouble(double x); 223 pi(Target t)224 static private Target.Floaty pi(Target t) { 225 return t.newFloaty(Math.PI); 226 } 227 pi32(Target t)228 static private Target.Floaty pi32(Target t) { 229 return t.new32((float) Math.PI); 230 } 231 any(Target t)232 static private Target.Floaty any(Target t) { 233 return t.newFloaty(Double.NEGATIVE_INFINITY, Double.NaN, Double.POSITIVE_INFINITY); 234 } 235 any32(Target t)236 static private Target.Floaty any32(Target t) { 237 return t.new32(Float.NEGATIVE_INFINITY, Float.NaN, Float.POSITIVE_INFINITY); 238 } 239 acos(double d, Target t)240 static private Target.Floaty acos(double d, Target t) { 241 Target.Floaty in = t.newFloaty(d); 242 return t.newFloaty( 243 Math.acos(in.mid()), 244 Math.acos(in.min()), 245 Math.acos(in.max())); 246 } 247 248 // TODO Remove this function and similar variants that take a float parameter instead of double. acos(float f, Target t)249 static private Target.Floaty acos(float f, Target t) { 250 Target.Floaty in = t.new32(f); 251 return t.new32( 252 acos(in.mid32()), 253 acos(in.min32()), 254 acos(in.max32())); 255 } 256 257 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 258 // double-precision version later. acosh(double d, Target t)259 static private Target.Floaty acosh(double d, Target t) { 260 Target.Floaty in = t.newFloaty(d); 261 return t.newFloaty( 262 acosh((float) in.mid()), 263 acosh((float) in.min()), 264 acosh((float) in.max())); 265 } 266 acosh(float f, Target t)267 static private Target.Floaty acosh(float f, Target t) { 268 Target.Floaty in = t.new32(f); 269 return t.new32( 270 acosh(in.mid32()), 271 acosh(in.min32()), 272 acosh(in.max32())); 273 } 274 acospi(double d, Target t)275 static private Target.Floaty acospi(double d, Target t) { 276 return t.divide(acos(d, t), pi(t)); 277 } 278 acospi(float f, Target t)279 static private Target.Floaty acospi(float f, Target t) { 280 return t.divide(acos(f, t), pi32(t)); 281 } 282 asin(double d, Target t)283 static private Target.Floaty asin(double d, Target t) { 284 Target.Floaty in = t.newFloaty(d); 285 return t.newFloaty( 286 Math.asin(in.mid()), 287 Math.asin(in.min()), 288 Math.asin(in.max())); 289 } 290 asin(float f, Target t)291 static private Target.Floaty asin(float f, Target t) { 292 Target.Floaty in = t.new32(f); 293 return t.new32( 294 asin(in.mid32()), 295 asin(in.min32()), 296 asin(in.max32())); 297 } 298 299 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 300 // double-precision version later. asinh(double d, Target t)301 static private Target.Floaty asinh(double d, Target t) { 302 Target.Floaty in = t.newFloaty(d); 303 return t.newFloaty( 304 asinh((float) in.mid()), 305 asinh((float) in.min()), 306 asinh((float) in.max())); 307 } 308 asinh(float f, Target t)309 static private Target.Floaty asinh(float f, Target t) { 310 Target.Floaty in = t.new32(f); 311 return t.new32( 312 asinh(in.mid32()), 313 asinh(in.min32()), 314 asinh(in.max32())); 315 } 316 asinpi(double d, Target t)317 static private Target.Floaty asinpi(double d, Target t) { 318 return t.divide(asin(d, t), pi(t)); 319 } 320 asinpi(float f, Target t)321 static private Target.Floaty asinpi(float f, Target t) { 322 return t.divide(asin(f, t), pi32(t)); 323 } 324 atan(double d, Target t)325 static private Target.Floaty atan(double d, Target t) { 326 Target.Floaty in = t.newFloaty(d); 327 return t.newFloaty( 328 Math.atan(in.mid()), 329 Math.atan(in.min()), 330 Math.atan(in.max())); 331 } 332 atan(float f, Target t)333 static private Target.Floaty atan(float f, Target t) { 334 Target.Floaty in = t.new32(f); 335 return t.new32( 336 atan(in.mid32()), 337 atan(in.min32()), 338 atan(in.max32())); 339 } 340 341 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 342 // double-precision version later. atanh(double d, Target t)343 static private Target.Floaty atanh(double d, Target t) { 344 Target.Floaty in = t.newFloaty(d); 345 return t.newFloaty( 346 atanh((float) in.mid()), 347 atanh((float) in.min()), 348 atanh((float) in.max())); 349 } 350 atanh(float f, Target t)351 static private Target.Floaty atanh(float f, Target t) { 352 Target.Floaty in = t.new32(f); 353 return t.new32( 354 atanh(in.mid32()), 355 atanh(in.min32()), 356 atanh(in.max32())); 357 } 358 atanpi(double d, Target t)359 static private Target.Floaty atanpi(double d, Target t) { 360 return t.divide(atan(d, t), pi(t)); 361 } 362 atanpi(float f, Target t)363 static private Target.Floaty atanpi(float f, Target t) { 364 return t.divide(atan(f, t), pi32(t)); 365 } 366 atan2(double y, double x, Target t)367 static private Target.Floaty atan2(double y, double x, Target t) { 368 Target.Floaty numerator = t.newFloaty(y); 369 Target.Floaty denominator = t.newFloaty(x); 370 return t.newFloaty( 371 Math.atan2(numerator.mid(), denominator.mid()), 372 Math.atan2(numerator.min(), denominator.min()), 373 Math.atan2(numerator.min(), denominator.max()), 374 Math.atan2(numerator.max(), denominator.min()), 375 Math.atan2(numerator.max(), denominator.max())); 376 } 377 atan2(float y, float x, Target t)378 static private Target.Floaty atan2(float y, float x, Target t) { 379 Target.Floaty numerator = t.new32(y); 380 Target.Floaty denominator = t.new32(x); 381 return t.new32( 382 atan2(numerator.mid32(), denominator.mid32()), 383 atan2(numerator.min32(), denominator.min32()), 384 atan2(numerator.min32(), denominator.max32()), 385 atan2(numerator.max32(), denominator.min32()), 386 atan2(numerator.max32(), denominator.max32())); 387 } 388 atan2pi(double y, double x, Target t)389 static private Target.Floaty atan2pi(double y, double x, Target t) { 390 return t.divide(atan2(y, x, t), pi(t)); 391 } 392 atan2pi(float y, float x, Target t)393 static private Target.Floaty atan2pi(float y, float x, Target t) { 394 return t.divide(atan2(y, x, t), pi32(t)); 395 } 396 cbrt(double d, Target t)397 static private Target.Floaty cbrt(double d, Target t) { 398 Target.Floaty in = t.newFloaty(d); 399 return t.newFloaty( 400 Math.cbrt(in.mid()), 401 Math.cbrt(in.min()), 402 Math.cbrt(in.max())); 403 } 404 cbrt(float f, Target t)405 static private Target.Floaty cbrt(float f, Target t) { 406 Target.Floaty in = t.new32(f); 407 return t.new32( 408 cbrt(in.mid32()), 409 cbrt(in.min32()), 410 cbrt(in.max32())); 411 } 412 clamp(double value, double minValue, double maxValue, Target t)413 static private Target.Floaty clamp(double value, double minValue, double maxValue, Target t) { 414 return t.newFloaty(Math.min(maxValue, Math.max(minValue, value))); 415 } 416 copysign(double magnitude, double sign, Target t)417 static private Target.Floaty copysign(double magnitude, double sign, Target t) { 418 return t.newFloaty(Math.copySign(magnitude, sign)); 419 } 420 cos(double d, Target t)421 static private Target.Floaty cos(double d, Target t) { 422 Target.Floaty in = t.newFloaty(d); 423 return t.newFloaty( 424 Math.cos(in.mid()), 425 Math.cos(in.min()), 426 Math.cos(in.max())); 427 } 428 cos(float f, Target t)429 static private Target.Floaty cos(float f, Target t) { 430 Target.Floaty in = t.new32(f); 431 return t.new32( 432 cos(in.mid32()), 433 cos(in.min32()), 434 cos(in.max32())); 435 } 436 cosh(double d, Target t)437 static private Target.Floaty cosh(double d, Target t) { 438 Target.Floaty in = t.newFloaty(d); 439 return t.newFloaty( 440 Math.cosh(in.mid()), 441 Math.cosh(in.min()), 442 Math.cosh(in.max())); 443 } 444 cosh(float f, Target t)445 static private Target.Floaty cosh(float f, Target t) { 446 Target.Floaty in = t.new32(f); 447 return t.new32( 448 cosh(in.mid32()), 449 cosh(in.min32()), 450 cosh(in.max32())); 451 } 452 cospi(double d, Target t)453 static private Target.Floaty cospi(double d, Target t) { 454 Target.Floaty in = t.multiply(t.newFloaty(d), pi(t)); 455 return t.newFloaty( 456 Math.cos(in.mid()), 457 Math.cos(in.min()), 458 Math.cos(in.max())); 459 } 460 cospi(float f, Target t)461 static private Target.Floaty cospi(float f, Target t) { 462 Target.Floaty in = t.multiply(t.new32(f), pi32(t)); 463 return t.new32( 464 cos(in.mid32()), 465 cos(in.min32()), 466 cos(in.max32())); 467 } 468 469 // Computes the cross product of two double-precision 3D vectors. cross(double[] v1, double[] v2, Target.Floaty[] out, Target t)470 static private void cross(double[] v1, double[] v2, Target.Floaty[] out, Target t) { 471 Target.Floaty a12 = t.multiply(t.newFloaty(v1[1]), t.newFloaty(v2[2])); 472 Target.Floaty a21 = t.multiply(t.newFloaty(v1[2]), t.newFloaty(v2[1])); 473 out[0] = t.subtract(a12, a21); 474 Target.Floaty a02 = t.multiply(t.newFloaty(v1[0]), t.newFloaty(v2[2])); 475 Target.Floaty a20 = t.multiply(t.newFloaty(v1[2]), t.newFloaty(v2[0])); 476 out[1] = t.subtract(a20, a02); 477 Target.Floaty a01 = t.multiply(t.newFloaty(v1[0]), t.newFloaty(v2[1])); 478 Target.Floaty a10 = t.multiply(t.newFloaty(v1[1]), t.newFloaty(v2[0])); 479 out[2] = t.subtract(a01, a10); 480 if (out.length == 4) { 481 out[3] = t.newFloaty(0.f); 482 } 483 } 484 485 // Computes the cross product of two 3D vectors. cross(float[] v1, float[] v2, Target.Floaty[] out, Target t)486 static private void cross(float[] v1, float[] v2, Target.Floaty[] out, Target t) { 487 Target.Floaty a12 = t.multiply(t.new32(v1[1]), t.new32(v2[2])); 488 Target.Floaty a21 = t.multiply(t.new32(v1[2]), t.new32(v2[1])); 489 out[0] = t.subtract(a12, a21); 490 Target.Floaty a02 = t.multiply(t.new32(v1[0]), t.new32(v2[2])); 491 Target.Floaty a20 = t.multiply(t.new32(v1[2]), t.new32(v2[0])); 492 out[1] = t.subtract(a20, a02); 493 Target.Floaty a01 = t.multiply(t.new32(v1[0]), t.new32(v2[1])); 494 Target.Floaty a10 = t.multiply(t.new32(v1[1]), t.new32(v2[0])); 495 out[2] = t.subtract(a01, a10); 496 if (out.length == 4) { 497 out[3] = t.new32(0.f); 498 } 499 } 500 divide(double left, double right, Target t)501 static private Target.Floaty divide(double left, double right, Target t) { 502 Target.Floaty lFloaty = t.newFloaty(left); 503 Target.Floaty rFloaty = t.newFloaty(right); 504 return t.divide(lFloaty, rFloaty); 505 } 506 507 // Convert a double-precision radian value to degrees. degrees(double d, Target t)508 static private Target.Floaty degrees(double d, Target t) { 509 Target.Floaty in = t.newFloaty(d); 510 Target.Floaty k = t.newFloaty(180. / Math.PI); 511 return t.multiply(in, k); 512 } 513 514 // Returns the distance between two points (in double-precision) in n-dimensional space. distance(double[] point1, double[] point2, Target t)515 static private Target.Floaty distance(double[] point1, double[] point2, Target t) { 516 Target.Floaty sum = t.newFloaty(0.f); 517 for (int i = 0; i < point1.length; i++) { 518 Target.Floaty diff = t.subtract(t.newFloaty(point1[i]), t.newFloaty(point2[i])); 519 sum = t.add(sum, t.multiply(diff, diff)); 520 } 521 Target.Floaty d = t.sqrt(sum); 522 return d; 523 } 524 525 // Returns the distance between two points in n-dimensional space. distance(float[] point1, float[] point2, Target t)526 static private Target.Floaty distance(float[] point1, float[] point2, Target t) { 527 Target.Floaty sum = t.new32(0.f); 528 for (int i = 0; i < point1.length; i++) { 529 Target.Floaty diff = t.subtract(t.new32(point1[i]), t.new32(point2[i])); 530 sum = t.add(sum, t.multiply(diff, diff)); 531 } 532 Target.Floaty d = t.sqrt(sum); 533 return d; 534 } 535 536 // Computes the error function for a double-precision input. 537 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 538 // double-precision version later. erf(double d, Target t)539 static private Target.Floaty erf(double d, Target t) { 540 Target.Floaty in = t.newFloaty(d); 541 return t.newFloaty( 542 erf((float) in.mid()), 543 erf((float) in.min()), 544 erf((float) in.max())); 545 } 546 547 // Computes the complementary error function for a double-precision input. 548 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 549 // double-precision version later. erfc(double d, Target t)550 static private Target.Floaty erfc(double d, Target t) { 551 Target.Floaty in = t.newFloaty(d); 552 return t.newFloaty( 553 erfc((float) in.mid()), 554 erfc((float) in.min()), 555 erfc((float) in.max())); 556 } 557 exp(double d, Target t)558 static private Target.Floaty exp(double d, Target t) { 559 Target.Floaty in = t.newFloaty(d); 560 return t.newFloaty( 561 Math.exp(in.mid()), 562 Math.exp(in.min()), 563 Math.exp(in.max())); 564 } 565 exp(float f, Target t)566 static private Target.Floaty exp(float f, Target t) { 567 Target.Floaty in = t.new32(f); 568 return t.new32( 569 exp(in.mid32()), 570 exp(in.min32()), 571 exp(in.max32())); 572 } 573 574 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 575 // double-precision version later. exp10(double d, Target t)576 static private Target.Floaty exp10(double d, Target t) { 577 Target.Floaty in = t.newFloaty(d); 578 return t.newFloaty( 579 exp10((float) in.mid()), 580 exp10((float) in.min()), 581 exp10((float) in.max())); 582 } 583 exp10(float f, Target t)584 static private Target.Floaty exp10(float f, Target t) { 585 Target.Floaty in = t.new32(f); 586 return t.new32( 587 exp10(in.mid32()), 588 exp10(in.min32()), 589 exp10(in.max32())); 590 } 591 592 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 593 // double-precision version later. exp2(double d, Target t)594 static private Target.Floaty exp2(double d, Target t) { 595 Target.Floaty in = t.newFloaty(d); 596 return t.newFloaty( 597 exp2((float) in.mid()), 598 exp2((float) in.min()), 599 exp2((float) in.max())); 600 } 601 exp2(float f, Target t)602 static private Target.Floaty exp2(float f, Target t) { 603 Target.Floaty in = t.new32(f); 604 return t.new32( 605 exp2(in.mid32()), 606 exp2(in.min32()), 607 exp2(in.max32())); 608 } 609 expm1(double d, Target t)610 static private Target.Floaty expm1(double d, Target t) { 611 Target.Floaty in = t.newFloaty(d); 612 return t.newFloaty( 613 Math.expm1(in.mid()), 614 Math.expm1(in.min()), 615 Math.expm1(in.max())); 616 } 617 expm1(float f, Target t)618 static private Target.Floaty expm1(float f, Target t) { 619 Target.Floaty in = t.new32(f); 620 return t.new32( 621 expm1(in.mid32()), 622 expm1(in.min32()), 623 expm1(in.max32())); 624 } 625 fabs(double d, Target t)626 static private Target.Floaty fabs(double d, Target t) { 627 Target.Floaty in = t.newFloaty(d); 628 return t.newFloaty( 629 Math.abs(in.mid()), 630 Math.abs(in.min()), 631 Math.abs(in.max())); 632 } 633 fdim(double a, double b, Target t)634 static private Target.Floaty fdim(double a, double b, Target t) { 635 Target.Floaty inA = t.newFloaty(a); 636 Target.Floaty inB = t.newFloaty(b); 637 Target.Floaty r = t.subtract(inA, inB); 638 return t.newFloaty( 639 Math.max(0., r.mid()), 640 Math.max(0., r.min()), 641 Math.max(0., r.max())); 642 } 643 floor(double d, Target t)644 static private Target.Floaty floor(double d, Target t) { 645 Target.Floaty in = t.newFloaty(d); 646 return t.newFloaty( 647 Math.floor(in.mid()), 648 Math.floor(in.min()), 649 Math.floor(in.max())); 650 } 651 fma(double m1, double m2, double offset, Target t)652 static private Target.Floaty fma(double m1, double m2, double offset, Target t) { 653 Target.Floaty inM1 = t.newFloaty(m1); 654 Target.Floaty inM2 = t.newFloaty(m2); 655 Target.Floaty inOffset = t.newFloaty(offset); 656 657 return t.add(t.multiply(inM1, inM2), inOffset); 658 } 659 fmax(double a, double b, Target t)660 static private Target.Floaty fmax(double a, double b, Target t) { 661 return t.newFloaty(Math.max(a, b)); 662 } 663 fmin(double a, double b, Target t)664 static private Target.Floaty fmin(double a, double b, Target t) { 665 return t.newFloaty(Math.min(a, b)); 666 } 667 fmod(double numerator, double denominator, Target t)668 static private Target.Floaty fmod(double numerator, double denominator, Target t) { 669 Target.Floaty inNumerator = t.newFloaty(numerator); 670 Target.Floaty inDenominator = t.newFloaty(denominator); 671 return t.newFloaty( 672 numerator % denominator, 673 inNumerator.min() % inDenominator.min(), 674 inNumerator.min() % inDenominator.max(), 675 inNumerator.max() % inDenominator.min(), 676 inNumerator.max() % inDenominator.max()); 677 } 678 679 // Compute the fractional part of a double value and returns a result that is at most 680 // 'fractUpperBound'. fract(double d, Target t, double fractUpperBound)681 static private Target.Floaty fract(double d, Target t, double fractUpperBound) { 682 return t.newFloaty(Math.min( 683 d - Math.floor(d), 684 fractUpperBound)); 685 } 686 hypot(double x, double y, Target t)687 static private Target.Floaty hypot(double x, double y, Target t) { 688 Target.Floaty inX = t.newFloaty(x); 689 Target.Floaty inY = t.newFloaty(y); 690 return t.newFloaty( 691 Math.hypot(inX.mid(), inY.mid()), 692 Math.hypot(inX.min(), inY.min()), 693 Math.hypot(inX.min(), inY.max()), 694 Math.hypot(inX.max(), inY.min()), 695 Math.hypot(inX.max(), inY.max())); 696 } 697 hypot(float x, float y, Target t)698 static private Target.Floaty hypot(float x, float y, Target t) { 699 Target.Floaty inX = t.new32(x); 700 Target.Floaty inY = t.new32(y); 701 return t.new32( 702 hypot(inX.mid32(), inY.mid32()), 703 hypot(inX.min32(), inY.min32()), 704 hypot(inX.min32(), inY.max32()), 705 hypot(inX.max32(), inY.min32()), 706 hypot(inX.max32(), inY.max32())); 707 } 708 709 // Returns the length of an n-dimensional vector (in double-precision). length(double[] array, Target t)710 static private Target.Floaty length(double[] array, Target t) { 711 Target.Floaty sum = t.newFloaty(0.); 712 for (int i = 0; i < array.length; i++) { 713 Target.Floaty f = t.newFloaty(array[i]); 714 sum = t.add(sum, t.multiply(f, f)); 715 } 716 return t.sqrt(sum); 717 } 718 719 // Returns the length of the n-dimensional vector. length(float[] array, Target t)720 static private Target.Floaty length(float[] array, Target t) { 721 Target.Floaty sum = t.new32(0.f); 722 for (int i = 0; i < array.length; i++) { 723 Target.Floaty f = t.new32(array[i]); 724 sum = t.add(sum, t.multiply(f, f)); 725 } 726 Target.Floaty l = t.sqrt(sum); 727 return l; 728 } 729 log(double d, Target t)730 static private Target.Floaty log(double d, Target t) { 731 Target.Floaty in = t.newFloaty(d); 732 return t.newFloaty( 733 Math.log(in.mid()), 734 Math.log(in.min()), 735 Math.log(in.max())); 736 } 737 log(float f, Target t)738 static private Target.Floaty log(float f, Target t) { 739 Target.Floaty in = t.new32(f); 740 return t.new32( 741 log(in.mid32()), 742 log(in.min32()), 743 log(in.max32())); 744 } 745 log10(double d, Target t)746 static private Target.Floaty log10(double d, Target t) { 747 Target.Floaty in = t.newFloaty(d); 748 return t.newFloaty( 749 Math.log10(in.mid()), 750 Math.log10(in.min()), 751 Math.log10(in.max())); 752 } 753 log10(float f, Target t)754 static private Target.Floaty log10(float f, Target t) { 755 Target.Floaty in = t.new32(f); 756 return t.new32( 757 log10(in.mid32()), 758 log10(in.min32()), 759 log10(in.max32())); 760 } 761 log1p(double d, Target t)762 static private Target.Floaty log1p(double d, Target t) { 763 Target.Floaty in = t.newFloaty(d); 764 return t.newFloaty( 765 Math.log1p(in.mid()), 766 Math.log1p(in.min()), 767 Math.log1p(in.max())); 768 } 769 log1p(float f, Target t)770 static private Target.Floaty log1p(float f, Target t) { 771 Target.Floaty in = t.new32(f); 772 return t.new32( 773 log1p(in.mid32()), 774 log1p(in.min32()), 775 log1p(in.max32())); 776 } 777 778 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 779 // double-precision version later. log2(double d, Target t)780 static private Target.Floaty log2(double d, Target t) { 781 Target.Floaty in = t.newFloaty(d); 782 return t.newFloaty( 783 log2((float) in.mid()), 784 log2((float) in.min()), 785 log2((float) in.max())); 786 } 787 log2(float f, Target t)788 static private Target.Floaty log2(float f, Target t) { 789 Target.Floaty in = t.new32(f); 790 return t.new32( 791 log2(in.mid32()), 792 log2(in.min32()), 793 log2(in.max32())); 794 } 795 796 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 797 // double-precision version later. logb(double d, Target t)798 static private Target.Floaty logb(double d, Target t) { 799 Target.Floaty in = t.newFloaty(d); 800 return t.newFloaty( 801 logb((float) in.mid()), 802 logb((float) in.min()), 803 logb((float) in.max())); 804 } 805 mad(double m1, double m2, double offset, Target t)806 static private Target.Floaty mad(double m1, double m2, double offset, Target t) { 807 Target.Floaty ab = t.multiply(t.newFloaty(m1), t.newFloaty(m2)); 808 return t.add(ab, t.newFloaty(offset)); 809 } 810 max(double a, double b, Target t)811 static private Target.Floaty max(double a, double b, Target t) { 812 return t.newFloaty(Math.max(a, b)); 813 } 814 min(double a, double b, Target t)815 static private Target.Floaty min(double a, double b, Target t) { 816 return t.newFloaty(Math.min(a, b)); 817 } 818 mix(double start, double stop, double fraction, Target t)819 static private Target.Floaty mix(double start, double stop, double fraction, Target t) { 820 Target.Floaty inStart = t.newFloaty(start); 821 Target.Floaty inStop = t.newFloaty(stop); 822 Target.Floaty inFraction = t.newFloaty(fraction); 823 824 Target.Floaty diff = t.subtract(inStop, inStart); 825 return t.add(inStart, t.multiply(diff, inFraction)); 826 } 827 828 // Normalizes the double-precision n-dimensional vector, i.e. makes it length 1. normalize(double[] in, Target.Floaty[] out, Target t)829 static private void normalize(double[] in, Target.Floaty[] out, Target t) { 830 Target.Floaty l = length(in, t); 831 boolean isZero = l.get() == 0.; 832 for (int i = 0; i < in.length; i++) { 833 out[i] = t.newFloaty(in[i]); 834 if (!isZero) { 835 out[i] = t.divide(out[i], l); 836 } 837 } 838 } 839 840 // Normalizes the n-dimensional vector, i.e. makes it length 1. normalize(float[] in, Target.Floaty[] out, Target t)841 static private void normalize(float[] in, Target.Floaty[] out, Target t) { 842 Target.Floaty l = length(in, t); 843 boolean isZero = l.get32() == 0.f; 844 for (int i = 0; i < in.length; i++) { 845 out[i] = t.new32(in[i]); 846 if (!isZero) { 847 out[i] = t.divide(out[i], l); 848 } 849 } 850 } 851 pow(double x, double y, Target t)852 static private Target.Floaty pow(double x, double y, Target t) { 853 Target.Floaty base = t.newFloaty(x); 854 Target.Floaty exponent = t.newFloaty(y); 855 return t.newFloaty( 856 Math.pow(base.mid(), exponent.mid()), 857 Math.pow(base.min(), exponent.min()), 858 Math.pow(base.min(), exponent.max()), 859 Math.pow(base.max(), exponent.min()), 860 Math.pow(base.max(), exponent.max())); 861 } 862 powr(float x, float y, Target t)863 static private Target.Floaty powr(float x, float y, Target t) { 864 Target.Floaty base = t.new32(x); 865 Target.Floaty exponent = t.new32(y); 866 return t.new32( 867 pow(base.mid32(), exponent.mid32()), 868 pow(base.min32(), exponent.min32()), 869 pow(base.min32(), exponent.max32()), 870 pow(base.max32(), exponent.min32()), 871 pow(base.max32(), exponent.max32())); 872 } 873 radians(double d, Target t)874 static private Target.Floaty radians(double d, Target t) { 875 Target.Floaty in = t.newFloaty(d); 876 Target.Floaty k = t.newFloaty(Math.PI / 180); 877 return t.multiply(in, k); 878 } 879 recip(double d, Target t)880 static private Target.Floaty recip(double d, Target t) { 881 Target.Floaty in = t.newFloaty(d); 882 return t.divide(t.newFloaty(1.), in); 883 } 884 recip(float f, Target t)885 static private Target.Floaty recip(float f, Target t) { 886 Target.Floaty in = t.new32(f); 887 return t.divide(t.new32(1.f), in); 888 } 889 rint(double d, Target t)890 static private Target.Floaty rint(double d, Target t) { 891 Target.Floaty in = t.newFloaty(d); 892 return t.newFloaty( 893 Math.rint(in.mid()), 894 Math.rint(in.min()), 895 Math.rint(in.max())); 896 } 897 rootn(float inV, int inN, Target t)898 static private Target.Floaty rootn(float inV, int inN, Target t) { 899 /* Rootn of a negative number should be possible only if the number 900 * is odd. In cases where the int is very large, our approach will 901 * lose whether the int is odd, and we'll get a NaN for weird cases 902 * like rootn(-3.95, 818181881), which should return 1. We handle the 903 * case by handling the sign ourselves. We use copysign to handle the 904 * negative zero case. 905 */ 906 float value; 907 if ((inN & 0x1) == 0x1) { 908 value = Math.copySign(pow(Math.abs(inV), 1.f / inN), 909 inV); 910 } else { 911 value = pow(inV, 1.f / inN); 912 } 913 if (inN == 0) { 914 return t.new32(value, Float.NaN); 915 } else { 916 return t.new32(value); 917 } 918 } 919 920 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 921 // double-precision version later. 922 // 923 // Also, use native round() instead of Math.round() as the latter has different rounding 924 // behavior in case of ties. round(double d, Target t)925 static private Target.Floaty round(double d, Target t) { 926 Target.Floaty in = t.newFloaty(d); 927 return t.newFloaty( 928 round((float) in.mid()), 929 round((float) in.min()), 930 round((float) in.max())); 931 } 932 rsqrt(double d, Target t)933 static private Target.Floaty rsqrt(double d, Target t) { 934 Target.Floaty in = t.newFloaty(d); 935 return t.divide(t.newFloaty(1.), t.sqrt(in)); 936 } 937 rsqrt(float f, Target t)938 static private Target.Floaty rsqrt(float f, Target t) { 939 Target.Floaty in = t.new32(f); 940 return t.divide(t.new32(1.f), t.sqrt(in)); 941 } 942 sin(double d, Target t)943 static private Target.Floaty sin(double d, Target t) { 944 Target.Floaty in = t.newFloaty(d); 945 return t.newFloaty( 946 Math.sin(in.mid()), 947 Math.sin(in.min()), 948 Math.sin(in.max())); 949 } 950 sin(float f, Target t)951 static private Target.Floaty sin(float f, Target t) { 952 Target.Floaty in = t.new32(f); 953 return t.new32( 954 sin(in.mid32()), 955 sin(in.min32()), 956 sin(in.max32())); 957 } 958 sinh(double d, Target t)959 static private Target.Floaty sinh(double d, Target t) { 960 Target.Floaty in = t.newFloaty(d); 961 return t.newFloaty( 962 Math.sinh(in.mid()), 963 Math.sinh(in.min()), 964 Math.sinh(in.max())); 965 } 966 sinh(float f, Target t)967 static private Target.Floaty sinh(float f, Target t) { 968 Target.Floaty in = t.new32(f); 969 return t.new32( 970 sinh(in.mid32()), 971 sinh(in.min32()), 972 sinh(in.max32())); 973 } 974 sinpi(double d, Target t)975 static private Target.Floaty sinpi(double d, Target t) { 976 Target.Floaty in = t.multiply(t.newFloaty(d), pi(t)); 977 return t.newFloaty( 978 Math.sin(in.mid()), 979 Math.sin(in.min()), 980 Math.sin(in.max())); 981 } 982 sinpi(float f, Target t)983 static private Target.Floaty sinpi(float f, Target t) { 984 Target.Floaty in = t.multiply(t.new32(f), pi32(t)); 985 return t.new32( 986 sin(in.mid32()), 987 sin(in.min32()), 988 sin(in.max32())); 989 } 990 sqrt(double d, Target t)991 static private Target.Floaty sqrt(double d, Target t) { 992 Target.Floaty in = t.newFloaty(d); 993 return t.sqrt(in); 994 } 995 sqrt(float f, Target t)996 static private Target.Floaty sqrt(float f, Target t) { 997 Target.Floaty in = t.new32(f); 998 return t.sqrt(in); 999 } 1000 step(double v, double edge, Target t)1001 static private Target.Floaty step(double v, double edge, Target t) { 1002 return t.newFloaty(v < edge ? 0.f : 1.f); 1003 } 1004 tan(double d, Target t)1005 static private Target.Floaty tan(double d, Target t) { 1006 Target.Floaty in = t.newFloaty(d); 1007 double min = Math.tan(in.min()); 1008 double max = Math.tan(in.max()); 1009 /* If difference between in.max() and in.min() is larger than PI or if the tan of the min is 1010 * greater than that of the max, we spanned a discontinuity. 1011 */ 1012 if (in.max() - in.min() > Math.PI || min > max) { 1013 return any(t); 1014 } else { 1015 return t.newFloaty(Math.tan(d), min, max); 1016 } 1017 } 1018 tan(float f, Target t)1019 static private Target.Floaty tan(float f, Target t) { 1020 Target.Floaty in = t.new32(f); 1021 float min = tan(in.min32()); 1022 float max = tan(in.max32()); 1023 /* If difference between in.max() and in.min() is larger than PI or if the tan of the min is 1024 * greater than that of the max, we spanned a discontinuity. 1025 */ 1026 if (in.max() - in.min() > Math.PI || min > max) { 1027 return any32(t); 1028 } else { 1029 return t.new32(tan(f), min, max); 1030 } 1031 } 1032 tanh(double d, Target t)1033 static private Target.Floaty tanh(double d, Target t) { 1034 Target.Floaty in = t.newFloaty(d); 1035 return t.newFloaty( 1036 Math.tanh(in.mid()), 1037 Math.tanh(in.min()), 1038 Math.tanh(in.max())); 1039 } 1040 tanh(float f, Target t)1041 static private Target.Floaty tanh(float f, Target t) { 1042 Target.Floaty in = t.new32(f); 1043 return t.new32( 1044 tanh(in.mid32()), 1045 tanh(in.min32()), 1046 tanh(in.max32())); 1047 } 1048 tanpi(double d, Target t)1049 static private Target.Floaty tanpi(double d, Target t) { 1050 Target.Floaty in = t.multiply(t.newFloaty(d), pi(t)); 1051 double min = Math.tan(in.min()); 1052 double max = Math.tan(in.max()); 1053 1054 /* If difference between in.max() and in.min() is larger than PI or if the tan of the min is 1055 * greater than that of the max, we spanned a discontinuity. 1056 */ 1057 if (in.max() - in.min() > Math.PI || min > max) { 1058 return any(t); 1059 } else { 1060 return t.newFloaty(Math.tan(in.mid()), min, max); 1061 } 1062 } 1063 tanpi(float f, Target t)1064 static private Target.Floaty tanpi(float f, Target t) { 1065 Target.Floaty in = t.multiply(t.new32(f), pi32(t)); 1066 float min = tan(in.min32()); 1067 float max = tan(in.max32()); 1068 /* If difference between in.max() and in.min() is larger than PI or if the tan of the min is 1069 * greater than that of the max, we spanned a discontinuity. 1070 */ 1071 if (in.max() - in.min() > Math.PI || min > max) { 1072 return any32(t); 1073 } else { 1074 return t.new32(tan(in.mid32()), min, max); 1075 } 1076 } 1077 1078 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 1079 // double-precision version later. tgamma(double d, Target t)1080 static private Target.Floaty tgamma(double d, Target t) { 1081 Target.Floaty in = t.newFloaty(d); 1082 return t.newFloaty( 1083 tgamma((float) in.mid()), 1084 tgamma((float) in.min()), 1085 tgamma((float) in.max())); 1086 } 1087 1088 // NOTE: This function delegates to the floating-point version in libm. Need to switch to the 1089 // double-precision version later. trunc(double d, Target t)1090 static private Target.Floaty trunc(double d, Target t) { 1091 Target.Floaty in = t.newFloaty(d); 1092 return t.newFloaty( 1093 trunc((float) in.mid()), 1094 trunc((float) in.min()), 1095 trunc((float) in.max())); 1096 } 1097 computeAbs(TestAbs.ArgumentsCharUchar args)1098 static public void computeAbs(TestAbs.ArgumentsCharUchar args) { 1099 args.out = (byte)Math.abs(args.inV); 1100 } 1101 computeAbs(TestAbs.ArgumentsShortUshort args)1102 static public void computeAbs(TestAbs.ArgumentsShortUshort args) { 1103 args.out = (short)Math.abs(args.inV); 1104 } 1105 computeAbs(TestAbs.ArgumentsIntUint args)1106 static public void computeAbs(TestAbs.ArgumentsIntUint args) { 1107 args.out = Math.abs(args.inV); 1108 } 1109 computeAcos(TestAcos.ArgumentsHalfHalf args, Target t)1110 static public void computeAcos(TestAcos.ArgumentsHalfHalf args, Target t) { 1111 t.setPrecision(4, 4); 1112 args.out = acos(args.inVDouble, t); 1113 } 1114 computeAcos(TestAcos.ArgumentsFloatFloat args, Target t)1115 static public void computeAcos(TestAcos.ArgumentsFloatFloat args, Target t) { 1116 t.setPrecision(4, 128); 1117 args.out = acos(args.inV, t); 1118 } 1119 computeAcosh(TestAcosh.ArgumentsHalfHalf args, Target t)1120 static public void computeAcosh(TestAcosh.ArgumentsHalfHalf args, Target t) { 1121 t.setPrecision(4, 4); 1122 args.out = acosh(args.inVDouble, t); 1123 } 1124 computeAcosh(TestAcosh.ArgumentsFloatFloat args, Target t)1125 static public void computeAcosh(TestAcosh.ArgumentsFloatFloat args, Target t) { 1126 t.setPrecision(4, 128); 1127 args.out = acosh(args.inV, t); 1128 } 1129 computeAcospi(TestAcospi.ArgumentsHalfHalf args, Target t)1130 static public void computeAcospi(TestAcospi.ArgumentsHalfHalf args, Target t) { 1131 t.setPrecision(5, 5); 1132 args.out = acospi(args.inVDouble, t); 1133 } 1134 computeAcospi(TestAcospi.ArgumentsFloatFloat args, Target t)1135 static public void computeAcospi(TestAcospi.ArgumentsFloatFloat args, Target t) { 1136 t.setPrecision(5, 128); 1137 args.out = acospi(args.inV, t); 1138 } 1139 computeAsin(TestAsin.ArgumentsHalfHalf args, Target t)1140 static public void computeAsin(TestAsin.ArgumentsHalfHalf args, Target t) { 1141 t.setPrecision(4, 4); 1142 args.out = asin(args.inVDouble, t); 1143 } 1144 computeAsin(TestAsin.ArgumentsFloatFloat args, Target t)1145 static public void computeAsin(TestAsin.ArgumentsFloatFloat args, Target t) { 1146 t.setPrecision(4, 128); 1147 args.out = asin(args.inV, t); 1148 } 1149 computeAsinh(TestAsinh.ArgumentsHalfHalf args, Target t)1150 static public void computeAsinh(TestAsinh.ArgumentsHalfHalf args, Target t) { 1151 t.setPrecision(4, 4); 1152 args.out = asinh(args.inVDouble, t); 1153 } 1154 computeAsinh(TestAsinh.ArgumentsFloatFloat args, Target t)1155 static public void computeAsinh(TestAsinh.ArgumentsFloatFloat args, Target t) { 1156 t.setPrecision(4, 128); 1157 args.out = asinh(args.inV, t); 1158 } 1159 computeAsinpi(TestAsinpi.ArgumentsHalfHalf args, Target t)1160 static public void computeAsinpi(TestAsinpi.ArgumentsHalfHalf args, Target t) { 1161 t.setPrecision(5, 5); 1162 args.out = asinpi(args.inVDouble, t); 1163 } 1164 computeAsinpi(TestAsinpi.ArgumentsFloatFloat args, Target t)1165 static public void computeAsinpi(TestAsinpi.ArgumentsFloatFloat args, Target t) { 1166 t.setPrecision(5, 128); 1167 args.out = asinpi(args.inV, t); 1168 } 1169 computeAtan(TestAtan.ArgumentsHalfHalf args, Target t)1170 static public void computeAtan(TestAtan.ArgumentsHalfHalf args, Target t) { 1171 t.setPrecision(5, 5); 1172 args.out = atan(args.inVDouble, t); 1173 } 1174 computeAtan(TestAtan.ArgumentsFloatFloat args, Target t)1175 static public void computeAtan(TestAtan.ArgumentsFloatFloat args, Target t) { 1176 t.setPrecision(5, 128); 1177 args.out = atan(args.inV, t); 1178 } 1179 computeAtanh(TestAtanh.ArgumentsHalfHalf args, Target t)1180 static public void computeAtanh(TestAtanh.ArgumentsHalfHalf args, Target t) { 1181 t.setPrecision(5, 5); 1182 args.out = atanh(args.inVDouble, t); 1183 } 1184 computeAtanh(TestAtanh.ArgumentsFloatFloat args, Target t)1185 static public void computeAtanh(TestAtanh.ArgumentsFloatFloat args, Target t) { 1186 t.setPrecision(5, 128); 1187 args.out = atanh(args.inV, t); 1188 } 1189 computeAtanpi(TestAtanpi.ArgumentsHalfHalf args, Target t)1190 static public void computeAtanpi(TestAtanpi.ArgumentsHalfHalf args, Target t) { 1191 t.setPrecision(5, 5); 1192 args.out = atanpi(args.inVDouble, t); 1193 } 1194 computeAtanpi(TestAtanpi.ArgumentsFloatFloat args, Target t)1195 static public void computeAtanpi(TestAtanpi.ArgumentsFloatFloat args, Target t) { 1196 t.setPrecision(5, 128); 1197 args.out = atanpi(args.inV, t); 1198 } 1199 computeAtan2(TestAtan2.ArgumentsHalfHalfHalf args, Target t)1200 static public void computeAtan2(TestAtan2.ArgumentsHalfHalfHalf args, Target t) { 1201 t.setPrecision(6, 6); 1202 args.out = atan2(args.inNumeratorDouble, args.inDenominatorDouble, t); 1203 } 1204 computeAtan2(TestAtan2.ArgumentsFloatFloatFloat args, Target t)1205 static public void computeAtan2(TestAtan2.ArgumentsFloatFloatFloat args, Target t) { 1206 t.setPrecision(6, 128); 1207 args.out = atan2(args.inNumerator, args.inDenominator, t); 1208 } 1209 computeAtan2pi(TestAtan2pi.ArgumentsHalfHalfHalf args, Target t)1210 static public void computeAtan2pi(TestAtan2pi.ArgumentsHalfHalfHalf args, Target t) { 1211 t.setPrecision(6, 6); 1212 args.out = atan2pi(args.inNumeratorDouble, args.inDenominatorDouble, t); 1213 } 1214 computeAtan2pi(TestAtan2pi.ArgumentsFloatFloatFloat args, Target t)1215 static public void computeAtan2pi(TestAtan2pi.ArgumentsFloatFloatFloat args, Target t) { 1216 t.setPrecision(6, 128); 1217 args.out = atan2pi(args.inNumerator, args.inDenominator, t); 1218 } 1219 computeCbrt(TestCbrt.ArgumentsHalfHalf args, Target t)1220 static public void computeCbrt(TestCbrt.ArgumentsHalfHalf args, Target t) { 1221 t.setPrecision(2, 2); 1222 args.out = cbrt(args.inVDouble, t); 1223 } 1224 computeCbrt(TestCbrt.ArgumentsFloatFloat args, Target t)1225 static public void computeCbrt(TestCbrt.ArgumentsFloatFloat args, Target t) { 1226 t.setPrecision(2, 128); 1227 args.out = cbrt(args.inV, t); 1228 } 1229 computeCeil(TestCeil.ArgumentsHalfHalf args, Target t)1230 static public void computeCeil(TestCeil.ArgumentsHalfHalf args, Target t) { 1231 t.setPrecision(0, 0); 1232 Target.Floaty in = t.newFloaty(args.inVDouble); 1233 args.out = t.newFloaty( 1234 Math.ceil(in.mid()), 1235 Math.ceil(in.min()), 1236 Math.ceil(in.max())); 1237 } 1238 computeCeil(TestCeil.ArgumentsFloatFloat args, Target t)1239 static public void computeCeil(TestCeil.ArgumentsFloatFloat args, Target t) { 1240 t.setPrecision(0, 1); 1241 Target.Floaty in = t.new32(args.inV); 1242 args.out = t.new32( 1243 ceil(in.mid32()), 1244 ceil(in.min32()), 1245 ceil(in.max32())); 1246 } 1247 computeClamp(TestClamp.ArgumentsCharCharCharChar args)1248 static public void computeClamp(TestClamp.ArgumentsCharCharCharChar args) { 1249 args.out = minI8(args.inMaxValue, maxI8(args.inValue, args.inMinValue)); 1250 } 1251 computeClamp(TestClamp.ArgumentsUcharUcharUcharUchar args)1252 static public void computeClamp(TestClamp.ArgumentsUcharUcharUcharUchar args) { 1253 args.out = minU8(args.inMaxValue, maxU8(args.inValue, args.inMinValue)); 1254 } 1255 computeClamp(TestClamp.ArgumentsShortShortShortShort args)1256 static public void computeClamp(TestClamp.ArgumentsShortShortShortShort args) { 1257 args.out = minI16(args.inMaxValue, maxI16(args.inValue, args.inMinValue)); 1258 } 1259 computeClamp(TestClamp.ArgumentsUshortUshortUshortUshort args)1260 static public void computeClamp(TestClamp.ArgumentsUshortUshortUshortUshort args) { 1261 args.out = minU16(args.inMaxValue, maxU16(args.inValue, args.inMinValue)); 1262 } 1263 computeClamp(TestClamp.ArgumentsIntIntIntInt args)1264 static public void computeClamp(TestClamp.ArgumentsIntIntIntInt args) { 1265 args.out = minI32(args.inMaxValue, maxI32(args.inValue, args.inMinValue)); 1266 } 1267 computeClamp(TestClamp.ArgumentsUintUintUintUint args)1268 static public void computeClamp(TestClamp.ArgumentsUintUintUintUint args) { 1269 args.out = minU32(args.inMaxValue, maxU32(args.inValue, args.inMinValue)); 1270 } 1271 computeClamp(TestClamp.ArgumentsHalfHalfHalfHalf args, Target t)1272 static public void computeClamp(TestClamp.ArgumentsHalfHalfHalfHalf args, Target t) { 1273 t.setPrecision(0, 0); 1274 args.out = clamp(args.inValueDouble, args.inMinValueDouble, args.inMaxValueDouble, t); 1275 } 1276 computeClamp(TestClamp.ArgumentsFloatFloatFloatFloat args, Target t)1277 static public void computeClamp(TestClamp.ArgumentsFloatFloatFloatFloat args, Target t) { 1278 t.setPrecision(0, 0); 1279 args.out = t.new32(Math.min(args.inMaxValue, 1280 Math.max(args.inValue, args.inMinValue))); 1281 } 1282 computeClamp(TestClamp.ArgumentsLongLongLongLong args)1283 static public void computeClamp(TestClamp.ArgumentsLongLongLongLong args) { 1284 args.out = minI64(args.inMaxValue, maxI64(args.inValue, args.inMinValue)); 1285 } 1286 computeClamp(TestClamp.ArgumentsUlongUlongUlongUlong args)1287 static public void computeClamp(TestClamp.ArgumentsUlongUlongUlongUlong args) { 1288 args.out = minU64(args.inMaxValue, maxU64(args.inValue, args.inMinValue)); 1289 } 1290 computeClz(TestClz.ArgumentsCharChar args)1291 static public void computeClz(TestClz.ArgumentsCharChar args) { 1292 int x = args.inValue; 1293 args.out = (byte) (Integer.numberOfLeadingZeros(x & 0xff) - 24); 1294 } 1295 computeClz(TestClz.ArgumentsUcharUchar args)1296 static public void computeClz(TestClz.ArgumentsUcharUchar args) { 1297 int x = args.inValue; 1298 args.out = (byte) (Integer.numberOfLeadingZeros(x & 0xff) - 24); 1299 } 1300 computeClz(TestClz.ArgumentsShortShort args)1301 static public void computeClz(TestClz.ArgumentsShortShort args) { 1302 args.out = (short) (Integer.numberOfLeadingZeros(args.inValue & 0xffff) - 16); 1303 } 1304 computeClz(TestClz.ArgumentsUshortUshort args)1305 static public void computeClz(TestClz.ArgumentsUshortUshort args) { 1306 args.out = (short) (Integer.numberOfLeadingZeros(args.inValue & 0xffff) - 16); 1307 } 1308 computeClz(TestClz.ArgumentsIntInt args)1309 static public void computeClz(TestClz.ArgumentsIntInt args) { 1310 args.out = (int) Integer.numberOfLeadingZeros(args.inValue); 1311 } 1312 computeClz(TestClz.ArgumentsUintUint args)1313 static public void computeClz(TestClz.ArgumentsUintUint args) { 1314 args.out = (int) Integer.numberOfLeadingZeros(args.inValue); 1315 } 1316 1317 computeConvert(TestConvert.ArgumentsCharChar args)1318 static public void computeConvert(TestConvert.ArgumentsCharChar args) { 1319 args.out = convertCharToChar(args.inV); 1320 } computeConvert(TestConvert.ArgumentsCharUchar args)1321 static public void computeConvert(TestConvert.ArgumentsCharUchar args) { 1322 args.out = convertCharToUchar(args.inV); 1323 } computeConvert(TestConvert.ArgumentsCharShort args)1324 static public void computeConvert(TestConvert.ArgumentsCharShort args) { 1325 args.out = convertCharToShort(args.inV); 1326 } computeConvert(TestConvert.ArgumentsCharUshort args)1327 static public void computeConvert(TestConvert.ArgumentsCharUshort args) { 1328 args.out = convertCharToUshort(args.inV); 1329 } computeConvert(TestConvert.ArgumentsCharInt args)1330 static public void computeConvert(TestConvert.ArgumentsCharInt args) { 1331 args.out = convertCharToInt(args.inV); 1332 } computeConvert(TestConvert.ArgumentsCharUint args)1333 static public void computeConvert(TestConvert.ArgumentsCharUint args) { 1334 args.out = convertCharToUint(args.inV); 1335 } computeConvert(TestConvert.ArgumentsCharLong args)1336 static public void computeConvert(TestConvert.ArgumentsCharLong args) { 1337 args.out = convertCharToLong(args.inV); 1338 } computeConvert(TestConvert.ArgumentsCharUlong args)1339 static public void computeConvert(TestConvert.ArgumentsCharUlong args) { 1340 args.out = convertCharToUlong(args.inV); 1341 } computeConvert(TestConvert.ArgumentsCharHalf args, Target t)1342 static public void computeConvert(TestConvert.ArgumentsCharHalf args, Target t) { 1343 t.setPrecision(0, 0); 1344 args.out = t.newFloaty(convertCharToDouble(args.inV)); 1345 } computeConvert(TestConvert.ArgumentsCharFloat args, Target t)1346 static public void computeConvert(TestConvert.ArgumentsCharFloat args, Target t) { 1347 t.setPrecision(0, 0); 1348 args.out = t.new32(convertCharToFloat(args.inV)); 1349 } computeConvert(TestConvert.ArgumentsCharDouble args, Target t)1350 static public void computeConvert(TestConvert.ArgumentsCharDouble args, Target t) { 1351 t.setPrecision(0, 0); 1352 args.out = t.new64(convertCharToDouble(args.inV)); 1353 } 1354 computeConvert(TestConvert.ArgumentsUcharChar args)1355 static public void computeConvert(TestConvert.ArgumentsUcharChar args) { 1356 args.out = convertUcharToChar(args.inV); 1357 } computeConvert(TestConvert.ArgumentsUcharUchar args)1358 static public void computeConvert(TestConvert.ArgumentsUcharUchar args) { 1359 args.out = convertUcharToUchar(args.inV); 1360 } computeConvert(TestConvert.ArgumentsUcharShort args)1361 static public void computeConvert(TestConvert.ArgumentsUcharShort args) { 1362 args.out = convertUcharToShort(args.inV); 1363 } computeConvert(TestConvert.ArgumentsUcharUshort args)1364 static public void computeConvert(TestConvert.ArgumentsUcharUshort args) { 1365 args.out = convertUcharToUshort(args.inV); 1366 } computeConvert(TestConvert.ArgumentsUcharInt args)1367 static public void computeConvert(TestConvert.ArgumentsUcharInt args) { 1368 args.out = convertUcharToInt(args.inV); 1369 } computeConvert(TestConvert.ArgumentsUcharUint args)1370 static public void computeConvert(TestConvert.ArgumentsUcharUint args) { 1371 args.out = convertUcharToUint(args.inV); 1372 } computeConvert(TestConvert.ArgumentsUcharLong args)1373 static public void computeConvert(TestConvert.ArgumentsUcharLong args) { 1374 args.out = convertUcharToLong(args.inV); 1375 } computeConvert(TestConvert.ArgumentsUcharUlong args)1376 static public void computeConvert(TestConvert.ArgumentsUcharUlong args) { 1377 args.out = convertUcharToUlong(args.inV); 1378 } computeConvert(TestConvert.ArgumentsUcharHalf args, Target t)1379 static public void computeConvert(TestConvert.ArgumentsUcharHalf args, Target t) { 1380 t.setPrecision(0, 0); 1381 args.out = t.newFloaty(convertUcharToDouble(args.inV)); 1382 } computeConvert(TestConvert.ArgumentsUcharFloat args, Target t)1383 static public void computeConvert(TestConvert.ArgumentsUcharFloat args, Target t) { 1384 t.setPrecision(0, 0); 1385 args.out = t.new32(convertUcharToFloat(args.inV)); 1386 } computeConvert(TestConvert.ArgumentsUcharDouble args, Target t)1387 static public void computeConvert(TestConvert.ArgumentsUcharDouble args, Target t) { 1388 t.setPrecision(0, 0); 1389 args.out = t.new64(convertUcharToDouble(args.inV)); 1390 } 1391 computeConvert(TestConvert.ArgumentsShortChar args)1392 static public void computeConvert(TestConvert.ArgumentsShortChar args) { 1393 args.out = convertShortToChar(args.inV); 1394 } computeConvert(TestConvert.ArgumentsShortUchar args)1395 static public void computeConvert(TestConvert.ArgumentsShortUchar args) { 1396 args.out = convertShortToUchar(args.inV); 1397 } computeConvert(TestConvert.ArgumentsShortShort args)1398 static public void computeConvert(TestConvert.ArgumentsShortShort args) { 1399 args.out = convertShortToShort(args.inV); 1400 } computeConvert(TestConvert.ArgumentsShortUshort args)1401 static public void computeConvert(TestConvert.ArgumentsShortUshort args) { 1402 args.out = convertShortToUshort(args.inV); 1403 } computeConvert(TestConvert.ArgumentsShortInt args)1404 static public void computeConvert(TestConvert.ArgumentsShortInt args) { 1405 args.out = convertShortToInt(args.inV); 1406 } computeConvert(TestConvert.ArgumentsShortUint args)1407 static public void computeConvert(TestConvert.ArgumentsShortUint args) { 1408 args.out = convertShortToUint(args.inV); 1409 } computeConvert(TestConvert.ArgumentsShortLong args)1410 static public void computeConvert(TestConvert.ArgumentsShortLong args) { 1411 args.out = convertShortToLong(args.inV); 1412 } computeConvert(TestConvert.ArgumentsShortUlong args)1413 static public void computeConvert(TestConvert.ArgumentsShortUlong args) { 1414 args.out = convertShortToUlong(args.inV); 1415 } computeConvert(TestConvert.ArgumentsShortHalf args, Target t)1416 static public void computeConvert(TestConvert.ArgumentsShortHalf args, Target t) { 1417 t.setPrecision(1, 1); 1418 args.out = t.newFloaty(convertShortToDouble(args.inV)); 1419 } computeConvert(TestConvert.ArgumentsShortFloat args, Target t)1420 static public void computeConvert(TestConvert.ArgumentsShortFloat args, Target t) { 1421 t.setPrecision(0, 0); 1422 args.out = t.new32(convertShortToFloat(args.inV)); 1423 } computeConvert(TestConvert.ArgumentsShortDouble args, Target t)1424 static public void computeConvert(TestConvert.ArgumentsShortDouble args, Target t) { 1425 t.setPrecision(0, 0); 1426 args.out = t.new64(convertShortToDouble(args.inV)); 1427 } 1428 computeConvert(TestConvert.ArgumentsUshortChar args)1429 static public void computeConvert(TestConvert.ArgumentsUshortChar args) { 1430 args.out = convertUshortToChar(args.inV); 1431 } computeConvert(TestConvert.ArgumentsUshortUchar args)1432 static public void computeConvert(TestConvert.ArgumentsUshortUchar args) { 1433 args.out = convertUshortToUchar(args.inV); 1434 } computeConvert(TestConvert.ArgumentsUshortShort args)1435 static public void computeConvert(TestConvert.ArgumentsUshortShort args) { 1436 args.out = convertUshortToShort(args.inV); 1437 } computeConvert(TestConvert.ArgumentsUshortUshort args)1438 static public void computeConvert(TestConvert.ArgumentsUshortUshort args) { 1439 args.out = convertUshortToUshort(args.inV); 1440 } computeConvert(TestConvert.ArgumentsUshortInt args)1441 static public void computeConvert(TestConvert.ArgumentsUshortInt args) { 1442 args.out = convertUshortToInt(args.inV); 1443 } computeConvert(TestConvert.ArgumentsUshortUint args)1444 static public void computeConvert(TestConvert.ArgumentsUshortUint args) { 1445 args.out = convertUshortToUint(args.inV); 1446 } computeConvert(TestConvert.ArgumentsUshortLong args)1447 static public void computeConvert(TestConvert.ArgumentsUshortLong args) { 1448 args.out = convertUshortToLong(args.inV); 1449 } computeConvert(TestConvert.ArgumentsUshortUlong args)1450 static public void computeConvert(TestConvert.ArgumentsUshortUlong args) { 1451 args.out = convertUshortToUlong(args.inV); 1452 } computeConvert(TestConvert.ArgumentsUshortHalf args, Target t)1453 static public void computeConvert(TestConvert.ArgumentsUshortHalf args, Target t) { 1454 t.setPrecision(1, 1); 1455 args.out = t.newFloaty(convertUshortToDouble(args.inV)); 1456 } computeConvert(TestConvert.ArgumentsUshortFloat args, Target t)1457 static public void computeConvert(TestConvert.ArgumentsUshortFloat args, Target t) { 1458 t.setPrecision(0, 0); 1459 args.out = t.new32(convertUshortToFloat(args.inV)); 1460 } computeConvert(TestConvert.ArgumentsUshortDouble args, Target t)1461 static public void computeConvert(TestConvert.ArgumentsUshortDouble args, Target t) { 1462 t.setPrecision(0, 0); 1463 args.out = t.new64(convertUshortToDouble(args.inV)); 1464 } 1465 computeConvert(TestConvert.ArgumentsIntChar args)1466 static public void computeConvert(TestConvert.ArgumentsIntChar args) { 1467 args.out = convertIntToChar(args.inV); 1468 } computeConvert(TestConvert.ArgumentsIntUchar args)1469 static public void computeConvert(TestConvert.ArgumentsIntUchar args) { 1470 args.out = convertIntToUchar(args.inV); 1471 } computeConvert(TestConvert.ArgumentsIntShort args)1472 static public void computeConvert(TestConvert.ArgumentsIntShort args) { 1473 args.out = convertIntToShort(args.inV); 1474 } computeConvert(TestConvert.ArgumentsIntUshort args)1475 static public void computeConvert(TestConvert.ArgumentsIntUshort args) { 1476 args.out = convertIntToUshort(args.inV); 1477 } computeConvert(TestConvert.ArgumentsIntInt args)1478 static public void computeConvert(TestConvert.ArgumentsIntInt args) { 1479 args.out = convertIntToInt(args.inV); 1480 } computeConvert(TestConvert.ArgumentsIntUint args)1481 static public void computeConvert(TestConvert.ArgumentsIntUint args) { 1482 args.out = convertIntToUint(args.inV); 1483 } computeConvert(TestConvert.ArgumentsIntLong args)1484 static public void computeConvert(TestConvert.ArgumentsIntLong args) { 1485 args.out = convertIntToLong(args.inV); 1486 } computeConvert(TestConvert.ArgumentsIntUlong args)1487 static public void computeConvert(TestConvert.ArgumentsIntUlong args) { 1488 args.out = convertIntToUlong(args.inV); 1489 } computeConvert(TestConvert.ArgumentsIntHalf args, Target t)1490 static public void computeConvert(TestConvert.ArgumentsIntHalf args, Target t) { 1491 t.setPrecision(1, 1); 1492 args.out = t.newFloaty(convertIntToDouble(args.inV)); 1493 } computeConvert(TestConvert.ArgumentsIntFloat args, Target t)1494 static public void computeConvert(TestConvert.ArgumentsIntFloat args, Target t) { 1495 t.setPrecision(1, 1); 1496 args.out = t.new32(convertIntToFloat(args.inV)); 1497 } computeConvert(TestConvert.ArgumentsIntDouble args, Target t)1498 static public void computeConvert(TestConvert.ArgumentsIntDouble args, Target t) { 1499 t.setPrecision(0, 0); 1500 args.out = t.new64(convertIntToDouble(args.inV)); 1501 } 1502 computeConvert(TestConvert.ArgumentsUintChar args)1503 static public void computeConvert(TestConvert.ArgumentsUintChar args) { 1504 args.out = convertUintToChar(args.inV); 1505 } computeConvert(TestConvert.ArgumentsUintUchar args)1506 static public void computeConvert(TestConvert.ArgumentsUintUchar args) { 1507 args.out = convertUintToUchar(args.inV); 1508 } computeConvert(TestConvert.ArgumentsUintShort args)1509 static public void computeConvert(TestConvert.ArgumentsUintShort args) { 1510 args.out = convertUintToShort(args.inV); 1511 } computeConvert(TestConvert.ArgumentsUintUshort args)1512 static public void computeConvert(TestConvert.ArgumentsUintUshort args) { 1513 args.out = convertUintToUshort(args.inV); 1514 } computeConvert(TestConvert.ArgumentsUintInt args)1515 static public void computeConvert(TestConvert.ArgumentsUintInt args) { 1516 args.out = convertUintToInt(args.inV); 1517 } computeConvert(TestConvert.ArgumentsUintUint args)1518 static public void computeConvert(TestConvert.ArgumentsUintUint args) { 1519 args.out = convertUintToUint(args.inV); 1520 } computeConvert(TestConvert.ArgumentsUintLong args)1521 static public void computeConvert(TestConvert.ArgumentsUintLong args) { 1522 args.out = convertUintToLong(args.inV); 1523 } computeConvert(TestConvert.ArgumentsUintUlong args)1524 static public void computeConvert(TestConvert.ArgumentsUintUlong args) { 1525 args.out = convertUintToUlong(args.inV); 1526 } computeConvert(TestConvert.ArgumentsUintHalf args, Target t)1527 static public void computeConvert(TestConvert.ArgumentsUintHalf args, Target t) { 1528 t.setPrecision(1, 1); 1529 args.out = t.newFloaty(convertUintToDouble(args.inV)); 1530 } computeConvert(TestConvert.ArgumentsUintFloat args, Target t)1531 static public void computeConvert(TestConvert.ArgumentsUintFloat args, Target t) { 1532 t.setPrecision(1, 1); 1533 args.out = t.new32(convertUintToFloat(args.inV)); 1534 } computeConvert(TestConvert.ArgumentsUintDouble args, Target t)1535 static public void computeConvert(TestConvert.ArgumentsUintDouble args, Target t) { 1536 t.setPrecision(0, 0); 1537 args.out = t.new64(convertUintToDouble(args.inV)); 1538 } 1539 computeConvert(TestConvert.ArgumentsLongChar args)1540 static public void computeConvert(TestConvert.ArgumentsLongChar args) { 1541 args.out = convertLongToChar(args.inV); 1542 } computeConvert(TestConvert.ArgumentsLongUchar args)1543 static public void computeConvert(TestConvert.ArgumentsLongUchar args) { 1544 args.out = convertLongToUchar(args.inV); 1545 } computeConvert(TestConvert.ArgumentsLongShort args)1546 static public void computeConvert(TestConvert.ArgumentsLongShort args) { 1547 args.out = convertLongToShort(args.inV); 1548 } computeConvert(TestConvert.ArgumentsLongUshort args)1549 static public void computeConvert(TestConvert.ArgumentsLongUshort args) { 1550 args.out = convertLongToUshort(args.inV); 1551 } computeConvert(TestConvert.ArgumentsLongInt args)1552 static public void computeConvert(TestConvert.ArgumentsLongInt args) { 1553 args.out = convertLongToInt(args.inV); 1554 } computeConvert(TestConvert.ArgumentsLongUint args)1555 static public void computeConvert(TestConvert.ArgumentsLongUint args) { 1556 args.out = convertLongToUint(args.inV); 1557 } computeConvert(TestConvert.ArgumentsLongLong args)1558 static public void computeConvert(TestConvert.ArgumentsLongLong args) { 1559 args.out = convertLongToLong(args.inV); 1560 } computeConvert(TestConvert.ArgumentsLongUlong args)1561 static public void computeConvert(TestConvert.ArgumentsLongUlong args) { 1562 args.out = convertLongToUlong(args.inV); 1563 } computeConvert(TestConvert.ArgumentsLongHalf args, Target t)1564 static public void computeConvert(TestConvert.ArgumentsLongHalf args, Target t) { 1565 t.setPrecision(1, 1); 1566 args.out = t.newFloaty(convertLongToDouble(args.inV)); 1567 } computeConvert(TestConvert.ArgumentsLongFloat args, Target t)1568 static public void computeConvert(TestConvert.ArgumentsLongFloat args, Target t) { 1569 t.setPrecision(1, 1); 1570 args.out = t.new32(convertLongToFloat(args.inV)); 1571 } computeConvert(TestConvert.ArgumentsLongDouble args, Target t)1572 static public void computeConvert(TestConvert.ArgumentsLongDouble args, Target t) { 1573 t.setPrecision(1, 1); 1574 args.out = t.new64(convertLongToDouble(args.inV)); 1575 } 1576 computeConvert(TestConvert.ArgumentsUlongChar args)1577 static public void computeConvert(TestConvert.ArgumentsUlongChar args) { 1578 args.out = convertUlongToChar(args.inV); 1579 } computeConvert(TestConvert.ArgumentsUlongUchar args)1580 static public void computeConvert(TestConvert.ArgumentsUlongUchar args) { 1581 args.out = convertUlongToUchar(args.inV); 1582 } computeConvert(TestConvert.ArgumentsUlongShort args)1583 static public void computeConvert(TestConvert.ArgumentsUlongShort args) { 1584 args.out = convertUlongToShort(args.inV); 1585 } computeConvert(TestConvert.ArgumentsUlongUshort args)1586 static public void computeConvert(TestConvert.ArgumentsUlongUshort args) { 1587 args.out = convertUlongToUshort(args.inV); 1588 } computeConvert(TestConvert.ArgumentsUlongInt args)1589 static public void computeConvert(TestConvert.ArgumentsUlongInt args) { 1590 args.out = convertUlongToInt(args.inV); 1591 } computeConvert(TestConvert.ArgumentsUlongUint args)1592 static public void computeConvert(TestConvert.ArgumentsUlongUint args) { 1593 args.out = convertUlongToUint(args.inV); 1594 } computeConvert(TestConvert.ArgumentsUlongLong args)1595 static public void computeConvert(TestConvert.ArgumentsUlongLong args) { 1596 args.out = convertUlongToLong(args.inV); 1597 } computeConvert(TestConvert.ArgumentsUlongUlong args)1598 static public void computeConvert(TestConvert.ArgumentsUlongUlong args) { 1599 args.out = convertUlongToUlong(args.inV); 1600 } computeConvert(TestConvert.ArgumentsUlongHalf args, Target t)1601 static public void computeConvert(TestConvert.ArgumentsUlongHalf args, Target t) { 1602 t.setPrecision(1, 1); 1603 args.out = t.newFloaty(convertUlongToDouble(args.inV)); 1604 } computeConvert(TestConvert.ArgumentsUlongFloat args, Target t)1605 static public void computeConvert(TestConvert.ArgumentsUlongFloat args, Target t) { 1606 t.setPrecision(1, 1); 1607 args.out = t.new32(convertUlongToFloat(args.inV)); 1608 } computeConvert(TestConvert.ArgumentsUlongDouble args, Target t)1609 static public void computeConvert(TestConvert.ArgumentsUlongDouble args, Target t) { 1610 t.setPrecision(1, 1); 1611 args.out = t.new64(convertUlongToDouble(args.inV)); 1612 } 1613 computeConvert(TestConvert.ArgumentsHalfChar args)1614 static public void computeConvert(TestConvert.ArgumentsHalfChar args) { 1615 args.out = convertDoubleToChar(args.inVDouble); 1616 } computeConvert(TestConvert.ArgumentsHalfUchar args)1617 static public void computeConvert(TestConvert.ArgumentsHalfUchar args) { 1618 args.out = convertDoubleToUchar(args.inVDouble); 1619 } computeConvert(TestConvert.ArgumentsHalfShort args)1620 static public void computeConvert(TestConvert.ArgumentsHalfShort args) { 1621 args.out = convertDoubleToShort(args.inVDouble); 1622 } computeConvert(TestConvert.ArgumentsHalfUshort args)1623 static public void computeConvert(TestConvert.ArgumentsHalfUshort args) { 1624 args.out = convertDoubleToUshort(args.inVDouble); 1625 } computeConvert(TestConvert.ArgumentsHalfInt args)1626 static public void computeConvert(TestConvert.ArgumentsHalfInt args) { 1627 args.out = convertDoubleToInt(args.inVDouble); 1628 } computeConvert(TestConvert.ArgumentsHalfUint args)1629 static public void computeConvert(TestConvert.ArgumentsHalfUint args) { 1630 args.out = convertDoubleToUint(args.inVDouble); 1631 } computeConvert(TestConvert.ArgumentsHalfLong args)1632 static public void computeConvert(TestConvert.ArgumentsHalfLong args) { 1633 args.out = convertDoubleToLong(args.inVDouble); 1634 } computeConvert(TestConvert.ArgumentsHalfUlong args)1635 static public void computeConvert(TestConvert.ArgumentsHalfUlong args) { 1636 args.out = convertDoubleToUlong(args.inVDouble); 1637 } computeConvert(TestConvert.ArgumentsHalfHalf args, Target t)1638 static public void computeConvert(TestConvert.ArgumentsHalfHalf args, Target t) { 1639 t.setPrecision(0, 0); 1640 args.out = t.newFloaty(args.inVDouble); 1641 } computeConvert(TestConvert.ArgumentsHalfFloat args, Target t)1642 static public void computeConvert(TestConvert.ArgumentsHalfFloat args, Target t) { 1643 t.setPrecision(0, 0); 1644 args.out = t.newFloaty(convertDoubleToFloat(args.inVDouble)); 1645 } computeConvert(TestConvert.ArgumentsHalfDouble args, Target t)1646 static public void computeConvert(TestConvert.ArgumentsHalfDouble args, Target t) { 1647 t.setPrecision(0, 0); 1648 args.out = t.newFloaty(args.inVDouble); 1649 } 1650 computeConvert(TestConvert.ArgumentsFloatChar args)1651 static public void computeConvert(TestConvert.ArgumentsFloatChar args) { 1652 args.out = convertFloatToChar(args.inV); 1653 } computeConvert(TestConvert.ArgumentsFloatUchar args)1654 static public void computeConvert(TestConvert.ArgumentsFloatUchar args) { 1655 args.out = convertFloatToUchar(args.inV); 1656 } computeConvert(TestConvert.ArgumentsFloatShort args)1657 static public void computeConvert(TestConvert.ArgumentsFloatShort args) { 1658 args.out = convertFloatToShort(args.inV); 1659 } computeConvert(TestConvert.ArgumentsFloatUshort args)1660 static public void computeConvert(TestConvert.ArgumentsFloatUshort args) { 1661 args.out = convertFloatToUshort(args.inV); 1662 } computeConvert(TestConvert.ArgumentsFloatInt args)1663 static public void computeConvert(TestConvert.ArgumentsFloatInt args) { 1664 args.out = convertFloatToInt(args.inV); 1665 } computeConvert(TestConvert.ArgumentsFloatUint args)1666 static public void computeConvert(TestConvert.ArgumentsFloatUint args) { 1667 args.out = convertFloatToUint(args.inV); 1668 } computeConvert(TestConvert.ArgumentsFloatLong args)1669 static public void computeConvert(TestConvert.ArgumentsFloatLong args) { 1670 args.out = convertFloatToLong(args.inV); 1671 } computeConvert(TestConvert.ArgumentsFloatUlong args)1672 static public void computeConvert(TestConvert.ArgumentsFloatUlong args) { 1673 args.out = convertFloatToUlong(args.inV); 1674 } computeConvert(TestConvert.ArgumentsFloatHalf args, Target t)1675 static public void computeConvert(TestConvert.ArgumentsFloatHalf args, Target t) { 1676 t.setPrecision(1, 1); 1677 args.out = t.newFloaty(args.inV); 1678 } computeConvert(TestConvert.ArgumentsFloatFloat args, Target t)1679 static public void computeConvert(TestConvert.ArgumentsFloatFloat args, Target t) { 1680 t.setPrecision(0, 0); 1681 args.out = t.new32(convertFloatToFloat(args.inV)); 1682 } computeConvert(TestConvert.ArgumentsFloatDouble args, Target t)1683 static public void computeConvert(TestConvert.ArgumentsFloatDouble args, Target t) { 1684 t.setPrecision(0, 0); 1685 args.out = t.new64(convertFloatToDouble(args.inV)); 1686 } 1687 computeConvert(TestConvert.ArgumentsDoubleChar args)1688 static public void computeConvert(TestConvert.ArgumentsDoubleChar args) { 1689 args.out = convertDoubleToChar(args.inV); 1690 } computeConvert(TestConvert.ArgumentsDoubleUchar args)1691 static public void computeConvert(TestConvert.ArgumentsDoubleUchar args) { 1692 args.out = convertDoubleToUchar(args.inV); 1693 } computeConvert(TestConvert.ArgumentsDoubleShort args)1694 static public void computeConvert(TestConvert.ArgumentsDoubleShort args) { 1695 args.out = convertDoubleToShort(args.inV); 1696 } computeConvert(TestConvert.ArgumentsDoubleUshort args)1697 static public void computeConvert(TestConvert.ArgumentsDoubleUshort args) { 1698 args.out = convertDoubleToUshort(args.inV); 1699 } computeConvert(TestConvert.ArgumentsDoubleInt args)1700