Re: Subtraction + comparison in one asm instruction?

"VBDis" <vbdis@aol.com>
19 Sep 2002 01:11:08 -0400

          From comp.compilers

Related articles
[7 earlier articles]
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)
Re: Subtraction + comparison in one asm instruction? vincent+news@vinc17.org (Vincent Lefevre) (2002-09-12)
Re: Subtraction + comparison in one asm instruction? anton@mips.complang.tuwien.ac.at (Anton Ertl) (2002-09-14)
Re: Subtraction + comparison in one asm instruction? vincent+news@vinc17.org (Vincent Lefevre) (2002-09-14)
Re: Subtraction + comparison in one asm instruction? vbdis@aol.com (VBDis) (2002-09-19)
Re: Subtraction + comparison in one asm instruction? anton@mips.complang.tuwien.ac.at (Anton Ertl) (2002-09-19)
Re: Subtraction + comparison in one asm instruction? joachim_d@gmx.de (Joachim Durchholz) (2002-09-19)
Re: Subtraction + comparison in one asm instruction? sander@haldjas.folklore.ee (Sander Vesik) (2002-11-12)
Re: Subtraction + comparison in one asm instruction? sander@haldjas.folklore.ee (Sander Vesik) (2002-11-12)
Re: Subtraction + comparison in one asm instruction? jvorbrueggen@mediasec.de (Jan C. =?iso-8859-1?Q?Vorbr=FCggen?=) (2002-11-13)
| List of all articles for this month |

From: "VBDis" <vbdis@aol.com>
Newsgroups: comp.compilers
Date: 19 Sep 2002 01:11:08 -0400
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
References: 02-09-093
Keywords: arithmetic, architecture
Posted-Date: 19 Sep 2002 01:11:08 EDT

<anton@mips.complang.tuwien.ac.at> schreibt:


>In contrast, x-1>0 gives a different result from x>1 if x is the
>smallest signed integer. In that case the result of x-1 is undefined
>(or implementation-defined or somesuch), so the implementation has the
>right to perform this optimization according to the C standard. It's
>not clear if it is a good idea, though.


You just remind me of another point:


    A compiler is almost free to cast or convert values into more appropriate
    types during the evaluation of expressions.


Usually up-casts (to a wider type) will be inserted by the compiler only when
the operand types for an operator differ, but the exact behaviour should be
specified in the language. In the expression x-1 both the types of x and 1 are
significant, so the type of (untyped) literals also should be specified for a
language.


IOW: What's the data type of an expression, as specified for the language of
interest?


IMO overflows or underflows /during/ the evaluation of expressions can be
checked only, when the language or compiler specifies the exact handling of
data types during expression evaluation. Typically, for speed reasons, range
checks are inserted into the code only when required by specific situations,
like before assignments to typed variables, or before indexing arrays.


DoDi


Post a followup to this message

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