Opened 14 months ago

Closed 14 months ago

Last modified 2 months ago

#7689 closed feature request (fixed)

Primitive bitwise operations on Int#

Reported by: jstolarek Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc: jan.stolarek@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: primops/should_run/T7689.hs Blocked By:
Blocking: Related Tickets:

Description

During recent work I found a need for primitive bitwise operations that work on Int# type. Currently existing and#, or#, not# and xor# PrimOps work on Word#, which requires writing explicit conversions using int2Word# and word2Int#. It would be most helpful to have equivalent andI#, orI#, notI# and xorI# PrimOps.

Attachments (2)

Test-7689.patch (4.6 KB) - added by jstolarek 14 months ago.
Patch for the testsuite
Primitive-bitwise-operations-on-Int-Fixes-7689.patch (3.4 KB) - added by jstolarek 14 months ago.
Adds primitive bitwise operatons on Int#

Download all attachments as: .zip

Change History (13)

Changed 14 months ago by jstolarek

Patch for the testsuite

comment:1 Changed 14 months ago by jstolarek

  • Owner set to jstolarek

comment:2 Changed 14 months ago by jstolarek

  • Status changed from new to patch

comment:3 Changed 14 months ago by simonmar

  • Difficulty set to Unknown
  • Owner jstolarek deleted
  • Status changed from patch to new

Could you please separate out the whitespace changes into a separate patch?

Changed 14 months ago by jstolarek

Adds primitive bitwise operatons on Int#

comment:4 Changed 14 months ago by jstolarek

  • Status changed from new to patch

Whoops. Sorry about that. I've recently set up my Emacs to remove trailing whitespaces upon saving. A good thing to do, but only assuming that everyone else in the team does that. Anyway, I've uploaded the fixed patch.

comment:5 Changed 14 months ago by jan.stolarek@…

commit 29e86f9b178d3cf436629641ec1f2502c67f0347

Author: Jan Stolarek <jan.stolarek@p.lodz.pl>
Date:   Fri Feb 15 13:10:36 2013 +0100

    Primitive bitwise operations on Int# (Fixes #7689)

 compiler/codeGen/StgCmmPrim.hs  |    4 ++++
 compiler/prelude/PrelRules.lhs  |    9 +++++++++
 compiler/prelude/primops.txt.pp |   11 +++++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

comment:6 Changed 14 months ago by simonmar

  • Milestone set to 7.8.1
  • Resolution set to fixed
  • Status changed from patch to closed

Pushed, thanks!

comment:7 Changed 14 months ago by jstolarek

  • Resolution fixed deleted
  • Status changed from closed to new

It looks that patch for the Testsuite was not merged. Reopening.

comment:8 Changed 14 months ago by jstolarek

  • Status changed from new to patch

comment:9 Changed 14 months ago by simonmar

  • Resolution set to fixed
  • Status changed from patch to closed

Sorry about that, done now:

commit de9a5457567313b5890f6aa8caee8f7802464acb
Author: Jan Stolarek <jan.stolarek@p.lodz.pl>
Date:   Thu Feb 14 13:07:26 2013 +0100

    Test #7689
    
    Tests primitive bitwise `andI#`, `orI#`, `notI#`, `xorI#`
    operations on Int#

comment:10 Changed 8 months ago by jstolarek

  • Cc jan.stolarek@… added
  • Test Case set to primops/should_run/T7689.hs

comment:11 Changed 2 months ago by Herbert Valerio Riedel <hvr@…>

In 0fc4fb5477d3ca22a8b6894db5b1112b9badfdc4/base:

Use new bitwise Int# primops in Data.Bits (re #8791)

The new primops (see also #7689) allow to optimize
`instance Bits Int` by allowing to operate directly on Int#
instead of having to convert to Word# and back to Int# again.

Authored-by: Chris Dueck <crdueck@uwaterloo.ca>
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Note: See TracTickets for help on using tickets.