qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] target/i386: Fix carry flag for BLSI


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 2/2] target/i386: Fix carry flag for BLSI
Date: Fri, 16 Aug 2024 11:30:02 +0200
User-agent: Mozilla Thunderbird

On 1/8/24 09:58, Richard Henderson wrote:
BLSI has inverted semantics for C as compared to the other two
BMI1 instructions, BLSMSK and BLSR.  Introduce CC_OP_BLSI* for
this purpose.

Fixes: 1d0b926150 ("target/i386: move scalar 0F 38 and 0F 3A instruction to new decoder")

or even older?

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2175
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  target/i386/cpu.h                        |  5 +++++
  target/i386/tcg/cc_helper.c              | 18 ++++++++++++++++++
  target/i386/tcg/translate.c              |  5 +++++
  tests/tcg/x86_64/test-2175.c             | 24 ++++++++++++++++++++++++
  target/i386/tcg/cc_helper_template.h.inc | 18 ++++++++++++++++++
  target/i386/tcg/emit.c.inc               |  2 +-
  tests/tcg/x86_64/Makefile.target         |  1 +
  7 files changed, 72 insertions(+), 1 deletion(-)
  create mode 100644 tests/tcg/x86_64/test-2175.c


+static int glue(compute_all_blsi, SUFFIX)(DATA_TYPE dst, DATA_TYPE src1)
+{
+    int cf, pf, af, zf, sf, of;
+
+    cf = (src1 != 0);
+    pf = 0; /* undefined */
+    af = 0; /* undefined */
+    zf = (dst == 0) * CC_Z;
+    sf = lshift(dst, 8 - DATA_BITS) & CC_S;
+    of = 0;
+    return cf | pf | af | zf | sf | of;
+}

Except this function which I'm not reviewing, for the rest
to the best of my x86 knowledge:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]