Andreas Klebinger pushed to branch wip/andreask/interpreter_primops at Glasgow Haskell Compiler / GHC

Commits:

17 changed files:

Changes:

  • compiler/GHC/Builtin/primops.txt.pp
    ... ... @@ -147,6 +147,7 @@ defaults
    147 147
        fixity           = Nothing
    
    148 148
        vector           = []
    
    149 149
        deprecated_msg   = {}      -- A non-empty message indicates deprecation
    
    150
    +   div_like         = False   -- Second argument expected to be non zero - used for tests
    
    150 151
     
    
    151 152
     -- Note [When do out-of-line primops go in primops.txt.pp]
    
    152 153
     -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ... ... @@ -296,14 +297,18 @@ primop Int8MulOp "timesInt8#" GenPrimOp Int8# -> Int8# -> Int8#
    296 297
     primop Int8QuotOp "quotInt8#" GenPrimOp Int8# -> Int8# -> Int8#
    
    297 298
       with
    
    298 299
         effect = CanFail
    
    300
    +    div_like = True
    
    299 301
     
    
    300 302
     primop Int8RemOp "remInt8#" GenPrimOp Int8# -> Int8# -> Int8#
    
    301 303
       with
    
    302 304
         effect = CanFail
    
    305
    +    div_like = True
    
    306
    +
    
    303 307
     
    
    304 308
     primop Int8QuotRemOp "quotRemInt8#" GenPrimOp Int8# -> Int8# -> (# Int8#, Int8# #)
    
    305 309
       with
    
    306 310
         effect = CanFail
    
    311
    +    div_like = True
    
    307 312
     
    
    308 313
     primop Int8SllOp "uncheckedShiftLInt8#"  GenPrimOp Int8# -> Int# -> Int8#
    
    309 314
     primop Int8SraOp "uncheckedShiftRAInt8#" GenPrimOp Int8# -> Int# -> Int8#
    
    ... ... @@ -342,14 +347,17 @@ primop Word8MulOp "timesWord8#" GenPrimOp Word8# -> Word8# -> Word8#
    342 347
     primop Word8QuotOp "quotWord8#" GenPrimOp Word8# -> Word8# -> Word8#
    
    343 348
       with
    
    344 349
         effect = CanFail
    
    350
    +    div_like = True
    
    345 351
     
    
    346 352
     primop Word8RemOp "remWord8#" GenPrimOp Word8# -> Word8# -> Word8#
    
    347 353
       with
    
    348 354
         effect = CanFail
    
    355
    +    div_like = True
    
    349 356
     
    
    350 357
     primop Word8QuotRemOp "quotRemWord8#" GenPrimOp Word8# -> Word8# -> (# Word8#, Word8# #)
    
    351 358
       with
    
    352 359
         effect = CanFail
    
    360
    +    div_like = True
    
    353 361
     
    
    354 362
     primop Word8AndOp "andWord8#" GenPrimOp Word8# -> Word8# -> Word8#
    
    355 363
        with commutable = True
    
    ... ... @@ -400,14 +408,17 @@ primop Int16MulOp "timesInt16#" GenPrimOp Int16# -> Int16# -> Int16#
    400 408
     primop Int16QuotOp "quotInt16#" GenPrimOp Int16# -> Int16# -> Int16#
    
    401 409
       with
    
    402 410
         effect = CanFail
    
    411
    +    div_like = True
    
    403 412
     
    
    404 413
     primop Int16RemOp "remInt16#" GenPrimOp Int16# -> Int16# -> Int16#
    
    405 414
       with
    
    406 415
         effect = CanFail
    
    416
    +    div_like = True
    
    407 417
     
    
    408 418
     primop Int16QuotRemOp "quotRemInt16#" GenPrimOp Int16# -> Int16# -> (# Int16#, Int16# #)
    
    409 419
       with
    
    410 420
         effect = CanFail
    
    421
    +    div_like = True
    
    411 422
     
    
    412 423
     primop Int16SllOp "uncheckedShiftLInt16#"  GenPrimOp Int16# -> Int# -> Int16#
    
    413 424
     primop Int16SraOp "uncheckedShiftRAInt16#" GenPrimOp Int16# -> Int# -> Int16#
    
    ... ... @@ -446,14 +457,17 @@ primop Word16MulOp "timesWord16#" GenPrimOp Word16# -> Word16# -> Word16#
    446 457
     primop Word16QuotOp "quotWord16#" GenPrimOp Word16# -> Word16# -> Word16#
    
    447 458
       with
    
    448 459
         effect = CanFail
    
    460
    +    div_like = True
    
    449 461
     
    
    450 462
     primop Word16RemOp "remWord16#" GenPrimOp Word16# -> Word16# -> Word16#
    
    451 463
       with
    
    452 464
         effect = CanFail
    
    465
    +    div_like = True
    
    453 466
     
    
    454 467
     primop Word16QuotRemOp "quotRemWord16#" GenPrimOp Word16# -> Word16# -> (# Word16#, Word16# #)
    
    455 468
       with
    
    456 469
         effect = CanFail
    
    470
    +    div_like = True
    
    457 471
     
    
    458 472
     primop Word16AndOp "andWord16#" GenPrimOp Word16# -> Word16# -> Word16#
    
    459 473
        with commutable = True
    
    ... ... @@ -504,14 +518,17 @@ primop Int32MulOp "timesInt32#" GenPrimOp Int32# -> Int32# -> Int32#
    504 518
     primop Int32QuotOp "quotInt32#" GenPrimOp Int32# -> Int32# -> Int32#
    
    505 519
       with
    
    506 520
         effect = CanFail
    
    521
    +    div_like = True
    
    507 522
     
    
    508 523
     primop Int32RemOp "remInt32#" GenPrimOp Int32# -> Int32# -> Int32#
    
    509 524
       with
    
    510 525
         effect = CanFail
    
    526
    +    div_like = True
    
    511 527
     
    
    512 528
     primop Int32QuotRemOp "quotRemInt32#" GenPrimOp Int32# -> Int32# -> (# Int32#, Int32# #)
    
    513 529
       with
    
    514 530
         effect = CanFail
    
    531
    +    div_like = True
    
    515 532
     
    
    516 533
     primop Int32SllOp "uncheckedShiftLInt32#"  GenPrimOp Int32# -> Int# -> Int32#
    
    517 534
     primop Int32SraOp "uncheckedShiftRAInt32#" GenPrimOp Int32# -> Int# -> Int32#
    
    ... ... @@ -550,14 +567,17 @@ primop Word32MulOp "timesWord32#" GenPrimOp Word32# -> Word32# -> Word32#
    550 567
     primop Word32QuotOp "quotWord32#" GenPrimOp Word32# -> Word32# -> Word32#
    
    551 568
       with
    
    552 569
         effect = CanFail
    
    570
    +    div_like = True
    
    553 571
     
    
    554 572
     primop Word32RemOp "remWord32#" GenPrimOp Word32# -> Word32# -> Word32#
    
    555 573
       with
    
    556 574
         effect = CanFail
    
    575
    +    div_like = True
    
    557 576
     
    
    558 577
     primop Word32QuotRemOp "quotRemWord32#" GenPrimOp Word32# -> Word32# -> (# Word32#, Word32# #)
    
    559 578
       with
    
    560 579
         effect = CanFail
    
    580
    +    div_like = True
    
    561 581
     
    
    562 582
     primop Word32AndOp "andWord32#" GenPrimOp Word32# -> Word32# -> Word32#
    
    563 583
        with commutable = True
    
    ... ... @@ -608,10 +628,12 @@ primop Int64MulOp "timesInt64#" GenPrimOp Int64# -> Int64# -> Int64#
    608 628
     primop Int64QuotOp "quotInt64#" GenPrimOp Int64# -> Int64# -> Int64#
    
    609 629
       with
    
    610 630
         effect = CanFail
    
    631
    +    div_like = True
    
    611 632
     
    
    612 633
     primop Int64RemOp "remInt64#" GenPrimOp Int64# -> Int64# -> Int64#
    
    613 634
       with
    
    614 635
         effect = CanFail
    
    636
    +    div_like = True
    
    615 637
     
    
    616 638
     primop Int64SllOp "uncheckedIShiftL64#"  GenPrimOp Int64# -> Int# -> Int64#
    
    617 639
     primop Int64SraOp "uncheckedIShiftRA64#" GenPrimOp Int64# -> Int# -> Int64#
    
    ... ... @@ -650,10 +672,12 @@ primop Word64MulOp "timesWord64#" GenPrimOp Word64# -> Word64# -> Word64#
    650 672
     primop Word64QuotOp "quotWord64#" GenPrimOp Word64# -> Word64# -> Word64#
    
    651 673
       with
    
    652 674
         effect = CanFail
    
    675
    +    div_like = True
    
    653 676
     
    
    654 677
     primop Word64RemOp "remWord64#" GenPrimOp Word64# -> Word64# -> Word64#
    
    655 678
       with
    
    656 679
         effect = CanFail
    
    680
    +    div_like = True
    
    657 681
     
    
    658 682
     primop Word64AndOp "and64#" GenPrimOp Word64# -> Word64# -> Word64#
    
    659 683
        with commutable = True
    
    ... ... @@ -737,6 +761,7 @@ primop IntQuotOp "quotInt#" GenPrimOp
    737 761
         zero.
    
    738 762
        }
    
    739 763
        with effect = CanFail
    
    764
    +        div_like = True
    
    740 765
     
    
    741 766
     primop   IntRemOp    "remInt#"    GenPrimOp
    
    742 767
        Int# -> Int# -> Int#
    
    ... ... @@ -744,11 +769,13 @@ primop IntRemOp "remInt#" GenPrimOp
    744 769
         behavior is undefined if the second argument is zero.
    
    745 770
        }
    
    746 771
        with effect = CanFail
    
    772
    +        div_like = True
    
    747 773
     
    
    748 774
     primop   IntQuotRemOp "quotRemInt#"    GenPrimOp
    
    749 775
        Int# -> Int# -> (# Int#, Int# #)
    
    750 776
        {Rounds towards zero.}
    
    751 777
        with effect = CanFail
    
    778
    +        div_like = True
    
    752 779
     
    
    753 780
     primop   IntAndOp   "andI#"   GenPrimOp    Int# -> Int# -> Int#
    
    754 781
        {Bitwise "and".}
    
    ... ... @@ -886,19 +913,23 @@ primop WordMul2Op "timesWord2#" GenPrimOp
    886 913
     
    
    887 914
     primop   WordQuotOp   "quotWord#"   GenPrimOp   Word# -> Word# -> Word#
    
    888 915
        with effect = CanFail
    
    916
    +        div_like = True
    
    889 917
     
    
    890 918
     primop   WordRemOp   "remWord#"   GenPrimOp   Word# -> Word# -> Word#
    
    891 919
        with effect = CanFail
    
    920
    +        div_like = True
    
    892 921
     
    
    893 922
     primop   WordQuotRemOp "quotRemWord#" GenPrimOp
    
    894 923
        Word# -> Word# -> (# Word#, Word# #)
    
    895 924
        with effect = CanFail
    
    925
    +        div_like = True
    
    896 926
     
    
    897 927
     primop   WordQuotRem2Op "quotRemWord2#" GenPrimOp
    
    898 928
        Word# -> Word# -> Word# -> (# Word#, Word# #)
    
    899 929
              { Takes high word of dividend, then low word of dividend, then divisor.
    
    900 930
                Requires that high word < divisor.}
    
    901 931
        with effect = CanFail
    
    932
    +        div_like = True
    
    902 933
     
    
    903 934
     primop   WordAndOp   "and#"   GenPrimOp   Word# -> Word# -> Word#
    
    904 935
        with commutable = True
    
    ... ... @@ -4166,6 +4197,7 @@ primop VecQuotOp "quot#" GenPrimOp
    4166 4197
          Do not expect high performance. }
    
    4167 4198
        with effect = CanFail
    
    4168 4199
             vector = INT_VECTOR_TYPES
    
    4200
    +        div_like = True
    
    4169 4201
     
    
    4170 4202
     primop VecRemOp "rem#" GenPrimOp
    
    4171 4203
        VECTOR -> VECTOR -> VECTOR
    
    ... ... @@ -4175,6 +4207,8 @@ primop VecRemOp "rem#" GenPrimOp
    4175 4207
          Do not expect high performance. }
    
    4176 4208
        with effect = CanFail
    
    4177 4209
             vector = INT_VECTOR_TYPES
    
    4210
    +        div_like = True
    
    4211
    +
    
    4178 4212
     
    
    4179 4213
     primop VecNegOp "negate#" GenPrimOp
    
    4180 4214
        VECTOR -> VECTOR
    

  • compiler/GHC/ByteCode/Asm.hs
    ... ... @@ -732,6 +732,143 @@ assembleI platform i = case i of
    732 732
       CCALL off m_addr i       -> do np <- addr m_addr
    
    733 733
                                      emit_ bci_CCALL [wOp off, Op np, SmallOp i]
    
    734 734
       PRIMCALL                 -> emit_ bci_PRIMCALL []
    
    735
    +
    
    736
    +  OP_ADD w -> case w of
    
    737
    +    W64                   -> emit_ bci_OP_ADD_64 []
    
    738
    +    W32                   -> emit_ bci_OP_ADD_32 []
    
    739
    +    W16                   -> emit_ bci_OP_ADD_16 []
    
    740
    +    W8                    -> emit_ bci_OP_ADD_08 []
    
    741
    +    _                     -> unsupported_width
    
    742
    +  OP_SUB w -> case w of
    
    743
    +    W64                   -> emit_ bci_OP_SUB_64 []
    
    744
    +    W32                   -> emit_ bci_OP_SUB_32 []
    
    745
    +    W16                   -> emit_ bci_OP_SUB_16 []
    
    746
    +    W8                    -> emit_ bci_OP_SUB_08 []
    
    747
    +    _                     -> unsupported_width
    
    748
    +  OP_AND w -> case w of
    
    749
    +    W64                   -> emit_ bci_OP_AND_64 []
    
    750
    +    W32                   -> emit_ bci_OP_AND_32 []
    
    751
    +    W16                   -> emit_ bci_OP_AND_16 []
    
    752
    +    W8                    -> emit_ bci_OP_AND_08 []
    
    753
    +    _                     -> unsupported_width
    
    754
    +  OP_XOR w -> case w of
    
    755
    +    W64                   -> emit_ bci_OP_XOR_64 []
    
    756
    +    W32                   -> emit_ bci_OP_XOR_32 []
    
    757
    +    W16                   -> emit_ bci_OP_XOR_16 []
    
    758
    +    W8                    -> emit_ bci_OP_XOR_08 []
    
    759
    +    _                     -> unsupported_width
    
    760
    +  OP_OR w -> case w of
    
    761
    +    W64                    -> emit_ bci_OP_OR_64 []
    
    762
    +    W32                    -> emit_ bci_OP_OR_32 []
    
    763
    +    W16                    -> emit_ bci_OP_OR_16 []
    
    764
    +    W8                     -> emit_ bci_OP_OR_08 []
    
    765
    +    _                      -> unsupported_width
    
    766
    +  OP_NOT w -> case w of
    
    767
    +    W64                   -> emit_ bci_OP_NOT_64 []
    
    768
    +    W32                   -> emit_ bci_OP_NOT_32 []
    
    769
    +    W16                   -> emit_ bci_OP_NOT_16 []
    
    770
    +    W8                    -> emit_ bci_OP_NOT_08 []
    
    771
    +    _                     -> unsupported_width
    
    772
    +  OP_NEG w -> case w of
    
    773
    +    W64                   -> emit_ bci_OP_NEG_64 []
    
    774
    +    W32                   -> emit_ bci_OP_NEG_32 []
    
    775
    +    W16                   -> emit_ bci_OP_NEG_16 []
    
    776
    +    W8                    -> emit_ bci_OP_NEG_08 []
    
    777
    +    _                     -> unsupported_width
    
    778
    +  OP_MUL w -> case w of
    
    779
    +    W64                   -> emit_ bci_OP_MUL_64 []
    
    780
    +    W32                   -> emit_ bci_OP_MUL_32 []
    
    781
    +    W16                   -> emit_ bci_OP_MUL_16 []
    
    782
    +    W8                    -> emit_ bci_OP_MUL_08 []
    
    783
    +    _                     -> unsupported_width
    
    784
    +  OP_SHL w -> case w of
    
    785
    +    W64                   -> emit_ bci_OP_SHL_64 []
    
    786
    +    W32                   -> emit_ bci_OP_SHL_32 []
    
    787
    +    W16                   -> emit_ bci_OP_SHL_16 []
    
    788
    +    W8                    -> emit_ bci_OP_SHL_08 []
    
    789
    +    _                     -> unsupported_width
    
    790
    +  OP_ASR w -> case w of
    
    791
    +    W64                   -> emit_ bci_OP_ASR_64 []
    
    792
    +    W32                   -> emit_ bci_OP_ASR_32 []
    
    793
    +    W16                   -> emit_ bci_OP_ASR_16 []
    
    794
    +    W8                    -> emit_ bci_OP_ASR_08 []
    
    795
    +    _                     -> unsupported_width
    
    796
    +  OP_LSR w -> case w of
    
    797
    +    W64                   -> emit_ bci_OP_LSR_64 []
    
    798
    +    W32                   -> emit_ bci_OP_LSR_32 []
    
    799
    +    W16                   -> emit_ bci_OP_LSR_16 []
    
    800
    +    W8                    -> emit_ bci_OP_LSR_08 []
    
    801
    +    _                     -> unsupported_width
    
    802
    +
    
    803
    +  OP_NEQ w -> case w of
    
    804
    +    W64                   -> emit_ bci_OP_NEQ_64 []
    
    805
    +    W32                   -> emit_ bci_OP_NEQ_32 []
    
    806
    +    W16                   -> emit_ bci_OP_NEQ_16 []
    
    807
    +    W8                    -> emit_ bci_OP_NEQ_08 []
    
    808
    +    _                     -> unsupported_width
    
    809
    +  OP_EQ w -> case w of
    
    810
    +    W64                    -> emit_ bci_OP_EQ_64 []
    
    811
    +    W32                    -> emit_ bci_OP_EQ_32 []
    
    812
    +    W16                    -> emit_ bci_OP_EQ_16 []
    
    813
    +    W8                     -> emit_ bci_OP_EQ_08 []
    
    814
    +    _                      -> unsupported_width
    
    815
    +
    
    816
    +  OP_U_LT w -> case w of
    
    817
    +    W64                  -> emit_ bci_OP_U_LT_64 []
    
    818
    +    W32                  -> emit_ bci_OP_U_LT_32 []
    
    819
    +    W16                  -> emit_ bci_OP_U_LT_16 []
    
    820
    +    W8                   -> emit_ bci_OP_U_LT_08 []
    
    821
    +    _                    -> unsupported_width
    
    822
    +  OP_S_LT w -> case w of
    
    823
    +    W64                  -> emit_ bci_OP_S_LT_64 []
    
    824
    +    W32                  -> emit_ bci_OP_S_LT_32 []
    
    825
    +    W16                  -> emit_ bci_OP_S_LT_16 []
    
    826
    +    W8                   -> emit_ bci_OP_S_LT_08 []
    
    827
    +    _                    -> unsupported_width
    
    828
    +  OP_U_GE w -> case w of
    
    829
    +    W64                  -> emit_ bci_OP_U_GE_64 []
    
    830
    +    W32                  -> emit_ bci_OP_U_GE_32 []
    
    831
    +    W16                  -> emit_ bci_OP_U_GE_16 []
    
    832
    +    W8                   -> emit_ bci_OP_U_GE_08 []
    
    833
    +    _                    -> unsupported_width
    
    834
    +  OP_S_GE w -> case w of
    
    835
    +    W64                  -> emit_ bci_OP_S_GE_64 []
    
    836
    +    W32                  -> emit_ bci_OP_S_GE_32 []
    
    837
    +    W16                  -> emit_ bci_OP_S_GE_16 []
    
    838
    +    W8                   -> emit_ bci_OP_S_GE_08 []
    
    839
    +    _                    -> unsupported_width
    
    840
    +  OP_U_GT w -> case w of
    
    841
    +    W64                  -> emit_ bci_OP_U_GT_64 []
    
    842
    +    W32                  -> emit_ bci_OP_U_GT_32 []
    
    843
    +    W16                  -> emit_ bci_OP_U_GT_16 []
    
    844
    +    W8                   -> emit_ bci_OP_U_GT_08 []
    
    845
    +    _                    -> unsupported_width
    
    846
    +  OP_S_GT w -> case w of
    
    847
    +    W64                  -> emit_ bci_OP_S_GT_64 []
    
    848
    +    W32                  -> emit_ bci_OP_S_GT_32 []
    
    849
    +    W16                  -> emit_ bci_OP_S_GT_16 []
    
    850
    +    W8                   -> emit_ bci_OP_S_GT_08 []
    
    851
    +    _                    -> unsupported_width
    
    852
    +  OP_U_LE w -> case w of
    
    853
    +    W64                  -> emit_ bci_OP_U_LE_64 []
    
    854
    +    W32                  -> emit_ bci_OP_U_LE_32 []
    
    855
    +    W16                  -> emit_ bci_OP_U_LE_16 []
    
    856
    +    W8                   -> emit_ bci_OP_U_LE_08 []
    
    857
    +    _                    -> unsupported_width
    
    858
    +  OP_S_LE w -> case w of
    
    859
    +    W64                  -> emit_ bci_OP_S_LE_64 []
    
    860
    +    W32                  -> emit_ bci_OP_S_LE_32 []
    
    861
    +    W16                  -> emit_ bci_OP_S_LE_16 []
    
    862
    +    W8                   -> emit_ bci_OP_S_LE_08 []
    
    863
    +    _                    -> unsupported_width
    
    864
    +
    
    865
    +  OP_INDEX_ADDR w -> case w of
    
    866
    +    W64                  -> emit_ bci_OP_INDEX_ADDR_64 []
    
    867
    +    W32                  -> emit_ bci_OP_INDEX_ADDR_32 []
    
    868
    +    W16                  -> emit_ bci_OP_INDEX_ADDR_16 []
    
    869
    +    W8                   -> emit_ bci_OP_INDEX_ADDR_08 []
    
    870
    +    _                    -> unsupported_width
    
    871
    +
    
    735 872
       BRK_FUN arr tick_mod tick_mod_id tickx info_mod info_mod_id infox cc ->
    
    736 873
                                   do p1 <- ptr (BCOPtrBreakArray arr)
    
    737 874
                                      tick_addr <- addr tick_mod
    
    ... ... @@ -753,6 +890,7 @@ assembleI platform i = case i of
    753 890
     
    
    754 891
     
    
    755 892
       where
    
    893
    +    unsupported_width = panic "GHC.ByteCode.Asm: Unsupported Width"
    
    756 894
         emit_ = emit word_size
    
    757 895
     
    
    758 896
         literal :: Literal -> m Word
    

  • compiler/GHC/ByteCode/Instr.hs
    ... ... @@ -14,12 +14,15 @@ module GHC.ByteCode.Instr (
    14 14
     import GHC.Prelude
    
    15 15
     
    
    16 16
     import GHC.ByteCode.Types
    
    17
    +import GHC.Cmm.Type (Width)
    
    17 18
     import GHCi.RemoteTypes
    
    18 19
     import GHCi.FFI (C_ffi_cif)
    
    19 20
     import GHC.StgToCmm.Layout     ( ArgRep(..) )
    
    20 21
     import GHC.Utils.Outputable
    
    22
    +import GHC.Unit.Types (UnitId)
    
    21 23
     import GHC.Types.Name
    
    22 24
     import GHC.Types.Literal
    
    25
    +import GHC.Types.Unique
    
    23 26
     import GHC.Core.DataCon
    
    24 27
     import GHC.Builtin.PrimOps
    
    25 28
     import GHC.Runtime.Heap.Layout ( StgWord )
    
    ... ... @@ -36,8 +39,6 @@ import GHC.Stack.CCS (CostCentre)
    36 39
     import GHC.Stg.Syntax
    
    37 40
     import GHCi.BreakArray (BreakArray)
    
    38 41
     import Language.Haskell.Syntax.Module.Name (ModuleName)
    
    39
    -import GHC.Types.Unique
    
    40
    -import GHC.Unit.Types (UnitId)
    
    41 42
     
    
    42 43
     -- ----------------------------------------------------------------------------
    
    43 44
     -- Bytecode instructions
    
    ... ... @@ -220,6 +221,39 @@ data BCInstr
    220 221
     
    
    221 222
        | PRIMCALL
    
    222 223
     
    
    224
    +   -- Primops - The actual interpreter instructions are flattened into 64/32/16/8 wide
    
    225
    +   -- instructions. But for generating code it's handy to have the width as argument
    
    226
    +   -- to avoid duplication.
    
    227
    +   | OP_ADD !Width
    
    228
    +   | OP_SUB !Width
    
    229
    +   | OP_AND !Width
    
    230
    +   | OP_XOR !Width
    
    231
    +   | OP_MUL !Width
    
    232
    +   | OP_SHL !Width
    
    233
    +   | OP_ASR !Width
    
    234
    +   | OP_LSR !Width
    
    235
    +   | OP_OR  !Width
    
    236
    +
    
    237
    +   | OP_NOT !Width
    
    238
    +   | OP_NEG !Width
    
    239
    +
    
    240
    +   | OP_NEQ !Width
    
    241
    +   | OP_EQ !Width
    
    242
    +
    
    243
    +   | OP_U_LT !Width
    
    244
    +   | OP_U_GE !Width
    
    245
    +   | OP_U_GT !Width
    
    246
    +   | OP_U_LE !Width
    
    247
    +
    
    248
    +   | OP_S_LT !Width
    
    249
    +   | OP_S_GE !Width
    
    250
    +   | OP_S_GT !Width
    
    251
    +   | OP_S_LE !Width
    
    252
    +
    
    253
    +   -- Always puts at least a machine word on the stack.
    
    254
    +   -- We zero extend the result we put on the stack according to host byte order.
    
    255
    +   | OP_INDEX_ADDR !Width
    
    256
    +
    
    223 257
        -- For doing magic ByteArray passing to foreign calls
    
    224 258
        | SWIZZLE          !WordOff -- to the ptr N words down the stack,
    
    225 259
                           !Int     -- add M
    
    ... ... @@ -401,6 +435,32 @@ instance Outputable BCInstr where
    401 435
                                                           0x2 -> text "(unsafe)"
    
    402 436
                                                           _   -> empty)
    
    403 437
        ppr PRIMCALL              = text "PRIMCALL"
    
    438
    +
    
    439
    +   ppr (OP_ADD w)            = text "OP_ADD_" <> ppr w
    
    440
    +   ppr (OP_SUB w)            = text "OP_SUB_" <> ppr w
    
    441
    +   ppr (OP_AND w)            = text "OP_AND_" <> ppr w
    
    442
    +   ppr (OP_XOR w)            = text "OP_XOR_" <> ppr w
    
    443
    +   ppr (OP_OR w)             = text "OP_OR_" <> ppr w
    
    444
    +   ppr (OP_NOT w)            = text "OP_NOT_" <> ppr w
    
    445
    +   ppr (OP_NEG w)            = text "OP_NEG_" <> ppr w
    
    446
    +   ppr (OP_MUL w)            = text "OP_MUL_" <> ppr w
    
    447
    +   ppr (OP_SHL w)            = text "OP_SHL_" <> ppr w
    
    448
    +   ppr (OP_ASR w)            = text "OP_ASR_" <> ppr w
    
    449
    +   ppr (OP_LSR w)            = text "OP_LSR_" <> ppr w
    
    450
    +
    
    451
    +   ppr (OP_EQ w)             = text "OP_EQ_" <> ppr w
    
    452
    +   ppr (OP_NEQ w)            = text "OP_NEQ_" <> ppr w
    
    453
    +   ppr (OP_S_LT w)           = text "OP_S_LT_" <> ppr w
    
    454
    +   ppr (OP_S_GE w)           = text "OP_S_GE_" <> ppr w
    
    455
    +   ppr (OP_S_GT w)           = text "OP_S_GT_" <> ppr w
    
    456
    +   ppr (OP_S_LE w)           = text "OP_S_LE_" <> ppr w
    
    457
    +   ppr (OP_U_LT w)           = text "OP_U_LT_" <> ppr w
    
    458
    +   ppr (OP_U_GE w)           = text "OP_U_GE_" <> ppr w
    
    459
    +   ppr (OP_U_GT w)           = text "OP_U_GT_" <> ppr w
    
    460
    +   ppr (OP_U_LE w)           = text "OP_U_LE_" <> ppr w
    
    461
    +
    
    462
    +   ppr (OP_INDEX_ADDR w)     = text "OP_INDEX_ADDR_" <> ppr w
    
    463
    +
    
    404 464
        ppr (SWIZZLE stkoff n)    = text "SWIZZLE " <+> text "stkoff" <+> ppr stkoff
    
    405 465
                                                    <+> text "by" <+> ppr n
    
    406 466
        ppr ENTER                 = text "ENTER"
    
    ... ... @@ -509,6 +569,31 @@ bciStackUse RETURN{} = 1 -- pushes stg_ret_X for some X
    509 569
     bciStackUse RETURN_TUPLE{}        = 1 -- pushes stg_ret_t header
    
    510 570
     bciStackUse CCALL{}               = 0
    
    511 571
     bciStackUse PRIMCALL{}            = 1 -- pushes stg_primcall
    
    572
    +bciStackUse OP_ADD{}              = 0 -- We overestimate, it's -1 actually ...
    
    573
    +bciStackUse OP_SUB{}              = 0
    
    574
    +bciStackUse OP_AND{}              = 0
    
    575
    +bciStackUse OP_XOR{}              = 0
    
    576
    +bciStackUse OP_OR{}               = 0
    
    577
    +bciStackUse OP_NOT{}              = 0
    
    578
    +bciStackUse OP_NEG{}              = 0
    
    579
    +bciStackUse OP_MUL{}              = 0
    
    580
    +bciStackUse OP_SHL{}              = 0
    
    581
    +bciStackUse OP_ASR{}              = 0
    
    582
    +bciStackUse OP_LSR{}              = 0
    
    583
    +
    
    584
    +bciStackUse OP_NEQ{}              = 0
    
    585
    +bciStackUse OP_EQ{}               = 0
    
    586
    +bciStackUse OP_S_LT{}               = 0
    
    587
    +bciStackUse OP_S_GT{}               = 0
    
    588
    +bciStackUse OP_S_LE{}               = 0
    
    589
    +bciStackUse OP_S_GE{}               = 0
    
    590
    +bciStackUse OP_U_LT{}               = 0
    
    591
    +bciStackUse OP_U_GT{}               = 0
    
    592
    +bciStackUse OP_U_LE{}               = 0
    
    593
    +bciStackUse OP_U_GE{}               = 0
    
    594
    +
    
    595
    +bciStackUse OP_INDEX_ADDR{}         = 0
    
    596
    +
    
    512 597
     bciStackUse SWIZZLE{}             = 0
    
    513 598
     bciStackUse BRK_FUN{}             = 0
    
    514 599
     
    

  • compiler/GHC/StgToByteCode.hs
    ... ... @@ -58,6 +58,7 @@ import GHC.Builtin.Uniques
    58 58
     import GHC.Data.FastString
    
    59 59
     import GHC.Utils.Panic
    
    60 60
     import GHC.Utils.Exception (evaluate)
    
    61
    +import GHC.CmmToAsm.Config (platformWordWidth)
    
    61 62
     import GHC.StgToCmm.Closure ( NonVoid(..), fromNonVoid, idPrimRepU,
    
    62 63
                                   addIdReps, addArgReps,
    
    63 64
                                   assertNonVoidIds, assertNonVoidStgArgs )
    
    ... ... @@ -582,8 +583,7 @@ returnUnboxedTuple d s p es = do
    582 583
     
    
    583 584
     -- Compile code to apply the given expression to the remaining args
    
    584 585
     -- on the stack, returning a HNF.
    
    585
    -schemeE
    
    586
    -    :: StackDepth -> Sequel -> BCEnv -> CgStgExpr -> BcM BCInstrList
    
    586
    +schemeE :: StackDepth -> Sequel -> BCEnv -> CgStgExpr -> BcM BCInstrList
    
    587 587
     schemeE d s p (StgLit lit) = returnUnliftedAtom d s p (StgLitArg lit)
    
    588 588
     schemeE d s p (StgApp x [])
    
    589 589
        | isUnliftedType (idType x) = returnUnliftedAtom d s p (StgVarArg x)
    
    ... ... @@ -734,8 +734,14 @@ schemeT d s p (StgOpApp (StgFCallOp (CCall ccall_spec) _ty) args result_ty)
    734 734
           then generateCCall d s p ccall_spec result_ty args
    
    735 735
           else unsupportedCConvException
    
    736 736
     
    
    737
    -schemeT d s p (StgOpApp (StgPrimOp op) args _ty)
    
    738
    -   = doTailCall d s p (primOpId op) (reverse args)
    
    737
    +schemeT d s p (StgOpApp (StgPrimOp op) args _ty) = do
    
    738
    +  profile <- getProfile
    
    739
    +  let platform = profilePlatform profile
    
    740
    +  case doPrimOp platform op d s p args of
    
    741
    +    -- Can we do this right in the interpreter?
    
    742
    +    Just prim_code -> prim_code
    
    743
    +    -- Otherwise we have to do a call to the primop wrapper instead :(
    
    744
    +    _         -> doTailCall d s p (primOpId op) (reverse args)
    
    739 745
     
    
    740 746
     schemeT d s p (StgOpApp (StgPrimCallOp (PrimCall label unit)) args result_ty)
    
    741 747
        = generatePrimCall d s p label (Just unit) result_ty args
    
    ... ... @@ -830,6 +836,300 @@ doTailCall init_d s p fn args = do
    830 836
         (final_d, more_push_code) <- push_seq (d + sz) args
    
    831 837
         return (final_d, push_code `appOL` more_push_code)
    
    832 838
     
    
    839
    +doPrimOp  :: Platform
    
    840
    +          -> PrimOp
    
    841
    +          -> StackDepth
    
    842
    +          -> Sequel
    
    843
    +          -> BCEnv
    
    844
    +          -> [StgArg]
    
    845
    +          -> Maybe (BcM BCInstrList)
    
    846
    +doPrimOp platform op init_d s p args =
    
    847
    +  case op of
    
    848
    +    IntAddOp -> sizedPrimOp OP_ADD
    
    849
    +    Int64AddOp -> only64bit $ sizedPrimOp OP_ADD
    
    850
    +    Int32AddOp -> sizedPrimOp OP_ADD
    
    851
    +    Int16AddOp -> sizedPrimOp OP_ADD
    
    852
    +    Int8AddOp -> sizedPrimOp OP_ADD
    
    853
    +    WordAddOp -> sizedPrimOp OP_ADD
    
    854
    +    Word64AddOp -> only64bit $ sizedPrimOp OP_ADD
    
    855
    +    Word32AddOp -> sizedPrimOp OP_ADD
    
    856
    +    Word16AddOp -> sizedPrimOp OP_ADD
    
    857
    +    Word8AddOp -> sizedPrimOp OP_ADD
    
    858
    +    AddrAddOp -> sizedPrimOp OP_ADD
    
    859
    +
    
    860
    +    IntMulOp -> sizedPrimOp OP_MUL
    
    861
    +    Int64MulOp -> only64bit $ sizedPrimOp OP_MUL
    
    862
    +    Int32MulOp -> sizedPrimOp OP_MUL
    
    863
    +    Int16MulOp -> sizedPrimOp OP_MUL
    
    864
    +    Int8MulOp -> sizedPrimOp OP_MUL
    
    865
    +    WordMulOp -> sizedPrimOp OP_MUL
    
    866
    +    Word64MulOp -> only64bit $ sizedPrimOp OP_MUL
    
    867
    +    Word32MulOp -> sizedPrimOp OP_MUL
    
    868
    +    Word16MulOp -> sizedPrimOp OP_MUL
    
    869
    +    Word8MulOp -> sizedPrimOp OP_MUL
    
    870
    +
    
    871
    +    IntSubOp -> sizedPrimOp OP_SUB
    
    872
    +    WordSubOp -> sizedPrimOp OP_SUB
    
    873
    +    Int64SubOp -> only64bit $ sizedPrimOp OP_SUB
    
    874
    +    Int32SubOp -> sizedPrimOp OP_SUB
    
    875
    +    Int16SubOp -> sizedPrimOp OP_SUB
    
    876
    +    Int8SubOp -> sizedPrimOp OP_SUB
    
    877
    +    Word64SubOp -> only64bit $ sizedPrimOp OP_SUB
    
    878
    +    Word32SubOp -> sizedPrimOp OP_SUB
    
    879
    +    Word16SubOp -> sizedPrimOp OP_SUB
    
    880
    +    Word8SubOp -> sizedPrimOp OP_SUB
    
    881
    +    AddrSubOp -> sizedPrimOp OP_SUB
    
    882
    +
    
    883
    +    IntAndOp -> sizedPrimOp OP_AND
    
    884
    +    WordAndOp -> sizedPrimOp OP_AND
    
    885
    +    Word64AndOp -> only64bit $ sizedPrimOp OP_AND
    
    886
    +    Word32AndOp -> sizedPrimOp OP_AND
    
    887
    +    Word16AndOp -> sizedPrimOp OP_AND
    
    888
    +    Word8AndOp -> sizedPrimOp OP_AND
    
    889
    +
    
    890
    +    IntNotOp -> sizedPrimOp OP_NOT
    
    891
    +    WordNotOp -> sizedPrimOp OP_NOT
    
    892
    +    Word64NotOp -> only64bit $ sizedPrimOp OP_NOT
    
    893
    +    Word32NotOp -> sizedPrimOp OP_NOT
    
    894
    +    Word16NotOp -> sizedPrimOp OP_NOT
    
    895
    +    Word8NotOp -> sizedPrimOp OP_NOT
    
    896
    +
    
    897
    +    IntXorOp -> sizedPrimOp OP_XOR
    
    898
    +    WordXorOp -> sizedPrimOp OP_XOR
    
    899
    +    Word64XorOp -> only64bit $ sizedPrimOp OP_XOR
    
    900
    +    Word32XorOp -> sizedPrimOp OP_XOR
    
    901
    +    Word16XorOp -> sizedPrimOp OP_XOR
    
    902
    +    Word8XorOp -> sizedPrimOp OP_XOR
    
    903
    +
    
    904
    +    IntOrOp -> sizedPrimOp OP_OR
    
    905
    +    WordOrOp -> sizedPrimOp OP_OR
    
    906
    +    Word64OrOp -> only64bit $ sizedPrimOp OP_OR
    
    907
    +    Word32OrOp -> sizedPrimOp OP_OR
    
    908
    +    Word16OrOp -> sizedPrimOp OP_OR
    
    909
    +    Word8OrOp -> sizedPrimOp OP_OR
    
    910
    +
    
    911
    +    WordSllOp   -> sizedPrimOp OP_SHL
    
    912
    +    Word64SllOp -> only64bit $ sizedPrimOp OP_SHL -- check 32bit platform
    
    913
    +    Word32SllOp -> sizedPrimOp OP_SHL
    
    914
    +    Word16SllOp -> sizedPrimOp OP_SHL
    
    915
    +    Word8SllOp -> sizedPrimOp OP_SHL
    
    916
    +    IntSllOp    -> sizedPrimOp OP_SHL
    
    917
    +    Int64SllOp  -> only64bit $ sizedPrimOp OP_SHL
    
    918
    +    Int32SllOp  -> sizedPrimOp OP_SHL
    
    919
    +    Int16SllOp  -> sizedPrimOp OP_SHL
    
    920
    +    Int8SllOp  -> sizedPrimOp OP_SHL
    
    921
    +
    
    922
    +    WordSrlOp   -> sizedPrimOp OP_LSR
    
    923
    +    Word64SrlOp -> only64bit $ sizedPrimOp OP_LSR
    
    924
    +    Word32SrlOp -> sizedPrimOp OP_LSR
    
    925
    +    Word16SrlOp -> sizedPrimOp OP_LSR
    
    926
    +    Word8SrlOp -> sizedPrimOp OP_LSR
    
    927
    +    IntSrlOp    -> sizedPrimOp OP_LSR
    
    928
    +    Int64SrlOp  -> only64bit $ sizedPrimOp OP_LSR -- check 32bit platform
    
    929
    +    Int32SrlOp  -> sizedPrimOp OP_LSR
    
    930
    +    Int16SrlOp  -> sizedPrimOp OP_LSR
    
    931
    +    Int8SrlOp  -> sizedPrimOp OP_LSR
    
    932
    +
    
    933
    +    IntSraOp -> sizedPrimOp OP_ASR
    
    934
    +    Int64SraOp -> only64bit $ sizedPrimOp OP_ASR -- check 32bit platform
    
    935
    +    Int32SraOp -> sizedPrimOp OP_ASR
    
    936
    +    Int16SraOp -> sizedPrimOp OP_ASR
    
    937
    +    Int8SraOp -> sizedPrimOp OP_ASR
    
    938
    +
    
    939
    +
    
    940
    +    IntNeOp -> sizedPrimOp OP_NEQ
    
    941
    +    Int64NeOp -> only64bit $ sizedPrimOp OP_NEQ
    
    942
    +    Int32NeOp -> sizedPrimOp OP_NEQ
    
    943
    +    Int16NeOp -> sizedPrimOp OP_NEQ
    
    944
    +    Int8NeOp -> sizedPrimOp OP_NEQ
    
    945
    +    WordNeOp -> sizedPrimOp OP_NEQ
    
    946
    +    Word64NeOp -> only64bit $ sizedPrimOp OP_NEQ
    
    947
    +    Word32NeOp -> sizedPrimOp OP_NEQ
    
    948
    +    Word16NeOp -> sizedPrimOp OP_NEQ
    
    949
    +    Word8NeOp -> sizedPrimOp OP_NEQ
    
    950
    +    AddrNeOp -> sizedPrimOp OP_NEQ
    
    951
    +
    
    952
    +    IntEqOp -> sizedPrimOp OP_EQ
    
    953
    +    Int64EqOp -> only64bit $ sizedPrimOp OP_EQ
    
    954
    +    Int32EqOp -> sizedPrimOp OP_EQ
    
    955
    +    Int16EqOp -> sizedPrimOp OP_EQ
    
    956
    +    Int8EqOp -> sizedPrimOp OP_EQ
    
    957
    +    WordEqOp -> sizedPrimOp OP_EQ
    
    958
    +    Word64EqOp -> only64bit $ sizedPrimOp OP_EQ
    
    959
    +    Word32EqOp -> sizedPrimOp OP_EQ
    
    960
    +    Word16EqOp -> sizedPrimOp OP_EQ
    
    961
    +    Word8EqOp -> sizedPrimOp OP_EQ
    
    962
    +    AddrEqOp -> sizedPrimOp OP_EQ
    
    963
    +    CharEqOp -> sizedPrimOp OP_EQ
    
    964
    +
    
    965
    +    IntLtOp -> sizedPrimOp OP_S_LT
    
    966
    +    Int64LtOp -> only64bit $ sizedPrimOp OP_S_LT
    
    967
    +    Int32LtOp -> sizedPrimOp OP_S_LT
    
    968
    +    Int16LtOp -> sizedPrimOp OP_S_LT
    
    969
    +    Int8LtOp -> sizedPrimOp OP_S_LT
    
    970
    +    WordLtOp -> sizedPrimOp OP_U_LT
    
    971
    +    Word64LtOp -> only64bit $ sizedPrimOp OP_U_LT
    
    972
    +    Word32LtOp -> sizedPrimOp OP_U_LT
    
    973
    +    Word16LtOp -> sizedPrimOp OP_U_LT
    
    974
    +    Word8LtOp -> sizedPrimOp OP_U_LT
    
    975
    +    AddrLtOp -> sizedPrimOp OP_U_LT
    
    976
    +    CharLtOp -> sizedPrimOp OP_U_LT
    
    977
    +
    
    978
    +    IntGeOp -> sizedPrimOp OP_S_GE
    
    979
    +    Int64GeOp -> only64bit $ sizedPrimOp OP_S_GE
    
    980
    +    Int32GeOp -> sizedPrimOp OP_S_GE
    
    981
    +    Int16GeOp -> sizedPrimOp OP_S_GE
    
    982
    +    Int8GeOp -> sizedPrimOp OP_S_GE
    
    983
    +    WordGeOp -> sizedPrimOp OP_U_GE
    
    984
    +    Word64GeOp -> only64bit $ sizedPrimOp OP_U_GE
    
    985
    +    Word32GeOp -> sizedPrimOp OP_U_GE
    
    986
    +    Word16GeOp -> sizedPrimOp OP_U_GE
    
    987
    +    Word8GeOp -> sizedPrimOp OP_U_GE
    
    988
    +    AddrGeOp -> sizedPrimOp OP_U_GE
    
    989
    +    CharGeOp -> sizedPrimOp OP_U_GE
    
    990
    +
    
    991
    +    IntGtOp -> sizedPrimOp OP_S_GT
    
    992
    +    Int64GtOp -> only64bit $ sizedPrimOp OP_S_GT
    
    993
    +    Int32GtOp -> sizedPrimOp OP_S_GT
    
    994
    +    Int16GtOp -> sizedPrimOp OP_S_GT
    
    995
    +    Int8GtOp -> sizedPrimOp OP_S_GT
    
    996
    +    WordGtOp -> sizedPrimOp OP_U_GT
    
    997
    +    Word64GtOp -> only64bit $ sizedPrimOp OP_U_GT
    
    998
    +    Word32GtOp -> sizedPrimOp OP_U_GT
    
    999
    +    Word16GtOp -> sizedPrimOp OP_U_GT
    
    1000
    +    Word8GtOp -> sizedPrimOp OP_U_GT
    
    1001
    +    AddrGtOp -> sizedPrimOp OP_U_GT
    
    1002
    +    CharGtOp -> sizedPrimOp OP_U_GT
    
    1003
    +
    
    1004
    +    IntLeOp -> sizedPrimOp OP_S_LE
    
    1005
    +    Int64LeOp -> only64bit $ sizedPrimOp OP_S_LE
    
    1006
    +    Int32LeOp -> sizedPrimOp OP_S_LE
    
    1007
    +    Int16LeOp -> sizedPrimOp OP_S_LE
    
    1008
    +    Int8LeOp -> sizedPrimOp OP_S_LE
    
    1009
    +    WordLeOp -> sizedPrimOp OP_U_LE
    
    1010
    +    Word64LeOp -> only64bit $ sizedPrimOp OP_U_LE
    
    1011
    +    Word32LeOp -> sizedPrimOp OP_U_LE
    
    1012
    +    Word16LeOp -> sizedPrimOp OP_U_LE
    
    1013
    +    Word8LeOp -> sizedPrimOp OP_U_LE
    
    1014
    +    AddrLeOp -> sizedPrimOp OP_U_LE
    
    1015
    +    CharLeOp -> sizedPrimOp OP_U_LE
    
    1016
    +
    
    1017
    +    IntNegOp -> sizedPrimOp OP_NEG
    
    1018
    +    Int64NegOp -> only64bit $ sizedPrimOp OP_NEG
    
    1019
    +    Int32NegOp -> sizedPrimOp OP_NEG
    
    1020
    +    Int16NegOp -> sizedPrimOp OP_NEG
    
    1021
    +    Int8NegOp -> sizedPrimOp OP_NEG
    
    1022
    +
    
    1023
    +    IntToWordOp     -> mk_conv (platformWordWidth platform)
    
    1024
    +    WordToIntOp     -> mk_conv (platformWordWidth platform)
    
    1025
    +    Int8ToWord8Op   -> mk_conv W8
    
    1026
    +    Word8ToInt8Op   -> mk_conv W8
    
    1027
    +    Int16ToWord16Op -> mk_conv W16
    
    1028
    +    Word16ToInt16Op -> mk_conv W16
    
    1029
    +    Int32ToWord32Op -> mk_conv W32
    
    1030
    +    Word32ToInt32Op -> mk_conv W32
    
    1031
    +    Int64ToWord64Op -> only64bit $ mk_conv W64
    
    1032
    +    Word64ToInt64Op -> only64bit $ mk_conv W64
    
    1033
    +    IntToAddrOp     -> mk_conv (platformWordWidth platform)
    
    1034
    +    AddrToIntOp     -> mk_conv (platformWordWidth platform)
    
    1035
    +    ChrOp           -> mk_conv (platformWordWidth platform)   -- Int# and Char# are rep'd the same
    
    1036
    +    OrdOp           -> mk_conv (platformWordWidth platform)
    
    1037
    +
    
    1038
    +    -- Memory primops, expand the ghci-mem-primops test if you add more.
    
    1039
    +    IndexOffAddrOp_Word8 ->  primOpWithRep (OP_INDEX_ADDR W8) W8
    
    1040
    +    IndexOffAddrOp_Word16 -> primOpWithRep (OP_INDEX_ADDR W16) W16
    
    1041
    +    IndexOffAddrOp_Word32 -> primOpWithRep (OP_INDEX_ADDR W32) W32
    
    1042
    +    IndexOffAddrOp_Word64 -> only64bit $ primOpWithRep (OP_INDEX_ADDR W64) W64
    
    1043
    +
    
    1044
    +    _ -> Nothing
    
    1045
    +  where
    
    1046
    +    only64bit = if platformWordWidth platform == W64 then id else const Nothing
    
    1047
    +    primArg1Width :: StgArg -> Width
    
    1048
    +    primArg1Width arg
    
    1049
    +      | rep <- (stgArgRepU arg)
    
    1050
    +      = case rep of
    
    1051
    +        AddrRep -> platformWordWidth platform
    
    1052
    +        IntRep -> platformWordWidth platform
    
    1053
    +        WordRep -> platformWordWidth platform
    
    1054
    +
    
    1055
    +        Int64Rep -> W64
    
    1056
    +        Word64Rep -> W64
    
    1057
    +
    
    1058
    +        Int32Rep -> W32
    
    1059
    +        Word32Rep -> W32
    
    1060
    +
    
    1061
    +        Int16Rep -> W16
    
    1062
    +        Word16Rep -> W16
    
    1063
    +
    
    1064
    +        Int8Rep -> W8
    
    1065
    +        Word8Rep -> W8
    
    1066
    +
    
    1067
    +        FloatRep -> unexpectedRep
    
    1068
    +        DoubleRep -> unexpectedRep
    
    1069
    +
    
    1070
    +        BoxedRep{} -> unexpectedRep
    
    1071
    +        VecRep{} -> unexpectedRep
    
    1072
    +      where
    
    1073
    +        unexpectedRep = panic "doPrimOp: Unexpected argument rep"
    
    1074
    +
    
    1075
    +
    
    1076
    +    -- TODO: The slides for the result need to be two words on 32bit for 64bit ops.
    
    1077
    +    mkNReturn width
    
    1078
    +      | W64 <- width = RETURN L -- L works for 64 bit on any platform
    
    1079
    +      | otherwise = RETURN N -- <64bit width, fits in word on all platforms
    
    1080
    +
    
    1081
    +    mkSlideWords width = if platformWordWidth platform < width then 2 else 1
    
    1082
    +
    
    1083
    +    -- Push args, execute primop, slide, return_N
    
    1084
    +    -- Decides width of operation based on first argument.
    
    1085
    +    sizedPrimOp op_inst = Just $ do
    
    1086
    +      let width = primArg1Width (head args)
    
    1087
    +      prim_code <- mkPrimOpCode init_d s p (op_inst width) $ args
    
    1088
    +      let slide = mkSlideW (mkSlideWords width) (bytesToWords platform $ init_d - s) `snocOL` mkNReturn width
    
    1089
    +      return $ prim_code `appOL` slide
    
    1090
    +
    
    1091
    +    -- primOpWithRep op w => operation @op@ resulting in result @w@ wide.
    
    1092
    +    primOpWithRep :: BCInstr -> Width -> Maybe (BcM (OrdList BCInstr))
    
    1093
    +    primOpWithRep op_inst result_width = Just $ do
    
    1094
    +      prim_code <- mkPrimOpCode init_d s p op_inst $ args
    
    1095
    +      let slide = mkSlideW (mkSlideWords result_width) (bytesToWords platform $ init_d - s) `snocOL` mkNReturn result_width
    
    1096
    +      return $ prim_code `appOL` slide
    
    1097
    +
    
    1098
    +    -- Coerce the argument, requires them to be the same size
    
    1099
    +    mk_conv :: Width -> Maybe (BcM (OrdList BCInstr))
    
    1100
    +    mk_conv target_width = Just $ do
    
    1101
    +      let width = primArg1Width (head args)
    
    1102
    +      massert (width == target_width)
    
    1103
    +      (push_code, _bytes) <- pushAtom init_d p (head args)
    
    1104
    +      let slide = mkSlideW (mkSlideWords target_width) (bytesToWords platform $ init_d - s) `snocOL` mkNReturn target_width
    
    1105
    +      return $ push_code `appOL` slide
    
    1106
    +
    
    1107
    +-- Push the arguments on the stack and emit the given instruction
    
    1108
    +-- Pushes at least one word per non void arg.
    
    1109
    +mkPrimOpCode
    
    1110
    +    :: StackDepth
    
    1111
    +    -> Sequel
    
    1112
    +    -> BCEnv
    
    1113
    +    -> BCInstr                  -- The operator
    
    1114
    +    -> [StgArg]                 -- Args, in *reverse* order (must be fully applied)
    
    1115
    +    -> BcM BCInstrList
    
    1116
    +mkPrimOpCode orig_d _ p op_inst args = app_code
    
    1117
    +  where
    
    1118
    +    app_code = do
    
    1119
    +        profile <- getProfile
    
    1120
    +        let _platform = profilePlatform profile
    
    1121
    +
    
    1122
    +            do_pushery :: StackDepth -> [StgArg] -> BcM BCInstrList
    
    1123
    +            do_pushery !d (arg : args) = do
    
    1124
    +                (push,arg_bytes) <- pushAtom d p arg
    
    1125
    +                more_push_code <- do_pushery (d + arg_bytes) args
    
    1126
    +                return (push `appOL` more_push_code)
    
    1127
    +            do_pushery !_d [] = do
    
    1128
    +                return (unitOL op_inst)
    
    1129
    +
    
    1130
    +        -- Push on the stack in the reverse order.
    
    1131
    +        do_pushery orig_d (reverse args)
    
    1132
    +
    
    833 1133
     -- v. similar to CgStackery.findMatch, ToDo: merge
    
    834 1134
     findPushSeq :: [ArgRep] -> (BCInstr, Int, [ArgRep])
    
    835 1135
     findPushSeq (P: P: P: P: P: P: rest)
    

  • rts/Disassembler.c
    ... ... @@ -62,6 +62,26 @@ disInstr ( StgBCO *bco, int pc )
    62 62
     #error Cannot cope with WORD_SIZE_IN_BITS being nether 32 nor 64
    
    63 63
     #endif
    
    64 64
     #define BCO_GET_LARGE_ARG ((instr & bci_FLAG_LARGE_ARGS) ? BCO_READ_NEXT_WORD : BCO_NEXT)
    
    65
    +// For brevity
    
    66
    +#define BELCH_INSTR_NAME(OP_NAME) \
    
    67
    +   case bci_ ## OP_NAME: \
    
    68
    +      debugBelch("OP_NAME\n"); \
    
    69
    +      break
    
    70
    +
    
    71
    +#define BELCH_INSTR_NAME_ALL_SIZES(OP_NAME) \
    
    72
    +   case bci_ ## OP_NAME ## _64: \
    
    73
    +      debugBelch("#OP_NAME" "_64\n"); \
    
    74
    +      break; \
    
    75
    +   case bci_ ## OP_NAME ## _32: \
    
    76
    +      debugBelch("#OP_NAME" "_32\n"); \
    
    77
    +      break; \
    
    78
    +   case bci_ ## OP_NAME ## _16: \
    
    79
    +      debugBelch("#OP_NAME" "_16\n"); \
    
    80
    +      break; \
    
    81
    +   case bci_ ## OP_NAME ## _08: \
    
    82
    +      debugBelch("#OP_NAME" "_08\n"); \
    
    83
    +      break;
    
    84
    +
    
    65 85
     
    
    66 86
        switch (instr & 0xff) {
    
    67 87
           case bci_BRK_FUN:
    
    ... ... @@ -419,38 +439,20 @@ disInstr ( StgBCO *bco, int pc )
    419 439
              debugBelch("TESTEQ_P  %d, fail to %d\n", instrs[pc],
    
    420 440
                                                           instrs[pc+1]);
    
    421 441
              pc += 2; break;
    
    422
    -      case bci_CASEFAIL:
    
    423
    -         debugBelch("CASEFAIL\n" );
    
    424
    -         break;
    
    442
    +      BELCH_INSTR_NAME(CASEFAIL);
    
    425 443
           case bci_JMP:
    
    426 444
              debugBelch("JMP to    %d\n", instrs[pc]);
    
    427 445
              pc += 1; break;
    
    428 446
     
    
    429
    -      case bci_ENTER:
    
    430
    -         debugBelch("ENTER\n");
    
    431
    -         break;
    
    447
    +      BELCH_INSTR_NAME(ENTER);
    
    448
    +      BELCH_INSTR_NAME(RETURN_P);
    
    449
    +      BELCH_INSTR_NAME(RETURN_N);
    
    450
    +      BELCH_INSTR_NAME(RETURN_F);
    
    451
    +      BELCH_INSTR_NAME(RETURN_D);
    
    452
    +      BELCH_INSTR_NAME(RETURN_L);
    
    453
    +      BELCH_INSTR_NAME(RETURN_V);
    
    454
    +      BELCH_INSTR_NAME(RETURN_T);
    
    432 455
     
    
    433
    -      case bci_RETURN_P:
    
    434
    -         debugBelch("RETURN_P\n" );
    
    435
    -         break;
    
    436
    -      case bci_RETURN_N:
    
    437
    -         debugBelch("RETURN_N\n" );
    
    438
    -         break;
    
    439
    -      case bci_RETURN_F:
    
    440
    -         debugBelch("RETURN_F\n" );
    
    441
    -         break;
    
    442
    -      case bci_RETURN_D:
    
    443
    -         debugBelch("RETURN_D\n" );
    
    444
    -         break;
    
    445
    -      case bci_RETURN_L:
    
    446
    -         debugBelch("RETURN_L\n" );
    
    447
    -         break;
    
    448
    -      case bci_RETURN_V:
    
    449
    -         debugBelch("RETURN_V\n" );
    
    450
    -         break;
    
    451
    -      case bci_RETURN_T:
    
    452
    -         debugBelch("RETURN_T\n ");
    
    453
    -         break;
    
    454 456
     
    
    455 457
           case bci_BCO_NAME: {
    
    456 458
              const char *name = (const char*) literals[instrs[pc]];
    
    ... ... @@ -459,6 +461,33 @@ disInstr ( StgBCO *bco, int pc )
    459 461
              break;
    
    460 462
           }
    
    461 463
     
    
    464
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_ADD);
    
    465
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_SUB);
    
    466
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_AND);
    
    467
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_XOR);
    
    468
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_OR);
    
    469
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_NOT);
    
    470
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_NEG);
    
    471
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_MUL);
    
    472
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_SHL);
    
    473
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_ASR);
    
    474
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_LSR);
    
    475
    +
    
    476
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_NEQ);
    
    477
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_EQ);
    
    478
    +
    
    479
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_U_GT);
    
    480
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_U_LE);
    
    481
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_U_GE);
    
    482
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_U_LT);
    
    483
    +
    
    484
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_S_GT);
    
    485
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_S_LE);
    
    486
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_S_GE);
    
    487
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_S_LT);
    
    488
    +
    
    489
    +      BELCH_INSTR_NAME_ALL_SIZES(OP_INDEX_ADDR);
    
    490
    +
    
    462 491
           default:
    
    463 492
              barf("disInstr: unknown opcode %u", (unsigned int) instr);
    
    464 493
        }
    

  • rts/Interpreter.c
    ... ... @@ -178,23 +178,35 @@ See also Note [Width of parameters] for some more motivation.
    178 178
     #define Sp_plusB(n)  ((void *)((StgWord8*)Sp + (ptrdiff_t)(n)))
    
    179 179
     #define Sp_minusB(n) ((void *)((StgWord8*)Sp - (ptrdiff_t)(n)))
    
    180 180
     
    
    181
    -#define Sp_plusW(n)  (Sp_plusB((ptrdiff_t)(n) * (ptrdiff_t)sizeof(W_)))
    
    182
    -#define Sp_minusW(n) (Sp_minusB((ptrdiff_t)(n) * (ptrdiff_t)sizeof(W_)))
    
    181
    +#define Sp_plusW(n)    ((void*)Sp_plusB((ptrdiff_t)(n) * (ptrdiff_t)sizeof(W_)))
    
    182
    +#define Sp_plusW64(n)  ((void*)Sp_plusB((ptrdiff_t)(n) * (ptrdiff_t)sizeof(StgWord64)))
    
    183
    +#define Sp_minusW(n)   ((void*)Sp_minusB((ptrdiff_t)(n) * (ptrdiff_t)sizeof(W_)))
    
    183 184
     
    
    184 185
     #define Sp_addB(n)   (Sp = Sp_plusB(n))
    
    185 186
     #define Sp_subB(n)   (Sp = Sp_minusB(n))
    
    186 187
     #define Sp_addW(n)   (Sp = Sp_plusW(n))
    
    188
    +#define Sp_addW64(n) (Sp = Sp_plusW64(n))
    
    187 189
     #define Sp_subW(n)   (Sp = Sp_minusW(n))
    
    188 190
     
    
    189
    -#define SpW(n)       (*(StgWord*)(Sp_plusW(n)))
    
    190
    -#define SpB(n)       (*(StgWord*)(Sp_plusB(n)))
    
    191
    +// Assumes stack location is within stack chunk bounds
    
    192
    +#define SpW(n)      (*(StgWord*)(Sp_plusW(n)))
    
    193
    +#define SpW64(n)    (*(StgWord*)(Sp_plusW64(n)))
    
    191 194
     
    
    192
    -#define WITHIN_CAP_CHUNK_BOUNDS(n)  WITHIN_CHUNK_BOUNDS(n, cap->r.rCurrentTSO->stackobj)
    
    195
    +#define WITHIN_CAP_CHUNK_BOUNDS_W(n)  WITHIN_CHUNK_BOUNDS_W(n, cap->r.rCurrentTSO->stackobj)
    
    193 196
     
    
    194
    -#define WITHIN_CHUNK_BOUNDS(n, s)  \
    
    195
    -  (RTS_LIKELY((StgWord*)(Sp_plusW(n)) < ((s)->stack + (s)->stack_size - sizeofW(StgUnderflowFrame))))
    
    197
    +#define WITHIN_CHUNK_BOUNDS_W(n, s)  \
    
    198
    +    (RTS_LIKELY(((StgWord*) Sp_plusW(n)) < ((s)->stack + (s)->stack_size - sizeofW(StgUnderflowFrame))))
    
    196 199
     
    
    197 200
     
    
    201
    +#define W64_TO_WDS(n) ((n * sizeof(StgWord64) / sizeof(StgWord)))
    
    202
    +
    
    203
    +// Always safe to use - Return the value at the address
    
    204
    +#define ReadSpW(n)       (*((StgWord*)   SafeSpWP(n)))
    
    205
    +//Argument is offset in multiples of word64
    
    206
    +#define ReadSpW64(n)     (*((StgWord64*) SafeSpWP(W64_TO_WDS(n))))
    
    207
    +// Perhaps confusingly this still reads a full word, merely the offset is in bytes.
    
    208
    +#define ReadSpB(n)       (*((StgWord*)   SafeSpBP(n)))
    
    209
    +
    
    198 210
     /* Note [PUSH_L underflow]
    
    199 211
        ~~~~~~~~~~~~~~~~~~~~~~~
    
    200 212
     BCOs can be nested, resulting in nested BCO stack frames where the inner most
    
    ... ... @@ -215,9 +227,9 @@ variables. If a stack overflow happens between the creation of the stack frame
    215 227
     for BCO_1 and BCO_N the RTS might move BCO_N to a new stack chunk while leaving
    
    216 228
     BCO_1 in place, invalidating a simple offset based reference to the outer stack
    
    217 229
     frames.
    
    218
    -Therefore `ReadSpW` first performs a bounds check to ensure that accesses onto
    
    230
    +Therefore `SafeSpW` first performs a bounds check to ensure that accesses onto
    
    219 231
     the stack will succeed. If the target address would not be a valid location for
    
    220
    -the current stack chunk then `slow_spw` function is called, which dereferences
    
    232
    +the current stack chunk then `slow_sp` function is called, which dereferences
    
    221 233
     the underflow frame to adjust the offset before performing the lookup.
    
    222 234
     
    
    223 235
                    ┌->--x   |  CHK_1  |
    
    ... ... @@ -229,14 +241,43 @@ the underflow frame to adjust the offset before performing the lookup.
    229 241
     |---------|    | PUSH_L <n>
    
    230 242
     |  BCO_ N | ->-┘
    
    231 243
     |---------|
    
    244
    +
    
    245
    +To keep things simpler all accesses to the stack which might go beyond the stack
    
    246
    +chunk go through one of the ReadSP* or SafeSP* macros.
    
    247
    +When writing to the stack there is no need for checks, we ensured we have space
    
    248
    +in the current chunk ahead of time. So there we use SpW and it's variants which
    
    249
    +omit the stack bounds check.
    
    250
    +
    
    232 251
     See ticket #25750
    
    233 252
     
    
    234 253
     */
    
    235 254
     
    
    236
    -#define ReadSpW(n)      \
    
    237
    -  ((WITHIN_CAP_CHUNK_BOUNDS(n)) ? SpW(n): slow_spw(Sp, cap->r.rCurrentTSO->stackobj, n))
    
    255
    +// Returns a pointer to the stack location.
    
    256
    +#define SafeSpWP(n)      \
    
    257
    +  ( ((WITHIN_CAP_CHUNK_BOUNDS_W(n)) ? Sp_plusW(n) : slow_spw(Sp, cap->r.rCurrentTSO->stackobj, n)))
    
    258
    +#define SafeSpBP(off_w)      \
    
    259
    +  ( (WITHIN_CAP_CHUNK_BOUNDS_W((1+(off_w))/sizeof(StgWord))) ? \
    
    260
    +        Sp_plusB(off_w) : \
    
    261
    +        (void*)((ptrdiff_t)((ptrdiff_t)(off_w) % (ptrdiff_t)sizeof(StgWord)) + (StgWord8*)slow_spw(Sp, cap->r.rCurrentTSO->stackobj, (off_w)/sizeof(StgWord))) \
    
    262
    +    )
    
    263
    +
    
    238 264
     
    
    239 265
     
    
    266
    +/* Note [Interpreter subword primops]
    
    267
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    268
    +In general the interpreter stack is host-platform word aligned.
    
    269
    +We keep with this convention when evaluating primops for simplicity.
    
    270
    +
    
    271
    +This means:
    
    272
    +
    
    273
    +* All arguments are pushed extended to word size.
    
    274
    +* Results are written to the stack extended to word size.
    
    275
    +
    
    276
    +The only exception are constructor allocations where we push unaligned subwords
    
    277
    +on the stack which are cleaned up by the PACK instruction afterwards.
    
    278
    +
    
    279
    +*/
    
    280
    +
    
    240 281
     STATIC_INLINE StgPtr
    
    241 282
     allocate_NONUPD (Capability *cap, int n_words)
    
    242 283
     {
    
    ... ... @@ -392,11 +433,12 @@ StgClosure * copyPAP (Capability *cap, StgPAP *oldpap)
    392 433
     
    
    393 434
     // See Note [PUSH_L underflow] for in which situations this
    
    394 435
     // slow lookup is needed
    
    395
    -static StgWord
    
    396
    -slow_spw(void *Sp, StgStack *cur_stack, StgWord offset){
    
    397
    -  // 1. If in range, access the item from the current stack chunk
    
    398
    -  if (WITHIN_CHUNK_BOUNDS(offset, cur_stack)) {
    
    399
    -    return SpW(offset);
    
    436
    +// Returns a pointer to the stack location.
    
    437
    +static void*
    
    438
    +slow_spw(void *Sp, StgStack *cur_stack, StgWord offset_words){
    
    439
    +  // 1. If in range, simply return ptr+offset_words pointing into the current stack chunk
    
    440
    +  if (WITHIN_CHUNK_BOUNDS_W(offset_words, cur_stack)) {
    
    441
    +    return Sp_plusW(offset_words);
    
    400 442
       }
    
    401 443
       // 2. Not in this stack chunk, so access the underflow frame.
    
    402 444
       else {
    
    ... ... @@ -420,21 +462,19 @@ slow_spw(void *Sp, StgStack *cur_stack, StgWord offset){
    420 462
     
    
    421 463
           // How many words were on the stack
    
    422 464
           stackWords = (StgWord *)frame - (StgWord *) Sp;
    
    423
    -      ASSERT(offset > stackWords);
    
    465
    +      ASSERT(offset_words > stackWords);
    
    424 466
     
    
    425 467
           // Recursive, in the very unlikely case we have to traverse two
    
    426 468
           // stack chunks.
    
    427
    -      return slow_spw(new_stack->sp, new_stack, offset-stackWords);
    
    469
    +      return slow_spw(new_stack->sp, new_stack, offset_words-stackWords);
    
    428 470
         }
    
    429 471
         // 2b. Access the element if there is no underflow frame, it must be right
    
    430 472
         // at the top of the stack.
    
    431 473
         else {
    
    432 474
             // Not actually in the underflow case
    
    433
    -        return SpW(offset);
    
    475
    +        return Sp_plusW(offset_words);
    
    434 476
         }
    
    435
    -
    
    436 477
       }
    
    437
    -
    
    438 478
     }
    
    439 479
     
    
    440 480
     // Compute the pointer tag for the constructor and tag the pointer;
    
    ... ... @@ -883,7 +923,7 @@ do_return_nonpointer:
    883 923
             // get the offset of the header of the next stack frame
    
    884 924
             offset = stack_frame_sizeW((StgClosure *)Sp);
    
    885 925
     
    
    886
    -        switch (get_itbl((StgClosure*)(Sp_plusW(offset)))->type) {
    
    926
    +        switch (get_itbl((StgClosure*)(SafeSpWP(offset)))->type) {
    
    887 927
     
    
    888 928
             case RET_BCO:
    
    889 929
                 // Returning to an interpreted continuation: pop the return frame
    
    ... ... @@ -1236,9 +1276,9 @@ run_BCO:
    1236 1276
     #endif
    
    1237 1277
     
    
    1238 1278
             bci = BCO_NEXT;
    
    1239
    -    /* We use the high 8 bits for flags, only the highest of which is
    
    1240
    -     * currently allocated */
    
    1241
    -    ASSERT((bci & 0xFF00) == (bci & 0x8000));
    
    1279
    +    /* We use the high 8 bits for flags. The highest of which is
    
    1280
    +     * currently allocated to LARGE_ARGS */
    
    1281
    +    ASSERT((bci & 0xFF00) == (bci & ( bci_FLAG_LARGE_ARGS )));
    
    1242 1282
     
    
    1243 1283
         switch (bci & 0xFF) {
    
    1244 1284
     
    
    ... ... @@ -1429,41 +1469,41 @@ run_BCO:
    1429 1469
             case bci_PUSH8: {
    
    1430 1470
                 W_ off = BCO_GET_LARGE_ARG;
    
    1431 1471
                 Sp_subB(1);
    
    1432
    -            *(StgWord8*)Sp = (StgWord8) *(StgWord*)(Sp_plusB(off+1));
    
    1472
    +            *(StgWord8*)Sp = (StgWord8) (ReadSpB(off+1));
    
    1433 1473
                 goto nextInsn;
    
    1434 1474
             }
    
    1435 1475
     
    
    1436 1476
             case bci_PUSH16: {
    
    1437 1477
                 W_ off = BCO_GET_LARGE_ARG;
    
    1438 1478
                 Sp_subB(2);
    
    1439
    -            *(StgWord16*)Sp = (StgWord16) *(StgWord*)(Sp_plusB(off+2));
    
    1479
    +            *(StgWord16*)Sp = (StgWord16) (ReadSpB(off+2));
    
    1440 1480
                 goto nextInsn;
    
    1441 1481
             }
    
    1442 1482
     
    
    1443 1483
             case bci_PUSH32: {
    
    1444 1484
                 W_ off = BCO_GET_LARGE_ARG;
    
    1445 1485
                 Sp_subB(4);
    
    1446
    -            *(StgWord32*)Sp = (StgWord32) *(StgWord*)(Sp_plusB(off+4));
    
    1486
    +            *(StgWord32*)Sp = (StgWord32) (ReadSpB(off+4));
    
    1447 1487
                 goto nextInsn;
    
    1448 1488
             }
    
    1449 1489
     
    
    1450 1490
             case bci_PUSH8_W: {
    
    1451 1491
                 W_ off = BCO_GET_LARGE_ARG;
    
    1452
    -            *(StgWord*)(Sp_minusW(1)) = (StgWord) ((StgWord8) *(StgWord*)(Sp_plusB(off)));
    
    1492
    +            *(StgWord*)(Sp_minusW(1)) = (StgWord) ((StgWord8) (ReadSpB(off)));
    
    1453 1493
                 Sp_subW(1);
    
    1454 1494
                 goto nextInsn;
    
    1455 1495
             }
    
    1456 1496
     
    
    1457 1497
             case bci_PUSH16_W: {
    
    1458 1498
                 W_ off = BCO_GET_LARGE_ARG;
    
    1459
    -            *(StgWord*)(Sp_minusW(1)) = (StgWord) ((StgWord16) *(StgWord*)(Sp_plusB(off)));
    
    1499
    +            *(StgWord*)(Sp_minusW(1)) = (StgWord) ((StgWord16) (ReadSpB(off)));
    
    1460 1500
                 Sp_subW(1);
    
    1461 1501
                 goto nextInsn;
    
    1462 1502
             }
    
    1463 1503
     
    
    1464 1504
             case bci_PUSH32_W: {
    
    1465 1505
                 W_ off = BCO_GET_LARGE_ARG;
    
    1466
    -            *(StgWord*)(Sp_minusW(1)) = (StgWord) ((StgWord32) *(StgWord*)(Sp_plusB(off)));
    
    1506
    +            *(StgWord*)(Sp_minusW(1)) = (StgWord) ((StgWord32) (ReadSpB(off)));
    
    1467 1507
                 Sp_subW(1);
    
    1468 1508
                 goto nextInsn;
    
    1469 1509
             }
    
    ... ... @@ -1953,7 +1993,7 @@ run_BCO:
    1953 1993
             case bci_TESTLT_I64: {
    
    1954 1994
                 int discr   = BCO_GET_LARGE_ARG;
    
    1955 1995
                 int failto  = BCO_GET_LARGE_ARG;
    
    1956
    -            StgInt64 stackInt = (*(StgInt64*)Sp);
    
    1996
    +            StgInt64 stackInt = ReadSpW64(0);
    
    1957 1997
                 if (stackInt >= BCO_LITI64(discr))
    
    1958 1998
                     bciPtr = failto;
    
    1959 1999
                 goto nextInsn;
    
    ... ... @@ -1999,7 +2039,7 @@ run_BCO:
    1999 2039
             case bci_TESTEQ_I64: {
    
    2000 2040
                 int discr   = BCO_GET_LARGE_ARG;
    
    2001 2041
                 int failto  = BCO_GET_LARGE_ARG;
    
    2002
    -            StgInt64 stackInt = (*(StgInt64*)Sp);
    
    2042
    +            StgInt64 stackInt = ReadSpW64(0);
    
    2003 2043
                 if (stackInt != BCO_LITI64(discr)) {
    
    2004 2044
                     bciPtr = failto;
    
    2005 2045
                 }
    
    ... ... @@ -2048,7 +2088,7 @@ run_BCO:
    2048 2088
             case bci_TESTLT_W64: {
    
    2049 2089
                 int discr   = BCO_GET_LARGE_ARG;
    
    2050 2090
                 int failto  = BCO_GET_LARGE_ARG;
    
    2051
    -            StgWord64 stackWord = (*(StgWord64*)Sp);
    
    2091
    +            StgWord64 stackWord = ReadSpW64(0);
    
    2052 2092
                 if (stackWord >= BCO_LITW64(discr))
    
    2053 2093
                     bciPtr = failto;
    
    2054 2094
                 goto nextInsn;
    
    ... ... @@ -2094,7 +2134,7 @@ run_BCO:
    2094 2134
             case bci_TESTEQ_W64: {
    
    2095 2135
                 int discr   = BCO_GET_LARGE_ARG;
    
    2096 2136
                 int failto  = BCO_GET_LARGE_ARG;
    
    2097
    -            StgWord64 stackWord = (*(StgWord64*)Sp);
    
    2137
    +            StgWord64 stackWord = ReadSpW64(0);
    
    2098 2138
                 if (stackWord != BCO_LITW64(discr)) {
    
    2099 2139
                     bciPtr = failto;
    
    2100 2140
                 }
    
    ... ... @@ -2231,7 +2271,7 @@ run_BCO:
    2231 2271
             case bci_SWIZZLE: {
    
    2232 2272
                 W_ stkoff = BCO_GET_LARGE_ARG;
    
    2233 2273
                 StgInt n = BCO_GET_LARGE_ARG;
    
    2234
    -            (*(StgInt*)(Sp_plusW(stkoff))) += n;
    
    2274
    +            (*(StgInt*)(SafeSpWP(stkoff))) += n;
    
    2235 2275
                 goto nextInsn;
    
    2236 2276
             }
    
    2237 2277
     
    
    ... ... @@ -2241,6 +2281,203 @@ run_BCO:
    2241 2281
                 RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
    
    2242 2282
             }
    
    2243 2283
     
    
    2284
    +// op :: ty -> ty
    
    2285
    +#define UN_SIZED_OP(op,ty)                                          \
    
    2286
    +    {                                                               \
    
    2287
    +        if(sizeof(ty) == 8) {                                       \
    
    2288
    +            ty r = op ((ty) ReadSpW64(0));                        \
    
    2289
    +            SpW64(0) = (StgWord64) r;                               \
    
    2290
    +        } else {                                                    \
    
    2291
    +            ty r = op ((ty) ReadSpW(0));                          \
    
    2292
    +            SpW(0) = (StgWord) r;                                   \
    
    2293
    +        }                                                           \
    
    2294
    +        goto nextInsn;                                              \
    
    2295
    +    }
    
    2296
    +
    
    2297
    +// op :: ty -> ty -> ty
    
    2298
    +#define SIZED_BIN_OP(op,ty)                                                     \
    
    2299
    +        {                                                                       \
    
    2300
    +            if(sizeof(ty) == 8) {                                               \
    
    2301
    +                ty r = ((ty) ReadSpW64(0)) op ((ty) ReadSpW64(1));                  \
    
    2302
    +                Sp_addW64(1);                                                   \
    
    2303
    +                SpW64(0) = (StgWord64) r;                                       \
    
    2304
    +            } else {                                                            \
    
    2305
    +                ty r = ((ty) ReadSpW(0)) op ((ty) ReadSpW(1));                  \
    
    2306
    +                Sp_addW(1);                                                     \
    
    2307
    +                SpW(0) = (StgWord) r;                                           \
    
    2308
    +            };                                                                  \
    
    2309
    +            goto nextInsn;                                                      \
    
    2310
    +        }
    
    2311
    +
    
    2312
    +// op :: ty -> Int -> ty
    
    2313
    +#define SIZED_BIN_OP_TY_INT(op,ty)                                      \
    
    2314
    +{                                                                       \
    
    2315
    +    if(sizeof(ty) > sizeof(StgWord)) {                                  \
    
    2316
    +        ty r = ((ty) ReadSpW64(0)) op ((ty) ReadSpW(2));                \
    
    2317
    +        Sp_addW(1);                                                     \
    
    2318
    +        SpW64(0) = (StgWord64) r;                                       \
    
    2319
    +    } else {                                                            \
    
    2320
    +        ty r = ((ty) ReadSpW(0)) op ((ty) ReadSpW(1));                  \
    
    2321
    +        Sp_addW(1);                                                     \
    
    2322
    +        SpW(0) = (StgWord) r;                                           \
    
    2323
    +    };                                                                  \
    
    2324
    +    goto nextInsn;                                                      \
    
    2325
    +}
    
    2326
    +
    
    2327
    +// op :: ty -> ty -> Int
    
    2328
    +#define SIZED_BIN_OP_TY_TY_INT(op,ty)                                   \
    
    2329
    +{                                                                       \
    
    2330
    +    if(sizeof(ty) > sizeof(StgWord)) {                                  \
    
    2331
    +        ty r = ((ty) ReadSpW64(0)) op ((ty) ReadSpW64(1));              \
    
    2332
    +        Sp_addW(3);                                                     \
    
    2333
    +        SpW(0) = (StgWord) r;                                       \
    
    2334
    +    } else {                                                            \
    
    2335
    +        ty r = ((ty) ReadSpW(0)) op ((ty) ReadSpW(1));                  \
    
    2336
    +        Sp_addW(1);                                                     \
    
    2337
    +        SpW(0) = (StgWord) r;                                           \
    
    2338
    +    };                                                                  \
    
    2339
    +    goto nextInsn;                                                      \
    
    2340
    +}
    
    2341
    +
    
    2342
    +        case bci_OP_ADD_64: SIZED_BIN_OP(+, StgInt64)
    
    2343
    +        case bci_OP_SUB_64: SIZED_BIN_OP(-, StgInt64)
    
    2344
    +        case bci_OP_AND_64: SIZED_BIN_OP(&, StgInt64)
    
    2345
    +        case bci_OP_XOR_64: SIZED_BIN_OP(^, StgInt64)
    
    2346
    +        case bci_OP_OR_64:  SIZED_BIN_OP(|, StgInt64)
    
    2347
    +        case bci_OP_MUL_64: SIZED_BIN_OP(*, StgInt64)
    
    2348
    +        case bci_OP_SHL_64: SIZED_BIN_OP_TY_INT(<<, StgWord64)
    
    2349
    +        case bci_OP_LSR_64: SIZED_BIN_OP_TY_INT(>>, StgWord64)
    
    2350
    +        case bci_OP_ASR_64: SIZED_BIN_OP_TY_INT(>>, StgInt64)
    
    2351
    +
    
    2352
    +        case bci_OP_NEQ_64:  SIZED_BIN_OP_TY_TY_INT(!=, StgWord64)
    
    2353
    +        case bci_OP_EQ_64:   SIZED_BIN_OP_TY_TY_INT(==, StgWord64)
    
    2354
    +        case bci_OP_U_GT_64: SIZED_BIN_OP_TY_TY_INT(>, StgWord64)
    
    2355
    +        case bci_OP_U_GE_64: SIZED_BIN_OP_TY_TY_INT(>=, StgWord64)
    
    2356
    +        case bci_OP_U_LT_64: SIZED_BIN_OP_TY_TY_INT(<, StgWord64)
    
    2357
    +        case bci_OP_U_LE_64: SIZED_BIN_OP_TY_TY_INT(<=, StgWord64)
    
    2358
    +
    
    2359
    +        case bci_OP_S_GT_64: SIZED_BIN_OP_TY_TY_INT(>, StgInt64)
    
    2360
    +        case bci_OP_S_GE_64: SIZED_BIN_OP_TY_TY_INT(>=, StgInt64)
    
    2361
    +        case bci_OP_S_LT_64: SIZED_BIN_OP_TY_TY_INT(<, StgInt64)
    
    2362
    +        case bci_OP_S_LE_64: SIZED_BIN_OP_TY_TY_INT(<=, StgInt64)
    
    2363
    +
    
    2364
    +        case bci_OP_NOT_64: UN_SIZED_OP(~, StgWord64)
    
    2365
    +        case bci_OP_NEG_64: UN_SIZED_OP(-, StgInt64)
    
    2366
    +
    
    2367
    +
    
    2368
    +        case bci_OP_ADD_32: SIZED_BIN_OP(+, StgInt32)
    
    2369
    +        case bci_OP_SUB_32: SIZED_BIN_OP(-, StgInt32)
    
    2370
    +        case bci_OP_AND_32: SIZED_BIN_OP(&, StgInt32)
    
    2371
    +        case bci_OP_XOR_32: SIZED_BIN_OP(^, StgInt32)
    
    2372
    +        case bci_OP_OR_32:  SIZED_BIN_OP(|, StgInt32)
    
    2373
    +        case bci_OP_MUL_32: SIZED_BIN_OP(*, StgInt32)
    
    2374
    +        case bci_OP_SHL_32: SIZED_BIN_OP_TY_INT(<<, StgWord32)
    
    2375
    +        case bci_OP_LSR_32: SIZED_BIN_OP_TY_INT(>>, StgWord32)
    
    2376
    +        case bci_OP_ASR_32: SIZED_BIN_OP_TY_INT(>>, StgInt32)
    
    2377
    +
    
    2378
    +        case bci_OP_NEQ_32:  SIZED_BIN_OP_TY_TY_INT(!=, StgWord32)
    
    2379
    +        case bci_OP_EQ_32:   SIZED_BIN_OP_TY_TY_INT(==, StgWord32)
    
    2380
    +        case bci_OP_U_GT_32: SIZED_BIN_OP_TY_TY_INT(>, StgWord32)
    
    2381
    +        case bci_OP_U_GE_32: SIZED_BIN_OP_TY_TY_INT(>=, StgWord32)
    
    2382
    +        case bci_OP_U_LT_32: SIZED_BIN_OP_TY_TY_INT(<, StgWord32)
    
    2383
    +        case bci_OP_U_LE_32: SIZED_BIN_OP_TY_TY_INT(<=, StgWord32)
    
    2384
    +
    
    2385
    +        case bci_OP_S_GT_32: SIZED_BIN_OP_TY_TY_INT(>, StgInt32)
    
    2386
    +        case bci_OP_S_GE_32: SIZED_BIN_OP_TY_TY_INT(>=, StgInt32)
    
    2387
    +        case bci_OP_S_LT_32: SIZED_BIN_OP_TY_TY_INT(<, StgInt32)
    
    2388
    +        case bci_OP_S_LE_32: SIZED_BIN_OP_TY_TY_INT(<=, StgInt32)
    
    2389
    +
    
    2390
    +        case bci_OP_NOT_32: UN_SIZED_OP(~, StgWord32)
    
    2391
    +        case bci_OP_NEG_32: UN_SIZED_OP(-, StgInt32)
    
    2392
    +
    
    2393
    +
    
    2394
    +        case bci_OP_ADD_16: SIZED_BIN_OP(+, StgInt16)
    
    2395
    +        case bci_OP_SUB_16: SIZED_BIN_OP(-, StgInt16)
    
    2396
    +        case bci_OP_AND_16: SIZED_BIN_OP(&, StgInt16)
    
    2397
    +        case bci_OP_XOR_16: SIZED_BIN_OP(^, StgInt16)
    
    2398
    +        case bci_OP_OR_16:  SIZED_BIN_OP(|, StgInt16)
    
    2399
    +        case bci_OP_MUL_16: SIZED_BIN_OP(*, StgInt16)
    
    2400
    +        case bci_OP_SHL_16: SIZED_BIN_OP_TY_INT(<<, StgWord16)
    
    2401
    +        case bci_OP_LSR_16: SIZED_BIN_OP_TY_INT(>>, StgWord16)
    
    2402
    +        case bci_OP_ASR_16: SIZED_BIN_OP_TY_INT(>>, StgInt16)
    
    2403
    +
    
    2404
    +        case bci_OP_NEQ_16:  SIZED_BIN_OP_TY_TY_INT(!=, StgWord16)
    
    2405
    +        case bci_OP_EQ_16:   SIZED_BIN_OP_TY_TY_INT(==, StgWord16)
    
    2406
    +        case bci_OP_U_GT_16: SIZED_BIN_OP_TY_TY_INT(>, StgWord16)
    
    2407
    +        case bci_OP_U_GE_16: SIZED_BIN_OP_TY_TY_INT(>=, StgWord16)
    
    2408
    +        case bci_OP_U_LT_16: SIZED_BIN_OP_TY_TY_INT(<, StgWord16)
    
    2409
    +        case bci_OP_U_LE_16: SIZED_BIN_OP_TY_TY_INT(<=, StgWord16)
    
    2410
    +
    
    2411
    +        case bci_OP_S_GT_16: SIZED_BIN_OP(>, StgInt16)
    
    2412
    +        case bci_OP_S_GE_16: SIZED_BIN_OP(>=, StgInt16)
    
    2413
    +        case bci_OP_S_LT_16: SIZED_BIN_OP(<, StgInt16)
    
    2414
    +        case bci_OP_S_LE_16: SIZED_BIN_OP(<=, StgInt16)
    
    2415
    +
    
    2416
    +        case bci_OP_NOT_16: UN_SIZED_OP(~, StgWord16)
    
    2417
    +        case bci_OP_NEG_16: UN_SIZED_OP(-, StgInt16)
    
    2418
    +
    
    2419
    +
    
    2420
    +        case bci_OP_ADD_08: SIZED_BIN_OP(+, StgInt8)
    
    2421
    +        case bci_OP_SUB_08: SIZED_BIN_OP(-, StgInt8)
    
    2422
    +        case bci_OP_AND_08: SIZED_BIN_OP(&, StgInt8)
    
    2423
    +        case bci_OP_XOR_08: SIZED_BIN_OP(^, StgInt8)
    
    2424
    +        case bci_OP_OR_08:  SIZED_BIN_OP(|, StgInt8)
    
    2425
    +        case bci_OP_MUL_08: SIZED_BIN_OP(*, StgInt8)
    
    2426
    +        case bci_OP_SHL_08: SIZED_BIN_OP_TY_INT(<<, StgWord8)
    
    2427
    +        case bci_OP_LSR_08: SIZED_BIN_OP_TY_INT(>>, StgWord8)
    
    2428
    +        case bci_OP_ASR_08: SIZED_BIN_OP_TY_INT(>>, StgInt8)
    
    2429
    +
    
    2430
    +        case bci_OP_NEQ_08:  SIZED_BIN_OP_TY_TY_INT(!=, StgWord8)
    
    2431
    +        case bci_OP_EQ_08:   SIZED_BIN_OP_TY_TY_INT(==, StgWord8)
    
    2432
    +        case bci_OP_U_GT_08: SIZED_BIN_OP_TY_TY_INT(>, StgWord8)
    
    2433
    +        case bci_OP_U_GE_08: SIZED_BIN_OP_TY_TY_INT(>=, StgWord8)
    
    2434
    +        case bci_OP_U_LT_08: SIZED_BIN_OP_TY_TY_INT(<, StgWord8)
    
    2435
    +        case bci_OP_U_LE_08: SIZED_BIN_OP_TY_TY_INT(<=, StgWord8)
    
    2436
    +
    
    2437
    +        case bci_OP_S_GT_08: SIZED_BIN_OP_TY_TY_INT(>, StgInt8)
    
    2438
    +        case bci_OP_S_GE_08: SIZED_BIN_OP_TY_TY_INT(>=, StgInt8)
    
    2439
    +        case bci_OP_S_LT_08: SIZED_BIN_OP_TY_TY_INT(<, StgInt8)
    
    2440
    +        case bci_OP_S_LE_08: SIZED_BIN_OP_TY_TY_INT(<=, StgInt8)
    
    2441
    +
    
    2442
    +        case bci_OP_NOT_08: UN_SIZED_OP(~, StgWord8)
    
    2443
    +        case bci_OP_NEG_08: UN_SIZED_OP(-, StgInt8)
    
    2444
    +
    
    2445
    +        case bci_OP_INDEX_ADDR_64:
    
    2446
    +        {
    
    2447
    +            StgWord64* addr = (StgWord64*) SpW(0);
    
    2448
    +            StgInt offset = (StgInt) SpW(1);
    
    2449
    +            if(sizeof(StgPtr) == sizeof(StgWord64)) {
    
    2450
    +                Sp_addW(1);
    
    2451
    +            }
    
    2452
    +            SpW64(0) = *(addr+offset);
    
    2453
    +            goto nextInsn;
    
    2454
    +        }
    
    2455
    +
    
    2456
    +        case bci_OP_INDEX_ADDR_32:
    
    2457
    +        {
    
    2458
    +            StgWord32* addr = (StgWord32*) SpW(0);
    
    2459
    +            StgInt offset = (StgInt) SpW(1);
    
    2460
    +            Sp_addW(1);
    
    2461
    +            SpW(0) = (StgWord) *(addr+offset);
    
    2462
    +            goto nextInsn;
    
    2463
    +        }
    
    2464
    +        case bci_OP_INDEX_ADDR_16:
    
    2465
    +        {
    
    2466
    +            StgWord16* addr = (StgWord16*) SpW(0);
    
    2467
    +            StgInt offset = (StgInt) SpW(1);
    
    2468
    +            Sp_addW(1);
    
    2469
    +            SpW(0) = (StgWord) *(addr+offset);
    
    2470
    +            goto nextInsn;
    
    2471
    +        }
    
    2472
    +        case bci_OP_INDEX_ADDR_08:
    
    2473
    +        {
    
    2474
    +            StgWord8* addr = (StgWord8*) SpW(0);
    
    2475
    +            StgInt offset = (StgInt) SpW(1);
    
    2476
    +            Sp_addW(1);
    
    2477
    +            SpW(0) = (StgWord) *(addr+offset);
    
    2478
    +            goto nextInsn;
    
    2479
    +        }
    
    2480
    +
    
    2244 2481
             case bci_CCALL: {
    
    2245 2482
                 void *tok;
    
    2246 2483
                 W_ stk_offset             = BCO_GET_LARGE_ARG;
    

  • rts/include/rts/Bytecodes.h
    ... ... @@ -114,6 +114,107 @@
    114 114
     
    
    115 115
     #define bci_BCO_NAME                    88
    
    116 116
     
    
    117
    +#define bci_OP_ADD_64                   90
    
    118
    +#define bci_OP_SUB_64                   91
    
    119
    +#define bci_OP_AND_64                   92
    
    120
    +#define bci_OP_XOR_64                   93
    
    121
    +#define bci_OP_NOT_64                   94
    
    122
    +#define bci_OP_NEG_64                   95
    
    123
    +#define bci_OP_MUL_64                   96
    
    124
    +#define bci_OP_SHL_64                   97
    
    125
    +#define bci_OP_ASR_64                   98
    
    126
    +#define bci_OP_LSR_64                   99
    
    127
    +#define bci_OP_OR_64                   100
    
    128
    +
    
    129
    +#define bci_OP_NEQ_64                  110
    
    130
    +#define bci_OP_EQ_64                   111
    
    131
    +#define bci_OP_U_GE_64                 112
    
    132
    +#define bci_OP_U_GT_64                 113
    
    133
    +#define bci_OP_U_LT_64                 114
    
    134
    +#define bci_OP_U_LE_64                 115
    
    135
    +#define bci_OP_S_GE_64                 116
    
    136
    +#define bci_OP_S_GT_64                 117
    
    137
    +#define bci_OP_S_LT_64                 118
    
    138
    +#define bci_OP_S_LE_64                 119
    
    139
    +
    
    140
    +
    
    141
    +#define bci_OP_ADD_32                  130
    
    142
    +#define bci_OP_SUB_32                  131
    
    143
    +#define bci_OP_AND_32                  132
    
    144
    +#define bci_OP_XOR_32                  133
    
    145
    +#define bci_OP_NOT_32                  134
    
    146
    +#define bci_OP_NEG_32                  135
    
    147
    +#define bci_OP_MUL_32                  136
    
    148
    +#define bci_OP_SHL_32                  137
    
    149
    +#define bci_OP_ASR_32                  138
    
    150
    +#define bci_OP_LSR_32                  139
    
    151
    +#define bci_OP_OR_32                   140
    
    152
    +
    
    153
    +#define bci_OP_NEQ_32                  150
    
    154
    +#define bci_OP_EQ_32                   151
    
    155
    +#define bci_OP_U_GE_32                 152
    
    156
    +#define bci_OP_U_GT_32                 153
    
    157
    +#define bci_OP_U_LT_32                 154
    
    158
    +#define bci_OP_U_LE_32                 155
    
    159
    +#define bci_OP_S_GE_32                 156
    
    160
    +#define bci_OP_S_GT_32                 157
    
    161
    +#define bci_OP_S_LT_32                 158
    
    162
    +#define bci_OP_S_LE_32                 159
    
    163
    +
    
    164
    +
    
    165
    +#define bci_OP_ADD_16                  170
    
    166
    +#define bci_OP_SUB_16                  171
    
    167
    +#define bci_OP_AND_16                  172
    
    168
    +#define bci_OP_XOR_16                  173
    
    169
    +#define bci_OP_NOT_16                  174
    
    170
    +#define bci_OP_NEG_16                  175
    
    171
    +#define bci_OP_MUL_16                  176
    
    172
    +#define bci_OP_SHL_16                  177
    
    173
    +#define bci_OP_ASR_16                  178
    
    174
    +#define bci_OP_LSR_16                  179
    
    175
    +#define bci_OP_OR_16                   180
    
    176
    +
    
    177
    +#define bci_OP_NEQ_16                  190
    
    178
    +#define bci_OP_EQ_16                   191
    
    179
    +#define bci_OP_U_GE_16                 192
    
    180
    +#define bci_OP_U_GT_16                 193
    
    181
    +#define bci_OP_U_LT_16                 194
    
    182
    +#define bci_OP_U_LE_16                 195
    
    183
    +#define bci_OP_S_GE_16                 196
    
    184
    +#define bci_OP_S_GT_16                 197
    
    185
    +#define bci_OP_S_LT_16                 198
    
    186
    +#define bci_OP_S_LE_16                 199
    
    187
    +
    
    188
    +
    
    189
    +#define bci_OP_ADD_08                  200
    
    190
    +#define bci_OP_SUB_08                  201
    
    191
    +#define bci_OP_AND_08                  202
    
    192
    +#define bci_OP_XOR_08                  203
    
    193
    +#define bci_OP_NOT_08                  204
    
    194
    +#define bci_OP_NEG_08                  205
    
    195
    +#define bci_OP_MUL_08                  206
    
    196
    +#define bci_OP_SHL_08                  207
    
    197
    +#define bci_OP_ASR_08                  208
    
    198
    +#define bci_OP_LSR_08                  209
    
    199
    +#define bci_OP_OR_08                   210
    
    200
    +
    
    201
    +#define bci_OP_NEQ_08                  220
    
    202
    +#define bci_OP_EQ_08                   221
    
    203
    +#define bci_OP_U_GE_08                 222
    
    204
    +#define bci_OP_U_GT_08                 223
    
    205
    +#define bci_OP_U_LT_08                 224
    
    206
    +#define bci_OP_U_LE_08                 225
    
    207
    +#define bci_OP_S_GE_08                 226
    
    208
    +#define bci_OP_S_GT_08                 227
    
    209
    +#define bci_OP_S_LT_08                 228
    
    210
    +#define bci_OP_S_LE_08                 229
    
    211
    +
    
    212
    +#define bci_OP_INDEX_ADDR_08           240
    
    213
    +#define bci_OP_INDEX_ADDR_16           241
    
    214
    +#define bci_OP_INDEX_ADDR_32           242
    
    215
    +#define bci_OP_INDEX_ADDR_64           243
    
    216
    +
    
    217
    +
    
    117 218
     /* If you need to go past 255 then you will run into the flags */
    
    118 219
     
    
    119 220
     /* If you need to go below 0x0100 then you will run into the instructions */
    

  • testsuite/tests/codeGen/should_run/all.T
    ... ... @@ -226,7 +226,7 @@ test('T20640b', normal, compile_and_run, [''])
    226 226
     test('T22296',[only_ways(llvm_ways)
    
    227 227
                   ,unless(arch('x86_64') or arch('aarch64'), skip)],compile_and_run,[''])
    
    228 228
     test('T22798', normal, compile_and_run, ['-fregs-graph'])
    
    229
    -test('CheckBoundsOK', normal, compile_and_run, ['-fcheck-prim-bounds'])
    
    229
    +test('CheckBoundsOK', normal, compile_and_run, ['-fcheck-prim-bounds -funoptimized-core-for-interpreter -O'])
    
    230 230
     test('OrigThunkInfo', normal, compile_and_run, ['-forig-thunk-info'])
    
    231 231
     test('T24809', req_profiling, compile_and_run, ['-forig-thunk-info -prof'])
    
    232 232
     
    

  • testsuite/tests/ghci/all.T
    1
    +test('ghci-mem-primops', [  extra_ways(['ghci-opt']), only_ways(['ghci', 'ghci-opt']),
    
    2
    +                            extra_hc_opts('-fno-unoptimized-core-for-interpreter -O')], ghci_script, ['ghci-mem-primops.script'])

  • testsuite/tests/ghci/ghci-mem-primops.hs
    1
    +{-# LANGUAGE MagicHash #-}
    
    2
    +{-# LANGUAGE UnboxedTuples #-}
    
    3
    +{-# LANGUAGE ExtendedLiterals #-}
    
    4
    +
    
    5
    +module Main where
    
    6
    +
    
    7
    +-- Test memory primops interpreted in interpreter, extend if you add more.
    
    8
    +import GHC.Word
    
    9
    +import GHC.PrimOps
    
    10
    +import GHC.IO
    
    11
    +import Numeric (showHex)
    
    12
    +
    
    13
    +data Bytes = Bytes { byte_addr :: Addr# }
    
    14
    +
    
    15
    +bytes :: Bytes
    
    16
    +bytes = Bytes "\0\1\2\3\4\5\6\7\8\0"#
    
    17
    +
    
    18
    +main = do
    
    19
    +    let val = 0x1122334455667788#Word64
    
    20
    +    IO (\s -> case writeWord64OffAddr# (byte_addr bytes) 0# val s of s2 -> (# s2,() #))
    
    21
    +    putStrLn . flip showHex "" $ W64# (indexWord64OffAddr# (byte_addr bytes) 0#)
    
    22
    +
    
    23
    +    IO (\s -> case writeWord32OffAddr# (byte_addr bytes) 0# 0x11223344#Word32 s of s2 -> (# s2,() #))
    
    24
    +    putStrLn . flip showHex "" $ W32# (indexWord32OffAddr# (byte_addr bytes) 0#)
    
    25
    +
    
    26
    +    IO (\s -> case writeWord16OffAddr# (byte_addr bytes) 0# 0x1122#Word16 s of s2 -> (# s2,() #))
    
    27
    +    putStrLn . flip showHex "" $ W16# (indexWord16OffAddr# (byte_addr bytes) 0#)
    
    28
    +
    
    29
    +    IO (\s -> case writeWord8OffAddr# (byte_addr bytes) 0# 0x11#Word8 s of s2 -> (# s2,() #))
    
    30
    +    putStrLn . flip showHex "" $ W8# (indexWord8OffAddr# (byte_addr bytes) 0#)
    \ No newline at end of file

  • testsuite/tests/ghci/ghci-mem-primops.script
    1
    +:l ghci-mem-primops
    
    2
    +:main
    \ No newline at end of file

  • testsuite/tests/ghci/ghci-mem-primops.stdout
    1
    +1122334455667788
    
    2
    +11223344
    
    3
    +1122
    
    4
    +11

  • testsuite/tests/numeric/should_run/all.T
    ... ... @@ -82,7 +82,7 @@ test('IntegerToFloat', normal, compile_and_run, [''])
    82 82
     test('T20291', normal, compile_and_run, [''])
    
    83 83
     test('T22282', normal, compile_and_run, [''])
    
    84 84
     test('T22671', js_fragile(24259), compile_and_run, [''])
    
    85
    -test('foundation', [when(js_arch(), run_timeout_multiplier(2)), js_fragile(24259)], compile_and_run, ['-O -package transformers'])
    
    85
    +test('foundation', [when(js_arch(), run_timeout_multiplier(2)), js_fragile(24259), extra_ways(['optasm','ghci','ghci-opt'])], compile_and_run, ['-package transformers -fno-break-points'])
    
    86 86
     test('T24066', normal, compile_and_run, [''])
    
    87 87
     test('div01', normal, compile_and_run, [''])
    
    88 88
     test('T24245', normal, compile_and_run, [''])
    

  • testsuite/tests/numeric/should_run/foundation.hs
    1
    +{- PARTS OF THIS FILE ARE SEMI-AUTOGENERATED.
    
    2
    +  You can re-generate them by invoking the genprimops utility with --foundation-tests
    
    3
    +  and then integrating the output in this file.
    
    4
    +
    
    5
    +  This test compares the results of various primops between the
    
    6
    +  pre-compiled version (primop wrapper) and the implementation of
    
    7
    +  whatever the test is run with.
    
    8
    +
    
    9
    +  This is particularly helpful when testing the interpreter as it allows us to
    
    10
    +  compare the result of the primop wrappers with the results of interpretation.
    
    11
    +-}
    
    12
    +
    
    1 13
     {-# LANGUAGE FlexibleContexts    #-}
    
    2 14
     {-# LANGUAGE OverloadedStrings   #-}
    
    3 15
     {-# LANGUAGE ScopedTypeVariables #-}
    
    ... ... @@ -5,6 +17,9 @@
    5 17
     {-# LANGUAGE DerivingStrategies #-}
    
    6 18
     {-# LANGUAGE MagicHash #-}
    
    7 19
     {-# LANGUAGE RecordWildCards #-}
    
    20
    +{-# LANGUAGE CPP #-}
    
    21
    +{-# LANGUAGE ViewPatterns #-}
    
    22
    +{-# LANGUAGE UnboxedTuples #-}
    
    8 23
     module Main
    
    9 24
         ( main
    
    10 25
         ) where
    
    ... ... @@ -16,6 +31,7 @@ import Data.Typeable
    16 31
     import Data.Proxy
    
    17 32
     import GHC.Int
    
    18 33
     import GHC.Word
    
    34
    +import GHC.Word
    
    19 35
     import Data.Function
    
    20 36
     import GHC.Prim
    
    21 37
     import Control.Monad.Reader
    
    ... ... @@ -26,6 +42,13 @@ import Foreign.Ptr
    26 42
     import Data.List (intercalate)
    
    27 43
     import Data.IORef
    
    28 44
     import Unsafe.Coerce
    
    45
    +import GHC.Types
    
    46
    +import Data.Char
    
    47
    +import Data.Semigroup
    
    48
    +import System.Exit
    
    49
    +
    
    50
    +import qualified GHC.Internal.PrimopWrappers as Wrapper
    
    51
    +import qualified GHC.Internal.Prim as Primop
    
    29 52
     
    
    30 53
     newtype Gen a = Gen { runGen :: (ReaderT LCGGen IO a) }
    
    31 54
       deriving newtype (Functor, Applicative, Monad)
    
    ... ... @@ -98,6 +121,17 @@ arbitraryWord64 = Gen $ do
    98 121
         h <- ask
    
    99 122
         liftIO (randomWord64 h)
    
    100 123
     
    
    124
    +nonZero :: (Arbitrary a, Num a, Eq a) => Gen (NonZero a)
    
    125
    +nonZero = do
    
    126
    +  x <- arbitrary
    
    127
    +  if x == 0 then nonZero else pure $ NonZero x
    
    128
    +
    
    129
    +newtype NonZero a = NonZero { getNonZero :: a }
    
    130
    +  deriving (Eq,Ord,Bounded,Show)
    
    131
    +
    
    132
    +instance (Arbitrary a, Num a, Eq a) => Arbitrary (NonZero a) where
    
    133
    +  arbitrary = nonZero
    
    134
    +
    
    101 135
     instance Arbitrary Natural where
    
    102 136
         arbitrary = integralDownsize . (`mod` 10000) . abs <$> arbitraryInt64
    
    103 137
     
    
    ... ... @@ -126,6 +160,13 @@ instance Arbitrary Int16 where
    126 160
     instance Arbitrary Int8 where
    
    127 161
         arbitrary = integralDownsize <$> arbitraryInt64
    
    128 162
     
    
    163
    +instance Arbitrary Char where
    
    164
    +    arbitrary = do
    
    165
    +      let high = fromIntegral $ fromEnum (maxBound :: Char) :: Word
    
    166
    +      (x::Word) <- arbitrary
    
    167
    +      let x' = mod x high
    
    168
    +      return (chr $ fromIntegral x')
    
    169
    +
    
    129 170
     int64ToInt :: Int64 -> Int
    
    130 171
     int64ToInt (I64# i) = I# (int64ToInt# i)
    
    131 172
     
    
    ... ... @@ -134,7 +175,7 @@ word64ToWord :: Word64 -> Word
    134 175
     word64ToWord (W64# i) = W# (word64ToWord# i)
    
    135 176
     
    
    136 177
     
    
    137
    -data RunS = RunS { depth :: Int, rg :: LCGGen  }
    
    178
    +data RunS = RunS { depth :: Int, rg :: LCGGen, context :: [String] }
    
    138 179
     
    
    139 180
     newtype LCGGen = LCGGen { randomWord64 :: IO Word64 }
    
    140 181
     
    
    ... ... @@ -148,43 +189,75 @@ newLCGGen LCGParams{..} = do
    148 189
     
    
    149 190
     
    
    150 191
     runPropertyCheck (PropertyBinaryOp res desc s1 s2) =
    
    151
    -  if res then return True else (putMsg ("Failure: " ++ s1 ++ desc ++ s2) >> return False)
    
    152
    -runPropertyCheck (PropertyAnd a1 a2) = (&&) <$> runPropertyCheck a1 <*> runPropertyCheck a2
    
    153
    -
    
    154
    -runProperty :: Property -> ReaderT RunS IO ()
    
    192
    +  if res then return Success
    
    193
    +         else do
    
    194
    +          ctx <- context <$> ask
    
    195
    +          let msg = "Failure: " ++ s1 ++ desc ++ s2
    
    196
    +          putMsg msg
    
    197
    +          return (Failure [msg : ctx])
    
    198
    +runPropertyCheck (PropertyAnd a1 a2) = (<>) <$> runPropertyCheck a1 <*> runPropertyCheck a2
    
    199
    +
    
    200
    +runProperty :: Property -> ReaderT RunS IO Result
    
    155 201
     runProperty (Prop p) = do
    
    156 202
       let iterations = 100
    
    157 203
       loop iterations iterations
    
    158 204
       where
    
    159
    -    loop iterations 0 = putMsg ("Passed " ++ show iterations ++ " iterations")
    
    205
    +    loop iterations 0 = do
    
    206
    +      putMsg ("Passed " ++ show iterations ++ " iterations")
    
    207
    +      return Success
    
    160 208
         loop iterations n = do
    
    161 209
           h <- rg <$> ask
    
    162 210
           p <- liftIO (runReaderT (runGen p) h)
    
    163 211
           let (ss, pc) = getCheck p
    
    164 212
           res <- runPropertyCheck pc
    
    165
    -      if res then loop iterations (n-1)
    
    166
    -             else putMsg ("With arguments " ++ intercalate ", " ss)
    
    213
    +      case res of
    
    214
    +        Success -> loop iterations (n-1)
    
    215
    +        Failure msgs -> do
    
    216
    +          let msg = ("With arguments " ++ intercalate ", " ss)
    
    217
    +          putMsg msg
    
    218
    +          return (Failure (map (msg :) msgs))
    
    219
    +
    
    220
    +data Result = Success | Failure [[String]]
    
    221
    +
    
    222
    +instance Semigroup Result where
    
    223
    +  Success <> x = x
    
    224
    +  x <> Success = x
    
    225
    +  (Failure xs) <> (Failure ys) = Failure (xs ++ ys)
    
    226
    +
    
    227
    +instance Monoid Result where
    
    228
    +  mempty = Success
    
    167 229
     
    
    168 230
     putMsg s = do
    
    169 231
       n <- depth <$> ask
    
    170 232
       liftIO . putStrLn $ replicate (n * 2) ' ' ++ s
    
    171 233
     
    
    172
    -nest = local (\s -> s { depth = depth s + 1 })
    
    173 234
     
    
    174
    -runTestInternal :: Test -> ReaderT RunS IO ()
    
    235
    +nest c = local (\s -> s { depth = depth s + 1, context = c : context s })
    
    236
    +
    
    237
    +runTestInternal :: Test -> ReaderT RunS IO Result
    
    175 238
     runTestInternal (Group name tests) = do
    
    176
    -  putMsg ("Group " ++ name)
    
    177
    -  nest (mapM_ runTestInternal tests)
    
    239
    +  let label = ("Group " ++ name)
    
    240
    +  putMsg label
    
    241
    +  nest label (mconcat <$> mapM runTestInternal tests)
    
    178 242
     runTestInternal (Property name p) = do
    
    179
    -  putMsg ("Running " ++ name)
    
    180
    -  nest $ runProperty (property p)
    
    243
    +  let label = ("Running " ++ name)
    
    244
    +  putMsg label
    
    245
    +  nest label $ runProperty (property p)
    
    181 246
     
    
    182 247
     
    
    183 248
     runTests :: Test -> IO ()
    
    184 249
     runTests t = do
    
    185 250
       -- These params are the same ones as glibc uses.
    
    186 251
       h <- newLCGGen (LCGParams { seed = 1238123213, m = 2^31, a = 1103515245, c = 12345 })
    
    187
    -  runReaderT  (runTestInternal t) (RunS 0 h)
    
    252
    +  res <- runReaderT  (runTestInternal t) (RunS 0 h [])
    
    253
    +  case res of
    
    254
    +    Success -> return ()
    
    255
    +    Failure tests -> do
    
    256
    +      putStrLn $ "These tests failed:  \n" ++ intercalate "  \n" (map (showStack 0 . reverse) tests)
    
    257
    +      exitFailure
    
    258
    +
    
    259
    +showStack _ [] = ""
    
    260
    +showStack n (s:ss) = replicate n ' ' ++ s ++ "\n" ++ showStack (n + 2) ss
    
    188 261
     
    
    189 262
     -------------------------------------------------------------------------------
    
    190 263
     
    
    ... ... @@ -228,9 +301,8 @@ testMultiplicative _ = Group "Multiplicative"
    228 301
     testDividible :: forall a . (Show a, Eq a, Integral a, Num a, Arbitrary a, Typeable a)
    
    229 302
                   => Proxy a -> Test
    
    230 303
     testDividible _ = Group "Divisible"
    
    231
    -    [ Property "(x `div` y) * y + (x `mod` y) == x" $ \(a :: a) b ->
    
    232
    -            if b == 0 then True === True
    
    233
    -                      else a === (a `div` b) * b + (a `mod` b)
    
    304
    +    [ Property "(x `div` y) * y + (x `mod` y) == x" $ \(a :: a) (NonZero b) ->
    
    305
    +            a === (a `div` b) * b + (a `mod` b)
    
    234 306
         ]
    
    235 307
     
    
    236 308
     testOperatorPrecedence :: forall a . (Show a, Eq a, Prelude.Num a, Integral a, Num a,  Arbitrary a, Typeable a)
    
    ... ... @@ -272,6 +344,590 @@ testNumberRefs = Group "ALL"
    272 344
         , testNumber "Word32" (Proxy :: Proxy Word32)
    
    273 345
         , testNumber "Word64" (Proxy :: Proxy Word64)
    
    274 346
         ]
    
    347
    +{-
    
    348
    +test_binop :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) a r'
    
    349
    +              (b :: TYPE r1) (r :: TYPE r2)  . String   -> (a -> b) -> (r -> r')
    
    350
    +                       -> (b -> b -> r)
    
    351
    +                       -> (b -> b -> r)
    
    352
    +                       -> Test
    
    353
    +test_binop name unwrap wrap primop wrapper =
    
    354
    +-}
    
    355
    +-- #define TEST_BINOP(name, unwrap, wrap, primop, wrapper)  Property name $ \l r -> wrap (primop (unwrap l) (unwrap r)) === wrap (wrapper (unwrap l) (unwrap r))
    
    356
    +
    
    357
    +wInt# :: Int# -> Int
    
    358
    +wInt# = I#
    
    359
    +
    
    360
    +uInt# :: Int -> Int#
    
    361
    +uInt# (I# x) = x
    
    362
    +
    
    363
    +wWord#:: Word# -> Word
    
    364
    +wWord#= W#
    
    365
    +
    
    366
    +uWord# (W# w) = w
    
    367
    +uWord8# (W8# w) = w
    
    368
    +uWord16# (W16# w) = w
    
    369
    +uWord32# (W32# w) = w
    
    370
    +uWord64# (W64# w) = w
    
    371
    +uChar# (C# c) = c
    
    372
    +uInt8# (I8# w) = w
    
    373
    +uInt16# (I16# w) = w
    
    374
    +uInt32# (I32# w) = w
    
    375
    +uInt64# (I64# w) = w
    
    376
    +
    
    377
    +wWord8# = W8#
    
    378
    +wWord16# = W16#
    
    379
    +wWord32# = W32#
    
    380
    +wWord64# = W64#
    
    381
    +wChar# = C#
    
    382
    +wInt8# = I8#
    
    383
    +wInt16# = I16#
    
    384
    +wInt32# = I32#
    
    385
    +wInt64# = I64#
    
    386
    +
    
    387
    +#define WTUP2(f, g, x) (case x of (# a, b #) -> (f a, g b))
    
    388
    +#define WTUP3(f, g, h, x) (case x of (# a, b, c #) -> (f a, g b, h c))
    
    389
    +
    
    390
    +
    
    391
    +class TestPrimop f where
    
    392
    +  testPrimop :: String -> f -> f -> Test
    
    393
    +
    
    394
    +  testPrimopDivLike :: String -> f -> f -> Test
    
    395
    +  testPrimopDivLike _ _ _ = error "Div testing not supported for this type."
    
    396
    +
    
    397
    +{-
    
    398
    +instance TestPrimop (Int# -> Int# -> Int#) where
    
    399
    +  testPrimop s l r = Property s $ \(uInt -> a1) (uInt -> a2) -> (wInt (l a1 a2)) === wInt (r a1 a2)
    
    400
    +
    
    401
    +instance TestPrimop (Word# -> Word# -> Int#) where
    
    402
    +  testPrimop s l r = Property s $ \(uWord -> a1) (uWord -> a2) -> (wInt (l a1 a2)) === wInt (r a1 a2)
    
    403
    +
    
    404
    +instance TestPrimop (Word# -> Int#) where
    
    405
    +  testPrimop s l r = Property s $ \(uWord -> a1) -> (wInt (l a1)) === wInt (r a1)
    
    406
    +
    
    407
    +instance TestPrimop (Word# -> Int# -> Word#) where
    
    408
    +  testPrimop s l r = Property s $ \(uWord -> a1) (uInt -> a2) -> (wWord (l a1 a2)) === wWord (r a1 a2)
    
    409
    +  -}
    
    410
    +
    
    411
    +
    
    412
    +twoNonZero :: (a -> a -> b) -> a -> NonZero a -> b
    
    413
    +twoNonZero f x (NonZero y) = f x y
    
    414
    +
    
    415
    +main = runTests (Group "ALL" [testNumberRefs, testPrimops])
    
    416
    +
    
    417
    +-- Test an interpreted primop vs a compiled primop
    
    418
    +testPrimops = Group "primop"
    
    419
    +  [ testPrimop "gtChar#" Primop.gtChar# Wrapper.gtChar#
    
    420
    +  , testPrimop "geChar#" Primop.geChar# Wrapper.geChar#
    
    421
    +  , testPrimop "eqChar#" Primop.eqChar# Wrapper.eqChar#
    
    422
    +  , testPrimop "neChar#" Primop.neChar# Wrapper.neChar#
    
    423
    +  , testPrimop "ltChar#" Primop.ltChar# Wrapper.ltChar#
    
    424
    +  , testPrimop "leChar#" Primop.leChar# Wrapper.leChar#
    
    425
    +  , testPrimop "ord#" Primop.ord# Wrapper.ord#
    
    426
    +  , testPrimop "int8ToInt#" Primop.int8ToInt# Wrapper.int8ToInt#
    
    427
    +  , testPrimop "intToInt8#" Primop.intToInt8# Wrapper.intToInt8#
    
    428
    +  , testPrimop "negateInt8#" Primop.negateInt8# Wrapper.negateInt8#
    
    429
    +  , testPrimop "plusInt8#" Primop.plusInt8# Wrapper.plusInt8#
    
    430
    +  , testPrimop "subInt8#" Primop.subInt8# Wrapper.subInt8#
    
    431
    +  , testPrimop "timesInt8#" Primop.timesInt8# Wrapper.timesInt8#
    
    432
    +  , testPrimopDivLike "quotInt8#" Primop.quotInt8# Wrapper.quotInt8#
    
    433
    +  , testPrimopDivLike "remInt8#" Primop.remInt8# Wrapper.remInt8#
    
    434
    +  , testPrimopDivLike "quotRemInt8#" Primop.quotRemInt8# Wrapper.quotRemInt8#
    
    435
    +  , testPrimop "uncheckedShiftLInt8#" Primop.uncheckedShiftLInt8# Wrapper.uncheckedShiftLInt8#
    
    436
    +  , testPrimop "uncheckedShiftRAInt8#" Primop.uncheckedShiftRAInt8# Wrapper.uncheckedShiftRAInt8#
    
    437
    +  , testPrimop "uncheckedShiftRLInt8#" Primop.uncheckedShiftRLInt8# Wrapper.uncheckedShiftRLInt8#
    
    438
    +  , testPrimop "int8ToWord8#" Primop.int8ToWord8# Wrapper.int8ToWord8#
    
    439
    +  , testPrimop "eqInt8#" Primop.eqInt8# Wrapper.eqInt8#
    
    440
    +  , testPrimop "geInt8#" Primop.geInt8# Wrapper.geInt8#
    
    441
    +  , testPrimop "gtInt8#" Primop.gtInt8# Wrapper.gtInt8#
    
    442
    +  , testPrimop "leInt8#" Primop.leInt8# Wrapper.leInt8#
    
    443
    +  , testPrimop "ltInt8#" Primop.ltInt8# Wrapper.ltInt8#
    
    444
    +  , testPrimop "neInt8#" Primop.neInt8# Wrapper.neInt8#
    
    445
    +  , testPrimop "word8ToWord#" Primop.word8ToWord# Wrapper.word8ToWord#
    
    446
    +  , testPrimop "wordToWord8#" Primop.wordToWord8# Wrapper.wordToWord8#
    
    447
    +  , testPrimop "plusWord8#" Primop.plusWord8# Wrapper.plusWord8#
    
    448
    +  , testPrimop "subWord8#" Primop.subWord8# Wrapper.subWord8#
    
    449
    +  , testPrimop "timesWord8#" Primop.timesWord8# Wrapper.timesWord8#
    
    450
    +  , testPrimopDivLike "quotWord8#" Primop.quotWord8# Wrapper.quotWord8#
    
    451
    +  , testPrimopDivLike "remWord8#" Primop.remWord8# Wrapper.remWord8#
    
    452
    +  , testPrimopDivLike "quotRemWord8#" Primop.quotRemWord8# Wrapper.quotRemWord8#
    
    453
    +  , testPrimop "andWord8#" Primop.andWord8# Wrapper.andWord8#
    
    454
    +  , testPrimop "orWord8#" Primop.orWord8# Wrapper.orWord8#
    
    455
    +  , testPrimop "xorWord8#" Primop.xorWord8# Wrapper.xorWord8#
    
    456
    +  , testPrimop "notWord8#" Primop.notWord8# Wrapper.notWord8#
    
    457
    +  , testPrimop "uncheckedShiftLWord8#" Primop.uncheckedShiftLWord8# Wrapper.uncheckedShiftLWord8#
    
    458
    +  , testPrimop "uncheckedShiftRLWord8#" Primop.uncheckedShiftRLWord8# Wrapper.uncheckedShiftRLWord8#
    
    459
    +  , testPrimop "word8ToInt8#" Primop.word8ToInt8# Wrapper.word8ToInt8#
    
    460
    +  , testPrimop "eqWord8#" Primop.eqWord8# Wrapper.eqWord8#
    
    461
    +  , testPrimop "geWord8#" Primop.geWord8# Wrapper.geWord8#
    
    462
    +  , testPrimop "gtWord8#" Primop.gtWord8# Wrapper.gtWord8#
    
    463
    +  , testPrimop "leWord8#" Primop.leWord8# Wrapper.leWord8#
    
    464
    +  , testPrimop "ltWord8#" Primop.ltWord8# Wrapper.ltWord8#
    
    465
    +  , testPrimop "neWord8#" Primop.neWord8# Wrapper.neWord8#
    
    466
    +  , testPrimop "int16ToInt#" Primop.int16ToInt# Wrapper.int16ToInt#
    
    467
    +  , testPrimop "intToInt16#" Primop.intToInt16# Wrapper.intToInt16#
    
    468
    +  , testPrimop "negateInt16#" Primop.negateInt16# Wrapper.negateInt16#
    
    469
    +  , testPrimop "plusInt16#" Primop.plusInt16# Wrapper.plusInt16#
    
    470
    +  , testPrimop "subInt16#" Primop.subInt16# Wrapper.subInt16#
    
    471
    +  , testPrimop "timesInt16#" Primop.timesInt16# Wrapper.timesInt16#
    
    472
    +  , testPrimopDivLike "quotInt16#" Primop.quotInt16# Wrapper.quotInt16#
    
    473
    +  , testPrimopDivLike "remInt16#" Primop.remInt16# Wrapper.remInt16#
    
    474
    +  , testPrimopDivLike "quotRemInt16#" Primop.quotRemInt16# Wrapper.quotRemInt16#
    
    475
    +  , testPrimop "uncheckedShiftLInt16#" Primop.uncheckedShiftLInt16# Wrapper.uncheckedShiftLInt16#
    
    476
    +  , testPrimop "uncheckedShiftRAInt16#" Primop.uncheckedShiftRAInt16# Wrapper.uncheckedShiftRAInt16#
    
    477
    +  , testPrimop "uncheckedShiftRLInt16#" Primop.uncheckedShiftRLInt16# Wrapper.uncheckedShiftRLInt16#
    
    478
    +  , testPrimop "int16ToWord16#" Primop.int16ToWord16# Wrapper.int16ToWord16#
    
    479
    +  , testPrimop "eqInt16#" Primop.eqInt16# Wrapper.eqInt16#
    
    480
    +  , testPrimop "geInt16#" Primop.geInt16# Wrapper.geInt16#
    
    481
    +  , testPrimop "gtInt16#" Primop.gtInt16# Wrapper.gtInt16#
    
    482
    +  , testPrimop "leInt16#" Primop.leInt16# Wrapper.leInt16#
    
    483
    +  , testPrimop "ltInt16#" Primop.ltInt16# Wrapper.ltInt16#
    
    484
    +  , testPrimop "neInt16#" Primop.neInt16# Wrapper.neInt16#
    
    485
    +  , testPrimop "word16ToWord#" Primop.word16ToWord# Wrapper.word16ToWord#
    
    486
    +  , testPrimop "wordToWord16#" Primop.wordToWord16# Wrapper.wordToWord16#
    
    487
    +  , testPrimop "plusWord16#" Primop.plusWord16# Wrapper.plusWord16#
    
    488
    +  , testPrimop "subWord16#" Primop.subWord16# Wrapper.subWord16#
    
    489
    +  , testPrimop "timesWord16#" Primop.timesWord16# Wrapper.timesWord16#
    
    490
    +  , testPrimopDivLike "quotWord16#" Primop.quotWord16# Wrapper.quotWord16#
    
    491
    +  , testPrimopDivLike "remWord16#" Primop.remWord16# Wrapper.remWord16#
    
    492
    +  , testPrimopDivLike "quotRemWord16#" Primop.quotRemWord16# Wrapper.quotRemWord16#
    
    493
    +  , testPrimop "andWord16#" Primop.andWord16# Wrapper.andWord16#
    
    494
    +  , testPrimop "orWord16#" Primop.orWord16# Wrapper.orWord16#
    
    495
    +  , testPrimop "xorWord16#" Primop.xorWord16# Wrapper.xorWord16#
    
    496
    +  , testPrimop "notWord16#" Primop.notWord16# Wrapper.notWord16#
    
    497
    +  , testPrimop "uncheckedShiftLWord16#" Primop.uncheckedShiftLWord16# Wrapper.uncheckedShiftLWord16#
    
    498
    +  , testPrimop "uncheckedShiftRLWord16#" Primop.uncheckedShiftRLWord16# Wrapper.uncheckedShiftRLWord16#
    
    499
    +  , testPrimop "word16ToInt16#" Primop.word16ToInt16# Wrapper.word16ToInt16#
    
    500
    +  , testPrimop "eqWord16#" Primop.eqWord16# Wrapper.eqWord16#
    
    501
    +  , testPrimop "geWord16#" Primop.geWord16# Wrapper.geWord16#
    
    502
    +  , testPrimop "gtWord16#" Primop.gtWord16# Wrapper.gtWord16#
    
    503
    +  , testPrimop "leWord16#" Primop.leWord16# Wrapper.leWord16#
    
    504
    +  , testPrimop "ltWord16#" Primop.ltWord16# Wrapper.ltWord16#
    
    505
    +  , testPrimop "neWord16#" Primop.neWord16# Wrapper.neWord16#
    
    506
    +  , testPrimop "int32ToInt#" Primop.int32ToInt# Wrapper.int32ToInt#
    
    507
    +  , testPrimop "intToInt32#" Primop.intToInt32# Wrapper.intToInt32#
    
    508
    +  , testPrimop "negateInt32#" Primop.negateInt32# Wrapper.negateInt32#
    
    509
    +  , testPrimop "plusInt32#" Primop.plusInt32# Wrapper.plusInt32#
    
    510
    +  , testPrimop "subInt32#" Primop.subInt32# Wrapper.subInt32#
    
    511
    +  , testPrimop "timesInt32#" Primop.timesInt32# Wrapper.timesInt32#
    
    512
    +  , testPrimopDivLike "quotInt32#" Primop.quotInt32# Wrapper.quotInt32#
    
    513
    +  , testPrimopDivLike "remInt32#" Primop.remInt32# Wrapper.remInt32#
    
    514
    +  , testPrimopDivLike "quotRemInt32#" Primop.quotRemInt32# Wrapper.quotRemInt32#
    
    515
    +  , testPrimop "uncheckedShiftLInt32#" Primop.uncheckedShiftLInt32# Wrapper.uncheckedShiftLInt32#
    
    516
    +  , testPrimop "uncheckedShiftRAInt32#" Primop.uncheckedShiftRAInt32# Wrapper.uncheckedShiftRAInt32#
    
    517
    +  , testPrimop "uncheckedShiftRLInt32#" Primop.uncheckedShiftRLInt32# Wrapper.uncheckedShiftRLInt32#
    
    518
    +  , testPrimop "int32ToWord32#" Primop.int32ToWord32# Wrapper.int32ToWord32#
    
    519
    +  , testPrimop "eqInt32#" Primop.eqInt32# Wrapper.eqInt32#
    
    520
    +  , testPrimop "geInt32#" Primop.geInt32# Wrapper.geInt32#
    
    521
    +  , testPrimop "gtInt32#" Primop.gtInt32# Wrapper.gtInt32#
    
    522
    +  , testPrimop "leInt32#" Primop.leInt32# Wrapper.leInt32#
    
    523
    +  , testPrimop "ltInt32#" Primop.ltInt32# Wrapper.ltInt32#
    
    524
    +  , testPrimop "neInt32#" Primop.neInt32# Wrapper.neInt32#
    
    525
    +  , testPrimop "word32ToWord#" Primop.word32ToWord# Wrapper.word32ToWord#
    
    526
    +  , testPrimop "wordToWord32#" Primop.wordToWord32# Wrapper.wordToWord32#
    
    527
    +  , testPrimop "plusWord32#" Primop.plusWord32# Wrapper.plusWord32#
    
    528
    +  , testPrimop "subWord32#" Primop.subWord32# Wrapper.subWord32#
    
    529
    +  , testPrimop "timesWord32#" Primop.timesWord32# Wrapper.timesWord32#
    
    530
    +  , testPrimopDivLike "quotWord32#" Primop.quotWord32# Wrapper.quotWord32#
    
    531
    +  , testPrimopDivLike "remWord32#" Primop.remWord32# Wrapper.remWord32#
    
    532
    +  , testPrimopDivLike "quotRemWord32#" Primop.quotRemWord32# Wrapper.quotRemWord32#
    
    533
    +  , testPrimop "andWord32#" Primop.andWord32# Wrapper.andWord32#
    
    534
    +  , testPrimop "orWord32#" Primop.orWord32# Wrapper.orWord32#
    
    535
    +  , testPrimop "xorWord32#" Primop.xorWord32# Wrapper.xorWord32#
    
    536
    +  , testPrimop "notWord32#" Primop.notWord32# Wrapper.notWord32#
    
    537
    +  , testPrimop "uncheckedShiftLWord32#" Primop.uncheckedShiftLWord32# Wrapper.uncheckedShiftLWord32#
    
    538
    +  , testPrimop "uncheckedShiftRLWord32#" Primop.uncheckedShiftRLWord32# Wrapper.uncheckedShiftRLWord32#
    
    539
    +  , testPrimop "word32ToInt32#" Primop.word32ToInt32# Wrapper.word32ToInt32#
    
    540
    +  , testPrimop "eqWord32#" Primop.eqWord32# Wrapper.eqWord32#
    
    541
    +  , testPrimop "geWord32#" Primop.geWord32# Wrapper.geWord32#
    
    542
    +  , testPrimop "gtWord32#" Primop.gtWord32# Wrapper.gtWord32#
    
    543
    +  , testPrimop "leWord32#" Primop.leWord32# Wrapper.leWord32#
    
    544
    +  , testPrimop "ltWord32#" Primop.ltWord32# Wrapper.ltWord32#
    
    545
    +  , testPrimop "neWord32#" Primop.neWord32# Wrapper.neWord32#
    
    546
    +  , testPrimop "int64ToInt#" Primop.int64ToInt# Wrapper.int64ToInt#
    
    547
    +  , testPrimop "intToInt64#" Primop.intToInt64# Wrapper.intToInt64#
    
    548
    +  , testPrimop "negateInt64#" Primop.negateInt64# Wrapper.negateInt64#
    
    549
    +  , testPrimop "plusInt64#" Primop.plusInt64# Wrapper.plusInt64#
    
    550
    +  , testPrimop "subInt64#" Primop.subInt64# Wrapper.subInt64#
    
    551
    +  , testPrimop "timesInt64#" Primop.timesInt64# Wrapper.timesInt64#
    
    552
    +  , testPrimopDivLike "quotInt64#" Primop.quotInt64# Wrapper.quotInt64#
    
    553
    +  , testPrimopDivLike "remInt64#" Primop.remInt64# Wrapper.remInt64#
    
    554
    +  , testPrimop "uncheckedIShiftL64#" Primop.uncheckedIShiftL64# Wrapper.uncheckedIShiftL64#
    
    555
    +  , testPrimop "uncheckedIShiftRA64#" Primop.uncheckedIShiftRA64# Wrapper.uncheckedIShiftRA64#
    
    556
    +  , testPrimop "uncheckedIShiftRL64#" Primop.uncheckedIShiftRL64# Wrapper.uncheckedIShiftRL64#
    
    557
    +  , testPrimop "int64ToWord64#" Primop.int64ToWord64# Wrapper.int64ToWord64#
    
    558
    +  , testPrimop "eqInt64#" Primop.eqInt64# Wrapper.eqInt64#
    
    559
    +  , testPrimop "geInt64#" Primop.geInt64# Wrapper.geInt64#
    
    560
    +  , testPrimop "gtInt64#" Primop.gtInt64# Wrapper.gtInt64#
    
    561
    +  , testPrimop "leInt64#" Primop.leInt64# Wrapper.leInt64#
    
    562
    +  , testPrimop "ltInt64#" Primop.ltInt64# Wrapper.ltInt64#
    
    563
    +  , testPrimop "neInt64#" Primop.neInt64# Wrapper.neInt64#
    
    564
    +  , testPrimop "word64ToWord#" Primop.word64ToWord# Wrapper.word64ToWord#
    
    565
    +  , testPrimop "wordToWord64#" Primop.wordToWord64# Wrapper.wordToWord64#
    
    566
    +  , testPrimop "plusWord64#" Primop.plusWord64# Wrapper.plusWord64#
    
    567
    +  , testPrimop "subWord64#" Primop.subWord64# Wrapper.subWord64#
    
    568
    +  , testPrimop "timesWord64#" Primop.timesWord64# Wrapper.timesWord64#
    
    569
    +  , testPrimopDivLike "quotWord64#" Primop.quotWord64# Wrapper.quotWord64#
    
    570
    +  , testPrimopDivLike "remWord64#" Primop.remWord64# Wrapper.remWord64#
    
    571
    +  , testPrimop "and64#" Primop.and64# Wrapper.and64#
    
    572
    +  , testPrimop "or64#" Primop.or64# Wrapper.or64#
    
    573
    +  , testPrimop "xor64#" Primop.xor64# Wrapper.xor64#
    
    574
    +  , testPrimop "not64#" Primop.not64# Wrapper.not64#
    
    575
    +  , testPrimop "uncheckedShiftL64#" Primop.uncheckedShiftL64# Wrapper.uncheckedShiftL64#
    
    576
    +  , testPrimop "uncheckedShiftRL64#" Primop.uncheckedShiftRL64# Wrapper.uncheckedShiftRL64#
    
    577
    +  , testPrimop "word64ToInt64#" Primop.word64ToInt64# Wrapper.word64ToInt64#
    
    578
    +  , testPrimop "eqWord64#" Primop.eqWord64# Wrapper.eqWord64#
    
    579
    +  , testPrimop "geWord64#" Primop.geWord64# Wrapper.geWord64#
    
    580
    +  , testPrimop "gtWord64#" Primop.gtWord64# Wrapper.gtWord64#
    
    581
    +  , testPrimop "leWord64#" Primop.leWord64# Wrapper.leWord64#
    
    582
    +  , testPrimop "ltWord64#" Primop.ltWord64# Wrapper.ltWord64#
    
    583
    +  , testPrimop "neWord64#" Primop.neWord64# Wrapper.neWord64#
    
    584
    +  , testPrimop "+#" (Primop.+#) (Wrapper.+#)
    
    585
    +  , testPrimop "-#" (Primop.-#) (Wrapper.-#)
    
    586
    +  , testPrimop "*#" (Primop.*#) (Wrapper.*#)
    
    587
    +  , testPrimop "timesInt2#" Primop.timesInt2# Wrapper.timesInt2#
    
    588
    +  , testPrimop "mulIntMayOflo#" Primop.mulIntMayOflo# Wrapper.mulIntMayOflo#
    
    589
    +  , testPrimopDivLike "quotInt#" Primop.quotInt# Wrapper.quotInt#
    
    590
    +  , testPrimopDivLike "remInt#" Primop.remInt# Wrapper.remInt#
    
    591
    +  , testPrimopDivLike "quotRemInt#" Primop.quotRemInt# Wrapper.quotRemInt#
    
    592
    +  , testPrimop "andI#" Primop.andI# Wrapper.andI#
    
    593
    +  , testPrimop "orI#" Primop.orI# Wrapper.orI#
    
    594
    +  , testPrimop "xorI#" Primop.xorI# Wrapper.xorI#
    
    595
    +  , testPrimop "notI#" Primop.notI# Wrapper.notI#
    
    596
    +  , testPrimop "negateInt#" Primop.negateInt# Wrapper.negateInt#
    
    597
    +  , testPrimop "addIntC#" Primop.addIntC# Wrapper.addIntC#
    
    598
    +  , testPrimop "subIntC#" Primop.subIntC# Wrapper.subIntC#
    
    599
    +  , testPrimop ">#" (Primop.>#) (Wrapper.>#)
    
    600
    +  , testPrimop ">=#" (Primop.>=#) (Wrapper.>=#)
    
    601
    +  , testPrimop "==#" (Primop.==#) (Wrapper.==#)
    
    602
    +  , testPrimop "/=#" (Primop./=#) (Wrapper./=#)
    
    603
    +  , testPrimop "<#" (Primop.<#) (Wrapper.<#)
    
    604
    +  , testPrimop "<=#" (Primop.<=#) (Wrapper.<=#)
    
    605
    +  , testPrimop "chr#" Primop.chr# Wrapper.chr#
    
    606
    +  , testPrimop "int2Word#" Primop.int2Word# Wrapper.int2Word#
    
    607
    +  , testPrimop "uncheckedIShiftL#" Primop.uncheckedIShiftL# Wrapper.uncheckedIShiftL#
    
    608
    +  , testPrimop "uncheckedIShiftRA#" Primop.uncheckedIShiftRA# Wrapper.uncheckedIShiftRA#
    
    609
    +  , testPrimop "uncheckedIShiftRL#" Primop.uncheckedIShiftRL# Wrapper.uncheckedIShiftRL#
    
    610
    +  , testPrimop "plusWord#" Primop.plusWord# Wrapper.plusWord#
    
    611
    +  , testPrimop "addWordC#" Primop.addWordC# Wrapper.addWordC#
    
    612
    +  , testPrimop "subWordC#" Primop.subWordC# Wrapper.subWordC#
    
    613
    +  , testPrimop "plusWord2#" Primop.plusWord2# Wrapper.plusWord2#
    
    614
    +  , testPrimop "minusWord#" Primop.minusWord# Wrapper.minusWord#
    
    615
    +  , testPrimop "timesWord#" Primop.timesWord# Wrapper.timesWord#
    
    616
    +  , testPrimop "timesWord2#" Primop.timesWord2# Wrapper.timesWord2#
    
    617
    +  , testPrimopDivLike "quotWord#" Primop.quotWord# Wrapper.quotWord#
    
    618
    +  , testPrimopDivLike "remWord#" Primop.remWord# Wrapper.remWord#
    
    619
    +  , testPrimopDivLike "quotRemWord#" Primop.quotRemWord# Wrapper.quotRemWord#
    
    620
    +  , testPrimop "and#" Primop.and# Wrapper.and#
    
    621
    +  , testPrimop "or#" Primop.or# Wrapper.or#
    
    622
    +  , testPrimop "xor#" Primop.xor# Wrapper.xor#
    
    623
    +  , testPrimop "not#" Primop.not# Wrapper.not#
    
    624
    +  , testPrimop "uncheckedShiftL#" Primop.uncheckedShiftL# Wrapper.uncheckedShiftL#
    
    625
    +  , testPrimop "uncheckedShiftRL#" Primop.uncheckedShiftRL# Wrapper.uncheckedShiftRL#
    
    626
    +  , testPrimop "word2Int#" Primop.word2Int# Wrapper.word2Int#
    
    627
    +  , testPrimop "gtWord#" Primop.gtWord# Wrapper.gtWord#
    
    628
    +  , testPrimop "geWord#" Primop.geWord# Wrapper.geWord#
    
    629
    +  , testPrimop "eqWord#" Primop.eqWord# Wrapper.eqWord#
    
    630
    +  , testPrimop "neWord#" Primop.neWord# Wrapper.neWord#
    
    631
    +  , testPrimop "ltWord#" Primop.ltWord# Wrapper.ltWord#
    
    632
    +  , testPrimop "leWord#" Primop.leWord# Wrapper.leWord#
    
    633
    +  , testPrimop "popCnt8#" Primop.popCnt8# Wrapper.popCnt8#
    
    634
    +  , testPrimop "popCnt16#" Primop.popCnt16# Wrapper.popCnt16#
    
    635
    +  , testPrimop "popCnt32#" Primop.popCnt32# Wrapper.popCnt32#
    
    636
    +  , testPrimop "popCnt64#" Primop.popCnt64# Wrapper.popCnt64#
    
    637
    +  , testPrimop "popCnt#" Primop.popCnt# Wrapper.popCnt#
    
    638
    +  , testPrimop "pdep8#" Primop.pdep8# Wrapper.pdep8#
    
    639
    +  , testPrimop "pdep16#" Primop.pdep16# Wrapper.pdep16#
    
    640
    +  , testPrimop "pdep32#" Primop.pdep32# Wrapper.pdep32#
    
    641
    +  , testPrimop "pdep64#" Primop.pdep64# Wrapper.pdep64#
    
    642
    +  , testPrimop "pdep#" Primop.pdep# Wrapper.pdep#
    
    643
    +  , testPrimop "pext8#" Primop.pext8# Wrapper.pext8#
    
    644
    +  , testPrimop "pext16#" Primop.pext16# Wrapper.pext16#
    
    645
    +  , testPrimop "pext32#" Primop.pext32# Wrapper.pext32#
    
    646
    +  , testPrimop "pext64#" Primop.pext64# Wrapper.pext64#
    
    647
    +  , testPrimop "pext#" Primop.pext# Wrapper.pext#
    
    648
    +  , testPrimop "clz8#" Primop.clz8# Wrapper.clz8#
    
    649
    +  , testPrimop "clz16#" Primop.clz16# Wrapper.clz16#
    
    650
    +  , testPrimop "clz32#" Primop.clz32# Wrapper.clz32#
    
    651
    +  , testPrimop "clz64#" Primop.clz64# Wrapper.clz64#
    
    652
    +  , testPrimop "clz#" Primop.clz# Wrapper.clz#
    
    653
    +  , testPrimop "ctz8#" Primop.ctz8# Wrapper.ctz8#
    
    654
    +  , testPrimop "ctz16#" Primop.ctz16# Wrapper.ctz16#
    
    655
    +  , testPrimop "ctz32#" Primop.ctz32# Wrapper.ctz32#
    
    656
    +  , testPrimop "ctz64#" Primop.ctz64# Wrapper.ctz64#
    
    657
    +  , testPrimop "ctz#" Primop.ctz# Wrapper.ctz#
    
    658
    +  , testPrimop "byteSwap16#" Primop.byteSwap16# Wrapper.byteSwap16#
    
    659
    +  , testPrimop "byteSwap32#" Primop.byteSwap32# Wrapper.byteSwap32#
    
    660
    +  , testPrimop "byteSwap64#" Primop.byteSwap64# Wrapper.byteSwap64#
    
    661
    +  , testPrimop "byteSwap#" Primop.byteSwap# Wrapper.byteSwap#
    
    662
    +  , testPrimop "bitReverse8#" Primop.bitReverse8# Wrapper.bitReverse8#
    
    663
    +  , testPrimop "bitReverse16#" Primop.bitReverse16# Wrapper.bitReverse16#
    
    664
    +  , testPrimop "bitReverse32#" Primop.bitReverse32# Wrapper.bitReverse32#
    
    665
    +  , testPrimop "bitReverse64#" Primop.bitReverse64# Wrapper.bitReverse64#
    
    666
    +  , testPrimop "bitReverse#" Primop.bitReverse# Wrapper.bitReverse#
    
    667
    +  , testPrimop "narrow8Int#" Primop.narrow8Int# Wrapper.narrow8Int#
    
    668
    +  , testPrimop "narrow16Int#" Primop.narrow16Int# Wrapper.narrow16Int#
    
    669
    +  , testPrimop "narrow32Int#" Primop.narrow32Int# Wrapper.narrow32Int#
    
    670
    +  , testPrimop "narrow8Word#" Primop.narrow8Word# Wrapper.narrow8Word#
    
    671
    +  , testPrimop "narrow16Word#" Primop.narrow16Word# Wrapper.narrow16Word#
    
    672
    +  , testPrimop "narrow32Word#" Primop.narrow32Word# Wrapper.narrow32Word#
    
    673
    +  ]
    
    674
    +
    
    675
    +instance TestPrimop (Char# -> Char# -> Int#) where
    
    676
    +  testPrimop s l r = Property s $ \ (uChar#-> x0) (uChar#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    677
    +
    
    678
    +instance TestPrimop (Char# -> Int#) where
    
    679
    +  testPrimop s l r = Property s $ \ (uChar#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    680
    +
    
    681
    +instance TestPrimop (Int# -> Int# -> Int#) where
    
    682
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) (uInt#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    683
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt#-> x0) (uInt#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    684
    +
    
    685
    +instance TestPrimop (Int# -> Int# -> (# Int#,Int# #)) where
    
    686
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP2(wInt#,wInt#, (l x0 x1)) === WTUP2(wInt#,wInt#, (r x0 x1))
    
    687
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP2(wInt#,wInt#, (l x0 x1)) === WTUP2(wInt#,wInt#, (r x0 x1))
    
    688
    +
    
    689
    +instance TestPrimop (Int# -> Int# -> (# Int#,Int#,Int# #)) where
    
    690
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP3(wInt#,wInt#,wInt#, (l x0 x1)) === WTUP3(wInt#,wInt#,wInt#, (r x0 x1))
    
    691
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP3(wInt#,wInt#,wInt#, (l x0 x1)) === WTUP3(wInt#,wInt#,wInt#, (r x0 x1))
    
    692
    +
    
    693
    +instance TestPrimop (Int# -> Char#) where
    
    694
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wChar# (l x0) === wChar# (r x0)
    
    695
    +
    
    696
    +instance TestPrimop (Int# -> Int#) where
    
    697
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    698
    +
    
    699
    +instance TestPrimop (Int# -> Int16#) where
    
    700
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wInt16# (l x0) === wInt16# (r x0)
    
    701
    +
    
    702
    +instance TestPrimop (Int# -> Int32#) where
    
    703
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wInt32# (l x0) === wInt32# (r x0)
    
    704
    +
    
    705
    +instance TestPrimop (Int# -> Int64#) where
    
    706
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wInt64# (l x0) === wInt64# (r x0)
    
    707
    +
    
    708
    +instance TestPrimop (Int# -> Int8#) where
    
    709
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wInt8# (l x0) === wInt8# (r x0)
    
    710
    +
    
    711
    +instance TestPrimop (Int# -> Word#) where
    
    712
    +  testPrimop s l r = Property s $ \ (uInt#-> x0) -> wWord# (l x0) === wWord# (r x0)
    
    713
    +
    
    714
    +instance TestPrimop (Int16# -> Int# -> Int16#) where
    
    715
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt#-> x1) -> wInt16# (l x0 x1) === wInt16# (r x0 x1)
    
    716
    +
    
    717
    +instance TestPrimop (Int16# -> Int16# -> Int#) where
    
    718
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    719
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    720
    +
    
    721
    +instance TestPrimop (Int16# -> Int16# -> Int16#) where
    
    722
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt16# (l x0 x1) === wInt16# (r x0 x1)
    
    723
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt16# (l x0 x1) === wInt16# (r x0 x1)
    
    724
    +
    
    725
    +instance TestPrimop (Int16# -> Int16# -> (# Int16#,Int16# #)) where
    
    726
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt16#-> x1) -> WTUP2(wInt16#,wInt16#, (l x0 x1)) === WTUP2(wInt16#,wInt16#, (r x0 x1))
    
    727
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt16#-> x0) (uInt16#-> x1) -> WTUP2(wInt16#,wInt16#, (l x0 x1)) === WTUP2(wInt16#,wInt16#, (r x0 x1))
    
    728
    +
    
    729
    +instance TestPrimop (Int16# -> Int#) where
    
    730
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    731
    +
    
    732
    +instance TestPrimop (Int16# -> Int16#) where
    
    733
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) -> wInt16# (l x0) === wInt16# (r x0)
    
    734
    +
    
    735
    +instance TestPrimop (Int16# -> Word16#) where
    
    736
    +  testPrimop s l r = Property s $ \ (uInt16#-> x0) -> wWord16# (l x0) === wWord16# (r x0)
    
    737
    +
    
    738
    +instance TestPrimop (Int32# -> Int# -> Int32#) where
    
    739
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt#-> x1) -> wInt32# (l x0 x1) === wInt32# (r x0 x1)
    
    740
    +
    
    741
    +instance TestPrimop (Int32# -> Int32# -> Int#) where
    
    742
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    743
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    744
    +
    
    745
    +instance TestPrimop (Int32# -> Int32# -> Int32#) where
    
    746
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt32# (l x0 x1) === wInt32# (r x0 x1)
    
    747
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt32# (l x0 x1) === wInt32# (r x0 x1)
    
    748
    +
    
    749
    +instance TestPrimop (Int32# -> Int32# -> (# Int32#,Int32# #)) where
    
    750
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt32#-> x1) -> WTUP2(wInt32#,wInt32#, (l x0 x1)) === WTUP2(wInt32#,wInt32#, (r x0 x1))
    
    751
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt32#-> x0) (uInt32#-> x1) -> WTUP2(wInt32#,wInt32#, (l x0 x1)) === WTUP2(wInt32#,wInt32#, (r x0 x1))
    
    752
    +
    
    753
    +instance TestPrimop (Int32# -> Int#) where
    
    754
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    755
    +
    
    756
    +instance TestPrimop (Int32# -> Int32#) where
    
    757
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) -> wInt32# (l x0) === wInt32# (r x0)
    
    758
    +
    
    759
    +instance TestPrimop (Int32# -> Word32#) where
    
    760
    +  testPrimop s l r = Property s $ \ (uInt32#-> x0) -> wWord32# (l x0) === wWord32# (r x0)
    
    761
    +
    
    762
    +instance TestPrimop (Int64# -> Int# -> Int64#) where
    
    763
    +  testPrimop s l r = Property s $ \ (uInt64#-> x0) (uInt#-> x1) -> wInt64# (l x0 x1) === wInt64# (r x0 x1)
    
    764
    +
    
    765
    +instance TestPrimop (Int64# -> Int64# -> Int#) where
    
    766
    +  testPrimop s l r = Property s $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    767
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    768
    +
    
    769
    +instance TestPrimop (Int64# -> Int64# -> Int64#) where
    
    770
    +  testPrimop s l r = Property s $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt64# (l x0 x1) === wInt64# (r x0 x1)
    
    771
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt64# (l x0 x1) === wInt64# (r x0 x1)
    
    772
    +
    
    773
    +instance TestPrimop (Int64# -> Int#) where
    
    774
    +  testPrimop s l r = Property s $ \ (uInt64#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    775
    +
    
    776
    +instance TestPrimop (Int64# -> Int64#) where
    
    777
    +  testPrimop s l r = Property s $ \ (uInt64#-> x0) -> wInt64# (l x0) === wInt64# (r x0)
    
    778
    +
    
    779
    +instance TestPrimop (Int64# -> Word64#) where
    
    780
    +  testPrimop s l r = Property s $ \ (uInt64#-> x0) -> wWord64# (l x0) === wWord64# (r x0)
    
    781
    +
    
    782
    +instance TestPrimop (Int8# -> Int# -> Int8#) where
    
    783
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt#-> x1) -> wInt8# (l x0 x1) === wInt8# (r x0 x1)
    
    784
    +
    
    785
    +instance TestPrimop (Int8# -> Int8# -> Int#) where
    
    786
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    787
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    788
    +
    
    789
    +instance TestPrimop (Int8# -> Int8# -> Int8#) where
    
    790
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt8# (l x0 x1) === wInt8# (r x0 x1)
    
    791
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt8# (l x0 x1) === wInt8# (r x0 x1)
    
    792
    +
    
    793
    +instance TestPrimop (Int8# -> Int8# -> (# Int8#,Int8# #)) where
    
    794
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt8#-> x1) -> WTUP2(wInt8#,wInt8#, (l x0 x1)) === WTUP2(wInt8#,wInt8#, (r x0 x1))
    
    795
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt8#-> x0) (uInt8#-> x1) -> WTUP2(wInt8#,wInt8#, (l x0 x1)) === WTUP2(wInt8#,wInt8#, (r x0 x1))
    
    796
    +
    
    797
    +instance TestPrimop (Int8# -> Int#) where
    
    798
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    799
    +
    
    800
    +instance TestPrimop (Int8# -> Int8#) where
    
    801
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) -> wInt8# (l x0) === wInt8# (r x0)
    
    802
    +
    
    803
    +instance TestPrimop (Int8# -> Word8#) where
    
    804
    +  testPrimop s l r = Property s $ \ (uInt8#-> x0) -> wWord8# (l x0) === wWord8# (r x0)
    
    805
    +
    
    806
    +instance TestPrimop (Word# -> Int# -> Word#) where
    
    807
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) (uInt#-> x1) -> wWord# (l x0 x1) === wWord# (r x0 x1)
    
    808
    +
    
    809
    +instance TestPrimop (Word# -> Word# -> Int#) where
    
    810
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    811
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    812
    +
    
    813
    +instance TestPrimop (Word# -> Word# -> Word#) where
    
    814
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> wWord# (l x0 x1) === wWord# (r x0 x1)
    
    815
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> wWord# (l x0 x1) === wWord# (r x0 x1)
    
    816
    +
    
    817
    +instance TestPrimop (Word# -> Word# -> (# Word#,Int# #)) where
    
    818
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wInt#, (l x0 x1)) === WTUP2(wWord#,wInt#, (r x0 x1))
    
    819
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wInt#, (l x0 x1)) === WTUP2(wWord#,wInt#, (r x0 x1))
    
    820
    +
    
    821
    +instance TestPrimop (Word# -> Word# -> (# Word#,Word# #)) where
    
    822
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wWord#, (l x0 x1)) === WTUP2(wWord#,wWord#, (r x0 x1))
    
    823
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wWord#, (l x0 x1)) === WTUP2(wWord#,wWord#, (r x0 x1))
    
    824
    +
    
    825
    +instance TestPrimop (Word# -> Int#) where
    
    826
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    827
    +
    
    828
    +instance TestPrimop (Word# -> Word#) where
    
    829
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) -> wWord# (l x0) === wWord# (r x0)
    
    830
    +
    
    831
    +instance TestPrimop (Word# -> Word16#) where
    
    832
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) -> wWord16# (l x0) === wWord16# (r x0)
    
    833
    +
    
    834
    +instance TestPrimop (Word# -> Word32#) where
    
    835
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) -> wWord32# (l x0) === wWord32# (r x0)
    
    836
    +
    
    837
    +instance TestPrimop (Word# -> Word64#) where
    
    838
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) -> wWord64# (l x0) === wWord64# (r x0)
    
    839
    +
    
    840
    +instance TestPrimop (Word# -> Word8#) where
    
    841
    +  testPrimop s l r = Property s $ \ (uWord#-> x0) -> wWord8# (l x0) === wWord8# (r x0)
    
    842
    +
    
    843
    +instance TestPrimop (Word16# -> Int# -> Word16#) where
    
    844
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) (uInt#-> x1) -> wWord16# (l x0 x1) === wWord16# (r x0 x1)
    
    845
    +
    
    846
    +instance TestPrimop (Word16# -> Word16# -> Int#) where
    
    847
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) (uWord16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    848
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord16#-> x0) (uWord16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    849
    +
    
    850
    +instance TestPrimop (Word16# -> Word16# -> Word16#) where
    
    851
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) (uWord16#-> x1) -> wWord16# (l x0 x1) === wWord16# (r x0 x1)
    
    852
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord16#-> x0) (uWord16#-> x1) -> wWord16# (l x0 x1) === wWord16# (r x0 x1)
    
    853
    +
    
    854
    +instance TestPrimop (Word16# -> Word16# -> (# Word16#,Word16# #)) where
    
    855
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) (uWord16#-> x1) -> WTUP2(wWord16#,wWord16#, (l x0 x1)) === WTUP2(wWord16#,wWord16#, (r x0 x1))
    
    856
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord16#-> x0) (uWord16#-> x1) -> WTUP2(wWord16#,wWord16#, (l x0 x1)) === WTUP2(wWord16#,wWord16#, (r x0 x1))
    
    857
    +
    
    858
    +instance TestPrimop (Word16# -> Int16#) where
    
    859
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) -> wInt16# (l x0) === wInt16# (r x0)
    
    860
    +
    
    861
    +instance TestPrimop (Word16# -> Word#) where
    
    862
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) -> wWord# (l x0) === wWord# (r x0)
    
    863
    +
    
    864
    +instance TestPrimop (Word16# -> Word16#) where
    
    865
    +  testPrimop s l r = Property s $ \ (uWord16#-> x0) -> wWord16# (l x0) === wWord16# (r x0)
    
    866
    +
    
    867
    +instance TestPrimop (Word32# -> Int# -> Word32#) where
    
    868
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) (uInt#-> x1) -> wWord32# (l x0 x1) === wWord32# (r x0 x1)
    
    869
    +
    
    870
    +instance TestPrimop (Word32# -> Word32# -> Int#) where
    
    871
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) (uWord32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    872
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord32#-> x0) (uWord32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    873
    +
    
    874
    +instance TestPrimop (Word32# -> Word32# -> Word32#) where
    
    875
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) (uWord32#-> x1) -> wWord32# (l x0 x1) === wWord32# (r x0 x1)
    
    876
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord32#-> x0) (uWord32#-> x1) -> wWord32# (l x0 x1) === wWord32# (r x0 x1)
    
    877
    +
    
    878
    +instance TestPrimop (Word32# -> Word32# -> (# Word32#,Word32# #)) where
    
    879
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) (uWord32#-> x1) -> WTUP2(wWord32#,wWord32#, (l x0 x1)) === WTUP2(wWord32#,wWord32#, (r x0 x1))
    
    880
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord32#-> x0) (uWord32#-> x1) -> WTUP2(wWord32#,wWord32#, (l x0 x1)) === WTUP2(wWord32#,wWord32#, (r x0 x1))
    
    881
    +
    
    882
    +instance TestPrimop (Word32# -> Int32#) where
    
    883
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) -> wInt32# (l x0) === wInt32# (r x0)
    
    884
    +
    
    885
    +instance TestPrimop (Word32# -> Word#) where
    
    886
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) -> wWord# (l x0) === wWord# (r x0)
    
    887
    +
    
    888
    +instance TestPrimop (Word32# -> Word32#) where
    
    889
    +  testPrimop s l r = Property s $ \ (uWord32#-> x0) -> wWord32# (l x0) === wWord32# (r x0)
    
    890
    +
    
    891
    +instance TestPrimop (Word64# -> Int# -> Word64#) where
    
    892
    +  testPrimop s l r = Property s $ \ (uWord64#-> x0) (uInt#-> x1) -> wWord64# (l x0 x1) === wWord64# (r x0 x1)
    
    893
    +
    
    894
    +instance TestPrimop (Word64# -> Word64# -> Int#) where
    
    895
    +  testPrimop s l r = Property s $ \ (uWord64#-> x0) (uWord64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    896
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord64#-> x0) (uWord64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    897
    +
    
    898
    +instance TestPrimop (Word64# -> Word64# -> Word64#) where
    
    899
    +  testPrimop s l r = Property s $ \ (uWord64#-> x0) (uWord64#-> x1) -> wWord64# (l x0 x1) === wWord64# (r x0 x1)
    
    900
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord64#-> x0) (uWord64#-> x1) -> wWord64# (l x0 x1) === wWord64# (r x0 x1)
    
    901
    +
    
    902
    +instance TestPrimop (Word64# -> Int64#) where
    
    903
    +  testPrimop s l r = Property s $ \ (uWord64#-> x0) -> wInt64# (l x0) === wInt64# (r x0)
    
    904
    +
    
    905
    +instance TestPrimop (Word64# -> Word#) where
    
    906
    +  testPrimop s l r = Property s $ \ (uWord64#-> x0) -> wWord# (l x0) === wWord# (r x0)
    
    907
    +
    
    908
    +instance TestPrimop (Word64# -> Word64#) where
    
    909
    +  testPrimop s l r = Property s $ \ (uWord64#-> x0) -> wWord64# (l x0) === wWord64# (r x0)
    
    910
    +
    
    911
    +instance TestPrimop (Word8# -> Int# -> Word8#) where
    
    912
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) (uInt#-> x1) -> wWord8# (l x0 x1) === wWord8# (r x0 x1)
    
    913
    +
    
    914
    +instance TestPrimop (Word8# -> Word8# -> Int#) where
    
    915
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) (uWord8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    916
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord8#-> x0) (uWord8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    917
    +
    
    918
    +instance TestPrimop (Word8# -> Word8# -> Word8#) where
    
    919
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) (uWord8#-> x1) -> wWord8# (l x0 x1) === wWord8# (r x0 x1)
    
    920
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord8#-> x0) (uWord8#-> x1) -> wWord8# (l x0 x1) === wWord8# (r x0 x1)
    
    921
    +
    
    922
    +instance TestPrimop (Word8# -> Word8# -> (# Word8#,Word8# #)) where
    
    923
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) (uWord8#-> x1) -> WTUP2(wWord8#,wWord8#, (l x0 x1)) === WTUP2(wWord8#,wWord8#, (r x0 x1))
    
    924
    +  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord8#-> x0) (uWord8#-> x1) -> WTUP2(wWord8#,wWord8#, (l x0 x1)) === WTUP2(wWord8#,wWord8#, (r x0 x1))
    
    925
    +
    
    926
    +instance TestPrimop (Word8# -> Int8#) where
    
    927
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) -> wInt8# (l x0) === wInt8# (r x0)
    
    275 928
     
    
    929
    +instance TestPrimop (Word8# -> Word#) where
    
    930
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) -> wWord# (l x0) === wWord# (r x0)
    
    276 931
     
    
    277
    -main = runTests testNumberRefs
    932
    +instance TestPrimop (Word8# -> Word8#) where
    
    933
    +  testPrimop s l r = Property s $ \ (uWord8#-> x0) -> wWord8# (l x0) === wWord8# (r x0)

  • testsuite/tests/numeric/should_run/foundation.stdout
    1 1
     Group ALL
    
    2
    -  Group Int
    
    3
    -    Group Integral
    
    4
    -      Running FromIntegral(Integer(a)) == a
    
    5
    -        Passed 100 iterations
    
    6
    -    Group Property
    
    7
    -      Running Eq
    
    8
    -        Passed 100 iterations
    
    9
    -      Running Show
    
    10
    -        Passed 100 iterations
    
    11
    -      Running Ord
    
    12
    -        Passed 100 iterations
    
    13
    -      Running <
    
    14
    -        Passed 100 iterations
    
    15
    -    Group Additive
    
    16
    -      Running a + azero == a
    
    17
    -        Passed 100 iterations
    
    18
    -      Running azero + a == a
    
    19
    -        Passed 100 iterations
    
    20
    -      Running a + b == b + a
    
    21
    -        Passed 100 iterations
    
    22
    -    Group Multiplicative
    
    23
    -      Running a * 1 == a
    
    24
    -        Passed 100 iterations
    
    25
    -      Running 1 * a == a
    
    26
    -        Passed 100 iterations
    
    27
    -      Running multiplication commutative
    
    28
    -        Passed 100 iterations
    
    29
    -      Running a * b == Integer(a) * Integer(b)
    
    30
    -        Passed 100 iterations
    
    31
    -    Group Divisible
    
    32
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    33
    -        Passed 100 iterations
    
    34
    -    Group Precedence
    
    35
    -      Running + and - (1)
    
    36
    -        Passed 100 iterations
    
    37
    -      Running + and - (2)
    
    38
    -        Passed 100 iterations
    
    39
    -      Running + and * (1)
    
    40
    -        Passed 100 iterations
    
    41
    -      Running + and * (2)
    
    42
    -        Passed 100 iterations
    
    43
    -      Running - and * (1)
    
    44
    -        Passed 100 iterations
    
    45
    -      Running - and * (2)
    
    46
    -        Passed 100 iterations
    
    47
    -      Running * and ^ (1)
    
    48
    -        Passed 100 iterations
    
    49
    -      Running * and ^ (2)
    
    50
    -        Passed 100 iterations
    
    51
    -  Group Int8
    
    52
    -    Group Integral
    
    53
    -      Running FromIntegral(Integer(a)) == a
    
    54
    -        Passed 100 iterations
    
    55
    -    Group Property
    
    56
    -      Running Eq
    
    57
    -        Passed 100 iterations
    
    58
    -      Running Show
    
    59
    -        Passed 100 iterations
    
    60
    -      Running Ord
    
    61
    -        Passed 100 iterations
    
    62
    -      Running <
    
    63
    -        Passed 100 iterations
    
    64
    -    Group Additive
    
    65
    -      Running a + azero == a
    
    66
    -        Passed 100 iterations
    
    67
    -      Running azero + a == a
    
    68
    -        Passed 100 iterations
    
    69
    -      Running a + b == b + a
    
    70
    -        Passed 100 iterations
    
    71
    -    Group Multiplicative
    
    72
    -      Running a * 1 == a
    
    73
    -        Passed 100 iterations
    
    74
    -      Running 1 * a == a
    
    75
    -        Passed 100 iterations
    
    76
    -      Running multiplication commutative
    
    77
    -        Passed 100 iterations
    
    78
    -      Running a * b == Integer(a) * Integer(b)
    
    79
    -        Passed 100 iterations
    
    80
    -    Group Divisible
    
    81
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    82
    -        Passed 100 iterations
    
    83
    -    Group Precedence
    
    84
    -      Running + and - (1)
    
    85
    -        Passed 100 iterations
    
    86
    -      Running + and - (2)
    
    87
    -        Passed 100 iterations
    
    88
    -      Running + and * (1)
    
    89
    -        Passed 100 iterations
    
    90
    -      Running + and * (2)
    
    91
    -        Passed 100 iterations
    
    92
    -      Running - and * (1)
    
    93
    -        Passed 100 iterations
    
    94
    -      Running - and * (2)
    
    95
    -        Passed 100 iterations
    
    96
    -      Running * and ^ (1)
    
    97
    -        Passed 100 iterations
    
    98
    -      Running * and ^ (2)
    
    99
    -        Passed 100 iterations
    
    100
    -  Group Int16
    
    101
    -    Group Integral
    
    102
    -      Running FromIntegral(Integer(a)) == a
    
    103
    -        Passed 100 iterations
    
    104
    -    Group Property
    
    105
    -      Running Eq
    
    106
    -        Passed 100 iterations
    
    107
    -      Running Show
    
    108
    -        Passed 100 iterations
    
    109
    -      Running Ord
    
    110
    -        Passed 100 iterations
    
    111
    -      Running <
    
    112
    -        Passed 100 iterations
    
    113
    -    Group Additive
    
    114
    -      Running a + azero == a
    
    115
    -        Passed 100 iterations
    
    116
    -      Running azero + a == a
    
    117
    -        Passed 100 iterations
    
    118
    -      Running a + b == b + a
    
    119
    -        Passed 100 iterations
    
    120
    -    Group Multiplicative
    
    121
    -      Running a * 1 == a
    
    122
    -        Passed 100 iterations
    
    123
    -      Running 1 * a == a
    
    124
    -        Passed 100 iterations
    
    125
    -      Running multiplication commutative
    
    126
    -        Passed 100 iterations
    
    127
    -      Running a * b == Integer(a) * Integer(b)
    
    128
    -        Passed 100 iterations
    
    129
    -    Group Divisible
    
    130
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    131
    -        Passed 100 iterations
    
    132
    -    Group Precedence
    
    133
    -      Running + and - (1)
    
    134
    -        Passed 100 iterations
    
    135
    -      Running + and - (2)
    
    136
    -        Passed 100 iterations
    
    137
    -      Running + and * (1)
    
    138
    -        Passed 100 iterations
    
    139
    -      Running + and * (2)
    
    140
    -        Passed 100 iterations
    
    141
    -      Running - and * (1)
    
    142
    -        Passed 100 iterations
    
    143
    -      Running - and * (2)
    
    144
    -        Passed 100 iterations
    
    145
    -      Running * and ^ (1)
    
    146
    -        Passed 100 iterations
    
    147
    -      Running * and ^ (2)
    
    148
    -        Passed 100 iterations
    
    149
    -  Group Int32
    
    150
    -    Group Integral
    
    151
    -      Running FromIntegral(Integer(a)) == a
    
    152
    -        Passed 100 iterations
    
    153
    -    Group Property
    
    154
    -      Running Eq
    
    155
    -        Passed 100 iterations
    
    156
    -      Running Show
    
    157
    -        Passed 100 iterations
    
    158
    -      Running Ord
    
    159
    -        Passed 100 iterations
    
    160
    -      Running <
    
    161
    -        Passed 100 iterations
    
    162
    -    Group Additive
    
    163
    -      Running a + azero == a
    
    164
    -        Passed 100 iterations
    
    165
    -      Running azero + a == a
    
    166
    -        Passed 100 iterations
    
    167
    -      Running a + b == b + a
    
    168
    -        Passed 100 iterations
    
    169
    -    Group Multiplicative
    
    170
    -      Running a * 1 == a
    
    171
    -        Passed 100 iterations
    
    172
    -      Running 1 * a == a
    
    173
    -        Passed 100 iterations
    
    174
    -      Running multiplication commutative
    
    175
    -        Passed 100 iterations
    
    176
    -      Running a * b == Integer(a) * Integer(b)
    
    177
    -        Passed 100 iterations
    
    178
    -    Group Divisible
    
    179
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    180
    -        Passed 100 iterations
    
    181
    -    Group Precedence
    
    182
    -      Running + and - (1)
    
    183
    -        Passed 100 iterations
    
    184
    -      Running + and - (2)
    
    185
    -        Passed 100 iterations
    
    186
    -      Running + and * (1)
    
    187
    -        Passed 100 iterations
    
    188
    -      Running + and * (2)
    
    189
    -        Passed 100 iterations
    
    190
    -      Running - and * (1)
    
    191
    -        Passed 100 iterations
    
    192
    -      Running - and * (2)
    
    193
    -        Passed 100 iterations
    
    194
    -      Running * and ^ (1)
    
    195
    -        Passed 100 iterations
    
    196
    -      Running * and ^ (2)
    
    197
    -        Passed 100 iterations
    
    198
    -  Group Int64
    
    199
    -    Group Integral
    
    200
    -      Running FromIntegral(Integer(a)) == a
    
    201
    -        Passed 100 iterations
    
    202
    -    Group Property
    
    203
    -      Running Eq
    
    204
    -        Passed 100 iterations
    
    205
    -      Running Show
    
    206
    -        Passed 100 iterations
    
    207
    -      Running Ord
    
    208
    -        Passed 100 iterations
    
    209
    -      Running <
    
    210
    -        Passed 100 iterations
    
    211
    -    Group Additive
    
    212
    -      Running a + azero == a
    
    213
    -        Passed 100 iterations
    
    214
    -      Running azero + a == a
    
    215
    -        Passed 100 iterations
    
    216
    -      Running a + b == b + a
    
    217
    -        Passed 100 iterations
    
    218
    -    Group Multiplicative
    
    219
    -      Running a * 1 == a
    
    220
    -        Passed 100 iterations
    
    221
    -      Running 1 * a == a
    
    222
    -        Passed 100 iterations
    
    223
    -      Running multiplication commutative
    
    224
    -        Passed 100 iterations
    
    225
    -      Running a * b == Integer(a) * Integer(b)
    
    226
    -        Passed 100 iterations
    
    227
    -    Group Divisible
    
    228
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    229
    -        Passed 100 iterations
    
    230
    -    Group Precedence
    
    231
    -      Running + and - (1)
    
    232
    -        Passed 100 iterations
    
    233
    -      Running + and - (2)
    
    234
    -        Passed 100 iterations
    
    235
    -      Running + and * (1)
    
    236
    -        Passed 100 iterations
    
    237
    -      Running + and * (2)
    
    238
    -        Passed 100 iterations
    
    239
    -      Running - and * (1)
    
    240
    -        Passed 100 iterations
    
    241
    -      Running - and * (2)
    
    242
    -        Passed 100 iterations
    
    243
    -      Running * and ^ (1)
    
    244
    -        Passed 100 iterations
    
    245
    -      Running * and ^ (2)
    
    246
    -        Passed 100 iterations
    
    247
    -  Group Integer
    
    248
    -    Group Integral
    
    249
    -      Running FromIntegral(Integer(a)) == a
    
    250
    -        Passed 100 iterations
    
    251
    -    Group Property
    
    252
    -      Running Eq
    
    253
    -        Passed 100 iterations
    
    254
    -      Running Show
    
    255
    -        Passed 100 iterations
    
    256
    -      Running Ord
    
    257
    -        Passed 100 iterations
    
    258
    -      Running <
    
    259
    -        Passed 100 iterations
    
    260
    -    Group Additive
    
    261
    -      Running a + azero == a
    
    262
    -        Passed 100 iterations
    
    263
    -      Running azero + a == a
    
    264
    -        Passed 100 iterations
    
    265
    -      Running a + b == b + a
    
    266
    -        Passed 100 iterations
    
    267
    -    Group Multiplicative
    
    268
    -      Running a * 1 == a
    
    269
    -        Passed 100 iterations
    
    270
    -      Running 1 * a == a
    
    271
    -        Passed 100 iterations
    
    272
    -      Running multiplication commutative
    
    273
    -        Passed 100 iterations
    
    274
    -      Running a * b == Integer(a) * Integer(b)
    
    275
    -        Passed 100 iterations
    
    276
    -    Group Divisible
    
    277
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    278
    -        Passed 100 iterations
    
    279
    -    Group Precedence
    
    280
    -      Running + and - (1)
    
    281
    -        Passed 100 iterations
    
    282
    -      Running + and - (2)
    
    283
    -        Passed 100 iterations
    
    284
    -      Running + and * (1)
    
    285
    -        Passed 100 iterations
    
    286
    -      Running + and * (2)
    
    287
    -        Passed 100 iterations
    
    288
    -      Running - and * (1)
    
    289
    -        Passed 100 iterations
    
    290
    -      Running - and * (2)
    
    291
    -        Passed 100 iterations
    
    292
    -      Running * and ^ (1)
    
    293
    -        Passed 100 iterations
    
    294
    -      Running * and ^ (2)
    
    295
    -        Passed 100 iterations
    
    296
    -  Group Word
    
    297
    -    Group Integral
    
    298
    -      Running FromIntegral(Integer(a)) == a
    
    299
    -        Passed 100 iterations
    
    300
    -    Group Property
    
    301
    -      Running Eq
    
    302
    -        Passed 100 iterations
    
    303
    -      Running Show
    
    304
    -        Passed 100 iterations
    
    305
    -      Running Ord
    
    306
    -        Passed 100 iterations
    
    307
    -      Running <
    
    308
    -        Passed 100 iterations
    
    309
    -    Group Additive
    
    310
    -      Running a + azero == a
    
    311
    -        Passed 100 iterations
    
    312
    -      Running azero + a == a
    
    313
    -        Passed 100 iterations
    
    314
    -      Running a + b == b + a
    
    315
    -        Passed 100 iterations
    
    316
    -    Group Multiplicative
    
    317
    -      Running a * 1 == a
    
    318
    -        Passed 100 iterations
    
    319
    -      Running 1 * a == a
    
    320
    -        Passed 100 iterations
    
    321
    -      Running multiplication commutative
    
    322
    -        Passed 100 iterations
    
    323
    -      Running a * b == Integer(a) * Integer(b)
    
    324
    -        Passed 100 iterations
    
    325
    -    Group Divisible
    
    326
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    327
    -        Passed 100 iterations
    
    328
    -    Group Precedence
    
    329
    -      Running + and - (1)
    
    330
    -        Passed 100 iterations
    
    331
    -      Running + and - (2)
    
    332
    -        Passed 100 iterations
    
    333
    -      Running + and * (1)
    
    334
    -        Passed 100 iterations
    
    335
    -      Running + and * (2)
    
    336
    -        Passed 100 iterations
    
    337
    -      Running - and * (1)
    
    338
    -        Passed 100 iterations
    
    339
    -      Running - and * (2)
    
    340
    -        Passed 100 iterations
    
    341
    -      Running * and ^ (1)
    
    342
    -        Passed 100 iterations
    
    343
    -      Running * and ^ (2)
    
    344
    -        Passed 100 iterations
    
    345
    -  Group Word8
    
    346
    -    Group Integral
    
    347
    -      Running FromIntegral(Integer(a)) == a
    
    348
    -        Passed 100 iterations
    
    349
    -    Group Property
    
    350
    -      Running Eq
    
    351
    -        Passed 100 iterations
    
    352
    -      Running Show
    
    353
    -        Passed 100 iterations
    
    354
    -      Running Ord
    
    355
    -        Passed 100 iterations
    
    356
    -      Running <
    
    357
    -        Passed 100 iterations
    
    358
    -    Group Additive
    
    359
    -      Running a + azero == a
    
    360
    -        Passed 100 iterations
    
    361
    -      Running azero + a == a
    
    362
    -        Passed 100 iterations
    
    363
    -      Running a + b == b + a
    
    364
    -        Passed 100 iterations
    
    365
    -    Group Multiplicative
    
    366
    -      Running a * 1 == a
    
    367
    -        Passed 100 iterations
    
    368
    -      Running 1 * a == a
    
    369
    -        Passed 100 iterations
    
    370
    -      Running multiplication commutative
    
    371
    -        Passed 100 iterations
    
    372
    -      Running a * b == Integer(a) * Integer(b)
    
    373
    -        Passed 100 iterations
    
    374
    -    Group Divisible
    
    375
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    376
    -        Passed 100 iterations
    
    377
    -    Group Precedence
    
    378
    -      Running + and - (1)
    
    379
    -        Passed 100 iterations
    
    380
    -      Running + and - (2)
    
    381
    -        Passed 100 iterations
    
    382
    -      Running + and * (1)
    
    383
    -        Passed 100 iterations
    
    384
    -      Running + and * (2)
    
    385
    -        Passed 100 iterations
    
    386
    -      Running - and * (1)
    
    387
    -        Passed 100 iterations
    
    388
    -      Running - and * (2)
    
    389
    -        Passed 100 iterations
    
    390
    -      Running * and ^ (1)
    
    391
    -        Passed 100 iterations
    
    392
    -      Running * and ^ (2)
    
    393
    -        Passed 100 iterations
    
    394
    -  Group Word16
    
    395
    -    Group Integral
    
    396
    -      Running FromIntegral(Integer(a)) == a
    
    397
    -        Passed 100 iterations
    
    398
    -    Group Property
    
    399
    -      Running Eq
    
    400
    -        Passed 100 iterations
    
    401
    -      Running Show
    
    402
    -        Passed 100 iterations
    
    403
    -      Running Ord
    
    404
    -        Passed 100 iterations
    
    405
    -      Running <
    
    406
    -        Passed 100 iterations
    
    407
    -    Group Additive
    
    408
    -      Running a + azero == a
    
    409
    -        Passed 100 iterations
    
    410
    -      Running azero + a == a
    
    411
    -        Passed 100 iterations
    
    412
    -      Running a + b == b + a
    
    413
    -        Passed 100 iterations
    
    414
    -    Group Multiplicative
    
    415
    -      Running a * 1 == a
    
    416
    -        Passed 100 iterations
    
    417
    -      Running 1 * a == a
    
    418
    -        Passed 100 iterations
    
    419
    -      Running multiplication commutative
    
    420
    -        Passed 100 iterations
    
    421
    -      Running a * b == Integer(a) * Integer(b)
    
    422
    -        Passed 100 iterations
    
    423
    -    Group Divisible
    
    424
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    425
    -        Passed 100 iterations
    
    426
    -    Group Precedence
    
    427
    -      Running + and - (1)
    
    428
    -        Passed 100 iterations
    
    429
    -      Running + and - (2)
    
    430
    -        Passed 100 iterations
    
    431
    -      Running + and * (1)
    
    432
    -        Passed 100 iterations
    
    433
    -      Running + and * (2)
    
    434
    -        Passed 100 iterations
    
    435
    -      Running - and * (1)
    
    436
    -        Passed 100 iterations
    
    437
    -      Running - and * (2)
    
    438
    -        Passed 100 iterations
    
    439
    -      Running * and ^ (1)
    
    440
    -        Passed 100 iterations
    
    441
    -      Running * and ^ (2)
    
    442
    -        Passed 100 iterations
    
    443
    -  Group Word32
    
    444
    -    Group Integral
    
    445
    -      Running FromIntegral(Integer(a)) == a
    
    446
    -        Passed 100 iterations
    
    447
    -    Group Property
    
    448
    -      Running Eq
    
    449
    -        Passed 100 iterations
    
    450
    -      Running Show
    
    451
    -        Passed 100 iterations
    
    452
    -      Running Ord
    
    453
    -        Passed 100 iterations
    
    454
    -      Running <
    
    455
    -        Passed 100 iterations
    
    456
    -    Group Additive
    
    457
    -      Running a + azero == a
    
    458
    -        Passed 100 iterations
    
    459
    -      Running azero + a == a
    
    460
    -        Passed 100 iterations
    
    461
    -      Running a + b == b + a
    
    462
    -        Passed 100 iterations
    
    463
    -    Group Multiplicative
    
    464
    -      Running a * 1 == a
    
    465
    -        Passed 100 iterations
    
    466
    -      Running 1 * a == a
    
    467
    -        Passed 100 iterations
    
    468
    -      Running multiplication commutative
    
    469
    -        Passed 100 iterations
    
    470
    -      Running a * b == Integer(a) * Integer(b)
    
    471
    -        Passed 100 iterations
    
    472
    -    Group Divisible
    
    473
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    474
    -        Passed 100 iterations
    
    475
    -    Group Precedence
    
    476
    -      Running + and - (1)
    
    477
    -        Passed 100 iterations
    
    478
    -      Running + and - (2)
    
    479
    -        Passed 100 iterations
    
    480
    -      Running + and * (1)
    
    481
    -        Passed 100 iterations
    
    482
    -      Running + and * (2)
    
    483
    -        Passed 100 iterations
    
    484
    -      Running - and * (1)
    
    485
    -        Passed 100 iterations
    
    486
    -      Running - and * (2)
    
    487
    -        Passed 100 iterations
    
    488
    -      Running * and ^ (1)
    
    489
    -        Passed 100 iterations
    
    490
    -      Running * and ^ (2)
    
    491
    -        Passed 100 iterations
    
    492
    -  Group Word64
    
    493
    -    Group Integral
    
    494
    -      Running FromIntegral(Integer(a)) == a
    
    495
    -        Passed 100 iterations
    
    496
    -    Group Property
    
    497
    -      Running Eq
    
    498
    -        Passed 100 iterations
    
    499
    -      Running Show
    
    500
    -        Passed 100 iterations
    
    501
    -      Running Ord
    
    502
    -        Passed 100 iterations
    
    503
    -      Running <
    
    504
    -        Passed 100 iterations
    
    505
    -    Group Additive
    
    506
    -      Running a + azero == a
    
    507
    -        Passed 100 iterations
    
    508
    -      Running azero + a == a
    
    509
    -        Passed 100 iterations
    
    510
    -      Running a + b == b + a
    
    511
    -        Passed 100 iterations
    
    512
    -    Group Multiplicative
    
    513
    -      Running a * 1 == a
    
    514
    -        Passed 100 iterations
    
    515
    -      Running 1 * a == a
    
    516
    -        Passed 100 iterations
    
    517
    -      Running multiplication commutative
    
    518
    -        Passed 100 iterations
    
    519
    -      Running a * b == Integer(a) * Integer(b)
    
    520
    -        Passed 100 iterations
    
    521
    -    Group Divisible
    
    522
    -      Running (x `div` y) * y + (x `mod` y) == x
    
    523
    -        Passed 100 iterations
    
    524
    -    Group Precedence
    
    525
    -      Running + and - (1)
    
    526
    -        Passed 100 iterations
    
    527
    -      Running + and - (2)
    
    528
    -        Passed 100 iterations
    
    529
    -      Running + and * (1)
    
    530
    -        Passed 100 iterations
    
    531
    -      Running + and * (2)
    
    532
    -        Passed 100 iterations
    
    533
    -      Running - and * (1)
    
    534
    -        Passed 100 iterations
    
    535
    -      Running - and * (2)
    
    536
    -        Passed 100 iterations
    
    537
    -      Running * and ^ (1)
    
    538
    -        Passed 100 iterations
    
    539
    -      Running * and ^ (2)
    
    540
    -        Passed 100 iterations
    2
    +  Group ALL
    
    3
    +    Group Int
    
    4
    +      Group Integral
    
    5
    +        Running FromIntegral(Integer(a)) == a
    
    6
    +          Passed 100 iterations
    
    7
    +      Group Property
    
    8
    +        Running Eq
    
    9
    +          Passed 100 iterations
    
    10
    +        Running Show
    
    11
    +          Passed 100 iterations
    
    12
    +        Running Ord
    
    13
    +          Passed 100 iterations
    
    14
    +        Running <
    
    15
    +          Passed 100 iterations
    
    16
    +      Group Additive
    
    17
    +        Running a + azero == a
    
    18
    +          Passed 100 iterations
    
    19
    +        Running azero + a == a
    
    20
    +          Passed 100 iterations
    
    21
    +        Running a + b == b + a
    
    22
    +          Passed 100 iterations
    
    23
    +      Group Multiplicative
    
    24
    +        Running a * 1 == a
    
    25
    +          Passed 100 iterations
    
    26
    +        Running 1 * a == a
    
    27
    +          Passed 100 iterations
    
    28
    +        Running multiplication commutative
    
    29
    +          Passed 100 iterations
    
    30
    +        Running a * b == Integer(a) * Integer(b)
    
    31
    +          Passed 100 iterations
    
    32
    +      Group Divisible
    
    33
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    34
    +          Passed 100 iterations
    
    35
    +      Group Precedence
    
    36
    +        Running + and - (1)
    
    37
    +          Passed 100 iterations
    
    38
    +        Running + and - (2)
    
    39
    +          Passed 100 iterations
    
    40
    +        Running + and * (1)
    
    41
    +          Passed 100 iterations
    
    42
    +        Running + and * (2)
    
    43
    +          Passed 100 iterations
    
    44
    +        Running - and * (1)
    
    45
    +          Passed 100 iterations
    
    46
    +        Running - and * (2)
    
    47
    +          Passed 100 iterations
    
    48
    +        Running * and ^ (1)
    
    49
    +          Passed 100 iterations
    
    50
    +        Running * and ^ (2)
    
    51
    +          Passed 100 iterations
    
    52
    +    Group Int8
    
    53
    +      Group Integral
    
    54
    +        Running FromIntegral(Integer(a)) == a
    
    55
    +          Passed 100 iterations
    
    56
    +      Group Property
    
    57
    +        Running Eq
    
    58
    +          Passed 100 iterations
    
    59
    +        Running Show
    
    60
    +          Passed 100 iterations
    
    61
    +        Running Ord
    
    62
    +          Passed 100 iterations
    
    63
    +        Running <
    
    64
    +          Passed 100 iterations
    
    65
    +      Group Additive
    
    66
    +        Running a + azero == a
    
    67
    +          Passed 100 iterations
    
    68
    +        Running azero + a == a
    
    69
    +          Passed 100 iterations
    
    70
    +        Running a + b == b + a
    
    71
    +          Passed 100 iterations
    
    72
    +      Group Multiplicative
    
    73
    +        Running a * 1 == a
    
    74
    +          Passed 100 iterations
    
    75
    +        Running 1 * a == a
    
    76
    +          Passed 100 iterations
    
    77
    +        Running multiplication commutative
    
    78
    +          Passed 100 iterations
    
    79
    +        Running a * b == Integer(a) * Integer(b)
    
    80
    +          Passed 100 iterations
    
    81
    +      Group Divisible
    
    82
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    83
    +          Passed 100 iterations
    
    84
    +      Group Precedence
    
    85
    +        Running + and - (1)
    
    86
    +          Passed 100 iterations
    
    87
    +        Running + and - (2)
    
    88
    +          Passed 100 iterations
    
    89
    +        Running + and * (1)
    
    90
    +          Passed 100 iterations
    
    91
    +        Running + and * (2)
    
    92
    +          Passed 100 iterations
    
    93
    +        Running - and * (1)
    
    94
    +          Passed 100 iterations
    
    95
    +        Running - and * (2)
    
    96
    +          Passed 100 iterations
    
    97
    +        Running * and ^ (1)
    
    98
    +          Passed 100 iterations
    
    99
    +        Running * and ^ (2)
    
    100
    +          Passed 100 iterations
    
    101
    +    Group Int16
    
    102
    +      Group Integral
    
    103
    +        Running FromIntegral(Integer(a)) == a
    
    104
    +          Passed 100 iterations
    
    105
    +      Group Property
    
    106
    +        Running Eq
    
    107
    +          Passed 100 iterations
    
    108
    +        Running Show
    
    109
    +          Passed 100 iterations
    
    110
    +        Running Ord
    
    111
    +          Passed 100 iterations
    
    112
    +        Running <
    
    113
    +          Passed 100 iterations
    
    114
    +      Group Additive
    
    115
    +        Running a + azero == a
    
    116
    +          Passed 100 iterations
    
    117
    +        Running azero + a == a
    
    118
    +          Passed 100 iterations
    
    119
    +        Running a + b == b + a
    
    120
    +          Passed 100 iterations
    
    121
    +      Group Multiplicative
    
    122
    +        Running a * 1 == a
    
    123
    +          Passed 100 iterations
    
    124
    +        Running 1 * a == a
    
    125
    +          Passed 100 iterations
    
    126
    +        Running multiplication commutative
    
    127
    +          Passed 100 iterations
    
    128
    +        Running a * b == Integer(a) * Integer(b)
    
    129
    +          Passed 100 iterations
    
    130
    +      Group Divisible
    
    131
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    132
    +          Passed 100 iterations
    
    133
    +      Group Precedence
    
    134
    +        Running + and - (1)
    
    135
    +          Passed 100 iterations
    
    136
    +        Running + and - (2)
    
    137
    +          Passed 100 iterations
    
    138
    +        Running + and * (1)
    
    139
    +          Passed 100 iterations
    
    140
    +        Running + and * (2)
    
    141
    +          Passed 100 iterations
    
    142
    +        Running - and * (1)
    
    143
    +          Passed 100 iterations
    
    144
    +        Running - and * (2)
    
    145
    +          Passed 100 iterations
    
    146
    +        Running * and ^ (1)
    
    147
    +          Passed 100 iterations
    
    148
    +        Running * and ^ (2)
    
    149
    +          Passed 100 iterations
    
    150
    +    Group Int32
    
    151
    +      Group Integral
    
    152
    +        Running FromIntegral(Integer(a)) == a
    
    153
    +          Passed 100 iterations
    
    154
    +      Group Property
    
    155
    +        Running Eq
    
    156
    +          Passed 100 iterations
    
    157
    +        Running Show
    
    158
    +          Passed 100 iterations
    
    159
    +        Running Ord
    
    160
    +          Passed 100 iterations
    
    161
    +        Running <
    
    162
    +          Passed 100 iterations
    
    163
    +      Group Additive
    
    164
    +        Running a + azero == a
    
    165
    +          Passed 100 iterations
    
    166
    +        Running azero + a == a
    
    167
    +          Passed 100 iterations
    
    168
    +        Running a + b == b + a
    
    169
    +          Passed 100 iterations
    
    170
    +      Group Multiplicative
    
    171
    +        Running a * 1 == a
    
    172
    +          Passed 100 iterations
    
    173
    +        Running 1 * a == a
    
    174
    +          Passed 100 iterations
    
    175
    +        Running multiplication commutative
    
    176
    +          Passed 100 iterations
    
    177
    +        Running a * b == Integer(a) * Integer(b)
    
    178
    +          Passed 100 iterations
    
    179
    +      Group Divisible
    
    180
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    181
    +          Passed 100 iterations
    
    182
    +      Group Precedence
    
    183
    +        Running + and - (1)
    
    184
    +          Passed 100 iterations
    
    185
    +        Running + and - (2)
    
    186
    +          Passed 100 iterations
    
    187
    +        Running + and * (1)
    
    188
    +          Passed 100 iterations
    
    189
    +        Running + and * (2)
    
    190
    +          Passed 100 iterations
    
    191
    +        Running - and * (1)
    
    192
    +          Passed 100 iterations
    
    193
    +        Running - and * (2)
    
    194
    +          Passed 100 iterations
    
    195
    +        Running * and ^ (1)
    
    196
    +          Passed 100 iterations
    
    197
    +        Running * and ^ (2)
    
    198
    +          Passed 100 iterations
    
    199
    +    Group Int64
    
    200
    +      Group Integral
    
    201
    +        Running FromIntegral(Integer(a)) == a
    
    202
    +          Passed 100 iterations
    
    203
    +      Group Property
    
    204
    +        Running Eq
    
    205
    +          Passed 100 iterations
    
    206
    +        Running Show
    
    207
    +          Passed 100 iterations
    
    208
    +        Running Ord
    
    209
    +          Passed 100 iterations
    
    210
    +        Running <
    
    211
    +          Passed 100 iterations
    
    212
    +      Group Additive
    
    213
    +        Running a + azero == a
    
    214
    +          Passed 100 iterations
    
    215
    +        Running azero + a == a
    
    216
    +          Passed 100 iterations
    
    217
    +        Running a + b == b + a
    
    218
    +          Passed 100 iterations
    
    219
    +      Group Multiplicative
    
    220
    +        Running a * 1 == a
    
    221
    +          Passed 100 iterations
    
    222
    +        Running 1 * a == a
    
    223
    +          Passed 100 iterations
    
    224
    +        Running multiplication commutative
    
    225
    +          Passed 100 iterations
    
    226
    +        Running a * b == Integer(a) * Integer(b)
    
    227
    +          Passed 100 iterations
    
    228
    +      Group Divisible
    
    229
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    230
    +          Passed 100 iterations
    
    231
    +      Group Precedence
    
    232
    +        Running + and - (1)
    
    233
    +          Passed 100 iterations
    
    234
    +        Running + and - (2)
    
    235
    +          Passed 100 iterations
    
    236
    +        Running + and * (1)
    
    237
    +          Passed 100 iterations
    
    238
    +        Running + and * (2)
    
    239
    +          Passed 100 iterations
    
    240
    +        Running - and * (1)
    
    241
    +          Passed 100 iterations
    
    242
    +        Running - and * (2)
    
    243
    +          Passed 100 iterations
    
    244
    +        Running * and ^ (1)
    
    245
    +          Passed 100 iterations
    
    246
    +        Running * and ^ (2)
    
    247
    +          Passed 100 iterations
    
    248
    +    Group Integer
    
    249
    +      Group Integral
    
    250
    +        Running FromIntegral(Integer(a)) == a
    
    251
    +          Passed 100 iterations
    
    252
    +      Group Property
    
    253
    +        Running Eq
    
    254
    +          Passed 100 iterations
    
    255
    +        Running Show
    
    256
    +          Passed 100 iterations
    
    257
    +        Running Ord
    
    258
    +          Passed 100 iterations
    
    259
    +        Running <
    
    260
    +          Passed 100 iterations
    
    261
    +      Group Additive
    
    262
    +        Running a + azero == a
    
    263
    +          Passed 100 iterations
    
    264
    +        Running azero + a == a
    
    265
    +          Passed 100 iterations
    
    266
    +        Running a + b == b + a
    
    267
    +          Passed 100 iterations
    
    268
    +      Group Multiplicative
    
    269
    +        Running a * 1 == a
    
    270
    +          Passed 100 iterations
    
    271
    +        Running 1 * a == a
    
    272
    +          Passed 100 iterations
    
    273
    +        Running multiplication commutative
    
    274
    +          Passed 100 iterations
    
    275
    +        Running a * b == Integer(a) * Integer(b)
    
    276
    +          Passed 100 iterations
    
    277
    +      Group Divisible
    
    278
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    279
    +          Passed 100 iterations
    
    280
    +      Group Precedence
    
    281
    +        Running + and - (1)
    
    282
    +          Passed 100 iterations
    
    283
    +        Running + and - (2)
    
    284
    +          Passed 100 iterations
    
    285
    +        Running + and * (1)
    
    286
    +          Passed 100 iterations
    
    287
    +        Running + and * (2)
    
    288
    +          Passed 100 iterations
    
    289
    +        Running - and * (1)
    
    290
    +          Passed 100 iterations
    
    291
    +        Running - and * (2)
    
    292
    +          Passed 100 iterations
    
    293
    +        Running * and ^ (1)
    
    294
    +          Passed 100 iterations
    
    295
    +        Running * and ^ (2)
    
    296
    +          Passed 100 iterations
    
    297
    +    Group Word
    
    298
    +      Group Integral
    
    299
    +        Running FromIntegral(Integer(a)) == a
    
    300
    +          Passed 100 iterations
    
    301
    +      Group Property
    
    302
    +        Running Eq
    
    303
    +          Passed 100 iterations
    
    304
    +        Running Show
    
    305
    +          Passed 100 iterations
    
    306
    +        Running Ord
    
    307
    +          Passed 100 iterations
    
    308
    +        Running <
    
    309
    +          Passed 100 iterations
    
    310
    +      Group Additive
    
    311
    +        Running a + azero == a
    
    312
    +          Passed 100 iterations
    
    313
    +        Running azero + a == a
    
    314
    +          Passed 100 iterations
    
    315
    +        Running a + b == b + a
    
    316
    +          Passed 100 iterations
    
    317
    +      Group Multiplicative
    
    318
    +        Running a * 1 == a
    
    319
    +          Passed 100 iterations
    
    320
    +        Running 1 * a == a
    
    321
    +          Passed 100 iterations
    
    322
    +        Running multiplication commutative
    
    323
    +          Passed 100 iterations
    
    324
    +        Running a * b == Integer(a) * Integer(b)
    
    325
    +          Passed 100 iterations
    
    326
    +      Group Divisible
    
    327
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    328
    +          Passed 100 iterations
    
    329
    +      Group Precedence
    
    330
    +        Running + and - (1)
    
    331
    +          Passed 100 iterations
    
    332
    +        Running + and - (2)
    
    333
    +          Passed 100 iterations
    
    334
    +        Running + and * (1)
    
    335
    +          Passed 100 iterations
    
    336
    +        Running + and * (2)
    
    337
    +          Passed 100 iterations
    
    338
    +        Running - and * (1)
    
    339
    +          Passed 100 iterations
    
    340
    +        Running - and * (2)
    
    341
    +          Passed 100 iterations
    
    342
    +        Running * and ^ (1)
    
    343
    +          Passed 100 iterations
    
    344
    +        Running * and ^ (2)
    
    345
    +          Passed 100 iterations
    
    346
    +    Group Word8
    
    347
    +      Group Integral
    
    348
    +        Running FromIntegral(Integer(a)) == a
    
    349
    +          Passed 100 iterations
    
    350
    +      Group Property
    
    351
    +        Running Eq
    
    352
    +          Passed 100 iterations
    
    353
    +        Running Show
    
    354
    +          Passed 100 iterations
    
    355
    +        Running Ord
    
    356
    +          Passed 100 iterations
    
    357
    +        Running <
    
    358
    +          Passed 100 iterations
    
    359
    +      Group Additive
    
    360
    +        Running a + azero == a
    
    361
    +          Passed 100 iterations
    
    362
    +        Running azero + a == a
    
    363
    +          Passed 100 iterations
    
    364
    +        Running a + b == b + a
    
    365
    +          Passed 100 iterations
    
    366
    +      Group Multiplicative
    
    367
    +        Running a * 1 == a
    
    368
    +          Passed 100 iterations
    
    369
    +        Running 1 * a == a
    
    370
    +          Passed 100 iterations
    
    371
    +        Running multiplication commutative
    
    372
    +          Passed 100 iterations
    
    373
    +        Running a * b == Integer(a) * Integer(b)
    
    374
    +          Passed 100 iterations
    
    375
    +      Group Divisible
    
    376
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    377
    +          Passed 100 iterations
    
    378
    +      Group Precedence
    
    379
    +        Running + and - (1)
    
    380
    +          Passed 100 iterations
    
    381
    +        Running + and - (2)
    
    382
    +          Passed 100 iterations
    
    383
    +        Running + and * (1)
    
    384
    +          Passed 100 iterations
    
    385
    +        Running + and * (2)
    
    386
    +          Passed 100 iterations
    
    387
    +        Running - and * (1)
    
    388
    +          Passed 100 iterations
    
    389
    +        Running - and * (2)
    
    390
    +          Passed 100 iterations
    
    391
    +        Running * and ^ (1)
    
    392
    +          Passed 100 iterations
    
    393
    +        Running * and ^ (2)
    
    394
    +          Passed 100 iterations
    
    395
    +    Group Word16
    
    396
    +      Group Integral
    
    397
    +        Running FromIntegral(Integer(a)) == a
    
    398
    +          Passed 100 iterations
    
    399
    +      Group Property
    
    400
    +        Running Eq
    
    401
    +          Passed 100 iterations
    
    402
    +        Running Show
    
    403
    +          Passed 100 iterations
    
    404
    +        Running Ord
    
    405
    +          Passed 100 iterations
    
    406
    +        Running <
    
    407
    +          Passed 100 iterations
    
    408
    +      Group Additive
    
    409
    +        Running a + azero == a
    
    410
    +          Passed 100 iterations
    
    411
    +        Running azero + a == a
    
    412
    +          Passed 100 iterations
    
    413
    +        Running a + b == b + a
    
    414
    +          Passed 100 iterations
    
    415
    +      Group Multiplicative
    
    416
    +        Running a * 1 == a
    
    417
    +          Passed 100 iterations
    
    418
    +        Running 1 * a == a
    
    419
    +          Passed 100 iterations
    
    420
    +        Running multiplication commutative
    
    421
    +          Passed 100 iterations
    
    422
    +        Running a * b == Integer(a) * Integer(b)
    
    423
    +          Passed 100 iterations
    
    424
    +      Group Divisible
    
    425
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    426
    +          Passed 100 iterations
    
    427
    +      Group Precedence
    
    428
    +        Running + and - (1)
    
    429
    +          Passed 100 iterations
    
    430
    +        Running + and - (2)
    
    431
    +          Passed 100 iterations
    
    432
    +        Running + and * (1)
    
    433
    +          Passed 100 iterations
    
    434
    +        Running + and * (2)
    
    435
    +          Passed 100 iterations
    
    436
    +        Running - and * (1)
    
    437
    +          Passed 100 iterations
    
    438
    +        Running - and * (2)
    
    439
    +          Passed 100 iterations
    
    440
    +        Running * and ^ (1)
    
    441
    +          Passed 100 iterations
    
    442
    +        Running * and ^ (2)
    
    443
    +          Passed 100 iterations
    
    444
    +    Group Word32
    
    445
    +      Group Integral
    
    446
    +        Running FromIntegral(Integer(a)) == a
    
    447
    +          Passed 100 iterations
    
    448
    +      Group Property
    
    449
    +        Running Eq
    
    450
    +          Passed 100 iterations
    
    451
    +        Running Show
    
    452
    +          Passed 100 iterations
    
    453
    +        Running Ord
    
    454
    +          Passed 100 iterations
    
    455
    +        Running <
    
    456
    +          Passed 100 iterations
    
    457
    +      Group Additive
    
    458
    +        Running a + azero == a
    
    459
    +          Passed 100 iterations
    
    460
    +        Running azero + a == a
    
    461
    +          Passed 100 iterations
    
    462
    +        Running a + b == b + a
    
    463
    +          Passed 100 iterations
    
    464
    +      Group Multiplicative
    
    465
    +        Running a * 1 == a
    
    466
    +          Passed 100 iterations
    
    467
    +        Running 1 * a == a
    
    468
    +          Passed 100 iterations
    
    469
    +        Running multiplication commutative
    
    470
    +          Passed 100 iterations
    
    471
    +        Running a * b == Integer(a) * Integer(b)
    
    472
    +          Passed 100 iterations
    
    473
    +      Group Divisible
    
    474
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    475
    +          Passed 100 iterations
    
    476
    +      Group Precedence
    
    477
    +        Running + and - (1)
    
    478
    +          Passed 100 iterations
    
    479
    +        Running + and - (2)
    
    480
    +          Passed 100 iterations
    
    481
    +        Running + and * (1)
    
    482
    +          Passed 100 iterations
    
    483
    +        Running + and * (2)
    
    484
    +          Passed 100 iterations
    
    485
    +        Running - and * (1)
    
    486
    +          Passed 100 iterations
    
    487
    +        Running - and * (2)
    
    488
    +          Passed 100 iterations
    
    489
    +        Running * and ^ (1)
    
    490
    +          Passed 100 iterations
    
    491
    +        Running * and ^ (2)
    
    492
    +          Passed 100 iterations
    
    493
    +    Group Word64
    
    494
    +      Group Integral
    
    495
    +        Running FromIntegral(Integer(a)) == a
    
    496
    +          Passed 100 iterations
    
    497
    +      Group Property
    
    498
    +        Running Eq
    
    499
    +          Passed 100 iterations
    
    500
    +        Running Show
    
    501
    +          Passed 100 iterations
    
    502
    +        Running Ord
    
    503
    +          Passed 100 iterations
    
    504
    +        Running <
    
    505
    +          Passed 100 iterations
    
    506
    +      Group Additive
    
    507
    +        Running a + azero == a
    
    508
    +          Passed 100 iterations
    
    509
    +        Running azero + a == a
    
    510
    +          Passed 100 iterations
    
    511
    +        Running a + b == b + a
    
    512
    +          Passed 100 iterations
    
    513
    +      Group Multiplicative
    
    514
    +        Running a * 1 == a
    
    515
    +          Passed 100 iterations
    
    516
    +        Running 1 * a == a
    
    517
    +          Passed 100 iterations
    
    518
    +        Running multiplication commutative
    
    519
    +          Passed 100 iterations
    
    520
    +        Running a * b == Integer(a) * Integer(b)
    
    521
    +          Passed 100 iterations
    
    522
    +      Group Divisible
    
    523
    +        Running (x `div` y) * y + (x `mod` y) == x
    
    524
    +          Passed 100 iterations
    
    525
    +      Group Precedence
    
    526
    +        Running + and - (1)
    
    527
    +          Passed 100 iterations
    
    528
    +        Running + and - (2)
    
    529
    +          Passed 100 iterations
    
    530
    +        Running + and * (1)
    
    531
    +          Passed 100 iterations
    
    532
    +        Running + and * (2)
    
    533
    +          Passed 100 iterations
    
    534
    +        Running - and * (1)
    
    535
    +          Passed 100 iterations
    
    536
    +        Running - and * (2)
    
    537
    +          Passed 100 iterations
    
    538
    +        Running * and ^ (1)
    
    539
    +          Passed 100 iterations
    
    540
    +        Running * and ^ (2)
    
    541
    +          Passed 100 iterations
    
    542
    +  Group primop
    
    543
    +    Running gtChar#
    
    544
    +      Passed 100 iterations
    
    545
    +    Running geChar#
    
    546
    +      Passed 100 iterations
    
    547
    +    Running eqChar#
    
    548
    +      Passed 100 iterations
    
    549
    +    Running neChar#
    
    550
    +      Passed 100 iterations
    
    551
    +    Running ltChar#
    
    552
    +      Passed 100 iterations
    
    553
    +    Running leChar#
    
    554
    +      Passed 100 iterations
    
    555
    +    Running ord#
    
    556
    +      Passed 100 iterations
    
    557
    +    Running int8ToInt#
    
    558
    +      Passed 100 iterations
    
    559
    +    Running intToInt8#
    
    560
    +      Passed 100 iterations
    
    561
    +    Running negateInt8#
    
    562
    +      Passed 100 iterations
    
    563
    +    Running plusInt8#
    
    564
    +      Passed 100 iterations
    
    565
    +    Running subInt8#
    
    566
    +      Passed 100 iterations
    
    567
    +    Running timesInt8#
    
    568
    +      Passed 100 iterations
    
    569
    +    Running quotInt8#
    
    570
    +      Passed 100 iterations
    
    571
    +    Running remInt8#
    
    572
    +      Passed 100 iterations
    
    573
    +    Running quotRemInt8#
    
    574
    +      Passed 100 iterations
    
    575
    +    Running uncheckedShiftLInt8#
    
    576
    +      Passed 100 iterations
    
    577
    +    Running uncheckedShiftRAInt8#
    
    578
    +      Passed 100 iterations
    
    579
    +    Running uncheckedShiftRLInt8#
    
    580
    +      Passed 100 iterations
    
    581
    +    Running int8ToWord8#
    
    582
    +      Passed 100 iterations
    
    583
    +    Running eqInt8#
    
    584
    +      Passed 100 iterations
    
    585
    +    Running geInt8#
    
    586
    +      Passed 100 iterations
    
    587
    +    Running gtInt8#
    
    588
    +      Passed 100 iterations
    
    589
    +    Running leInt8#
    
    590
    +      Passed 100 iterations
    
    591
    +    Running ltInt8#
    
    592
    +      Passed 100 iterations
    
    593
    +    Running neInt8#
    
    594
    +      Passed 100 iterations
    
    595
    +    Running word8ToWord#
    
    596
    +      Passed 100 iterations
    
    597
    +    Running wordToWord8#
    
    598
    +      Passed 100 iterations
    
    599
    +    Running plusWord8#
    
    600
    +      Passed 100 iterations
    
    601
    +    Running subWord8#
    
    602
    +      Passed 100 iterations
    
    603
    +    Running timesWord8#
    
    604
    +      Passed 100 iterations
    
    605
    +    Running quotWord8#
    
    606
    +      Passed 100 iterations
    
    607
    +    Running remWord8#
    
    608
    +      Passed 100 iterations
    
    609
    +    Running quotRemWord8#
    
    610
    +      Passed 100 iterations
    
    611
    +    Running andWord8#
    
    612
    +      Passed 100 iterations
    
    613
    +    Running orWord8#
    
    614
    +      Passed 100 iterations
    
    615
    +    Running xorWord8#
    
    616
    +      Passed 100 iterations
    
    617
    +    Running notWord8#
    
    618
    +      Passed 100 iterations
    
    619
    +    Running uncheckedShiftLWord8#
    
    620
    +      Passed 100 iterations
    
    621
    +    Running uncheckedShiftRLWord8#
    
    622
    +      Passed 100 iterations
    
    623
    +    Running word8ToInt8#
    
    624
    +      Passed 100 iterations
    
    625
    +    Running eqWord8#
    
    626
    +      Passed 100 iterations
    
    627
    +    Running geWord8#
    
    628
    +      Passed 100 iterations
    
    629
    +    Running gtWord8#
    
    630
    +      Passed 100 iterations
    
    631
    +    Running leWord8#
    
    632
    +      Passed 100 iterations
    
    633
    +    Running ltWord8#
    
    634
    +      Passed 100 iterations
    
    635
    +    Running neWord8#
    
    636
    +      Passed 100 iterations
    
    637
    +    Running int16ToInt#
    
    638
    +      Passed 100 iterations
    
    639
    +    Running intToInt16#
    
    640
    +      Passed 100 iterations
    
    641
    +    Running negateInt16#
    
    642
    +      Passed 100 iterations
    
    643
    +    Running plusInt16#
    
    644
    +      Passed 100 iterations
    
    645
    +    Running subInt16#
    
    646
    +      Passed 100 iterations
    
    647
    +    Running timesInt16#
    
    648
    +      Passed 100 iterations
    
    649
    +    Running quotInt16#
    
    650
    +      Passed 100 iterations
    
    651
    +    Running remInt16#
    
    652
    +      Passed 100 iterations
    
    653
    +    Running quotRemInt16#
    
    654
    +      Passed 100 iterations
    
    655
    +    Running uncheckedShiftLInt16#
    
    656
    +      Passed 100 iterations
    
    657
    +    Running uncheckedShiftRAInt16#
    
    658
    +      Passed 100 iterations
    
    659
    +    Running uncheckedShiftRLInt16#
    
    660
    +      Passed 100 iterations
    
    661
    +    Running int16ToWord16#
    
    662
    +      Passed 100 iterations
    
    663
    +    Running eqInt16#
    
    664
    +      Passed 100 iterations
    
    665
    +    Running geInt16#
    
    666
    +      Passed 100 iterations
    
    667
    +    Running gtInt16#
    
    668
    +      Passed 100 iterations
    
    669
    +    Running leInt16#
    
    670
    +      Passed 100 iterations
    
    671
    +    Running ltInt16#
    
    672
    +      Passed 100 iterations
    
    673
    +    Running neInt16#
    
    674
    +      Passed 100 iterations
    
    675
    +    Running word16ToWord#
    
    676
    +      Passed 100 iterations
    
    677
    +    Running wordToWord16#
    
    678
    +      Passed 100 iterations
    
    679
    +    Running plusWord16#
    
    680
    +      Passed 100 iterations
    
    681
    +    Running subWord16#
    
    682
    +      Passed 100 iterations
    
    683
    +    Running timesWord16#
    
    684
    +      Passed 100 iterations
    
    685
    +    Running quotWord16#
    
    686
    +      Passed 100 iterations
    
    687
    +    Running remWord16#
    
    688
    +      Passed 100 iterations
    
    689
    +    Running quotRemWord16#
    
    690
    +      Passed 100 iterations
    
    691
    +    Running andWord16#
    
    692
    +      Passed 100 iterations
    
    693
    +    Running orWord16#
    
    694
    +      Passed 100 iterations
    
    695
    +    Running xorWord16#
    
    696
    +      Passed 100 iterations
    
    697
    +    Running notWord16#
    
    698
    +      Passed 100 iterations
    
    699
    +    Running uncheckedShiftLWord16#
    
    700
    +      Passed 100 iterations
    
    701
    +    Running uncheckedShiftRLWord16#
    
    702
    +      Passed 100 iterations
    
    703
    +    Running word16ToInt16#
    
    704
    +      Passed 100 iterations
    
    705
    +    Running eqWord16#
    
    706
    +      Passed 100 iterations
    
    707
    +    Running geWord16#
    
    708
    +      Passed 100 iterations
    
    709
    +    Running gtWord16#
    
    710
    +      Passed 100 iterations
    
    711
    +    Running leWord16#
    
    712
    +      Passed 100 iterations
    
    713
    +    Running ltWord16#
    
    714
    +      Passed 100 iterations
    
    715
    +    Running neWord16#
    
    716
    +      Passed 100 iterations
    
    717
    +    Running int32ToInt#
    
    718
    +      Passed 100 iterations
    
    719
    +    Running intToInt32#
    
    720
    +      Passed 100 iterations
    
    721
    +    Running negateInt32#
    
    722
    +      Passed 100 iterations
    
    723
    +    Running plusInt32#
    
    724
    +      Passed 100 iterations
    
    725
    +    Running subInt32#
    
    726
    +      Passed 100 iterations
    
    727
    +    Running timesInt32#
    
    728
    +      Passed 100 iterations
    
    729
    +    Running quotInt32#
    
    730
    +      Passed 100 iterations
    
    731
    +    Running remInt32#
    
    732
    +      Passed 100 iterations
    
    733
    +    Running quotRemInt32#
    
    734
    +      Passed 100 iterations
    
    735
    +    Running uncheckedShiftLInt32#
    
    736
    +      Passed 100 iterations
    
    737
    +    Running uncheckedShiftRAInt32#
    
    738
    +      Passed 100 iterations
    
    739
    +    Running uncheckedShiftRLInt32#
    
    740
    +      Passed 100 iterations
    
    741
    +    Running int32ToWord32#
    
    742
    +      Passed 100 iterations
    
    743
    +    Running eqInt32#
    
    744
    +      Passed 100 iterations
    
    745
    +    Running geInt32#
    
    746
    +      Passed 100 iterations
    
    747
    +    Running gtInt32#
    
    748
    +      Passed 100 iterations
    
    749
    +    Running leInt32#
    
    750
    +      Passed 100 iterations
    
    751
    +    Running ltInt32#
    
    752
    +      Passed 100 iterations
    
    753
    +    Running neInt32#
    
    754
    +      Passed 100 iterations
    
    755
    +    Running word32ToWord#
    
    756
    +      Passed 100 iterations
    
    757
    +    Running wordToWord32#
    
    758
    +      Passed 100 iterations
    
    759
    +    Running plusWord32#
    
    760
    +      Passed 100 iterations
    
    761
    +    Running subWord32#
    
    762
    +      Passed 100 iterations
    
    763
    +    Running timesWord32#
    
    764
    +      Passed 100 iterations
    
    765
    +    Running quotWord32#
    
    766
    +      Passed 100 iterations
    
    767
    +    Running remWord32#
    
    768
    +      Passed 100 iterations
    
    769
    +    Running quotRemWord32#
    
    770
    +      Passed 100 iterations
    
    771
    +    Running andWord32#
    
    772
    +      Passed 100 iterations
    
    773
    +    Running orWord32#
    
    774
    +      Passed 100 iterations
    
    775
    +    Running xorWord32#
    
    776
    +      Passed 100 iterations
    
    777
    +    Running notWord32#
    
    778
    +      Passed 100 iterations
    
    779
    +    Running uncheckedShiftLWord32#
    
    780
    +      Passed 100 iterations
    
    781
    +    Running uncheckedShiftRLWord32#
    
    782
    +      Passed 100 iterations
    
    783
    +    Running word32ToInt32#
    
    784
    +      Passed 100 iterations
    
    785
    +    Running eqWord32#
    
    786
    +      Passed 100 iterations
    
    787
    +    Running geWord32#
    
    788
    +      Passed 100 iterations
    
    789
    +    Running gtWord32#
    
    790
    +      Passed 100 iterations
    
    791
    +    Running leWord32#
    
    792
    +      Passed 100 iterations
    
    793
    +    Running ltWord32#
    
    794
    +      Passed 100 iterations
    
    795
    +    Running neWord32#
    
    796
    +      Passed 100 iterations
    
    797
    +    Running int64ToInt#
    
    798
    +      Passed 100 iterations
    
    799
    +    Running intToInt64#
    
    800
    +      Passed 100 iterations
    
    801
    +    Running negateInt64#
    
    802
    +      Passed 100 iterations
    
    803
    +    Running plusInt64#
    
    804
    +      Passed 100 iterations
    
    805
    +    Running subInt64#
    
    806
    +      Passed 100 iterations
    
    807
    +    Running timesInt64#
    
    808
    +      Passed 100 iterations
    
    809
    +    Running quotInt64#
    
    810
    +      Passed 100 iterations
    
    811
    +    Running remInt64#
    
    812
    +      Passed 100 iterations
    
    813
    +    Running uncheckedIShiftL64#
    
    814
    +      Passed 100 iterations
    
    815
    +    Running uncheckedIShiftRA64#
    
    816
    +      Passed 100 iterations
    
    817
    +    Running uncheckedIShiftRL64#
    
    818
    +      Passed 100 iterations
    
    819
    +    Running int64ToWord64#
    
    820
    +      Passed 100 iterations
    
    821
    +    Running eqInt64#
    
    822
    +      Passed 100 iterations
    
    823
    +    Running geInt64#
    
    824
    +      Passed 100 iterations
    
    825
    +    Running gtInt64#
    
    826
    +      Passed 100 iterations
    
    827
    +    Running leInt64#
    
    828
    +      Passed 100 iterations
    
    829
    +    Running ltInt64#
    
    830
    +      Passed 100 iterations
    
    831
    +    Running neInt64#
    
    832
    +      Passed 100 iterations
    
    833
    +    Running word64ToWord#
    
    834
    +      Passed 100 iterations
    
    835
    +    Running wordToWord64#
    
    836
    +      Passed 100 iterations
    
    837
    +    Running plusWord64#
    
    838
    +      Passed 100 iterations
    
    839
    +    Running subWord64#
    
    840
    +      Passed 100 iterations
    
    841
    +    Running timesWord64#
    
    842
    +      Passed 100 iterations
    
    843
    +    Running quotWord64#
    
    844
    +      Passed 100 iterations
    
    845
    +    Running remWord64#
    
    846
    +      Passed 100 iterations
    
    847
    +    Running and64#
    
    848
    +      Passed 100 iterations
    
    849
    +    Running or64#
    
    850
    +      Passed 100 iterations
    
    851
    +    Running xor64#
    
    852
    +      Passed 100 iterations
    
    853
    +    Running not64#
    
    854
    +      Passed 100 iterations
    
    855
    +    Running uncheckedShiftL64#
    
    856
    +      Passed 100 iterations
    
    857
    +    Running uncheckedShiftRL64#
    
    858
    +      Passed 100 iterations
    
    859
    +    Running word64ToInt64#
    
    860
    +      Passed 100 iterations
    
    861
    +    Running eqWord64#
    
    862
    +      Passed 100 iterations
    
    863
    +    Running geWord64#
    
    864
    +      Passed 100 iterations
    
    865
    +    Running gtWord64#
    
    866
    +      Passed 100 iterations
    
    867
    +    Running leWord64#
    
    868
    +      Passed 100 iterations
    
    869
    +    Running ltWord64#
    
    870
    +      Passed 100 iterations
    
    871
    +    Running neWord64#
    
    872
    +      Passed 100 iterations
    
    873
    +    Running +#
    
    874
    +      Passed 100 iterations
    
    875
    +    Running -#
    
    876
    +      Passed 100 iterations
    
    877
    +    Running *#
    
    878
    +      Passed 100 iterations
    
    879
    +    Running timesInt2#
    
    880
    +      Passed 100 iterations
    
    881
    +    Running mulIntMayOflo#
    
    882
    +      Passed 100 iterations
    
    883
    +    Running quotInt#
    
    884
    +      Passed 100 iterations
    
    885
    +    Running remInt#
    
    886
    +      Passed 100 iterations
    
    887
    +    Running quotRemInt#
    
    888
    +      Passed 100 iterations
    
    889
    +    Running andI#
    
    890
    +      Passed 100 iterations
    
    891
    +    Running orI#
    
    892
    +      Passed 100 iterations
    
    893
    +    Running xorI#
    
    894
    +      Passed 100 iterations
    
    895
    +    Running notI#
    
    896
    +      Passed 100 iterations
    
    897
    +    Running negateInt#
    
    898
    +      Passed 100 iterations
    
    899
    +    Running addIntC#
    
    900
    +      Passed 100 iterations
    
    901
    +    Running subIntC#
    
    902
    +      Passed 100 iterations
    
    903
    +    Running >#
    
    904
    +      Passed 100 iterations
    
    905
    +    Running >=#
    
    906
    +      Passed 100 iterations
    
    907
    +    Running ==#
    
    908
    +      Passed 100 iterations
    
    909
    +    Running /=#
    
    910
    +      Passed 100 iterations
    
    911
    +    Running <#
    
    912
    +      Passed 100 iterations
    
    913
    +    Running <=#
    
    914
    +      Passed 100 iterations
    
    915
    +    Running chr#
    
    916
    +      Passed 100 iterations
    
    917
    +    Running int2Word#
    
    918
    +      Passed 100 iterations
    
    919
    +    Running uncheckedIShiftL#
    
    920
    +      Passed 100 iterations
    
    921
    +    Running uncheckedIShiftRA#
    
    922
    +      Passed 100 iterations
    
    923
    +    Running uncheckedIShiftRL#
    
    924
    +      Passed 100 iterations
    
    925
    +    Running plusWord#
    
    926
    +      Passed 100 iterations
    
    927
    +    Running addWordC#
    
    928
    +      Passed 100 iterations
    
    929
    +    Running subWordC#
    
    930
    +      Passed 100 iterations
    
    931
    +    Running plusWord2#
    
    932
    +      Passed 100 iterations
    
    933
    +    Running minusWord#
    
    934
    +      Passed 100 iterations
    
    935
    +    Running timesWord#
    
    936
    +      Passed 100 iterations
    
    937
    +    Running timesWord2#
    
    938
    +      Passed 100 iterations
    
    939
    +    Running quotWord#
    
    940
    +      Passed 100 iterations
    
    941
    +    Running remWord#
    
    942
    +      Passed 100 iterations
    
    943
    +    Running quotRemWord#
    
    944
    +      Passed 100 iterations
    
    945
    +    Running and#
    
    946
    +      Passed 100 iterations
    
    947
    +    Running or#
    
    948
    +      Passed 100 iterations
    
    949
    +    Running xor#
    
    950
    +      Passed 100 iterations
    
    951
    +    Running not#
    
    952
    +      Passed 100 iterations
    
    953
    +    Running uncheckedShiftL#
    
    954
    +      Passed 100 iterations
    
    955
    +    Running uncheckedShiftRL#
    
    956
    +      Passed 100 iterations
    
    957
    +    Running word2Int#
    
    958
    +      Passed 100 iterations
    
    959
    +    Running gtWord#
    
    960
    +      Passed 100 iterations
    
    961
    +    Running geWord#
    
    962
    +      Passed 100 iterations
    
    963
    +    Running eqWord#
    
    964
    +      Passed 100 iterations
    
    965
    +    Running neWord#
    
    966
    +      Passed 100 iterations
    
    967
    +    Running ltWord#
    
    968
    +      Passed 100 iterations
    
    969
    +    Running leWord#
    
    970
    +      Passed 100 iterations
    
    971
    +    Running popCnt8#
    
    972
    +      Passed 100 iterations
    
    973
    +    Running popCnt16#
    
    974
    +      Passed 100 iterations
    
    975
    +    Running popCnt32#
    
    976
    +      Passed 100 iterations
    
    977
    +    Running popCnt64#
    
    978
    +      Passed 100 iterations
    
    979
    +    Running popCnt#
    
    980
    +      Passed 100 iterations
    
    981
    +    Running pdep8#
    
    982
    +      Passed 100 iterations
    
    983
    +    Running pdep16#
    
    984
    +      Passed 100 iterations
    
    985
    +    Running pdep32#
    
    986
    +      Passed 100 iterations
    
    987
    +    Running pdep64#
    
    988
    +      Passed 100 iterations
    
    989
    +    Running pdep#
    
    990
    +      Passed 100 iterations
    
    991
    +    Running pext8#
    
    992
    +      Passed 100 iterations
    
    993
    +    Running pext16#
    
    994
    +      Passed 100 iterations
    
    995
    +    Running pext32#
    
    996
    +      Passed 100 iterations
    
    997
    +    Running pext64#
    
    998
    +      Passed 100 iterations
    
    999
    +    Running pext#
    
    1000
    +      Passed 100 iterations
    
    1001
    +    Running clz8#
    
    1002
    +      Passed 100 iterations
    
    1003
    +    Running clz16#
    
    1004
    +      Passed 100 iterations
    
    1005
    +    Running clz32#
    
    1006
    +      Passed 100 iterations
    
    1007
    +    Running clz64#
    
    1008
    +      Passed 100 iterations
    
    1009
    +    Running clz#
    
    1010
    +      Passed 100 iterations
    
    1011
    +    Running ctz8#
    
    1012
    +      Passed 100 iterations
    
    1013
    +    Running ctz16#
    
    1014
    +      Passed 100 iterations
    
    1015
    +    Running ctz32#
    
    1016
    +      Passed 100 iterations
    
    1017
    +    Running ctz64#
    
    1018
    +      Passed 100 iterations
    
    1019
    +    Running ctz#
    
    1020
    +      Passed 100 iterations
    
    1021
    +    Running byteSwap16#
    
    1022
    +      Passed 100 iterations
    
    1023
    +    Running byteSwap32#
    
    1024
    +      Passed 100 iterations
    
    1025
    +    Running byteSwap64#
    
    1026
    +      Passed 100 iterations
    
    1027
    +    Running byteSwap#
    
    1028
    +      Passed 100 iterations
    
    1029
    +    Running bitReverse8#
    
    1030
    +      Passed 100 iterations
    
    1031
    +    Running bitReverse16#
    
    1032
    +      Passed 100 iterations
    
    1033
    +    Running bitReverse32#
    
    1034
    +      Passed 100 iterations
    
    1035
    +    Running bitReverse64#
    
    1036
    +      Passed 100 iterations
    
    1037
    +    Running bitReverse#
    
    1038
    +      Passed 100 iterations
    
    1039
    +    Running narrow8Int#
    
    1040
    +      Passed 100 iterations
    
    1041
    +    Running narrow16Int#
    
    1042
    +      Passed 100 iterations
    
    1043
    +    Running narrow32Int#
    
    1044
    +      Passed 100 iterations
    
    1045
    +    Running narrow8Word#
    
    1046
    +      Passed 100 iterations
    
    1047
    +    Running narrow16Word#
    
    1048
    +      Passed 100 iterations
    
    1049
    +    Running narrow32Word#
    
    1050
    +      Passed 100 iterations

  • utils/genprimopcode/Main.hs
    1
    +{-# OPTIONS_GHC -Wno-x-partial #-}
    
    1 2
     ------------------------------------------------------------------
    
    2 3
     -- A primop-table mangling program                              --
    
    3 4
     --
    
    ... ... @@ -10,11 +11,12 @@ import Parser
    10 11
     import Syntax
    
    11 12
     
    
    12 13
     import Data.Char
    
    13
    -import Data.List (union, intersperse, intercalate, nub)
    
    14
    -import Data.Maybe ( catMaybes )
    
    14
    +import Data.List (union, intersperse, intercalate, nub, sort)
    
    15
    +import Data.Maybe ( catMaybes, mapMaybe )
    
    15 16
     import System.Environment ( getArgs )
    
    16 17
     import System.IO ( hSetEncoding, stdin, stdout, utf8 )
    
    17 18
     
    
    19
    +
    
    18 20
     vecOptions :: Entry -> [(String,String,Int)]
    
    19 21
     vecOptions i =
    
    20 22
         concat [vecs | OptionVector vecs <- opts i]
    
    ... ... @@ -204,6 +206,9 @@ main = getArgs >>= \args ->
    204 206
                           "--wired-in-deprecations"
    
    205 207
                              -> putStr (gen_wired_in_deprecations p_o_specs)
    
    206 208
     
    
    209
    +                      "--foundation-tests"
    
    210
    +                         -> putStr (gen_foundation_tests p_o_specs)
    
    211
    +
    
    207 212
                           _ -> error "Should not happen, known_args out of sync?"
    
    208 213
                        )
    
    209 214
     
    
    ... ... @@ -229,7 +234,8 @@ known_args
    229 234
            "--make-haskell-source",
    
    230 235
            "--make-latex-doc",
    
    231 236
            "--wired-in-docs",
    
    232
    -       "--wired-in-deprecations"
    
    237
    +       "--wired-in-deprecations",
    
    238
    +       "--foundation-tests"
    
    233 239
          ]
    
    234 240
     
    
    235 241
     ------------------------------------------------------------------
    
    ... ... @@ -679,6 +685,92 @@ gen_wired_in_deprecations (Info _ entries)
    679 685
             | otherwise = Nothing
    
    680 686
     
    
    681 687
     
    
    688
    +gen_foundation_tests :: Info -> String
    
    689
    +gen_foundation_tests (Info _ entries)
    
    690
    +  = "tests =\n  [ "
    
    691
    +    ++ intercalate "\n  , " (catMaybes $ map mkTest entries)
    
    692
    +    ++ "\n  ]\n"
    
    693
    +    ++ "\n" ++ intercalate "\n" (map mkInstances testable_tys)
    
    694
    +  where
    
    695
    +    testable_tys = nub (sort (mapMaybe (\po -> ty po <$ mkTest po) entries))
    
    696
    +
    
    697
    +    mkInstances inst_ty =
    
    698
    +      let test_lambda = "\\ " ++ intercalate " " (zipWith mkArg [0::Int ..] (arg_tys)) ++ " -> " ++ mk_body "l" ++ " === " ++ mk_body "r"
    
    699
    +      in  unlines $
    
    700
    +      [ "instance TestPrimop (" ++ pprTy inst_ty ++ ") where"
    
    701
    +      , "  testPrimop s l r = Property s $ " ++ test_lambda ]
    
    702
    +      ++ (if mb_divable_tys
    
    703
    +          then ["  testPrimopDivLike s l r = Property s $ twoNonZero $ " ++ test_lambda]
    
    704
    +          else [])
    
    705
    +      where
    
    706
    +        arg_tys = args inst_ty
    
    707
    +        -- eg Int -> Int -> a
    
    708
    +        mb_divable_tys = case arg_tys of
    
    709
    +            [ty1,ty2] -> ty1 == ty2 && ty1 `elem` divableTyCons
    
    710
    +            _         -> False
    
    711
    +
    
    712
    +        mk_body s = res_ty inst_ty (" (" ++ s ++ " " ++ intercalate " " vs ++ ")")
    
    713
    +
    
    714
    +        vs = zipWith (\n _ -> "x" ++ show n) [0::Int ..] (arg_tys)
    
    715
    +
    
    716
    +    mkArg n t = "(" ++ unwrapper t  ++ "-> x" ++ show n ++ ")"
    
    717
    +
    
    718
    +
    
    719
    +    wrapper s = "w" ++ s
    
    720
    +    unwrapper s = "u" ++ s
    
    721
    +
    
    722
    +
    
    723
    +    args (TyF (TyApp (TyCon c) []) t2) = c : args t2
    
    724
    +    args (TyApp {}) = []
    
    725
    +    args (TyUTup {}) = []
    
    726
    +    -- If you hit this you will need to handle the foundation tests to handle the
    
    727
    +    -- type it failed on.
    
    728
    +    args arg_ty = error ("Unexpected primop type:" ++ pprTy arg_ty)
    
    729
    +
    
    730
    +    res_ty (TyF _ t2) x = res_ty t2 x
    
    731
    +    res_ty (TyApp (TyCon c) []) x = wrapper c ++ x
    
    732
    +    res_ty (TyUTup tup_tys) x =
    
    733
    +      let wtup = case length tup_tys of
    
    734
    +                   2 -> "WTUP2"
    
    735
    +                   3 -> "WTUP3"
    
    736
    +                   -- Only handles primops returning unboxed tuples up to 3 args currently
    
    737
    +                   _ -> error "Unexpected primop result type"
    
    738
    +      in wtup ++"(" ++ intercalate "," (map (\a -> res_ty a "") tup_tys ++ [x]) ++ ")"
    
    739
    +    -- If you hit this you will need to handle the foundation tests to handle the
    
    740
    +    -- type it failed on.
    
    741
    +    res_ty unexpected_ty x = error ("Unexpected primop result type:" ++ pprTy unexpected_ty ++ "," ++ x)
    
    742
    +
    
    743
    +
    
    744
    +    wrap qual nm | isLower (head nm) = qual ++ "." ++ nm
    
    745
    +            | otherwise = "(" ++ qual ++ "." ++ nm ++ ")"
    
    746
    +    mkTest po
    
    747
    +      | Just poName <- getName po
    
    748
    +      , is_primop po
    
    749
    +      , not $ is_vector po
    
    750
    +      , poName /= "tagToEnum#"
    
    751
    +      , poName /= "quotRemWord2#"
    
    752
    +      , (testable (ty po))
    
    753
    +      = let testPrimOpHow = if is_divLikeOp po
    
    754
    +              then "testPrimopDivLike"
    
    755
    +              else "testPrimop"
    
    756
    +        in Just $ intercalate " " [testPrimOpHow, "\"" ++ poName ++ "\"", wrap "Primop" poName, wrap "Wrapper" poName]
    
    757
    +      | otherwise = Nothing
    
    758
    +
    
    759
    +
    
    760
    +
    
    761
    +    testable (TyF t1 t2) = testable t1 && testable t2
    
    762
    +    testable (TyC _  t2) = testable t2
    
    763
    +    testable (TyApp tc tys) = testableTyCon tc && all testable tys
    
    764
    +    testable (TyVar _a)   = False
    
    765
    +    testable (TyUTup tys)  = all testable tys
    
    766
    +
    
    767
    +    testableTyCon (TyCon c) =
    
    768
    +      c `elem` ["Int#", "Word#", "Word8#", "Word16#", "Word32#", "Word64#"
    
    769
    +               , "Int8#", "Int16#", "Int32#", "Int64#", "Char#"]
    
    770
    +    testableTyCon _ = False
    
    771
    +    divableTyCons = ["Int#", "Word#", "Word8#", "Word16#", "Word32#", "Word64#"
    
    772
    +                    ,"Int8#", "Int16#", "Int32#", "Int64#"]
    
    773
    +
    
    682 774
     ------------------------------------------------------------------
    
    683 775
     -- Create PrimOpInfo text from PrimOpSpecs -----------------------
    
    684 776
     ------------------------------------------------------------------
    

  • utils/genprimopcode/Syntax.hs
    ... ... @@ -53,6 +53,19 @@ is_primtype :: Entry -> Bool
    53 53
     is_primtype (PrimTypeSpec {}) = True
    
    54 54
     is_primtype _ = False
    
    55 55
     
    
    56
    +is_divLikeOp :: Entry -> Bool
    
    57
    +is_divLikeOp entry = case entry of
    
    58
    +   PrimOpSpec{} -> has_div_like
    
    59
    +   PseudoOpSpec{} -> has_div_like
    
    60
    +   PrimVecOpSpec{} -> has_div_like
    
    61
    +   PrimTypeSpec{} -> False
    
    62
    +   PrimVecTypeSpec{} -> False
    
    63
    +   Section{} -> False
    
    64
    +   where
    
    65
    +      has_div_like = case lookup_attrib "div_like" (opts entry) of
    
    66
    +         Just (OptionTrue{}) -> True
    
    67
    +         _ -> False
    
    68
    +
    
    56 69
     -- a binding of property to value
    
    57 70
     data Option
    
    58 71
        = OptionFalse  String          -- name = False
    
    ... ... @@ -78,7 +91,7 @@ data Ty
    78 91
        | TyVar  TyVar
    
    79 92
        | TyUTup [Ty]   -- unboxed tuples; just a TyCon really,
    
    80 93
                        -- but convenient like this
    
    81
    -   deriving (Eq,Show)
    
    94
    +   deriving (Eq,Show, Ord)
    
    82 95
     
    
    83 96
     type TyVar = String
    
    84 97
     type TyVarBinder = String