Re: Integer Overflow



Le 30/12/10 20:47, Seebs a écrit :
On 2010-12-30, Ben Bacarisse<ben.usenet@xxxxxxxxx> wrote:
jacob navia<jacob@xxxxxxxxxxxx> writes:
The Cell SPU has no overflow detection at all. You may feel you can
discount this processor as a valid target for a C compiler, but I'd be
wary of doing that.

Since the general registers of the Cell SPU are 128 bit wide,
you can very easily detect overflow using 32 bit data
by testing one bit of the result. Note that the machine
can't handle more than 32 bit integer operations...

That's not how I understand this processor to work. The 128-bit result
is made up from 4 separate 32-bit adds, each with no carry and overflow
information. Nothing carries from one word addition to another.


Then, it is very easy, just SPLIT your number in two
of those 4 slots and add them in parallel, then see if the
high parts overflow.

There was a discussion of precisely that in this thread.

There is NO processor that can't detect overflow.

Of course it's possible. I said it is always possible. The question is
the cost. I don't think the cost is a single bit test on the Cell SPU
but I am no expert on these processors.

I'm not a proper *expert*, but I've written a fair bit about the compiler
technology used for them.

So you can't make statements like: "There is no processor that hasn't an
overflow flag" and not expect people to comment on that.

Exactly.

-s

Exactly Seebs. Contrary to you (that thinks that you are always right)
I changed slighty my proposal from

expression
_overflow()

to _overflow(expression)

and left out any flags since the overflow detection can be done
with the use of other flags.

What is evident is that your interest is here to prove that
I am wrong and not to propose any solution to the detction
of overflow that apparently is for you a non problem.

Who cares?

If all my results are wrong because computation overflowed
it doesn't matter.

What do YOU propose Seebs? How would YOU solve this problem?

Or you think there is NO PROBLEM here ?

.



Relevant Pages

  • Re: a way to put C variables inside inline assembler (in C files) for Android NDK which is basically
    ... no matter how good your compiler is, no matter how many optimization flags are set, it's unlikely that code generated by the compiler will be as compact and as fast as if it were coded in assembly by hand. ... particular setup for a while loop in C that would generate the DBF instruction, which was the fastest way to loop on the 68K. ... math, which is much faster if you use the overflow flag, and the overflow ...
    (comp.dsp)
  • Re: Integer Overflow
    ... is made up from 4 separate 32-bit adds, each with no carry and overflow ... The SPU *does not have* scalar operations. ... in compiler land for creating the illusion of scalar operations. ... I don't think the cost is a single bit test on the Cell SPU ...
    (comp.lang.c)
  • Re: Could you please help me - branch command
    ... flags, I'm reffering to the flags in CCR register. ... "overflow" condition. ... program testover; ... neg(bx); ...
    (alt.lang.asm)
  • Re: Could you please help me - branch command
    ... flags, I'm reffering to the flags in CCR register. ... "overflow" condition. ... I used an emulator and I guess it has some bugs. ... with a second question? ...
    (alt.lang.asm)
  • Re: Flags in CCR register after...
    ... with regards to what flags are set when the commands listed below are ... TSTA command tests register A for zero or minus -> A - $00 ... because a sub of 0 doesn't generate an overflow, ...
    (alt.lang.asm)