aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@mail.ru>2004-07-31 15:05:03 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:02:26 -0700
commit5d356994901aab5fa2780a2af912cdc69013beb5 (patch)
treedebab252589df74b00f22f11f6f4203a659e8125 /compile-i386.c
parent[PATCH] Print instruction's suffix in a human-readable form. (diff)
downloadsparse-5d356994901aab5fa2780a2af912cdc69013beb5.tar.gz
sparse-5d356994901aab5fa2780a2af912cdc69013beb5.tar.bz2
sparse-5d356994901aab5fa2780a2af912cdc69013beb5.zip
[PATCH] Simplify mnemonic generation for mov* instructions.
We already have a function that adds correct {b,w,l,q} suffix.
Diffstat (limited to 'compile-i386.c')
-rw-r--r--compile-i386.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/compile-i386.c b/compile-i386.c
index d720b66..c620bf2 100644
--- a/compile-i386.c
+++ b/compile-i386.c
@@ -1018,31 +1018,15 @@ static void emit_move(struct storage *src, struct storage *dest,
return;
}
- switch (bits) {
- case 8:
- if (is_dest)
- opname = "movb";
- else {
- if (is_signed) opname = "movsxb";
- else opname = "movzxb";
- }
- break;
- case 16:
+ if ((bits == 8) || (bits == 16)) {
if (is_dest)
- opname = "movw";
- else {
- if (is_signed) opname = "movsxw";
- else opname = "movzxw";
- }
- break;
-
- case 32: opname = "movl"; break;
- case 64: opname = "movq"; break;
-
- default: assert(0); break;
- }
+ opname = "mov";
+ else
+ opname = is_signed ? "movsx" : "movzx";
+ } else
+ opname = "mov";
- insn(opname, src, dest, comment);
+ insn(opbits(opname, bits), src, dest, comment);
}
static struct storage *emit_compare(struct expression *expr)