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 // Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime. 18 19 package android.renderscript.cts; 20 21 import android.renderscript.Allocation; 22 import android.renderscript.RSRuntimeException; 23 import android.renderscript.Element; 24 25 public class TestFmin extends RSBaseCompute { 26 27 private ScriptC_TestFmin script; 28 private ScriptC_TestFminRelaxed scriptRelaxed; 29 30 @Override 31 protected void setUp() throws Exception { 32 super.setUp(); 33 script = new ScriptC_TestFmin(mRS); 34 scriptRelaxed = new ScriptC_TestFminRelaxed(mRS); 35 } 36 37 public class ArgumentsFloatFloatFloat { 38 public float inX; 39 public float inY; 40 public Target.Floaty out; 41 } 42 43 private void checkFminFloatFloatFloat() { 44 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7b46a8451d7b106fl, false); 45 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7b46a8451d7b1070l, false); 46 try { 47 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE); 48 script.set_gAllocInY(inY); 49 script.forEach_testFminFloatFloatFloat(inX, out); 50 verifyResultsFminFloatFloatFloat(inX, inY, out, false); 51 } catch (Exception e) { 52 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloatFloatFloat: " + e.toString()); 53 } 54 try { 55 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE); 56 scriptRelaxed.set_gAllocInY(inY); 57 scriptRelaxed.forEach_testFminFloatFloatFloat(inX, out); 58 verifyResultsFminFloatFloatFloat(inX, inY, out, true); 59 } catch (Exception e) { 60 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloatFloatFloat: " + e.toString()); 61 } 62 } 63 64 private void verifyResultsFminFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 65 float[] arrayInX = new float[INPUTSIZE * 1]; 66 inX.copyTo(arrayInX); 67 float[] arrayInY = new float[INPUTSIZE * 1]; 68 inY.copyTo(arrayInY); 69 float[] arrayOut = new float[INPUTSIZE * 1]; 70 out.copyTo(arrayOut); 71 for (int i = 0; i < INPUTSIZE; i++) { 72 for (int j = 0; j < 1 ; j++) { 73 // Extract the inputs. 74 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 75 args.inX = arrayInX[i]; 76 args.inY = arrayInY[i]; 77 // Figure out what the outputs should have been. 78 Target target = new Target(relaxed); 79 CoreMathVerifier.computeFmin(args, target); 80 // Validate the outputs. 81 boolean valid = true; 82 if (!args.out.couldBe(arrayOut[i * 1 + j])) { 83 valid = false; 84 } 85 if (!valid) { 86 StringBuilder message = new StringBuilder(); 87 message.append("Input inX: "); 88 message.append(String.format("%14.8g {%8x} %15a", 89 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 90 message.append("\n"); 91 message.append("Input inY: "); 92 message.append(String.format("%14.8g {%8x} %15a", 93 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 94 message.append("\n"); 95 message.append("Expected output out: "); 96 message.append(args.out.toString()); 97 message.append("\n"); 98 message.append("Actual output out: "); 99 message.append(String.format("%14.8g {%8x} %15a", 100 arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j])); 101 if (!args.out.couldBe(arrayOut[i * 1 + j])) { 102 message.append(" FAIL"); 103 } 104 message.append("\n"); 105 assertTrue("Incorrect output for checkFminFloatFloatFloat" + 106 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 107 } 108 } 109 } 110 } 111 112 private void checkFminFloat2Float2Float2() { 113 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x12b850a9e75faa59l, false); 114 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x12b850a9e75faa5al, false); 115 try { 116 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 117 script.set_gAllocInY(inY); 118 script.forEach_testFminFloat2Float2Float2(inX, out); 119 verifyResultsFminFloat2Float2Float2(inX, inY, out, false); 120 } catch (Exception e) { 121 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2Float2Float2: " + e.toString()); 122 } 123 try { 124 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 125 scriptRelaxed.set_gAllocInY(inY); 126 scriptRelaxed.forEach_testFminFloat2Float2Float2(inX, out); 127 verifyResultsFminFloat2Float2Float2(inX, inY, out, true); 128 } catch (Exception e) { 129 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2Float2Float2: " + e.toString()); 130 } 131 } 132 133 private void verifyResultsFminFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 134 float[] arrayInX = new float[INPUTSIZE * 2]; 135 inX.copyTo(arrayInX); 136 float[] arrayInY = new float[INPUTSIZE * 2]; 137 inY.copyTo(arrayInY); 138 float[] arrayOut = new float[INPUTSIZE * 2]; 139 out.copyTo(arrayOut); 140 for (int i = 0; i < INPUTSIZE; i++) { 141 for (int j = 0; j < 2 ; j++) { 142 // Extract the inputs. 143 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 144 args.inX = arrayInX[i * 2 + j]; 145 args.inY = arrayInY[i * 2 + j]; 146 // Figure out what the outputs should have been. 147 Target target = new Target(relaxed); 148 CoreMathVerifier.computeFmin(args, target); 149 // Validate the outputs. 150 boolean valid = true; 151 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 152 valid = false; 153 } 154 if (!valid) { 155 StringBuilder message = new StringBuilder(); 156 message.append("Input inX: "); 157 message.append(String.format("%14.8g {%8x} %15a", 158 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 159 message.append("\n"); 160 message.append("Input inY: "); 161 message.append(String.format("%14.8g {%8x} %15a", 162 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 163 message.append("\n"); 164 message.append("Expected output out: "); 165 message.append(args.out.toString()); 166 message.append("\n"); 167 message.append("Actual output out: "); 168 message.append(String.format("%14.8g {%8x} %15a", 169 arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j])); 170 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 171 message.append(" FAIL"); 172 } 173 message.append("\n"); 174 assertTrue("Incorrect output for checkFminFloat2Float2Float2" + 175 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 176 } 177 } 178 } 179 } 180 181 private void checkFminFloat3Float3Float3() { 182 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x671d2ec9e93dabfal, false); 183 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x671d2ec9e93dabfbl, false); 184 try { 185 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 186 script.set_gAllocInY(inY); 187 script.forEach_testFminFloat3Float3Float3(inX, out); 188 verifyResultsFminFloat3Float3Float3(inX, inY, out, false); 189 } catch (Exception e) { 190 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3Float3Float3: " + e.toString()); 191 } 192 try { 193 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 194 scriptRelaxed.set_gAllocInY(inY); 195 scriptRelaxed.forEach_testFminFloat3Float3Float3(inX, out); 196 verifyResultsFminFloat3Float3Float3(inX, inY, out, true); 197 } catch (Exception e) { 198 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3Float3Float3: " + e.toString()); 199 } 200 } 201 202 private void verifyResultsFminFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 203 float[] arrayInX = new float[INPUTSIZE * 4]; 204 inX.copyTo(arrayInX); 205 float[] arrayInY = new float[INPUTSIZE * 4]; 206 inY.copyTo(arrayInY); 207 float[] arrayOut = new float[INPUTSIZE * 4]; 208 out.copyTo(arrayOut); 209 for (int i = 0; i < INPUTSIZE; i++) { 210 for (int j = 0; j < 3 ; j++) { 211 // Extract the inputs. 212 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 213 args.inX = arrayInX[i * 4 + j]; 214 args.inY = arrayInY[i * 4 + j]; 215 // Figure out what the outputs should have been. 216 Target target = new Target(relaxed); 217 CoreMathVerifier.computeFmin(args, target); 218 // Validate the outputs. 219 boolean valid = true; 220 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 221 valid = false; 222 } 223 if (!valid) { 224 StringBuilder message = new StringBuilder(); 225 message.append("Input inX: "); 226 message.append(String.format("%14.8g {%8x} %15a", 227 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 228 message.append("\n"); 229 message.append("Input inY: "); 230 message.append(String.format("%14.8g {%8x} %15a", 231 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 232 message.append("\n"); 233 message.append("Expected output out: "); 234 message.append(args.out.toString()); 235 message.append("\n"); 236 message.append("Actual output out: "); 237 message.append(String.format("%14.8g {%8x} %15a", 238 arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j])); 239 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 240 message.append(" FAIL"); 241 } 242 message.append("\n"); 243 assertTrue("Incorrect output for checkFminFloat3Float3Float3" + 244 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 245 } 246 } 247 } 248 } 249 250 private void checkFminFloat4Float4Float4() { 251 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbb820ce9eb1bad9bl, false); 252 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbb820ce9eb1bad9cl, false); 253 try { 254 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 255 script.set_gAllocInY(inY); 256 script.forEach_testFminFloat4Float4Float4(inX, out); 257 verifyResultsFminFloat4Float4Float4(inX, inY, out, false); 258 } catch (Exception e) { 259 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4Float4Float4: " + e.toString()); 260 } 261 try { 262 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 263 scriptRelaxed.set_gAllocInY(inY); 264 scriptRelaxed.forEach_testFminFloat4Float4Float4(inX, out); 265 verifyResultsFminFloat4Float4Float4(inX, inY, out, true); 266 } catch (Exception e) { 267 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4Float4Float4: " + e.toString()); 268 } 269 } 270 271 private void verifyResultsFminFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 272 float[] arrayInX = new float[INPUTSIZE * 4]; 273 inX.copyTo(arrayInX); 274 float[] arrayInY = new float[INPUTSIZE * 4]; 275 inY.copyTo(arrayInY); 276 float[] arrayOut = new float[INPUTSIZE * 4]; 277 out.copyTo(arrayOut); 278 for (int i = 0; i < INPUTSIZE; i++) { 279 for (int j = 0; j < 4 ; j++) { 280 // Extract the inputs. 281 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 282 args.inX = arrayInX[i * 4 + j]; 283 args.inY = arrayInY[i * 4 + j]; 284 // Figure out what the outputs should have been. 285 Target target = new Target(relaxed); 286 CoreMathVerifier.computeFmin(args, target); 287 // Validate the outputs. 288 boolean valid = true; 289 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 290 valid = false; 291 } 292 if (!valid) { 293 StringBuilder message = new StringBuilder(); 294 message.append("Input inX: "); 295 message.append(String.format("%14.8g {%8x} %15a", 296 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 297 message.append("\n"); 298 message.append("Input inY: "); 299 message.append(String.format("%14.8g {%8x} %15a", 300 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 301 message.append("\n"); 302 message.append("Expected output out: "); 303 message.append(args.out.toString()); 304 message.append("\n"); 305 message.append("Actual output out: "); 306 message.append(String.format("%14.8g {%8x} %15a", 307 arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j])); 308 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 309 message.append(" FAIL"); 310 } 311 message.append("\n"); 312 assertTrue("Incorrect output for checkFminFloat4Float4Float4" + 313 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 314 } 315 } 316 } 317 } 318 319 private void checkFminFloat2FloatFloat2() { 320 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x4dd5869724457687l, false); 321 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4dd5869724457688l, false); 322 try { 323 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 324 script.set_gAllocInY(inY); 325 script.forEach_testFminFloat2FloatFloat2(inX, out); 326 verifyResultsFminFloat2FloatFloat2(inX, inY, out, false); 327 } catch (Exception e) { 328 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2FloatFloat2: " + e.toString()); 329 } 330 try { 331 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 332 scriptRelaxed.set_gAllocInY(inY); 333 scriptRelaxed.forEach_testFminFloat2FloatFloat2(inX, out); 334 verifyResultsFminFloat2FloatFloat2(inX, inY, out, true); 335 } catch (Exception e) { 336 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2FloatFloat2: " + e.toString()); 337 } 338 } 339 340 private void verifyResultsFminFloat2FloatFloat2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 341 float[] arrayInX = new float[INPUTSIZE * 2]; 342 inX.copyTo(arrayInX); 343 float[] arrayInY = new float[INPUTSIZE * 1]; 344 inY.copyTo(arrayInY); 345 float[] arrayOut = new float[INPUTSIZE * 2]; 346 out.copyTo(arrayOut); 347 for (int i = 0; i < INPUTSIZE; i++) { 348 for (int j = 0; j < 2 ; j++) { 349 // Extract the inputs. 350 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 351 args.inX = arrayInX[i * 2 + j]; 352 args.inY = arrayInY[i]; 353 // Figure out what the outputs should have been. 354 Target target = new Target(relaxed); 355 CoreMathVerifier.computeFmin(args, target); 356 // Validate the outputs. 357 boolean valid = true; 358 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 359 valid = false; 360 } 361 if (!valid) { 362 StringBuilder message = new StringBuilder(); 363 message.append("Input inX: "); 364 message.append(String.format("%14.8g {%8x} %15a", 365 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 366 message.append("\n"); 367 message.append("Input inY: "); 368 message.append(String.format("%14.8g {%8x} %15a", 369 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 370 message.append("\n"); 371 message.append("Expected output out: "); 372 message.append(args.out.toString()); 373 message.append("\n"); 374 message.append("Actual output out: "); 375 message.append(String.format("%14.8g {%8x} %15a", 376 arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j])); 377 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 378 message.append(" FAIL"); 379 } 380 message.append("\n"); 381 assertTrue("Incorrect output for checkFminFloat2FloatFloat2" + 382 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 383 } 384 } 385 } 386 } 387 388 private void checkFminFloat3FloatFloat3() { 389 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xa32539af12b06ae3l, false); 390 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa32539af12b06ae4l, false); 391 try { 392 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 393 script.set_gAllocInY(inY); 394 script.forEach_testFminFloat3FloatFloat3(inX, out); 395 verifyResultsFminFloat3FloatFloat3(inX, inY, out, false); 396 } catch (Exception e) { 397 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3FloatFloat3: " + e.toString()); 398 } 399 try { 400 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 401 scriptRelaxed.set_gAllocInY(inY); 402 scriptRelaxed.forEach_testFminFloat3FloatFloat3(inX, out); 403 verifyResultsFminFloat3FloatFloat3(inX, inY, out, true); 404 } catch (Exception e) { 405 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3FloatFloat3: " + e.toString()); 406 } 407 } 408 409 private void verifyResultsFminFloat3FloatFloat3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 410 float[] arrayInX = new float[INPUTSIZE * 4]; 411 inX.copyTo(arrayInX); 412 float[] arrayInY = new float[INPUTSIZE * 1]; 413 inY.copyTo(arrayInY); 414 float[] arrayOut = new float[INPUTSIZE * 4]; 415 out.copyTo(arrayOut); 416 for (int i = 0; i < INPUTSIZE; i++) { 417 for (int j = 0; j < 3 ; j++) { 418 // Extract the inputs. 419 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 420 args.inX = arrayInX[i * 4 + j]; 421 args.inY = arrayInY[i]; 422 // Figure out what the outputs should have been. 423 Target target = new Target(relaxed); 424 CoreMathVerifier.computeFmin(args, target); 425 // Validate the outputs. 426 boolean valid = true; 427 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 428 valid = false; 429 } 430 if (!valid) { 431 StringBuilder message = new StringBuilder(); 432 message.append("Input inX: "); 433 message.append(String.format("%14.8g {%8x} %15a", 434 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 435 message.append("\n"); 436 message.append("Input inY: "); 437 message.append(String.format("%14.8g {%8x} %15a", 438 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 439 message.append("\n"); 440 message.append("Expected output out: "); 441 message.append(args.out.toString()); 442 message.append("\n"); 443 message.append("Actual output out: "); 444 message.append(String.format("%14.8g {%8x} %15a", 445 arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j])); 446 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 447 message.append(" FAIL"); 448 } 449 message.append("\n"); 450 assertTrue("Incorrect output for checkFminFloat3FloatFloat3" + 451 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 452 } 453 } 454 } 455 } 456 457 private void checkFminFloat4FloatFloat4() { 458 Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf874ecc7011b5f3fl, false); 459 Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf874ecc7011b5f40l, false); 460 try { 461 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 462 script.set_gAllocInY(inY); 463 script.forEach_testFminFloat4FloatFloat4(inX, out); 464 verifyResultsFminFloat4FloatFloat4(inX, inY, out, false); 465 } catch (Exception e) { 466 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4FloatFloat4: " + e.toString()); 467 } 468 try { 469 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 470 scriptRelaxed.set_gAllocInY(inY); 471 scriptRelaxed.forEach_testFminFloat4FloatFloat4(inX, out); 472 verifyResultsFminFloat4FloatFloat4(inX, inY, out, true); 473 } catch (Exception e) { 474 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4FloatFloat4: " + e.toString()); 475 } 476 } 477 478 private void verifyResultsFminFloat4FloatFloat4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) { 479 float[] arrayInX = new float[INPUTSIZE * 4]; 480 inX.copyTo(arrayInX); 481 float[] arrayInY = new float[INPUTSIZE * 1]; 482 inY.copyTo(arrayInY); 483 float[] arrayOut = new float[INPUTSIZE * 4]; 484 out.copyTo(arrayOut); 485 for (int i = 0; i < INPUTSIZE; i++) { 486 for (int j = 0; j < 4 ; j++) { 487 // Extract the inputs. 488 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat(); 489 args.inX = arrayInX[i * 4 + j]; 490 args.inY = arrayInY[i]; 491 // Figure out what the outputs should have been. 492 Target target = new Target(relaxed); 493 CoreMathVerifier.computeFmin(args, target); 494 // Validate the outputs. 495 boolean valid = true; 496 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 497 valid = false; 498 } 499 if (!valid) { 500 StringBuilder message = new StringBuilder(); 501 message.append("Input inX: "); 502 message.append(String.format("%14.8g {%8x} %15a", 503 args.inX, Float.floatToRawIntBits(args.inX), args.inX)); 504 message.append("\n"); 505 message.append("Input inY: "); 506 message.append(String.format("%14.8g {%8x} %15a", 507 args.inY, Float.floatToRawIntBits(args.inY), args.inY)); 508 message.append("\n"); 509 message.append("Expected output out: "); 510 message.append(args.out.toString()); 511 message.append("\n"); 512 message.append("Actual output out: "); 513 message.append(String.format("%14.8g {%8x} %15a", 514 arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j])); 515 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 516 message.append(" FAIL"); 517 } 518 message.append("\n"); 519 assertTrue("Incorrect output for checkFminFloat4FloatFloat4" + 520 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid); 521 } 522 } 523 } 524 } 525 526 public void testFmin() { 527 checkFminFloatFloatFloat(); 528 checkFminFloat2Float2Float2(); 529 checkFminFloat3Float3Float3(); 530 checkFminFloat4Float4Float4(); 531 checkFminFloat2FloatFloat2(); 532 checkFminFloat3FloatFloat3(); 533 checkFminFloat4FloatFloat4(); 534 } 535 } 536