Bug in TC2.0 Optimization

wirzenius at cc.helsinki.fi wirzenius at cc.helsinki.fi
Mon Apr 29 06:02:49 AEST 1991


In article <1991Apr22.130418.8079 at uni-paderborn.de>, higgins at uni-paderborn.de (Frank Westheider) writes:
>     Input[func(bla)+bla] = !Input[func(bla)+bla]

A side note: do you really want to call func(bla) twice?

> In Assembly-Mode there will be
>     xor dx,dx
> generated, but dx has never been loaded !

I'm not familiar with assembler, but if this does what I think it does,
i.e. xors dx with itself and puts the result back into dx, then it
doesn't matter whether dx has been loaded or not. The truth table for
xor is:

	a	b	a xor b

	0	0	0
	0	1	1
	1	0	1
	1	1	0

Since the result is 1 if and only if the operands are different, xoring
a value with itself is identical to 0, regardless of the value of the
operand. So the assembler statement sets dx to 0. Why didn't they just
do it explicitly? Maybe this method is faster, smaller, or has some
other virtue.

Lars Wirzenius    wirzenius at cc.helsinki.fi



More information about the Comp.lang.c mailing list