Change return type for Int64# and Word64# comparisons?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Change return type for Int64# and Word64# comparisons?

Luite Stegeman
Hi all,

With the recent change of comparison primops to return Int# instead of
Bool, the 64 bit operations were also changed, to return Int64# or Word64#:

https://github.com/jstolarek/packages-ghc-prim/commit/07920f03d76dbaec64e3829404d332af22d744fe

It seems a bit wasteful to me to return a value bigger than a machine word
for just a boolean. Changing the type to Int# would make the same
optimizations possible as for the native-sized primops (though for me
personally Bool would be even better since they map to JavaScript bools in
GHCJS).

thoughts?

luite
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130815/70e5a7c7/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Change return type for Int64# and Word64# comparisons?

Jan Stolarek
> for me personally Bool would be even better
To get a Bool you can use wrappers defined in the same module, e.g.:

geInt64# :: Int64# -> Int64# -> Bool  
geInt64# a b = tagToEnum# (int64ToInt# (geInt64## a b))

Looking at the implementation of this wrapper I think Luite has a point - to get a Bool it has to be caste to a machine supported Int#. So I think that it would make sense to have these primops retunr Int# instead of Int64#, but I'd like to hear what others have to say.

Janek




----- Oryginalna wiadomo?? -----
Od: "Luite Stegeman" <stegeman at gmail.com>
Do: "ghc-devs" <ghc-devs at haskell.org>
Wys?ane: czwartek, 15 sierpie? 2013 16:36:59
Temat: Change return type for Int64# and Word64# comparisons?



Hi all,


With the recent change of comparison primops to return Int# instead of Bool, the 64 bit operations were also changed, to return Int64# or Word64#:


https://github.com/jstolarek/packages-ghc-prim/commit/07920f03d76dbaec64e3829404d332af22d744fe 



It seems a bit wasteful to me to return a value bigger than a machine word for just a boolean. Changing the type to Int# would make the same optimizations possible as for the native-sized primops (though  since they map to JavaScript bools in GHCJS).


thoughts?


luite


_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs



Reply | Threaded
Open this post in threaded view
|

Change return type for Int64# and Word64# comparisons?

Carter Schonwald
Please use native size. Eg Int# and/or Word#

Booleans should always always be a size that fits in native registers.  (If
there's good reasons to the contrary, I'd love to hear them)

Thanks Luite for noticing this!

On Thursday, August 15, 2013, Jan Stolarek wrote:

> > for me personally Bool would be even better
> To get a Bool you can use wrappers defined in the same module, e.g.:
>
> geInt64# :: Int64# -> Int64# -> Bool
> geInt64# a b = tagToEnum# (int64ToInt# (geInt64## a b))
>
> Looking at the implementation of this wrapper I think Luite has a point -
> to get a Bool it has to be caste to a machine supported Int#. So I think
> that it would make sense to have these primops retunr Int# instead of
> Int64#, but I'd like to hear what others have to say.
>
> Janek
>
>
>
>
> ----- Oryginalna wiadomo?? -----
> Od: "Luite Stegeman" <stegeman at gmail.com <javascript:;>>
> Do: "ghc-devs" <ghc-devs at haskell.org <javascript:;>>
> Wys?ane: czwartek, 15 sierpie? 2013 16:36:59
> Temat: Change return type for Int64# and Word64# comparisons?
>
>
>
> Hi all,
>
>
> With the recent change of comparison primops to return Int# instead of
> Bool, the 64 bit operations were also changed, to return Int64# or Word64#:
>
>
>
> https://github.com/jstolarek/packages-ghc-prim/commit/07920f03d76dbaec64e3829404d332af22d744fe
>
>
>
> It seems a bit wasteful to me to return a value bigger than a machine word
> for just a boolean. Changing the type to Int# would make the same
> optimizations possible as for the native-sized primops (though  since they
> map to JavaScript bools in GHCJS).
>
>
> thoughts?
>
>
> luite
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org <javascript:;>
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org <javascript:;>
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130815/70ee8222/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Change return type for Int64# and Word64# comparisons?

Simon Peyton Jones
Yes I agree: native Int#!

Simon

