Hi Duncan,

On Sat, 2007-03-24 at 23:10 +0100, Duncan Sands wrote:
> > Fix incorrect test cases for srem. The definition of srem is a remainder so
> > that the sign of the result follows the sign of the divisor.
> 
> In "A rem B", I hope you mean A when you talk of the divisor!  
> Because
> A rem B has the sign of A (unless B exactly divides A, in which case the
> sign is zero).  There is what is also called "mod" which differs in that
> A mod B has the sign of B.  In gcc, mod is called FLOOR_MOD_EXPR and
> rem is called TRUNC_MOD_EXPR.  When I implemented FLOOR_MOD_EXPR in
> turns of rem, I checked that LLVM's rem operator behaves as I describe
> above.

Thanks for pointing this out. I have just implemented it entirely
backwards, because the silly LangRef.html says divisor instead of
dividend. I believe we wanted remainder and not modulo here. According
to: http://en.wikipedia.org/wiki/Modulo_operation, that means the sign
goes with the dividend, not the divisor.

Thanks for noticing.

I'll fix immediately.

Reid.

> 
> Ciao,
> 
> Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to