Commit 4a9f2162 authored by Jan Stolarek's avatar Jan Stolarek

Follow changes in comparison primops (see #6135)

parent eca30442
......@@ -15,7 +15,7 @@ import Control.Exception
hashStr :: Ptr Word8 -> Int -> Int
hashStr (Ptr a#) (I# len#) = loop 0# 0#
where
loop h n | n GHC.Exts.==# len# = I# h
loop h n | isTrue# (n GHC.Exts.==# len#) = I# h
| otherwise = loop h2 (n GHC.Exts.+# 1#)
where !c = ord# (indexCharOffAddr# a# n)
!h2 = (c GHC.Exts.+# (h GHC.Exts.*# 128#)) `remInt#` 4091#
......@@ -9,8 +9,8 @@ import GHC.Ptr (Ptr(..))
utf8DecodeChar# :: Addr# -> Bool -> Bool
{-# NOINLINE utf8DecodeChar# #-}
utf8DecodeChar# a# fred =
case () of
_ | word2Int# (indexWord8OffAddr# a# 0#) <=# 0x7F# -> True
case () of
_ | isTrue# (word2Int# (indexWord8OffAddr# a# 0#) <=# 0x7F#) -> True
-- Omitting the next line gives an ASSERT error:
-- ghc-6.9: panic! (the 'impossible' happened)
......
......@@ -8,7 +8,7 @@ import GHC.Exts
data CList = CNil | CCons Int# CList
mk :: Int# -> CList
mk n = if (n ==# 0#)
mk n = if isTrue# (n ==# 0#)
then CNil
else CCons 1# (mk (n -# 1#))
......
......@@ -48,14 +48,14 @@ test_chars
fill_in :: STUArray s Int Char -> Int# -> Int# -> ST s ()
fill_in arr_in# first# last#
= if (first# ># last#)
= if isTrue# (first# ># last#)
then return ()
else writeArray arr_in# (I# first#) ((chr (I# first#))) >>
fill_in arr_in# (first# +# 1#) last#
lookup_range :: UArray Int Char -> Int# -> Int# -> [Char]
lookup_range arr from# to#
= if (from# ># to#)
= if isTrue# (from# ># to#)
then []
else (arr ! (I# from#))
: (lookup_range arr (from# +# 1#) to#)
......@@ -85,14 +85,14 @@ test_ints
fill_in :: STUArray s Int Int -> Int# -> Int# -> ST s ()
fill_in arr_in# first# last#
= if (first# ># last#)
= if isTrue# (first# ># last#)
then return ()
else writeArray arr_in# (I# first#) (I# (first# *# first#)) >>
fill_in arr_in# (first# +# 1#) last#
lookup_range :: UArray Int Int -> Int# -> Int# -> [Int]
lookup_range arr from# to#
= if (from# ># to#)
= if isTrue# (from# ># to#)
then []
else (arr ! (I# from#))
: (lookup_range arr (from# +# 1#) to#)
......@@ -122,7 +122,7 @@ test_addrs
fill_in :: STUArray s Int (Ptr ()) -> Int# -> Int# -> ST s ()
fill_in arr_in# first# last#
= if (first# ># last#)
= if isTrue# (first# ># last#)
then return ()
else writeArray arr_in# (I# first#)
(Ptr (int2Addr# (first# *# first#))) >>
......@@ -133,7 +133,7 @@ test_addrs
= let
a2i (Ptr a#) = I# (addr2Int# a#)
in
if (from# ># to#)
if isTrue# (from# ># to#)
then []
else (a2i (arr ! (I# from#)))
: (lookup_range arr (from# +# 1#) to#)
......@@ -163,7 +163,7 @@ test_floats
fill_in :: STUArray s Int Float -> Int# -> Int# -> ST s ()
fill_in arr_in# first# last#
= if (first# ># last#)
= if isTrue# (first# ># last#)
then return ()
{- else let e = ((fromIntegral (I# first#)) * pi)
in trace (show e) $ writeFloatArray arr_in# (I# first#) e >>
......@@ -174,7 +174,7 @@ test_floats
lookup_range :: UArray Int Float -> Int# -> Int# -> [Float]
lookup_range arr from# to#
= if (from# ># to#)
= if isTrue# (from# ># to#)
then []
else (arr ! (I# from#))
: (lookup_range arr (from# +# 1#) to#)
......@@ -204,14 +204,14 @@ test_doubles
fill_in :: STUArray s Int Double -> Int# -> Int# -> ST s ()
fill_in arr_in# first# last#
= if (first# ># last#)
= if isTrue# (first# ># last#)
then return ()
else writeArray arr_in# (I# first#) ((fromIntegral (I# first#)) * pi) >>
fill_in arr_in# (first# +# 1#) last#
lookup_range :: UArray Int Double -> Int# -> Int# -> [Double]
lookup_range arr from# to#
= if (from# ># to#)
= if isTrue# (from# ># to#)
then []
else (arr ! (I# from#))
: (lookup_range arr (from# +# 1#) to#)
......
......@@ -10,7 +10,7 @@ import Control.Exception
hashStr :: Ptr Word8 -> Int -> Int
hashStr (Ptr a#) (I# len#) = loop 0# 0#
where
loop h n | n GHC.Exts.==# len# = I# h
loop h n | isTrue# (n GHC.Exts.==# len#) = I# h
| otherwise = loop h2 (n GHC.Exts.+# 1#)
where !c = ord# (indexCharOffAddr# a# n)
!h2 = (c GHC.Exts.+# (h GHC.Exts.*# 128#)) `remInt#` 4091#
......
......@@ -6,7 +6,7 @@ import GHC.Exts
data CList = CNil | CCons Int# CList
mk :: Int# -> CList
mk n = case (n ==# 0#) of
mk n = case isTrue# (n ==# 0#) of
False -> CNil
_ -> CCons 1# (mk (n -# 1#))
......
......@@ -5,7 +5,7 @@ module ShouldFail where
import GHC.Exts
foreign export ccall foo :: Int# -> IO ()
foo i | i ==# 0# = return ()
foo i | isTrue# (i ==# 0#) = return ()
foreign export ccall bar :: Int -> Int#
bar _ = 42#
ccfail003.hs:7:1:
Unacceptable argument type in foreign declaration: Int#
When checking declaration: foreign export ccall "foo" foo :: Int# -> IO ()
When checking declaration:
foreign export ccall "foo" foo :: Int# -> IO ()
ccfail003.hs:10:1:
Unacceptable result type in foreign declaration: Int#
When checking declaration: foreign export ccall "bar" bar :: Int -> Int#
When checking declaration:
foreign export ccall "bar" bar :: Int -> Int#
......@@ -324,7 +324,7 @@ happyDoAction i tk st
happyFail i tk st
-1# -> (happyTrace ("accept.\n")) $
happyAccept i tk st
n | (n <# (0# :: Int#)) -> (happyTrace ("reduce (rule " ++ show rule ++ ")")) $
n | isTrue# (n <# (0# :: Int#)) -> (happyTrace ("reduce (rule " ++ show rule ++ ")")) $
(happyReduceArr ! rule) i tk st
where rule = (I# ((negateInt# ((n +# (1# :: Int#))))))
......@@ -335,8 +335,8 @@ happyDoAction i tk st
where new_state = (n -# (1# :: Int#))
where off = indexShortOffAddr happyActOffsets st
off_i = (off +# i)
check = if (off_i >=# (0# :: Int#))
then (indexShortOffAddr happyCheck off_i ==# i)
check = if isTrue# (off_i >=# (0# :: Int#))
then isTrue# (indexShortOffAddr happyCheck off_i ==# i)
else False
action | check = indexShortOffAddr happyTable off_i
| otherwise = indexShortOffAddr happyDefActions st
......
......@@ -2,18 +2,19 @@
module Main where
import GHC.Exts ( Float(F#),
eqFloat#, neFloat#, ltFloat#,
leFloat#, gtFloat#, geFloat#
import GHC.Exts ( Float(F#),
eqFloat#, neFloat#, ltFloat#,
leFloat#, gtFloat#, geFloat#,
isTrue#
)
fcmp_eq, fcmp_ne, fcmp_lt, fcmp_le, fcmp_gt, fcmp_ge :: (String, Float -> Float -> Bool)
fcmp_eq = ("==", \ (F# a) (F# b) -> a `eqFloat#` b)
fcmp_ne = ("/=", \ (F# a) (F# b) -> a `neFloat#` b)
fcmp_lt = ("< ", \ (F# a) (F# b) -> a `ltFloat#` b)
fcmp_le = ("<=", \ (F# a) (F# b) -> a `leFloat#` b)
fcmp_gt = ("> ", \ (F# a) (F# b) -> a `gtFloat#` b)
fcmp_ge = (">=", \ (F# a) (F# b) -> a `geFloat#` b)
fcmp_eq = ("==", \ (F# a) (F# b) -> isTrue# (a `eqFloat#` b))
fcmp_ne = ("/=", \ (F# a) (F# b) -> isTrue# (a `neFloat#` b))
fcmp_lt = ("< ", \ (F# a) (F# b) -> isTrue# (a `ltFloat#` b))
fcmp_le = ("<=", \ (F# a) (F# b) -> isTrue# (a `leFloat#` b))
fcmp_gt = ("> ", \ (F# a) (F# b) -> isTrue# (a `gtFloat#` b))
fcmp_ge = (">=", \ (F# a) (F# b) -> isTrue# (a `geFloat#` b))
float_fns = [fcmp_eq, fcmp_ne, fcmp_lt, fcmp_le, fcmp_gt, fcmp_ge]
......
Rule fired: unpack
Rule fired: Class op >>
Rule fired: Class op return
Rule fired: <=$#
Rule fired: tagToEnum#
Rule fired: <=#
Rule fired: fold/build
Rule fired: unpack-list
......@@ -12,7 +12,7 @@ main = do
print 3.14159
h :: Double# -> String
h n = if (n ==## 3.0##) || (n ==## 4.0##)
h n = if tagToEnum# (n ==## 3.0##) || tagToEnum# (n ==## 4.0##)
then "First branch"
else "Second branch"
......
This diff is collapsed.
=== testing gtCharI# ===
gtCharI# False
gtCharI# True
gtCharI# False
gtCharI# False
gtCharI# False
gtCharI# False
gtCharI# True
=== testing geCharI# ===
geCharI# True
geCharI# True
geCharI# False
geCharI# True
geCharI# True
geCharI# False
geCharI# True
=== testing ltCharI# ===
ltCharI# False
ltCharI# False
ltCharI# True
ltCharI# False
ltCharI# False
ltCharI# True
ltCharI# False
=== testing leCharI# ===
leCharI# True
leCharI# False
leCharI# True
leCharI# True
leCharI# True
leCharI# True
leCharI# False
=== testing eqCharI# ===
eqCharI# True
eqCharI# False
eqCharI# False
eqCharI# True
eqCharI# True
eqCharI# False
eqCharI# False
=== testing neCharI# ===
neCharI# False
neCharI# True
neCharI# True
neCharI# False
neCharI# False
neCharI# True
neCharI# True
=== testing >$# ===
>$# False
>$# True
>$# False
>$# False
>$# False
>$# True
>$# False
>$# False
>$# True
=== testing <$# ===
<$# False
<$# False
<$# True
<$# False
<$# False
<$# True
<$# False
<$# False
<$# True
=== testing >=$# ===
>=$# True
>=$# True
>=$# False
>=$# True
>=$# True
>=$# True
>=$# False
>=$# False
>=$# True
=== testing <=$# ===
<=$# True
<=$# False
<=$# True
<=$# True
<=$# True
<=$# True
<=$# False
<=$# False
<=$# True
=== testing ==$# ===
==$# True
==$# False
==$# False
==$# True
==$# False
==$# True
==$# False
==$# True
==$# True
==$# True
==$# True
=== testing /=$# ===
/=$# False
/=$# True
/=$# True
/=$# False
/=$# True
/=$# False
/=$# True
/=$# False
/=$# False
/=$# False
/=$# False
=== testing gtWordI# ===
gtWordI# False
gtWordI# True
gtWordI# False
gtWordI# False
gtWordI# False
gtWordI# True
gtWordI# False
gtWordI# False
gtWordI# True
=== testing ltWordI# ===
ltWordI# False
ltWordI# False
ltWordI# True
ltWordI# False
ltWordI# False
ltWordI# True
ltWordI# False
ltWordI# False
ltWordI# True
=== testing geWordI# ===
geWordI# True
geWordI# True
geWordI# False
geWordI# True
geWordI# True
geWordI# True
geWordI# False
geWordI# False
geWordI# True
=== testing leWordI# ===
leWordI# True
leWordI# False
leWordI# True
leWordI# True
leWordI# True
leWordI# True
leWordI# False
leWordI# False
leWordI# True
=== testing eqWordI# ===
eqWordI# True
eqWordI# False
eqWordI# False
eqWordI# True
eqWordI# False
eqWordI# True
eqWordI# False
eqWordI# True
eqWordI# True
eqWordI# True
eqWordI# True
=== testing neWordI# ===
neWordI# False
neWordI# True
neWordI# True
neWordI# False
neWordI# True
neWordI# False
neWordI# True
neWordI# False
neWordI# False
neWordI# False
neWordI# False
=== testing >$## ===
>$## False
>$## True
>$## False
>$## False
>$## False
>$## False
>$## False
>$## False
>$## True
>$## False
>$## False
>$## False
>$## False
>$## False
=== testing <$## ===
<$## False
<$## False
<$## True
<$## False
<$## False
<$## False
<$## False
<$## False
<$## False
<$## True
<$## False
<$## False
<$## False
<$## False
=== testing >=$## ===
>=$## True
>=$## True
>=$## False
>=$## False
>=$## False
>=$## False
>=$## True
>=$## True
>=$## True
>=$## False
>=$## False
>=$## False
>=$## False
>=$## False
=== testing <=$## ===
<=$## True
<=$## False
<=$## True
<=$## False
<=$## False
<=$## False
<=$## True
<=$## True
<=$## False
<=$## True
<=$## False
<=$## False
<=$## False
<=$## False
=== testing ==$## ===
==$## True
==$## False
==$## False
==$## False
==$## False
==$## False
==$## True
==$## True
==$## False
==$## False
==$## False
==$## False
==$## False
==$## False
=== testing /=$## ===
/=$## False
/=$## True
/=$## True
/=$## True
/=$## True
/=$## True
/=$## False
/=$## False
/=$## True
/=$## True
/=$## True
/=$## True
/=$## True
/=$## True
=== testing gtFloatI# ===
gtFloatI# False
gtFloatI# True
gtFloatI# False
gtFloatI# False
gtFloatI# False
gtFloatI# False
gtFloatI# False
gtFloatI# False
gtFloatI# True
gtFloatI# False
gtFloatI# False
gtFloatI# False
gtFloatI# False
gtFloatI# False
=== testing ltFloatI# ===
ltFloatI# False
ltFloatI# False
ltFloatI# True
ltFloatI# False
ltFloatI# False
ltFloatI# False
ltFloatI# False
ltFloatI# False
ltFloatI# False
ltFloatI# True
ltFloatI# False
ltFloatI# False
ltFloatI# False
ltFloatI# False
=== testing geFloatI# ===
geFloatI# True
geFloatI# True
geFloatI# False
geFloatI# False
geFloatI# False
geFloatI# False
geFloatI# True
geFloatI# True
geFloatI# True
geFloatI# False
geFloatI# False
geFloatI# False
geFloatI# False
geFloatI# False
=== testing leFloatI# ===
leFloatI# True
leFloatI# False
leFloatI# True
leFloatI# False
leFloatI# False
leFloatI# False
leFloatI# True
leFloatI# True
leFloatI# False
leFloatI# True
leFloatI# False
leFloatI# False
leFloatI# False
leFloatI# False
=== testing eqFloatI# ===
eqFloatI# True
eqFloatI# False
eqFloatI# False
eqFloatI# False
eqFloatI# False
eqFloatI# False
eqFloatI# True
eqFloatI# True
eqFloatI# False
eqFloatI# False
eqFloatI# False
eqFloatI# False
eqFloatI# False
eqFloatI# False
=== testing neFloatI# ===
neFloatI# False
neFloatI# True
neFloatI# True
neFloatI# True
neFloatI# True
neFloatI# True
neFloatI# False
neFloatI# False
neFloatI# True
neFloatI# True
neFloatI# True
neFloatI# True
neFloatI# True
neFloatI# True
=== TESTING WRAPPERS ===
=== testing Char > ===
Char > False
Char > True
Char > False
Char > False
Char > False
Char > False
Char > True
=== testing Char >= ===
Char >= True
Char >= True
Char >= False
Char >= True
Char >= True
Char >= False
Char >= True
=== testing Char < ===
Char < False
Char < False
Char < True