[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] tcg: add dup_const_tl wrapper
From: |
Philipp Tomsich |
Subject: |
[PATCH 1/2] tcg: add dup_const_tl wrapper |
Date: |
Tue, 28 Sep 2021 22:54:49 +0200 |
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
- [PATCH 1/2] tcg: add dup_const_tl wrapper,
Philipp Tomsich <=