Index: trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp
===================================================================
--- trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp	(revision 103048)
+++ trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp	(revision 103049)
@@ -145,4 +145,23 @@
 #define COUNT_VARIATIONS(a_SubTest) \
         (1 + ((a_SubTest).idxCpuEflFlavour == g_idxCpuEflFlavour && (a_SubTest).pfnNative) )
+
+
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
+typedef struct IEMBINARYOUTPUT
+{
+    /** The output file. */
+    RTVFSFILE       hVfsFile;
+    /** The stream we write uncompressed binary test data to. */
+    RTVFSIOSTREAM   hVfsUncompressed;
+    /** Write status. */
+    int             rcWrite;
+    /** Set if NULL. */
+    bool            fNull;
+    /** Filename.   */
+    char            szFilename[79];
+} IEMBINARYOUTPUT;
+typedef IEMBINARYOUTPUT *PIEMBINARYOUTPUT;
 
 
@@ -980,4 +999,95 @@
                  pszName, pszName);
 }
+
+
+static bool GenerateBinaryOpen(PIEMBINARYOUTPUT pBinOut, const char *pszFilenameFmt, const char *pszName,
+                               const char *pszCpuType = NULL)
+{
+    pBinOut->hVfsFile         = NIL_RTVFSFILE;
+    pBinOut->hVfsUncompressed = NIL_RTVFSIOSTREAM;
+    if (pszFilenameFmt)
+    {
+        pBinOut->fNull = false;
+        if (RTStrPrintf2(pBinOut->szFilename, sizeof(pBinOut->szFilename), pszFilenameFmt, pszName, pszCpuType) > 0)
+        {
+            RTMsgInfo("GenerateBinaryOpen: %s...\n", pBinOut->szFilename);
+            pBinOut->rcWrite = RTVfsFileOpenNormal(pBinOut->szFilename,
+                                                   RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_READWRITE,
+                                                   &pBinOut->hVfsFile);
+            if (RT_SUCCESS(pBinOut->rcWrite))
+            {
+                RTVFSIOSTREAM hVfsIoFile = RTVfsFileToIoStream(pBinOut->hVfsFile);
+                if (hVfsIoFile != NIL_RTVFSIOSTREAM)
+                {
+                    pBinOut->rcWrite = RTZipGzipCompressIoStream(hVfsIoFile, 0 /*fFlags*/, 9, &pBinOut->hVfsUncompressed);
+                    RTVfsIoStrmRelease(hVfsIoFile);
+                    if (RT_SUCCESS(pBinOut->rcWrite))
+                    {
+                        pBinOut->rcWrite = VINF_SUCCESS;
+                        return true;
+                    }
+
+                    RTMsgError("RTZipGzipCompressIoStream: %Rrc", pBinOut->rcWrite);
+                }
+                else
+                {
+                    RTMsgError("RTVfsFileToIoStream failed!");
+                    pBinOut->rcWrite = VERR_VFS_CHAIN_CAST_FAILED;
+                }
+                RTVfsFileRelease(pBinOut->hVfsFile);
+                RTFileDelete(pBinOut->szFilename);
+            }
+            else
+                RTMsgError("Failed to open '%s' for writing: %Rrc", pBinOut->szFilename, pBinOut->rcWrite);
+        }
+        else
+        {
+            RTMsgError("filename too long: %s + %s + %s", pszFilenameFmt, pszName, pszCpuType);
+            pBinOut->rcWrite = VERR_BUFFER_OVERFLOW;
+        }
+        return false;
+    }
+    RTMsgInfo("GenerateBinaryOpen: %s -> /dev/null\n", pszName);
+    pBinOut->rcWrite       = VERR_IGNORED;
+    pBinOut->fNull         = true;
+    pBinOut->szFilename[0] = '\0';
+    return true;
+}
+
+
+static void GenerateBinaryWrite(PIEMBINARYOUTPUT pBinOut, const void *pvData, size_t cbData)
+{
+    if (RT_SUCCESS_NP(pBinOut->rcWrite))
+    {
+        pBinOut->rcWrite = RTVfsIoStrmWrite(pBinOut->hVfsUncompressed, pvData, cbData, true /*fBlocking*/, NULL);
+        if (RT_SUCCESS(pBinOut->rcWrite))
+            return;
+        RTMsgError("Error writing '%s': %Rrc", pBinOut->szFilename, pBinOut->rcWrite);
+    }
+}
+
+
+static bool GenerateBinaryClose(PIEMBINARYOUTPUT pBinOut)
+{
+    if (!pBinOut->fNull)
+    {
+        /* This is rather jovial about rcWrite. */
+        int const rc1 = RTVfsIoStrmFlush(pBinOut->hVfsUncompressed);
+        RTVfsIoStrmRelease(pBinOut->hVfsUncompressed);
+        pBinOut->hVfsUncompressed = NIL_RTVFSIOSTREAM;
+        if (RT_FAILURE(rc1))
+            RTMsgError("Error flushing '%s' (uncompressed stream): %Rrc", pBinOut->szFilename, rc1);
+
+        int const rc2 = RTVfsFileFlush(pBinOut->hVfsFile);
+        RTVfsFileRelease(pBinOut->hVfsFile);
+        pBinOut->hVfsFile = NIL_RTVFSFILE;
+        if (RT_FAILURE(rc2))
+            RTMsgError("Error flushing '%s' (compressed file): %Rrc", pBinOut->szFilename, rc2);
+
+        return RT_SUCCESS(rc2) && RT_SUCCESS(rc1) && RT_SUCCESS(pBinOut->rcWrite);
+    }
+    return true;
+}
+
 
 #endif /* TSTIEMAIMPL_WITH_GENERATOR */
