Commit 0c03faed authored by Jan Stolarek's avatar Jan Stolarek

Comparison primops return Int# (Fixes #6135)

This patch adds tests for new primops and fixes the existing ones.
For a deatiled discussion of this changes please visit the wiki page:
http://hackage.haskell.org/trac/ghc/wiki/PrimBool
parent 5f18e9e0
......@@ -30,6 +30,8 @@ integerConstantFolding:
$(call CHECK,\<6253\>,shiftRInteger)
$(call CHECK,\<641\>,quotInteger)
$(call CHECK,\<68\>,remInteger)
$(call CHECK,\<642\>,divInteger)
$(call CHECK,\<90\>,modInteger)
$(call CHECK,\<200131.0\>,doubleFromInteger)
$(call CHECK,\<200135.0\>,floatFromInteger)
$(call CHECK,\<400276.0\>,encodeIntegerDouble)
......
......@@ -48,6 +48,8 @@ main = do p "plusInteger" plusInteger
p "shiftRInteger" shiftRInteger
p "quotInteger" quotInteger
p "remInteger" remInteger
p "divInteger" divInteger
p "modInteger" modInteger
p "doubleFromInteger" doubleFromInteger
p "floatFromInteger" floatFromInteger
p "decodeIntegerDouble" decodeIntegerDouble
......@@ -172,6 +174,12 @@ quotInteger = 100063 `quot` 156
remInteger :: Integer
remInteger = 100064 `rem` 156
divInteger :: Integer
divInteger = 100286 `div` 156
modInteger :: Integer
modInteger = 100086 `mod` 156
-- For the conversion functions, we can't just check that e.g. 100065
-- is in the resulting core, because it will be regardless of whether
-- the rules fire or not. So we add 100066, and thus rely on the
......
......@@ -40,6 +40,8 @@ shiftLInteger: 1600976
shiftRInteger: 6253
quotInteger: 641
remInteger: 68
divInteger: 642
modInteger: 90
doubleFromInteger: 200131.0
floatFromInteger: 200135.0
decodeIntegerDouble: (6877651390169088,-36)
......
Rule fired: unpack
Rule fired: Class op >>
Rule fired: Class op return
Rule fired: <=#
Rule fired: <=$#
Rule fired: tagToEnum#
Rule fired: fold/build
Rule fired: unpack-list
TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
-- Tests created by Jan Stolarek <jan.stolarek@p.lodz.pl>
{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Exts
main :: IO ()
main = do
print (h 3.0##)
print g
print 3.14159
h :: Double# -> String
h n = if (n ==## 3.0##) || (n ==## 4.0##)
then "First branch"
else "Second branch"
g :: String
g = if ((fromInteger 1 :: Integer) == 1)
then "First branch"
else "Second branch"
test('T6135_should_compile', only_compiler_types(['ghc']), compile, [''])
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
Char < False
Char < False
Char < True
Char < False
=== testing Char <= ===
Char <= True
Char <= False
Char <= True
Char <= True
Char <= True
Char <= True
Char <= False
=== testing Char == ===
Char == True
Char == False
Char == False
Char == True
Char == True
Char == False
Char == False
=== testing Char /= ===
Char /= False
Char /= True
Char /= True
Char /= False
Char /= False
Char /= True
Char /= True
=== testing Int > ===
Int > False
Int > True
Int > False
Int > False
Int > False
Int > True
Int > False
Int > False
Int > True
=== testing Int < ===
Int < False
Int < False
Int < True
Int < False
Int < False
Int < True
Int < False
Int < False
Int < True
=== testing Int >= ===
Int >= True
Int >= True
Int >= False
Int >= True
Int >= True
Int >= True
Int >= False
Int >= False
Int >= True
=== testing Int <= ===
Int <= True
Int <= False
Int <= True
Int <= True
Int <= True
Int <= True
Int <= False
Int <= False
Int <= True
=== testing Int == ===
Int == True
Int == False
Int == False
Int == True
Int == False
Int == True
Int == False
Int == True
Int == True
Int == True
Int == True
=== testing Int /= ===
Int /= False
Int /= True
Int /= True
Int /= False
Int /= True
Int /= False
Int /= True
Int /= False
Int /= False
Int /= False
Int /= False
=== testing Word > ===
Word > False
Word > True
Word > False
Word > False
Word > False
Word > True
Word > False
Word > False
Word > True
=== testing Word < ===
Word < False
Word < False
Word < True
Word < False
Word < False
Word < True
Word < False
Word < False
Word < True
=== testing Word >= ===
Word >= True
Word >= True
Word >= False
Word >= True
Word >= True
Word >= True
Word >= False
Word >= False
Word >= True
=== testing Word <= ===
Word <= True
Word <= False
Word <= True
Word <= True
Word <= True
Word <= True
Word <= False
Word <= False
Word <= True
=== testing Word == ===
Word == True
Word == False
Word == False
Word == True
Word == False
Word == True
Word == False
Word == True
Word == True
Word == True
Word == True
=== testing Word /= ===
Word /= False
Word /= True
Word /= True
Word /= False
Word /= True
Word /= False
Word /= True
Word /= False
Word /= False
Word /= False
Word /= False
=== testing Double > ===
Double > False
Double > True
Double > False
Double > False
Double > False
Double > False
Double > False
Double > False
Double > True
Double > False
Double > False
Double > False
Double > False
Double > False
=== testing Double < ===
Double < False
Double < False
Double < True
Double < False
Double < False
Double < False
Double < False
Double < False
Double < False
Double < True
Double < False
Double < False
Double < False
Double < False
=== testing Double >= ===
Double >= True
Double >= True
Double >= False
Double >= False
Double >= False
Double >= False
Double >= True
Double >= True
Double >= True
Double >= False
Double >= False
Double >= False