From: Brian Cain <brian.cain@oss.qualcomm.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: brian.cain@oss.qualcomm.com,
Alexey Karyakin <akaryaki@qti.qualcomm.com>,
Taylor Simpson <ltaylorsimpson@gmail.com>
Subject: [PULL 1/3] target/hexagon: fix J2_jumptnew/pt predicate check to use LSB
Date: Fri, 20 Mar 2026 07:50:39 -0700 [thread overview]
Message-ID: <20260320145041.3027130-2-brian.cain@oss.qualcomm.com> (raw)
In-Reply-To: <20260320145041.3027130-1-brian.cain@oss.qualcomm.com>
J2_jumptnew and J2_jumptnewpt passed the raw predicate value to
gen_cond_jump(), checking if the full 8-bit value was non-zero.
Refer to PRM Section 6.1.2 "predicate-consuming instructions examine
only the least-significant bit".
This inconsistency caused if (p0.new) jumps and if (p0.new) loads
within the same packet to disagree when the predicate had values
other than the ones generated by predicate-generating instructions
(e.g. 0x80 or 0xAA where bit 0 is clear but the value is
non-zero): the jump would be taken while the loads were skipped.
Fix by routing both macros through fGEN_TCG_cond_jumpt(fLSBNEW(PuN)),
matching the pattern used by every other predicated jump.
Discovered-by: Alexey Karyakin <akaryaki@qti.qualcomm.com>
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
target/hexagon/gen_tcg.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h
index 7b96dab9185..45ccd518883 100644
--- a/target/hexagon/gen_tcg.h
+++ b/target/hexagon/gen_tcg.h
@@ -951,9 +951,9 @@
#define fGEN_TCG_J2_jumpfpt(SHORTCODE) \
fGEN_TCG_cond_jumpf(fLSBOLD(PuV))
#define fGEN_TCG_J2_jumptnew(SHORTCODE) \
- gen_cond_jump(ctx, TCG_COND_EQ, PuN, riV)
+ fGEN_TCG_cond_jumpt(fLSBNEW(PuN))
#define fGEN_TCG_J2_jumptnewpt(SHORTCODE) \
- gen_cond_jump(ctx, TCG_COND_EQ, PuN, riV)
+ fGEN_TCG_cond_jumpt(fLSBNEW(PuN))
#define fGEN_TCG_J2_jumpfnewpt(SHORTCODE) \
fGEN_TCG_cond_jumpf(fLSBNEW(PuN))
#define fGEN_TCG_J2_jumpfnew(SHORTCODE) \
--
2.34.1
next prev parent reply other threads:[~2026-03-20 14:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 14:50 [PULL 0/3] hex queue Brian Cain
2026-03-20 14:50 ` Brian Cain [this message]
2026-03-20 14:50 ` [PULL 2/3] target/hexagon: use TCG_COND_TSTEQ/TSTNE for predicate branches Brian Cain
2026-03-20 14:50 ` [PULL 3/3] tests/tcg/hexagon: add test for predicated .new branch LSB evaluation Brian Cain
2026-03-23 12:42 ` [PULL 0/3] hex queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260320145041.3027130-2-brian.cain@oss.qualcomm.com \
--to=brian.cain@oss.qualcomm.com \
--cc=akaryaki@qti.qualcomm.com \
--cc=ltaylorsimpson@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox