[project @ 2001-12-07 11:34:48 by sewardj]
authorsewardj <unknown>
Fri, 7 Dec 2001 11:34:48 +0000 (11:34 +0000)
committersewardj <unknown>
Fri, 7 Dec 2001 11:34:48 +0000 (11:34 +0000)
commit5861bb81decb29ad398c3586f0bba0a1e872ff67
tree47d570bee20720f35cd6d5dee722a66ac906aaeb
parenta523b9fb302b56ce188a2a291652f7913ee1e5f3
[project @ 2001-12-07 11:34:48 by sewardj]
Change the story on shifting primops: SllOp, SrlOp, ISllOp, ISraOp, ISrlOp.

In the old primop story, these were implemented by C macros which
checked that the shift amount did not exceed the word size, and if so
returns a suitable value (0 or -1).  This gives consistent, defined
behaviour for any shift amount.  However, these checks were not
implemented on the NCG route, an inconsistency.

New story: these primops do NOT check their args; they just do the shift.
Shift values >= word size give undefined results.  To reflect this, their
Haskell names have been prefixed with 'unchecked'.

The checks are now done on the Bits instances in the Prelude.  This means
all code generation routes are consistently checked, and hopefully the
simplifier will remove the checks for literal shift amounts.

I have tried to fix up the implementation for 64-bit platforms too, but
not having one to hand, I don't know if it will work as-is.
ghc/compiler/prelude/primops.txt.pp
ghc/includes/PrimOps.h
ghc/lib/std/PrelBase.lhs
ghc/lib/std/PrelBits.lhs
ghc/lib/std/PrelGHC.hi-boot.pp
ghc/lib/std/PrelInt.lhs
ghc/lib/std/PrelWord.lhs
ghc/lib/std/cbits/longlong.c