qemu-e2k/tcg/s390
Philippe Mathieu-Daudé 8e43c5a1f2 tcg/s390: Fix compare instruction from extended-immediate facility
The code is currently comparing c2 to the type promotion of
uint32_t and int32_t. That is, the conversion rules are as:

  (common_type) c2 == (common_type) (uint32_t)
                        (is_unsigned
                        ? (uint32_t)c2
                        : (uint32_t)(int32_t)c2)

In the signed case we lose the desired sign extensions because
of the argument promotion rules of the ternary operator.

Solve the problem by doing the round-trip parsing through the
intermediate type and back to the desired common type (all at
one expression).

Fixes: a534bb15f3 ("tcg/s390: Use constant pool for cmpi")
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Suggested-by: David Hildenbrand <david@redhat.com>
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210204182902.1742826-1-f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-02-05 10:24:14 -10:00
..
tcg-target-con-set.h tcg/s390: Split out constraint sets to tcg-target-con-set.h 2021-02-02 12:12:43 -10:00
tcg-target-con-str.h tcg/s390: Split out target constraints to tcg-target-con-str.h 2021-02-02 12:12:31 -10:00
tcg-target.c.inc tcg/s390: Fix compare instruction from extended-immediate facility 2021-02-05 10:24:14 -10:00
tcg-target.h tcg: Remove TCG_TARGET_CON_SET_H 2021-02-02 12:12:43 -10:00