From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Carter Schonwald
Sent: 15 August 2013 17:43
To: Jan Stolarek
Cc: ghc-devs
Subject: Re: Change return type for Int64# and Word64# comparisons?

Please use native size. Eg Int# and/or Word#

Booleans should always always be a size that fits in native registers.  (If there's good reasons to the contrary, I'd love to hear them)

Thanks Luite for noticing this!

On Thursday, August 15, 2013, Jan Stolarek wrote:
> for me personally Bool would be even better
To get a Bool you can use wrappers defined in the same module, e.g.:

geInt64# :: Int64# -> Int64# -> Bool
geInt64# a b = tagToEnum# (int64ToInt# (geInt64## a b))

Looking at the implementation of this wrapper I think Luite has a point - to get a Bool it has to be caste to a machine supported Int#. So I think that it would make sense to have these primops retunr Int# instead of Int64#, but I'd like to hear what others have to say.

Janek




----- Oryginalna wiadomo?? -----
Od: "Luite Stegeman" <stegeman at gmail.com<javascript:;>>
Do: "ghc-devs" <ghc-devs at haskell.org<javascript:;>>
Wys?ane: czwartek, 15 sierpie? 2013 16:36:59
Temat: Change return type for Int64# and Word64# comparisons?



Hi all,


With the recent change of comparison primops to return Int# instead of Bool, the 64 bit operations were also changed, to return Int64# or Word64#:


https://github.com/jstolarek/packages-ghc-prim/commit/07920f03d76dbaec64e3829404d332af22d744fe



It seems a bit wasteful to me to return a value bigger than a machine word for just a boolean. Changing the type to Int# would make the same optimizations possible as for the native-sized primops (though  since they map to JavaScript bools in GHCJS).


thoughts?


luite


_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org<javascript:;>
http://www.haskell.org/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org<javascript:;>
http://www.haskell.org/mailman/listinfo/ghc-devs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130815/b59aa5e9/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Change return type for Int64# and Word64# comparisons?

Jan Stolarek
OK, will fix that ASAP.

Janek

Dnia czwartek, 15 sierpnia 2013, Simon Peyton-Jones napisa?:

> Yes I agree: native Int#!
>
> Simon
>
> From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Carter
> Schonwald Sent: 15 August 2013 17:43
> To: Jan Stolarek
> Cc: ghc-devs
> Subject: Re: Change return type for Int64# and Word64# comparisons?
>
> Please use native size. Eg Int# and/or Word#
>
> Booleans should always always be a size that fits in native registers.  (If
> there's good reasons to the contrary, I'd love to hear them)
>
> Thanks Luite for noticing this!
>
> On Thursday, August 15, 2013, Jan Stolarek wrote:
> > for me personally Bool would be even better
>
> To get a Bool you can use wrappers defined in the same module, e.g.:
>
> geInt64# :: Int64# -> Int64# -> Bool
> geInt64# a b = tagToEnum# (int64ToInt# (geInt64## a b))
>
> Looking at the implementation of this wrapper I think Luite has a point -
> to get a Bool it has to be caste to a machine supported Int#. So I think
> that it would make sense to have these primops retunr Int# instead of
> Int64#, but I'd like to hear what others have to say.
>
> Janek
>
>
>
>
> ----- Oryginalna wiadomo?? -----
> Od: "Luite Stegeman" <stegeman at gmail.com<javascript:;>>
> Do: "ghc-devs" <ghc-devs at haskell.org<javascript:;>>
> Wys?ane: czwartek, 15 sierpie? 2013 16:36:59
> Temat: Change return type for Int64# and Word64# comparisons?
>
>
>
> Hi all,
>
>
> With the recent change of comparison primops to return Int# instead of
> Bool, the 64 bit operations were also changed, to return Int64# or Word64#:
>
>
> https://github.com/jstolarek/packages-ghc-prim/commit/07920f03d76dbaec64e38
>29404d332af22d744fe
>
>
>
> It seems a bit wasteful to me to return a value bigger than a machine word
> for just a boolean. Changing the type to Int# would make the same
> optimizations possible as for the native-sized primops (though  since they
> map to JavaScript bools in GHCJS).
>
>
> thoughts?
>
>
> luite
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org<javascript:;>
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org<javascript:;>
> http://www.haskell.org/mailman/listinfo/ghc-devs