[llvm-commits] CVS: llvm/test/Integer/a1.ll a1.ll.out a15.ll a15.ll.out a17.ll a17.ll.out a31.ll a31.ll.out a33.ll a33.ll.out a63.ll.out a7.ll.out a9.ll.out

Reid Spencer reid at x10sys.com
Sat Mar 24 15:18:00 PDT 2007


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 at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070324/e1fe2039/attachment.sig>


More information about the llvm-commits mailing list