Re: Subtraction + comparison in one asm instruction?

"Walter Banks" <walter@bytecraft.com>
23 Aug 2002 11:03:25 -0400

          From comp.compilers

Related articles
Subtraction + comparison in one asm instruction? vincent+news@vinc17.org (Vincent Lefevre) (2002-08-10)
Re: Subtraction + comparison in one asm instruction? Peter-Lawrence.Montgomery@cwi.nl (Peter L. Montgomery) (2002-08-14)
Re: Subtraction + comparison in one asm instruction? iddw@hotmail.com (Dave Hansen) (2002-08-14)
Re: Subtraction + comparison in one asm instruction? walter@bytecraft.com (Walter Banks) (2002-08-23)
Re: Subtraction + comparison in one asm instruction? vincent+news@vinc17.org (Vincent Lefevre) (2002-08-23)
Re: Subtraction + comparison in one asm instruction? gdr@soliton.integrable-solutions.net (Gabriel Dos Reis) (2002-09-03)
Re: Subtraction + comparison in one asm instruction? vincent+news@vinc17.org (Vincent Lefevre) (2002-09-08)
Re: Subtraction + comparison in one asm instruction? gdr@integrable-solutions.net (Gabriel Dos Reis) (2002-09-12)
Re: Subtraction + comparison in one asm instruction? vbdis@aol.com (VBDis) (2002-09-12)
Re: Subtraction + comparison in one asm instruction? gdr@integrable-solutions.net (Gabriel Dos Reis) (2002-09-12)
[9 later articles]
| List of all articles for this month |

From: "Walter Banks" <walter@bytecraft.com>
Newsgroups: comp.compilers
Date: 23 Aug 2002 11:03:25 -0400
Organization: Compilers Central
References: 02-08-033
Keywords: architecture
Posted-Date: 23 Aug 2002 11:03:25 EDT

Vincent Lefevre wrote:
>


> or when writing c - 1 > 0 instead of c > 1.


These are not the same. Subtracting 1 from a signed c will make
the most negative number also conform to the > 0 test.


> Each time, a comparison is performed separately.
> A practical use would be a loop of the form:
> while (--c > 0)


The decrement skip 0 instructions found in some small micro
controllers is regularly used to perform this type of while.


It is interesting to look at the subset of an instruction set that
compilers use with a small test program that looks at generated
code and produces histograms of instruction usage.


We have used a similar tool to help develop new instruction
sets by looking at usage in pairs and triplets looking for
possible code size saving with more complex instructions.


w..


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.