delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/18/20:20:49

From: "John S. Fine" <johnfine AT erols DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Some assembly questions
Date: Thu, 18 Mar 1999 17:00:10 -0500
Lines: 18
Message-ID: <36F1776A.6DA0@erols.com>
References: <199903170746 DOT IAA06061 AT login-2 DOT eunet DOT no> <7cq156$q5$2 AT news DOT luth DOT se> <7cra9a$ui$1 AT murdoch DOT acc DOT Virginia DOT EDU> <7cre48$h9i$2 AT news DOT luth DOT se>
Mime-Version: 1.0
X-Trace: isRLZVu5KLlZnpm8pVEYYb9wg62mXWljCPGfveOto5k=
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 18 Mar 1999 22:01:34 GMT
X-Mailer: Mozilla 3.01 (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Martin Str|mberg wrote:

> Perhaps somebody can inform me on the difference (if there is one)
> between "cmpl $1, %eax" and "testl $1, %eax".

  CMP internally does a SUB, discarding the result and keeping
only the condition codes from the result.

  TEST internally does an AND, discarding the result and keeping
only the condition codes from the result.

  Since SUB is very different from AND, CMP is very different from
TEST.  For example, cmpl $1 will set the Z-bit only if the entire
target is equal to one.  testl $1 will set the Z-bit if the target
is any even number.
-- 
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019