qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tcg: add dup_const_tl wrapper
@ 2021-09-28 20:54 Philipp Tomsich
  2021-09-28 20:54 ` [PATCH 2/2] target/riscv: Use dup_const_tl in orc.b to legalise truncation of constant Philipp Tomsich
  2021-10-03 17:30 ` [PATCH 1/2] tcg: add dup_const_tl wrapper Richard Henderson
  0 siblings, 2 replies; 4+ messages in thread
From: Philipp Tomsich @ 2021-09-28 20:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alistair Francis, Richard Henderson, Philipp Tomsich

dup_const always generates a uint64_t, which may exceed the size of a
target_long (generating warnings with recent-enough compilers).

To ensure that we can use dup_const both for 64bit and 32bit targets,
this adds dup_const_tl, which wraps dup_const and legalises the
truncation to target_long by casting it to target_long.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>

---

 include/tcg/tcg.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 44ccd86f3e..8f8a209600 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -1272,6 +1272,11 @@ uint64_t dup_const(unsigned vece, uint64_t c);
         : (qemu_build_not_reached_always(), 0))                    \
      : dup_const(VECE, C))
 
+static inline target_long dup_const_tl(unsigned vece, uint64_t c)
+{
+    return (target_long)dup_const(vece, c);
+}
+
 /*
  * Memory helpers that will be used by TCG generated code.
  */
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-03 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28 20:54 [PATCH 1/2] tcg: add dup_const_tl wrapper Philipp Tomsich
2021-09-28 20:54 ` [PATCH 2/2] target/riscv: Use dup_const_tl in orc.b to legalise truncation of constant Philipp Tomsich
2021-10-03 17:30   ` Richard Henderson
2021-10-03 17:30 ` [PATCH 1/2] tcg: add dup_const_tl wrapper Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).