ppc64: VSX vector float to integer conversion instructions do not always return expected results on QEMU 8.0.4 if source vector has NaN values Description of problem: The problem is that the VSX xvcvspsxws/xvcvdpsxws/xvcvspsxds/xvcvdpsxds/xvcvspuxws/xvcvdpuxds/xvcvspuxds/xvcvdpuxws instructions incorrectly convert the preceding non-NaN source values to the NaN to integer result instead of the expected non-NaN to integer conversion result with qemu-ppc64le 8.0.4. Here are the results of the VSX operations whose results differ from the expected results with QEMU 8.0.4 (generated by running the vsx_f2i_nan_test_program_101423 test program with qemu-ppc64le 8.0.4): ``` xvcvspsxds ({1, 2, 3, nan}) = {-9223372036854775808, -9223372036854775808} xvcvspsxds ({nan, 2, 3, nan}) = {-9223372036854775808, -9223372036854775808} xvcvspsxds ({1, 2, nan, nan}) = {-9223372036854775808, -9223372036854775808} xvcvspsxds ({nan, 2, nan, nan}) = {-9223372036854775808, -9223372036854775808} xvcvspsxws ({1, nan, 3, 4}) = {-2147483648, -2147483648, 3, 4} xvcvspsxws ({1, 2, nan, 4}) = {-2147483648, -2147483648, -2147483648, 4} xvcvspsxws ({nan, 2, nan, 4}) = {-2147483648, -2147483648, -2147483648, 4} xvcvspsxws ({1, nan, nan, 4}) = {-2147483648, -2147483648, -2147483648, 4} xvcvspsxws ({1, 2, 3, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspsxws ({nan, 2, 3, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspsxws ({1, nan, 3, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspsxws ({nan, nan, 3, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspsxws ({1, 2, nan, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspsxws ({nan, 2, nan, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspsxws ({1, nan, nan, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvspuxds ({1, 2, 3, nan}) = {0, 0} xvcvspuxds ({nan, 2, 3, nan}) = {0, 0} xvcvspuxds ({1, 2, nan, nan}) = {0, 0} xvcvspuxds ({nan, 2, nan, nan}) = {0, 0} xvcvspuxws ({1, nan, 3, 4}) = {0, 0, 3, 4} xvcvspuxws ({1, 2, nan, 4}) = {0, 0, 0, 4} xvcvspuxws ({nan, 2, nan, 4}) = {0, 0, 0, 4} xvcvspuxws ({1, nan, nan, 4}) = {0, 0, 0, 4} xvcvspuxws ({1, 2, 3, nan}) = {0, 0, 0, 0} xvcvspuxws ({nan, 2, 3, nan}) = {0, 0, 0, 0} xvcvspuxws ({1, nan, 3, nan}) = {0, 0, 0, 0} xvcvspuxws ({nan, nan, 3, nan}) = {0, 0, 0, 0} xvcvspuxws ({1, 2, nan, nan}) = {0, 0, 0, 0} xvcvspuxws ({nan, 2, nan, nan}) = {0, 0, 0, 0} xvcvspuxws ({1, nan, nan, nan}) = {0, 0, 0, 0} xvcvdpsxws ({1, nan}) = {-2147483648, -2147483648, -2147483648, -2147483648} xvcvdpuxws ({1, nan}) = {0, 0, 0, 0} xvcvdpsxds ({1, nan}) = {-9223372036854775808, -9223372036854775808} xvcvdpuxds ({1, nan}) = {0, 0} ``` Here are the results of the same VSX conversion operations with QEMU 6.2.0 (generated by running the vsx_f2i_nan_test_program_101423 test program with qemu-ppc64le 6.2.0): ``` xvcvspsxds ({1, 2, 3, nan}) = {2, -9223372036854775808} xvcvspsxds ({nan, 2, 3, nan}) = {2, -9223372036854775808} xvcvspsxds ({1, 2, nan, nan}) = {2, -9223372036854775808} xvcvspsxds ({nan, 2, nan, nan}) = {2, -9223372036854775808} xvcvspsxws ({1, nan, 3, 4}) = {1, -2147483648, 3, 4} xvcvspsxws ({1, 2, nan, 4}) = {1, 2, -2147483648, 4} xvcvspsxws ({nan, 2, nan, 4}) = {-2147483648, 2, -2147483648, 4} xvcvspsxws ({1, nan, nan, 4}) = {1, -2147483648, -2147483648, 4} xvcvspsxws ({1, 2, 3, nan}) = {1, 2, 3, -2147483648} xvcvspsxws ({nan, 2, 3, nan}) = {-2147483648, 2, 3, -2147483648} xvcvspsxws ({1, nan, 3, nan}) = {1, -2147483648, 3, -2147483648} xvcvspsxws ({nan, nan, 3, nan}) = {-2147483648, -2147483648, 3, -2147483648} xvcvspsxws ({1, 2, nan, nan}) = {1, 2, -2147483648, -2147483648} xvcvspsxws ({nan, 2, nan, nan}) = {-2147483648, 2, -2147483648, -2147483648} xvcvspsxws ({1, nan, nan, nan}) = {1, -2147483648, -2147483648, -2147483648} xvcvspuxds ({1, 2, 3, nan}) = {2, 0} xvcvspuxds ({nan, 2, 3, nan}) = {2, 0} xvcvspuxds ({1, 2, nan, nan}) = {2, 0} xvcvspuxds ({nan, 2, nan, nan}) = {2, 0} xvcvspuxws ({1, nan, 3, 4}) = {1, 0, 3, 4} xvcvspuxws ({1, 2, nan, 4}) = {1, 2, 0, 4} xvcvspuxws ({nan, 2, nan, 4}) = {0, 2, 0, 4} xvcvspuxws ({1, nan, nan, 4}) = {1, 0, 0, 4} xvcvspuxws ({1, 2, 3, nan}) = {1, 2, 3, 0} xvcvspuxws ({nan, 2, 3, nan}) = {0, 2, 3, 0} xvcvspuxws ({1, nan, 3, nan}) = {1, 0, 3, 0} xvcvspuxws ({nan, nan, 3, nan}) = {0, 0, 3, 0} xvcvspuxws ({1, 2, nan, nan}) = {1, 2, 0, 0} xvcvspuxws ({nan, 2, nan, nan}) = {0, 2, 0, 0} xvcvspuxws ({1, nan, nan, nan}) = {1, 0, 0, 0} xvcvdpsxws ({1, nan}) = {0, 1, 0, -2147483648} xvcvdpuxws ({1, nan}) = {0, 1, 0, 0} xvcvdpsxds ({1, nan}) = {1, -9223372036854775808} xvcvdpuxds ({1, nan}) = {1, 0} ``` Steps to reproduce: 1. Compile the attached vsx_f2i_nan_test_program_101423.cpp with either `powerpc64le-linux-gnu-g++` or `clang --target=powerpc64le-linux-gnu` 2. Run the compiled vsx_f2i_nan_test_program_101423.cpp program using qemu-ppc64le 3. The vsx_f2i_nan_test_program_101423 program will return the results of the xvcvspsxws, xvcvdpsxws, xvcvspsxds, xvcvdpsxds, xvcvspuxws, xvcvdpuxds, xvcvspuxds, or xvcvdpuxws instruction. Additional information: Attachments: - [vsx_f2i_nan_test_program_101423.cpp](/uploads/749395aee2da1dcc86790804106d30ea/vsx_f2i_nan_test_program_101423.cpp) - [vsx_f2i_nan_test_program_101423_qemu_6.2.0_output.txt](/uploads/c883c4d04730a9c5a7e301e5d487ae2b/vsx_f2i_nan_test_program_101423_qemu_6.2.0_output.txt) - output of running vsx_f2i_nan_test_program_101423 with QEMU 6.2.0 - [vsx_f2i_nan_test_program_101423_qemu_8.0.4_output.txt](/uploads/9451e3419f8a4f3ef2274b2ccc7ef22d/vsx_f2i_nan_test_program_101423_qemu_8.0.4_output.txt) - output of running vsx_f2i_nan_test_program_101423 with QEMU 8.0.4