[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/46] tcg/s390: Fix compare instruction from extended-immediate f
From: |
Richard Henderson |
Subject: |
[PULL 01/46] tcg/s390: Fix compare instruction from extended-immediate facility |
Date: |
Fri, 5 Feb 2021 12:56:05 -1000 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
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: a534bb15f30 ("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>
---
tcg/s390/tcg-target.c.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc
index b67470137c..695d7ee652 100644
--- a/tcg/s390/tcg-target.c.inc
+++ b/tcg/s390/tcg-target.c.inc
@@ -1067,7 +1067,7 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond
c, TCGReg r1,
op = (is_unsigned ? RIL_CLFI : RIL_CFI);
tcg_out_insn_RIL(s, op, r1, c2);
goto exit;
- } else if (c2 == (is_unsigned ? (uint32_t)c2 : (int32_t)c2)) {
+ } else if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 :
(TCGArg)(int32_t)c2)) {
op = (is_unsigned ? RIL_CLGFI : RIL_CGFI);
tcg_out_insn_RIL(s, op, r1, c2);
goto exit;
--
2.25.1
- [PULL 00/46] tcg patch queue, Richard Henderson, 2021/02/05
- [PULL 01/46] tcg/s390: Fix compare instruction from extended-immediate facility,
Richard Henderson <=
- [PULL 02/46] exec/cpu-defs: Remove TCG backends dependency, Richard Henderson, 2021/02/05
- [PULL 03/46] tcg/aarch64: Do not convert TCGArg to temps that are not temps, Richard Henderson, 2021/02/05
- [PULL 04/46] configure: Fix --enable-tcg-interpreter, Richard Henderson, 2021/02/05
- [PULL 05/46] tcg/tci: Make tci_tb_ptr thread-local, Richard Henderson, 2021/02/05
- [PULL 06/46] tcg/tci: Implement INDEX_op_ld16s_i32, Richard Henderson, 2021/02/05
- [PULL 07/46] tcg/tci: Implement INDEX_op_ld8s_i64, Richard Henderson, 2021/02/05
- [PULL 08/46] tcg/tci: Inline tci_write_reg32s into the only caller, Richard Henderson, 2021/02/05
- [PULL 09/46] tcg/tci: Inline tci_write_reg8 into its callers, Richard Henderson, 2021/02/05
- [PULL 10/46] tcg/tci: Inline tci_write_reg16 into the only caller, Richard Henderson, 2021/02/05
- [PULL 11/46] tcg/tci: Inline tci_write_reg32 into all callers, Richard Henderson, 2021/02/05