[GHC] #10962: Improved arithmetic primops
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: | https://ghc.haskell.org/trac/ghc/wiki/ImprovedArithmeticPrimops -------------------------------------+------------------------------------- See the todo list on the wiki page. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * wikipage: https://ghc.haskell.org/trac/ghc/wiki/ImprovedArithmeticPrimops => wiki:ImprovedArithmeticPrimops * milestone: => 8.0.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Description changed by nkaretnikov: Old description:
See the todo list on the wiki page.
New description: There are a few primops that report arithmetic overflow, which work on `Int`s and a couple or so for `Word`s. But that's not enough! Let's add more and clean up the existing code (e.g., make overflow-reporting helpers proper primops) on the go. See the wiki page for the proposal. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Old description:
There are a few primops that report arithmetic overflow, which work on `Int`s and a couple or so for `Word`s. But that's not enough! Let's add more and clean up the existing code (e.g., make overflow-reporting helpers proper primops) on the go. See the wiki page for the proposal.
New description: See the todo list on the wiki page. -- Comment (by tibbe): Could you clarify (on the wiki) what assembly you get if you just implement this in Haskell (on top of the "unsafe" primops) and what assembly you'd like to see. Elsewhere (e.g. with the shift primops) we have been able to implement "safe" primops on top of the unsafe ones. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Description changed by thoughtpolice: Old description:
See the todo list on the wiki page.
New description: There are a few primops that report arithmetic overflow, which work on `Int`s and a couple or so for `Word`s. But that's not enough! Let's add more and clean up the existing code (e.g., make overflow-reporting helpers proper primops) on the go. See the wiki page for the proposal. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Comment (by nkaretnikov): Replying to [comment:3 tibbe]:
Could you clarify (on the wiki) what assembly you get if you just implement this in Haskell (on top of the "unsafe" primops) and what assembly you'd like to see. Elsewhere (e.g. with the shift primops) we have been able to implement "safe" primops on top of the unsafe ones.
https://ghc.haskell.org/trac/ghc/wiki/ImprovedArithmeticPrimops#AsmfromsubWo... .asmfromauser-definedoverflow-checkingfunction -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"8160f42b8dad33e47b4c73ed3f9bf889462e7bfe/ghc" 8160f42b/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="8160f42b8dad33e47b4c73ed3f9bf889462e7bfe" Add subWordC# on x86ish This adds a subWordC# primop which implements subtraction with overflow reporting. Reviewers: tibbe, goldfire, rwbarton, bgamari, austin, hvr Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1334 GHC Trac Issues: #10962 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Comment (by erikd): Sorry, to bring this up so late in the release cycle, but I have soem concerns about both the name and the type signature of this new function. Before this was added we had: {{{ plusWord2# :: Word# -> Word# -> (# Word#, Word# #) timesWord2# :: Word# -> Word# -> (# Word#, Word# #) quotRemWord#" :: Word# -> Word# -> (# Word#, Word# #) }}} and now we have added: {{{ subWordC# :: Word# -> Word# -> (# Word#, Int# #) }}} which has a name and a type signature that is wildly out of whack with the others. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: nkaretnikov Type: task | Status: patch Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1966 Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D1966 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10962: Improved arithmetic primops -------------------------------------+------------------------------------- Reporter: nkaretnikov | Owner: Type: task | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1966 Wiki Page: | wiki:ImprovedArithmeticPrimops | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => new * owner: nkaretnikov => * milestone: 8.2.1 => 8.4.1 Comment: It doesn't seem likely that this will happen for 8.2. Bumping to 8.4. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10962#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC