Ticket #7014: 0001-add-RULES-for-bitwise-logic-and-shift-primops.patch

File 0001-add-RULES-for-bitwise-logic-and-shift-primops.patch, 1.4 KB (added by akio, 22 months ago)

A proposed patch

  • GHC/Base.lhs

    From b20fc421b5afc2ce35cd16c5c92a03207672d708 Mon Sep 17 00:00:00 2001
    From: Takano Akio <aljee@hyper.cx>
    Date: Wed, 20 Jun 2012 10:56:39 +0900
    Subject: [PATCH] add RULES for bitwise logic and shift primops
    
    ---
     GHC/Base.lhs |   20 ++++++++++++++++++++
     1 files changed, 20 insertions(+), 0 deletions(-)
    
    diff --git a/GHC/Base.lhs b/GHC/Base.lhs
    index f684563..ee5d775 100644
    a b iShiftRL# :: Int# -> Int# -> Int# 
    803803a `iShiftRL#` b | b >=# WORD_SIZE_IN_BITS# = 0# 
    804804                | otherwise                = a `uncheckedIShiftRL#` b 
    805805 
     806{-# RULES 
     807"or# x# 0##"  forall x#. or# x# 0##  = x# 
     808"or# 0## x#"  forall x#. or# 0## x#  = x# 
     809"or# x# x#"   forall x#. or# x# x#   = x# 
     810"and# x# 0##" forall x#. and# x# 0## = 0## 
     811"and# 0## x#" forall x#. and# 0## x# = 0## 
     812"and# x# x#"  forall x#. and# x# x#  = x# 
     813"xor# x# 0##" forall x#. xor# x# 0## = x# 
     814"xor# 0## x#" forall x#. xor# 0## x# = x# 
     815"xor# x# x#"  forall x#. xor# x# x#  = 0## 
     816  #-} 
     817 
     818{-# RULES 
     819"uncheckedShiftL# x# 0#"   forall x#. uncheckedShiftL# x# 0#   = x# 
     820"uncheckedShiftRL# x# 0#"  forall x#. uncheckedShiftRL# x# 0#  = x# 
     821"uncheckedIShiftL# x# 0#"  forall x#. uncheckedIShiftL# x# 0#  = x# 
     822"uncheckedIShiftRA# x# 0#" forall x#. uncheckedIShiftRA# x# 0# = x# 
     823"uncheckedIShiftRL# x# 0#" forall x#. uncheckedIShiftRL# x# 0# = x# 
     824  #-} 
     825 
    806826#if WORD_SIZE_IN_BITS == 32 
    807827{-# RULES 
    808828"narrow32Int#"  forall x#. narrow32Int#   x# = x#