qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcg/i386: convert add/sub of 128 to sub/add of -128
@ 2023-12-21 13:43 Paolo Bonzini
  2023-12-27 20:13 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2023-12-21 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tcg/i386/tcg-target.c.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index a83f8aab304..4e9f372d4fd 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1332,7 +1332,11 @@ static void tgen_arithi(TCGContext *s, int c, int r0,
         return;
     }
 
-    if (c == ARITH_AND) {
+    if ((c == ARITH_ADD || c == ARITH_SUB) && val == 128) {
+        /* Facilitate using an 8-bit immediate.  */
+        c ^= ARITH_ADD ^ ARITH_SUB;
+	val = -128;
+    } else if (c == ARITH_AND) {
         if (TCG_TARGET_REG_BITS == 64) {
             if (val == 0xffffffffu) {
                 tcg_out_ext32u(s, r0, r0);
-- 
2.43.0



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

end of thread, other threads:[~2023-12-27 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-21 13:43 [PATCH] tcg/i386: convert add/sub of 128 to sub/add of -128 Paolo Bonzini
2023-12-27 20:13 ` 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).