aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/compile-i386.c
diff options
authorJeff Garzik <jgarzik@redhat.com>2003-09-09 16:42:58 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:01:09 -0700
commit1c94d3f88e424adc3ace586076d1529be3c847da (patch)
treecee1152ff863ccd145b93c46a8cdf42901acf1a6 /compile-i386.c
parent9124d261c0219df86fb1d835c0b6740143d74267 (diff)
downloadsparse-dev-1c94d3f88e424adc3ace586076d1529be3c847da.tar.gz
[be] Handle 'if' using test/jz insns rather than xor/cmp/je
Suggested by Arjan van de Ven.
Diffstat (limited to 'compile-i386.c')
-rw-r--r--compile-i386.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/compile-i386.c b/compile-i386.c
index f5ead65f..486206a9 100644
--- a/compile-i386.c
+++ b/compile-i386.c
@@ -1006,11 +1006,8 @@ static void emit_if_conditional(struct statement *stmt)
/* load 'if' test result into EAX */
insn("movl", val, REG_EAX, "begin if conditional", 0);
- /* clear ECX */
- insn("xorl", REG_ECX, REG_ECX, NULL, 0);
-
/* compare 'if' test result */
- insn("cmpl", REG_EAX, REG_ECX, NULL, 0);
+ insn("test", REG_EAX, REG_EAX, NULL, 0);
/* create end-of-if label / if-failed labelto jump to,
* and jump to it if the expression returned zero.
@@ -1018,7 +1015,7 @@ static void emit_if_conditional(struct statement *stmt)
target = new_label();
target_val = new_storage(STOR_LABEL);
target_val->label = target;
- insn("je", target_val, NULL, NULL, ATOM_FREE_OP1);
+ insn("jz", target_val, NULL, NULL, ATOM_FREE_OP1);
x86_statement(stmt->if_true);
if (stmt->if_false) {