aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2025-05-19 15:51:14 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-06-06 14:32:55 +0200
commit3f9bdfb0dc8162cbc080c868625336178ddcda56 (patch)
tree21462352c7e9ca215e4fe3a5d17b3915b603f995
parent57df511180ae015c4f6fac2a8260649a79e8ead9 (diff)
downloadqemu-3f9bdfb0dc8162cbc080c868625336178ddcda56.zip
qemu-3f9bdfb0dc8162cbc080c868625336178ddcda56.tar.gz
qemu-3f9bdfb0dc8162cbc080c868625336178ddcda56.tar.bz2
tests/tcg/x86_64/fma: add test for exact-denormal output
Add some fma test cases that check for correct handling of FTZ and for the flag that indicates that the input denormal was consumed. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250519145114.2786534-5-peter.maydell@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--tests/tcg/x86_64/fma.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/tcg/x86_64/fma.c b/tests/tcg/x86_64/fma.c
index 46f8630..3421961 100644
--- a/tests/tcg/x86_64/fma.c
+++ b/tests/tcg/x86_64/fma.c
@@ -82,6 +82,18 @@ static testdata tests[] = {
*/
{ 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, true,
0x8010000000000000, 0x20 }, /* Enabling FTZ shouldn't change flags */
+ /*
+ * normal * 0 + a denormal. With FTZ disabled this gives an exact
+ * result (equal to the input denormal) that has consumed the denormal.
+ */
+ { 0x3cc8000000000000, 0x0000000000000000, 0x8008000000000000, false,
+ 0x8008000000000000, 0x2 }, /* Denormal */
+ /*
+ * With FTZ enabled, this consumes the denormal, returns zero (because
+ * flushed) and indicates also Underflow and Precision.
+ */
+ { 0x3cc8000000000000, 0x0000000000000000, 0x8008000000000000, true,
+ 0x8000000000000000, 0x32 }, /* Precision, Underflow, Denormal */
};
int main(void)