Commit Graph

6 Commits

Author SHA1 Message Date
Zoltan Somogyi
4c528d429d Add <<u and >>u to library/{int,uint}*.m ...
... along with their unchecked equivalents. These differ from <<, >> and
their unchecked equivalents in that they take the shift amount as a uint,
instead of an int.

library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
    As above. The unchecked versions have only declarations, since
    these operations have been recognized as builtins for a while now.

NEWS:
    Document the new operations, and the recent change to recognize
    <<u and >>u as single tokens, and fix a typo in a recent addition.

configure.ac:
    Require the compiler to be sufficiently recent to be able to parse
    <<u and >>u as operators.

compiler/options.m:
    Provide a way for a later change to configure.ac to detect the presence
    of this change.

tests/hard_coded/bitwise_int.exp:
tests/hard_coded/bitwise_int.exp2:
tests/hard_coded/bitwise_int.m:
tests/hard_coded/bitwise_int16.exp:
tests/hard_coded/bitwise_int16.m:
tests/hard_coded/bitwise_int32.exp:
tests/hard_coded/bitwise_int32.m:
tests/hard_coded/bitwise_int64.exp:
tests/hard_coded/bitwise_int64.m:
tests/hard_coded/bitwise_int8.exp:
tests/hard_coded/bitwise_int8.m:
tests/hard_coded/bitwise_uint.exp:
tests/hard_coded/bitwise_uint.exp2:
tests/hard_coded/bitwise_uint.m:
tests/hard_coded/bitwise_uint16.exp:
tests/hard_coded/bitwise_uint16.m:
tests/hard_coded/bitwise_uint32.exp:
tests/hard_coded/bitwise_uint32.m:
tests/hard_coded/bitwise_uint64.exp:
tests/hard_coded/bitwise_uint64.m:
tests/hard_coded/bitwise_uint8.exp:
tests/hard_coded/bitwise_uint8.m:
    Check that <<u and >>u compute the same results as << and >> respectively.
2022-12-07 23:12:33 +11:00
Zoltan Somogyi
3c3c072a33 Make bitwise op tests' .exp files more readable.
tests/hard_coded/bitwise_int.m:
tests/hard_coded/bitwise_int16.m:
tests/hard_coded/bitwise_int32.m:
tests/hard_coded/bitwise_int64.m:
tests/hard_coded/bitwise_int8.m:
tests/hard_coded/bitwise_uint.m:
tests/hard_coded/bitwise_uint16.m:
tests/hard_coded/bitwise_uint32.m:
tests/hard_coded/bitwise_uint64.m:
tests/hard_coded/bitwise_uint8.m:
    Most of the expected output files of these test cases were
    easily readable already, but there were some exceptions caused
    by unnecessary differences between their source codes.

    The main problem was with bitwise_uint.m (uint_bitwise.m until recently),
    whose .exp file contained very long lines of the form A op B = C
    where A, B and C could each be 64 bits (and chars) long. Fix this
    by adopting the format used by the other modules:

        A op
        B =
        C

    The other problem was that in some test cases, the indentation had
    an off-by-one bug. They generated output such as

        \ aaaa =
         bbbb

    instead of the much-easier-to-visually-check

        \ aaaa =
          bbbb

    A third, much less important change is the deletion of unnecessary
    blank lines.

tests/hard_coded/bitwise_int.exp:
tests/hard_coded/bitwise_int16.exp:
tests/hard_coded/bitwise_int32.exp:
tests/hard_coded/bitwise_int64.exp:
tests/hard_coded/bitwise_int8.exp:
tests/hard_coded/bitwise_uint.exp:
tests/hard_coded/bitwise_uint16.exp:
tests/hard_coded/bitwise_uint32.exp:
tests/hard_coded/bitwise_uint64.exp:
tests/hard_coded/bitwise_uint8.exp:
    Conform to the changes in codes of the tests.
2022-12-05 21:25:07 +11:00
Peter Wang
88047bbb45 Delete Erlang from tests.
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
    Delete Erlang backend specific expected outputs.

tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
    Delete erlang target specific tests.

tests/*:
    Delete Erlang foreign procs and foreign types.
2020-10-27 11:10:11 +11:00
Julien Fischer
1c7e8c7cef More documentation of expected outputs.
tests/hard_coded/uint_bitwise.m:
tests/hard_coded/bitwise_int.m:
    As above.

tests/hard_coded/string_strip.exp2:
    Delete this: it was for the IL backend, which no longer exists.
    All our current backends just match the .exp file.
2018-09-05 15:06:35 +10:00
Julien Fischer
9ba6fb4701 Fix an off-by-one error in the bitwise tests.
tests/hard_coded/bitwise_int*.m:
tests/hard_coded/uint_bitwise.m:
    Fix an off-by-one error in the C code that prints integers in
    their binary representation.
2017-09-08 01:33:50 -04:00
Julien Fischer
8e66e5b075 Change the semantics of the int shift operations.
Change int.(<<) and int.(>>) to throw an exception if their second operand is
not in [0, bits_per_int).  This brings them into line with the other integer
types.

As a transitional measure, add new functions that provide the old semantics.

library/int.m:
    As above.

NEWS:
    Announce the above change.

    Include the fixed size integer types in the list of reserved type names.

tests/hard_coded/shift_test.m:
     Call the legacy versions of the int shift operations.

tests/hard_coded/bitwise_int.{m,exp}:
     A new test of bitwise operations for the int type.
     (XXX I will add a 32-bit expected output separately.)

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
     Include the new test case.

     Do not warn about the use of the obsolete legacy shift operations.
2017-08-30 20:46:11 +10:00