-#if 0
- pass = LLVMCreatePassManager();
- LLVMAddTargetData(LLVMGetExecutionEngineTargetData(lp_build_engine), pass);
- /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
- * but there are more on SVN. */
- LLVMAddConstantPropagationPass(pass);
- LLVMAddInstructionCombiningPass(pass);
- LLVMAddPromoteMemoryToRegisterPass(pass);
- LLVMAddGVNPass(pass);
- LLVMAddCFGSimplificationPass(pass);
- LLVMRunPassManager(pass, lp_build_module);
-#else
- (void)pass;
-#endif
-
- fetch_ptr = (fetch_ptr_t) LLVMGetPointerToGlobal(lp_build_engine, fetch);
-
- memset(unpacked, 0, sizeof unpacked);
-
- fetch_ptr(unpacked, test->packed, 0, 0);
-
- success = TRUE;
- for(i = 0; i < 4; ++i)
- if (fabs((float)test->unpacked[0][0][i] - unpacked[i]) > FLT_EPSILON)
- success = FALSE;
-
- if (!success) {
- printf("FAILED\n");
- printf(" Packed: %02x %02x %02x %02x\n",
- test->packed[0], test->packed[1], test->packed[2], test->packed[3]);
- printf(" Unpacked: %f %f %f %f obtained\n",
- unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
- printf(" %f %f %f %f expected\n",
- test->unpacked[0][0][0],
- test->unpacked[0][0][1],
- test->unpacked[0][0][2],
- test->unpacked[0][0][3]);
- LLVMDumpValue(fetch);
+ if (test->format == desc->format) {
+
+ if (first) {
+ printf("Testing %s (float) ...\n",
+ desc->name);
+ first = FALSE;
+ }
+
+ for (i = 0; i < desc->block.height; ++i) {
+ for (j = 0; j < desc->block.width; ++j) {
+ boolean match = TRUE;
+
+ memset(unpacked, 0, sizeof unpacked);
+
+ fetch_ptr(unpacked, test->packed, j, i);
+
+ for(k = 0; k < 4; ++k) {
+ if (util_double_inf_sign(test->unpacked[i][j][k]) != util_inf_sign(unpacked[k])) {
+ match = FALSE;
+ }
+
+ if (util_is_double_nan(test->unpacked[i][j][k]) != util_is_nan(unpacked[k])) {
+ match = FALSE;
+ }
+
+ if (!util_is_double_inf_or_nan(test->unpacked[i][j][k]) &&
+ fabs((float)test->unpacked[i][j][k] - unpacked[k]) > FLT_EPSILON) {
+ match = FALSE;
+ }
+ }
+
+ if (!match) {
+ printf("FAILED\n");
+ printf(" Packed: %02x %02x %02x %02x\n",
+ test->packed[0], test->packed[1], test->packed[2], test->packed[3]);
+ printf(" Unpacked (%u,%u): %.9g %.9g %.9g %.9g obtained\n",
+ j, i,
+ unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
+ printf(" %.9g %.9g %.9g %.9g expected\n",
+ test->unpacked[i][j][0],
+ test->unpacked[i][j][1],
+ test->unpacked[i][j][2],
+ test->unpacked[i][j][3]);
+ success = FALSE;
+ }
+ }
+ }
+ }