remAddr# primop inconsistency
Csaba Hruska
csaba.hruska at gmail.com
Mon Feb 1 21:56:01 UTC 2021
Hello,
I've discovered that the remAddr# primop documentation is inconsistent with
the implementation.
According to the docs (primops.txt.pp) the remAddr# should be the same as
remInt#.
> primop AddrRemOp "remAddr#" GenPrimOp Addr# -> Int# -> Int# {Return the remainder when the {\tt Addr\#} arg, treated like an {\tt Int\#}, is divided by the {\tt Int\#} arg.}
>
> But it is implemented with the mo_wordURem instruction, just like the
WordRemOp primop.
> GHC/StgToCmm/Prim.hs:
>
AddrRemOp -> \args -> opTranslate args (mo_wordURem platform)
>
WordRemOp -> \args -> opTranslate args (mo_wordURem platform)
>
IntRemOp -> \args -> opTranslate args (mo_wordSRem platform)
>
Which one is correct, the docs or the implementation?
Regards,
Csaba Hruska
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210201/3f341c44/attachment.html>
More information about the ghc-devs
mailing list