Skip to content

Commit 76e366e

Browse files
committed
tcg: Canonicalize alignment flags in MemOp
Having observed e.g. al8+leq in dumps, canonicalize to al+leq. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent d2ba802 commit 76e366e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tcg/tcg-op.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2765,7 +2765,12 @@ void tcg_gen_lookup_and_goto_ptr(void)
27652765
static inline MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st)
27662766
{
27672767
/* Trigger the asserts within as early as possible. */
2768-
(void)get_alignment_bits(op);
2768+
unsigned a_bits = get_alignment_bits(op);
2769+
2770+
/* Prefer MO_ALIGN+MO_XX over MO_ALIGN_XX+MO_XX */
2771+
if (a_bits == (op & MO_SIZE)) {
2772+
op = (op & ~MO_AMASK) | MO_ALIGN;
2773+
}
27692774

27702775
switch (op & MO_SIZE) {
27712776
case MO_8:

0 commit comments

Comments
 (0)