@@ -4804,11 +4914,6 @@
         PFNIEMAIMPLFPSSEF2U128 const pfn = g_aSseBinaryR32[iFn].pfnNative ? g_aSseBinaryR32[iFn].pfnNative : g_aSseBinaryR32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryR32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryR32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryR32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -4853,5 +4958,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -4861,5 +4966,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -4872,5 +4977,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -4883,5 +4988,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -4895,15 +5000,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryR32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -5003,11 +5103,6 @@
         PFNIEMAIMPLFPSSEF2U128 const pfn = g_aSseBinaryR64[iFn].pfnNative ? g_aSseBinaryR64[iFn].pfnNative : g_aSseBinaryR64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryR64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryR64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryR64[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -5045,5 +5140,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -5053,5 +5148,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -5064,5 +5159,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -5075,5 +5170,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -5087,15 +5182,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryR64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -5187,11 +5277,6 @@
         PFNIEMAIMPLFPSSEF2U128R32 const pfn = g_aSseBinaryU128R32[iFn].pfnNative ? g_aSseBinaryU128R32[iFn].pfnNative : g_aSseBinaryU128R32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryU128R32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryU128R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryU128R32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -5234,5 +5319,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -5242,5 +5327,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -5253,5 +5338,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -5264,5 +5349,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -5276,15 +5361,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryU128R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -5378,11 +5458,6 @@
         PFNIEMAIMPLFPSSEF2U128R64 const pfn = g_aSseBinaryU128R64[iFn].pfnNative ? g_aSseBinaryU128R64[iFn].pfnNative : g_aSseBinaryU128R64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryU128R64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryU128R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryU128R64[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -5419,5 +5494,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -5427,5 +5502,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -5438,5 +5513,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -5449,5 +5524,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -5461,15 +5536,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryU128R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -5554,11 +5624,6 @@
         PFNIEMAIMPLSSEF2I32U64 const pfn = g_aSseBinaryI32R64[iFn].pfnNative ? g_aSseBinaryI32R64[iFn].pfnNative : g_aSseBinaryI32R64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryI32R64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryI32R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryI32R64[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -5592,5 +5657,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.i32ValOut = i32OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -5600,5 +5665,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.i32ValOut = i32OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -5611,5 +5676,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.i32ValOut = i32Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -5622,5 +5687,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.i32ValOut = i32Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -5634,15 +5699,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.i32ValOut = i32Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryI32R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -5723,11 +5783,6 @@
         PFNIEMAIMPLSSEF2I64U64 const pfn = g_aSseBinaryI64R64[iFn].pfnNative ? g_aSseBinaryI64R64[iFn].pfnNative : g_aSseBinaryI64R64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryI64R64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryI64R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryI64R64[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -5761,5 +5816,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.i64ValOut = i64OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -5769,5 +5824,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.i64ValOut = i64OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -5780,5 +5835,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.i64ValOut = i64Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -5791,5 +5846,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.i64ValOut = i64Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -5803,15 +5858,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.i64ValOut = i64Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryI64R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -5892,11 +5942,6 @@
         PFNIEMAIMPLSSEF2I32U32 const pfn = g_aSseBinaryI32R32[iFn].pfnNative ? g_aSseBinaryI32R32[iFn].pfnNative : g_aSseBinaryI32R32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryI32R32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryI32R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryI32R32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -5930,5 +5975,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.i32ValOut = i32OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -5938,5 +5983,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.i32ValOut = i32OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -5949,5 +5994,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.i32ValOut = i32Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -5960,5 +6005,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.i32ValOut = i32Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -5972,15 +6017,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.i32ValOut = i32Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryI32R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -6061,11 +6101,6 @@
         PFNIEMAIMPLSSEF2I64U32 const pfn = g_aSseBinaryI64R32[iFn].pfnNative ? g_aSseBinaryI64R32[iFn].pfnNative : g_aSseBinaryI64R32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryI64R32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryI64R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryI64R32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -6099,5 +6134,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.i64ValOut = i64OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -6107,5 +6142,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.i64ValOut = i64OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -6118,5 +6153,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.i64ValOut = i64Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -6129,5 +6164,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.i64ValOut = i64Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -6141,15 +6176,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.i64ValOut = i64Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryI64R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -6229,11 +6259,6 @@
         PFNIEMAIMPLSSEF2R64I32 const pfn = g_aSseBinaryR64I32[iFn].pfnNative ? g_aSseBinaryR64I32[iFn].pfnNative : g_aSseBinaryR64I32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryR64I32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryR64I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryR64I32[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -6258,5 +6283,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.r64ValOut = r64OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -6266,5 +6291,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.r64ValOut = r64OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -6277,5 +6302,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.r64ValOut = r64Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -6288,5 +6313,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.r64ValOut = r64Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -6300,15 +6325,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.r64ValOut = r64Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryR64I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -6388,11 +6408,6 @@
         PFNIEMAIMPLSSEF2R64I64 const pfn = g_aSseBinaryR64I64[iFn].pfnNative ? g_aSseBinaryR64I64[iFn].pfnNative : g_aSseBinaryR64I64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryR64I64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryR64I64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryR64I64[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -6417,5 +6432,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.r64ValOut = r64OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -6425,5 +6440,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.r64ValOut = r64OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -6436,5 +6451,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.r64ValOut = r64Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -6447,5 +6462,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.r64ValOut = r64Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -6459,15 +6474,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.r64ValOut = r64Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryR64I64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -6547,11 +6557,6 @@
         PFNIEMAIMPLSSEF2R32I32 const pfn = g_aSseBinaryR32I32[iFn].pfnNative ? g_aSseBinaryR32I32[iFn].pfnNative : g_aSseBinaryR32I32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryR32I32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryR32I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryR32I32[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -6576,5 +6581,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.r32ValOut = r32OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -6584,5 +6589,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.r32ValOut = r32OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -6595,5 +6600,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.r32ValOut = r32Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -6606,5 +6611,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.r32ValOut = r32Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -6618,15 +6623,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.r32ValOut = r32Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryR32I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -6706,11 +6706,6 @@
         PFNIEMAIMPLSSEF2R32I64 const pfn = g_aSseBinaryR32I64[iFn].pfnNative ? g_aSseBinaryR32I64[iFn].pfnNative : g_aSseBinaryR32I64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseBinaryR32I64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseBinaryR32I64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseBinaryR32I64[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -6735,5 +6730,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.r32ValOut = r32OutM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -6743,5 +6738,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.r32ValOut = r32OutU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -6754,5 +6749,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.r32ValOut = r32Out1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -6765,5 +6760,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.r32ValOut = r32Out2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -6777,15 +6772,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.r32ValOut = r32Out3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseBinaryR32I64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -6873,11 +6863,6 @@
         PFNIEMAIMPLF2EFLMXCSR128 const pfn = g_aSseCompareEflR32R32[iFn].pfnNative ? g_aSseCompareEflR32R32[iFn].pfnNative : g_aSseCompareEflR32R32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseCompareEflR32R32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseCompareEflR32R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseCompareEflR32R32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -6921,5 +6906,5 @@
                         TestData.fEflIn     = fEFlags;
                         TestData.fEflOut    = fEFlagsM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -6931,5 +6916,5 @@
                         TestData.fEflIn     = fEFlags;
                         TestData.fEflOut    = fEFlagsU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -6944,5 +6929,5 @@
                             TestData.fEflIn     = fEFlags;
                             TestData.fEflOut    = fEFlags1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -6957,5 +6942,5 @@
                                 TestData.fEflIn     = fEFlags;
                                 TestData.fEflOut    = fEFlags2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -6971,15 +6956,10 @@
                                         TestData.fEflIn     = fEFlags;
                                         TestData.fEflOut    = fEFlags3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseCompareEflR32R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -7066,11 +7046,6 @@
         PFNIEMAIMPLF2EFLMXCSR128 const pfn = g_aSseCompareEflR64R64[iFn].pfnNative ? g_aSseCompareEflR64R64[iFn].pfnNative : g_aSseCompareEflR64R64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseCompareEflR64R64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseCompareEflR64R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseCompareEflR64R64[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -7114,5 +7089,5 @@
                         TestData.fEflIn     = fEFlags;
                         TestData.fEflOut    = fEFlagsM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -7124,5 +7099,5 @@
                         TestData.fEflIn     = fEFlags;
                         TestData.fEflOut    = fEFlagsU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -7137,5 +7112,5 @@
                             TestData.fEflIn     = fEFlags;
                             TestData.fEflOut    = fEFlags1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -7150,5 +7125,5 @@
                                 TestData.fEflIn     = fEFlags;
                                 TestData.fEflOut    = fEFlags2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -7164,15 +7139,10 @@
                                         TestData.fEflIn     = fEFlags;
                                         TestData.fEflOut    = fEFlags3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseCompareEflR64R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -7260,11 +7230,6 @@
         PFNIEMAIMPLMXCSRF2XMMIMM8 const pfn = g_aSseCompareF2XmmR32Imm8[iFn].pfnNative ? g_aSseCompareF2XmmR32Imm8[iFn].pfnNative : g_aSseCompareF2XmmR32Imm8[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseCompareF2XmmR32Imm8[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseCompareF2XmmR32Imm8[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseCompareF2XmmR32Imm8[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -7319,5 +7284,5 @@
                             TestData.bImm       = bImm;
                             TestData.OutVal     = ResM;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -7329,5 +7294,5 @@
                             TestData.bImm       = bImm;
                             TestData.OutVal     = ResU;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -7342,5 +7307,5 @@
                                 TestData.bImm       = bImm;
                                 TestData.OutVal     = Res1;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                                 if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -7355,5 +7320,5 @@
                                     TestData.bImm       = bImm;
                                     TestData.OutVal     = Res2;
-                                    RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                    GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                 }
                                 if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -7369,15 +7334,10 @@
                                             TestData.bImm       = bImm;
                                             TestData.OutVal     = Res3;
-                                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                         }
                             }
                         }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseCompareF2XmmR32Imm8[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -7472,11 +7432,6 @@
         PFNIEMAIMPLMXCSRF2XMMIMM8 const pfn = g_aSseCompareF2XmmR64Imm8[iFn].pfnNative ? g_aSseCompareF2XmmR64Imm8[iFn].pfnNative : g_aSseCompareF2XmmR64Imm8[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseCompareF2XmmR64Imm8[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseCompareF2XmmR64Imm8[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseCompareF2XmmR64Imm8[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -7523,5 +7478,5 @@
                             TestData.bImm       = bImm;
                             TestData.OutVal     = ResM;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -7533,5 +7488,5 @@
                             TestData.bImm       = bImm;
                             TestData.OutVal     = ResU;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -7546,5 +7501,5 @@
                                 TestData.bImm       = bImm;
                                 TestData.OutVal     = Res1;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                                 if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -7559,5 +7514,5 @@
                                     TestData.bImm       = bImm;
                                     TestData.OutVal     = Res2;
-                                    RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                    GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                 }
                                 if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -7573,15 +7528,10 @@
                                             TestData.bImm       = bImm;
                                             TestData.OutVal     = Res3;
-                                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                         }
                             }
                         }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseCompareF2XmmR64Imm8[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -7667,11 +7617,6 @@
         PFNIEMAIMPLFPSSEF2U128 const pfn = g_aSseConvertXmmI32R32[iFn].pfnNative ? g_aSseConvertXmmI32R32[iFn].pfnNative : g_aSseConvertXmmI32R32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertXmmI32R32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertXmmI32R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertXmmI32R32[iFn].pszName), RTEXITCODE_FAILURE);
 
         X86FXSTATE State;
@@ -7701,5 +7646,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -7709,5 +7654,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -7720,5 +7665,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -7731,5 +7676,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -7743,15 +7688,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertXmmI32R32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -7843,11 +7783,6 @@
         PFNIEMAIMPLFPSSEF2U128 const pfn = g_aSseConvertXmmR32I32[iFn].pfnNative ? g_aSseConvertXmmR32I32[iFn].pfnNative : g_aSseConvertXmmR32I32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertXmmR32I32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertXmmR32I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertXmmR32I32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -7887,5 +7822,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -7895,5 +7830,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -7906,5 +7841,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -7917,5 +7852,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -7929,15 +7864,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertXmmR32I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -8027,11 +7957,6 @@
         PFNIEMAIMPLFPSSEF2U128 const pfn = g_aSseConvertXmmI32R64[iFn].pfnNative ? g_aSseConvertXmmI32R64[iFn].pfnNative : g_aSseConvertXmmI32R64[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertXmmI32R64[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertXmmI32R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertXmmI32R64[iFn].pszName), RTEXITCODE_FAILURE);
 
         X86FXSTATE State;
@@ -8061,5 +7986,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -8069,5 +7994,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -8080,5 +8005,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -8091,5 +8016,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -8103,15 +8028,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertXmmI32R64[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -8197,11 +8117,6 @@
         PFNIEMAIMPLFPSSEF2U128 const pfn = g_aSseConvertXmmR64I32[iFn].pfnNative ? g_aSseConvertXmmR64I32[iFn].pfnNative : g_aSseConvertXmmR64I32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertXmmR64I32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertXmmR64I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertXmmR64I32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -8237,5 +8152,5 @@
                         TestData.fMxcsrOut = ResM.MXCSR;
                         TestData.OutVal    = ResM.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         State.MXCSR = State.MXCSR & ~X86_MXCSR_XCPT_MASK;
@@ -8245,5 +8160,5 @@
                         TestData.fMxcsrOut = ResU.MXCSR;
                         TestData.OutVal    = ResU.uResult;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (ResM.MXCSR | ResU.MXCSR) & X86_MXCSR_XCPT_FLAGS;
@@ -8256,5 +8171,5 @@
                             TestData.fMxcsrOut = Res1.MXCSR;
                             TestData.OutVal    = Res1.uResult;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((Res1.MXCSR & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (Res1.MXCSR & X86_MXCSR_XCPT_FLAGS))
@@ -8267,5 +8182,5 @@
                                 TestData.fMxcsrOut = Res2.MXCSR;
                                 TestData.OutVal    = Res2.uResult;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -8279,15 +8194,10 @@
                                         TestData.fMxcsrOut = Res3.MXCSR;
                                         TestData.OutVal    = Res3.uResult;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertXmmR64I32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -8378,11 +8288,6 @@
         PFNIEMAIMPLMXCSRU64U128 const pfn = g_aSseConvertMmXmm[iFn].pfnNative ? g_aSseConvertMmXmm[iFn].pfnNative : g_aSseConvertMmXmm[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertMmXmm[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertMmXmm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertMmXmm[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -8419,5 +8324,5 @@
                         TestData.fMxcsrOut  = fMxcsrM;
                         TestData.OutVal.u   = u64ResM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -8428,5 +8333,5 @@
                         TestData.fMxcsrOut  = fMxcsrU;
                         TestData.OutVal.u   = u64ResU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -8440,5 +8345,5 @@
                             TestData.fMxcsrOut  = fMxcsr1;
                             TestData.OutVal.u   = u64Res1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -8452,5 +8357,5 @@
                                 TestData.fMxcsrOut  = fMxcsr2;
                                 TestData.OutVal.u   = u64Res2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -8465,15 +8370,10 @@
                                         TestData.fMxcsrOut  = fMxcsr3;
                                         TestData.OutVal.u   = u64Res3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertMmXmm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -8552,11 +8452,6 @@
         PFNIEMAIMPLMXCSRU128U64 const pfn = g_aSseConvertXmmR64Mm[iFn].pfnNative ? g_aSseConvertXmmR64Mm[iFn].pfnNative : g_aSseConvertXmmR64Mm[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertXmmR64Mm[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertXmmR64Mm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertXmmR64Mm[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -8581,5 +8476,5 @@
                         TestData.fMxcsrIn   = fMxcsrIn;
                         TestData.fMxcsrOut  = fMxcsrM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -8588,5 +8483,5 @@
                         TestData.fMxcsrIn   = fMxcsrIn;
                         TestData.fMxcsrOut  = fMxcsrU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -8598,5 +8493,5 @@
                             TestData.fMxcsrIn   = fMxcsrIn;
                             TestData.fMxcsrOut  = fMxcsr1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -8608,5 +8503,5 @@
                                 TestData.fMxcsrIn   = fMxcsrIn;
                                 TestData.fMxcsrOut  = fMxcsr2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -8619,15 +8514,10 @@
                                         TestData.fMxcsrIn   = fMxcsrIn;
                                         TestData.fMxcsrOut  = fMxcsr3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertXmmR64Mm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -8704,11 +8594,6 @@
         PFNIEMAIMPLMXCSRU128U64 const pfn = g_aSseConvertXmmR32Mm[iFn].pfnNative ? g_aSseConvertXmmR32Mm[iFn].pfnNative : g_aSseConvertXmmR32Mm[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertXmmR32Mm[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertXmmR32Mm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertXmmR32Mm[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -8733,5 +8618,5 @@
                         TestData.fMxcsrIn   = fMxcsrIn;
                         TestData.fMxcsrOut  = fMxcsrM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -8740,5 +8625,5 @@
                         TestData.fMxcsrIn   = fMxcsrIn;
                         TestData.fMxcsrOut  = fMxcsrU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -8750,5 +8635,5 @@
                             TestData.fMxcsrIn   = fMxcsrIn;
                             TestData.fMxcsrOut  = fMxcsr1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -8760,5 +8645,5 @@
                                 TestData.fMxcsrIn   = fMxcsrIn;
                                 TestData.fMxcsrOut  = fMxcsr2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -8771,15 +8656,10 @@
                                         TestData.fMxcsrIn   = fMxcsrIn;
                                         TestData.fMxcsrOut  = fMxcsr3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertXmmR32Mm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -8860,11 +8740,6 @@
         PFNIEMAIMPLMXCSRU64U64 const pfn = g_aSseConvertMmI32XmmR32[iFn].pfnNative ? g_aSseConvertMmI32XmmR32[iFn].pfnNative : g_aSseConvertMmI32XmmR32[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseConvertMmI32XmmR32[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseConvertMmI32XmmR32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSseConvertMmI32XmmR32[iFn].pszName), RTEXITCODE_FAILURE);
 
         uint32_t cNormalInputPairs  = 0;
@@ -8905,5 +8780,5 @@
                         TestData.fMxcsrOut = fMxcsrM;
                         TestData.OutVal.u  = u64ResM;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         fMxcsrIn &= ~X86_MXCSR_XCPT_MASK;
@@ -8914,5 +8789,5 @@
                         TestData.fMxcsrOut = fMxcsrU;
                         TestData.OutVal.u  = u64ResU;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                         uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS;
@@ -8926,5 +8801,5 @@
                             TestData.fMxcsrOut = fMxcsr1;
                             TestData.OutVal.u  = u64Res1;
-                            RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                            GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
 
                             if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS))
@@ -8938,5 +8813,5 @@
                                 TestData.fMxcsrOut = fMxcsr2;
                                 TestData.OutVal.u  = u64Res2;
-                                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                             }
                             if (!RT_IS_POWER_OF_TWO(fXcpt))
@@ -8951,15 +8826,10 @@
                                         TestData.fMxcsrOut = fMxcsr3;
                                         TestData.OutVal.u  = u64Res3;
-                                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                                     }
                         }
                     }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSseConvertMmI32XmmR32[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -9043,11 +8913,6 @@
         PFNIEMAIMPLPCMPISTRIU128IMM8 const pfn = g_aSsePcmpistri[iFn].pfnNative ? g_aSsePcmpistri[iFn].pfnNative : g_aSsePcmpistri[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSsePcmpistri[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSsePcmpistri[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSsePcmpistri[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -9070,5 +8935,5 @@
                 TestData.fEFlagsOut = fEFlagsOut;
                 TestData.bImm       = (uint8_t)u16Imm;
-                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
             }
 
@@ -9085,13 +8950,8 @@
                 TestData.fEFlagsOut = fEFlagsOut;
                 TestData.bImm       = (uint8_t)u16Imm;
-                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
             }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSsePcmpistri[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -9165,11 +9025,6 @@
         PFNIEMAIMPLPCMPISTRMU128IMM8 const pfn = g_aSsePcmpistrm[iFn].pfnNative ? g_aSsePcmpistrm[iFn].pfnNative : g_aSsePcmpistrm[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSsePcmpistrm[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSsePcmpistrm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSsePcmpistrm[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -9192,5 +9047,5 @@
                 TestData.fEFlagsOut = fEFlagsOut;
                 TestData.bImm       = (uint8_t)u16Imm;
-                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
             }
 
@@ -9207,13 +9062,8 @@
                 TestData.fEFlagsOut = fEFlagsOut;
                 TestData.bImm       = (uint8_t)u16Imm;
-                RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
             }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSsePcmpistrm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -9289,11 +9139,6 @@
         PFNIEMAIMPLPCMPESTRIU128IMM8 const pfn = g_aSsePcmpestri[iFn].pfnNative ? g_aSsePcmpestri[iFn].pfnNative : g_aSsePcmpestri[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSsePcmpestri[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSsePcmpestri[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSsePcmpestri[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -9324,5 +9169,5 @@
                         TestData.fEFlagsOut = fEFlagsOut;
                         TestData.bImm       = (uint8_t)u16Imm;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                     }
 
@@ -9339,14 +9184,9 @@
                         TestData.fEFlagsOut = fEFlagsOut;
                         TestData.bImm       = (uint8_t)u16Imm;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                     }
                 }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSsePcmpestri[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -9424,11 +9264,6 @@
         PFNIEMAIMPLPCMPESTRMU128IMM8 const pfn = g_aSsePcmpestrm[iFn].pfnNative ? g_aSsePcmpestrm[iFn].pfnNative : g_aSsePcmpestrm[iFn].pfn;
 
-        PRTSTREAM pStrmOut = NULL;
-        int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSsePcmpestrm[iFn].pszName);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSsePcmpestrm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        IEMBINARYOUTPUT BinOut;
+        AssertReturn(GenerateBinaryOpen(&BinOut, pszDataFileFmt, g_aSsePcmpestrm[iFn].pszName), RTEXITCODE_FAILURE);
 
         for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1)
@@ -9459,5 +9294,5 @@
                         TestData.fEFlagsOut = fEFlagsOut;
                         TestData.bImm       = (uint8_t)u16Imm;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                     }
 
@@ -9474,14 +9309,9 @@
                         TestData.fEFlagsOut = fEFlagsOut;
                         TestData.bImm       = (uint8_t)u16Imm;
-                        RTStrmWrite(pStrmOut, &TestData, sizeof(TestData));
+                        GenerateBinaryWrite(&BinOut, &TestData, sizeof(TestData));
                     }
                 }
         }
-        rc = RTStrmClose(pStrmOut);
-        if (RT_FAILURE(rc))
-        {
-            RTMsgError("Failed to close data file for %s: %Rrc", g_aSsePcmpestrm[iFn].pszName, rc);
-            return RTEXITCODE_FAILURE;
-        }
+        AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE);
     }
 
@@ -9900,5 +9730,5 @@
         if (fSseFpBinary)
         {
-            const char *pszDataFileFmt = fCommonData ? "tstIEMAImplDataSseBinary-%s.bin" : pszBitBucket;
+            const char * const pszDataFileFmt = fCommonData ? "tstIEMAImplDataSseBinary-%s.bin.gz" : NULL;
 
             RTEXITCODE rcExit = SseBinaryR32Generate(pszDataFileFmt, cTests);
@@ -9933,6 +9763,6 @@
         if (fSseFpOther)
         {
-            const char *pszDataFileFmtCmp = fCommonData ? "tstIEMAImplDataSseCompare-%s.bin" : pszBitBucket;
-            const char *pszDataFileFmtConv = fCommonData ? "tstIEMAImplDataSseConvert-%s.bin" : pszBitBucket;
+            const char * const pszDataFileFmtCmp  = fCommonData ? "tstIEMAImplDataSseCompare-%s.bin.gz" : NULL;
+            const char * const pszDataFileFmtConv = fCommonData ? "tstIEMAImplDataSseConvert-%s.bin.gz" : NULL;
 
             RTEXITCODE rcExit = SseCompareEflR32R32Generate(pszDataFileFmtCmp, cTests);
@@ -9965,5 +9795,5 @@
         if (fSsePcmpxstrx)
         {
-            const char *pszDataFileFmtCmp = fCommonData ? "tstIEMAImplDataSsePcmpxstrx-%s.bin" : pszBitBucket;
+            const char * const pszDataFileFmtCmp = fCommonData ? "tstIEMAImplDataSsePcmpxstrx-%s.bin.gz" : NULL;
 
             RTEXITCODE rcExit = SseComparePcmpistriGenerate(pszDataFileFmtCmp, cTests);
