Files
mercury/tests/hard_coded/constant_prop_int.exp2
Zoltan Somogyi 2bd7c5ee3e Rename X's aux modules as X_helper_N in hard_coded.
tests/hard_coded/*.m:
    Rename modules as mentioned above.

    In a few cases, where the main module's name itself had a suffix,
    such as "_mod_a" or "_main", remove that suffix. This entails
    renaming the .exp file as well. (In some cases, this meant that
    the name of a helper module was "taken over" by the main module
    of the test case.)

    Update all references to the moved modules.

    General updates to programming style, such as

    - replacing DCG notation with state var notation
    - replacing (C->T;E) with (if C then T else E)
    - moving pred/func declarations to just before their code
    - replacing io.write/io.nl sequences with io.write_line
    - replacing io.print/io.nl sequences with io.print_line
    - fixing too-long lines
    - fixing grammar errors in comments

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
    Update all references to the moved modules.

    Enable the constant_prop_int test case. The fact that it wasn't enabled
    before is probably an accident. (When constant_prop_int.m was created,
    the test case was added to a list in the Mmakefile, but that list
    was later removed due to never being referenced.)

tests/hard_coded/constant_prop_int.{m,exp}:
    Delete the calls to shift operations with negative shift amounts,
    since we have added a compile-time error for these since the test
    was originally created.
2023-06-16 08:33:22 +02:00

386 lines
11 KiB
Plaintext

plus(1, 0) = 1
plus(1, 1) = 2
plus(1, -1) = 0
plus(1, 31) = 32
plus(1, -31) = -30
plus(1, 2147483647) = 2147483648
plus(1, -2147483648) = -2147483647
plus(-1, 0) = -1
plus(-1, 1) = 0
plus(-1, -1) = -2
plus(-1, 31) = 30
plus(-1, -31) = -32
plus(-1, 2147483647) = 2147483646
plus(-1, -2147483648) = -2147483649
plus(31, 0) = 31
plus(31, 1) = 32
plus(31, -1) = 30
plus(31, 31) = 62
plus(31, -31) = 0
plus(31, 2147483647) = 2147483678
plus(31, -2147483648) = -2147483617
plus(-31, 0) = -31
plus(-31, 1) = -30
plus(-31, -1) = -32
plus(-31, 31) = 0
plus(-31, -31) = -62
plus(-31, 2147483647) = 2147483616
plus(-31, -2147483648) = -2147483679
plus(2147483647, 0) = 2147483647
plus(2147483647, 1) = 2147483648
plus(2147483647, -1) = 2147483646
plus(2147483647, 31) = 2147483678
plus(2147483647, -31) = 2147483616
plus(2147483647, 2147483647) = 4294967294
plus(2147483647, -2147483648) = -1
plus(-2147483648, 0) = -2147483648
plus(-2147483648, 1) = -2147483647
plus(-2147483648, -1) = -2147483649
plus(-2147483648, 31) = -2147483617
plus(-2147483648, -31) = -2147483679
plus(-2147483648, 2147483647) = -1
plus(-2147483648, -2147483648) = -4294967296
minus(1, 0) = 1
minus(1, 1) = 0
minus(1, -1) = 2
minus(1, 31) = -30
minus(1, -31) = 32
minus(1, 2147483647) = -2147483646
minus(1, -2147483648) = 2147483649
minus(-1, 0) = -1
minus(-1, 1) = -2
minus(-1, -1) = 0
minus(-1, 31) = -32
minus(-1, -31) = 30
minus(-1, 2147483647) = -2147483648
minus(-1, -2147483648) = 2147483647
minus(31, 0) = 31
minus(31, 1) = 30
minus(31, -1) = 32
minus(31, 31) = 0
minus(31, -31) = 62
minus(31, 2147483647) = -2147483616
minus(31, -2147483648) = 2147483679
minus(-31, 0) = -31
minus(-31, 1) = -32
minus(-31, -1) = -30
minus(-31, 31) = -62
minus(-31, -31) = 0
minus(-31, 2147483647) = -2147483678
minus(-31, -2147483648) = 2147483617
minus(2147483647, 0) = 2147483647
minus(2147483647, 1) = 2147483646
minus(2147483647, -1) = 2147483648
minus(2147483647, 31) = 2147483616
minus(2147483647, -31) = 2147483678
minus(2147483647, 2147483647) = 0
minus(2147483647, -2147483648) = 4294967295
minus(-2147483648, 0) = -2147483648
minus(-2147483648, 1) = -2147483649
minus(-2147483648, -1) = -2147483647
minus(-2147483648, 31) = -2147483679
minus(-2147483648, -31) = -2147483617
minus(-2147483648, 2147483647) = -4294967295
minus(-2147483648, -2147483648) = 0
times(1, 0) = 0
times(1, 1) = 1
times(1, -1) = -1
times(1, 31) = 31
times(1, -31) = -31
times(1, 2147483647) = 2147483647
times(1, -2147483648) = -2147483648
times(-1, 0) = 0
times(-1, 1) = -1
times(-1, -1) = 1
times(-1, 31) = -31
times(-1, -31) = 31
times(-1, 2147483647) = -2147483647
times(-1, -2147483648) = 2147483648
times(31, 0) = 0
times(31, 1) = 31
times(31, -1) = -31
times(31, 31) = 961
times(31, -31) = -961
times(31, 2147483647) = 66571993057
times(31, -2147483648) = -66571993088
times(-31, 0) = 0
times(-31, 1) = -31
times(-31, -1) = 31
times(-31, 31) = -961
times(-31, -31) = 961
times(-31, 2147483647) = -66571993057
times(-31, -2147483648) = 66571993088
times(2147483647, 0) = 0
times(2147483647, 1) = 2147483647
times(2147483647, -1) = -2147483647
times(2147483647, 31) = 66571993057
times(2147483647, -31) = -66571993057
times(2147483647, 2147483647) = 4611686014132420609
times(2147483647, -2147483648) = -4611686016279904256
times(-2147483648, 0) = 0
times(-2147483648, 1) = -2147483648
times(-2147483648, -1) = 2147483648
times(-2147483648, 31) = -66571993088
times(-2147483648, -31) = 66571993088
times(-2147483648, 2147483647) = -4611686016279904256
times(-2147483648, -2147483648) = 4611686018427387904
quotient(1, 1) = 1
quotient(1, -1) = -1
quotient(1, 31) = 0
quotient(1, -31) = 0
quotient(1, 2147483647) = 0
quotient(1, -2147483648) = 0
quotient(-1, 1) = -1
quotient(-1, -1) = 1
quotient(-1, 31) = 0
quotient(-1, -31) = 0
quotient(-1, 2147483647) = 0
quotient(-1, -2147483648) = 0
quotient(31, 1) = 31
quotient(31, -1) = -31
quotient(31, 31) = 1
quotient(31, -31) = -1
quotient(31, 2147483647) = 0
quotient(31, -2147483648) = 0
quotient(-31, 1) = -31
quotient(-31, -1) = 31
quotient(-31, 31) = -1
quotient(-31, -31) = 1
quotient(-31, 2147483647) = 0
quotient(-31, -2147483648) = 0
quotient(2147483647, 1) = 2147483647
quotient(2147483647, -1) = -2147483647
quotient(2147483647, 31) = 69273666
quotient(2147483647, -31) = -69273666
quotient(2147483647, 2147483647) = 1
quotient(2147483647, -2147483648) = 0
quotient(-2147483648, 1) = -2147483648
quotient(-2147483648, 31) = -69273666
quotient(-2147483648, -31) = 69273666
quotient(-2147483648, 2147483647) = -1
quotient(-2147483648, -2147483648) = 1
unchecked_quotient(1, 1) = 1
unchecked_quotient(1, -1) = -1
unchecked_quotient(1, 31) = 0
unchecked_quotient(1, -31) = 0
unchecked_quotient(1, 2147483647) = 0
unchecked_quotient(1, -2147483648) = 0
unchecked_quotient(-1, 1) = -1
unchecked_quotient(-1, -1) = 1
unchecked_quotient(-1, 31) = 0
unchecked_quotient(-1, -31) = 0
unchecked_quotient(-1, 2147483647) = 0
unchecked_quotient(-1, -2147483648) = 0
unchecked_quotient(31, 1) = 31
unchecked_quotient(31, -1) = -31
unchecked_quotient(31, 31) = 1
unchecked_quotient(31, -31) = -1
unchecked_quotient(31, 2147483647) = 0
unchecked_quotient(31, -2147483648) = 0
unchecked_quotient(-31, 1) = -31
unchecked_quotient(-31, -1) = 31
unchecked_quotient(-31, 31) = -1
unchecked_quotient(-31, -31) = 1
unchecked_quotient(-31, 2147483647) = 0
unchecked_quotient(-31, -2147483648) = 0
unchecked_quotient(2147483647, 1) = 2147483647
unchecked_quotient(2147483647, -1) = -2147483647
unchecked_quotient(2147483647, 31) = 69273666
unchecked_quotient(2147483647, -31) = -69273666
unchecked_quotient(2147483647, 2147483647) = 1
unchecked_quotient(2147483647, -2147483648) = 0
unchecked_quotient(-2147483648, 1) = -2147483648
unchecked_quotient(-2147483648, 31) = -69273666
unchecked_quotient(-2147483648, -31) = 69273666
unchecked_quotient(-2147483648, 2147483647) = -1
unchecked_quotient(-2147483648, -2147483648) = 1
mod(1, 1) = 0
mod(1, -1) = 0
mod(1, 31) = 1
mod(1, -31) = -30
mod(1, 2147483647) = 1
mod(1, -2147483648) = -2147483647
mod(-1, 1) = 0
mod(-1, -1) = 0
mod(-1, 31) = 30
mod(-1, -31) = -1
mod(-1, 2147483647) = 2147483646
mod(-1, -2147483648) = -1
mod(31, 1) = 0
mod(31, -1) = 0
mod(31, 31) = 0
mod(31, -31) = 0
mod(31, 2147483647) = 31
mod(31, -2147483648) = -2147483617
mod(-31, 1) = 0
mod(-31, -1) = 0
mod(-31, 31) = 0
mod(-31, -31) = 0
mod(-31, 2147483647) = 2147483616
mod(-31, -2147483648) = -31
mod(2147483647, 1) = 0
mod(2147483647, -1) = 0
mod(2147483647, 31) = 1
mod(2147483647, -31) = -30
mod(2147483647, 2147483647) = 0
mod(2147483647, -2147483648) = -1
mod(-2147483648, 1) = 0
mod(-2147483648, 31) = 29
mod(-2147483648, -31) = -2
mod(-2147483648, 2147483647) = 2147483646
mod(-2147483648, -2147483648) = 0
rem(1, 1) = 0
rem(1, -1) = 0
rem(1, 31) = 1
rem(1, -31) = 1
rem(1, 2147483647) = 1
rem(1, -2147483648) = 1
rem(-1, 1) = 0
rem(-1, -1) = 0
rem(-1, 31) = -1
rem(-1, -31) = -1
rem(-1, 2147483647) = -1
rem(-1, -2147483648) = -1
rem(31, 1) = 0
rem(31, -1) = 0
rem(31, 31) = 0
rem(31, -31) = 0
rem(31, 2147483647) = 31
rem(31, -2147483648) = 31
rem(-31, 1) = 0
rem(-31, -1) = 0
rem(-31, 31) = 0
rem(-31, -31) = 0
rem(-31, 2147483647) = -31
rem(-31, -2147483648) = -31
rem(2147483647, 1) = 0
rem(2147483647, -1) = 0
rem(2147483647, 31) = 1
rem(2147483647, -31) = 1
rem(2147483647, 2147483647) = 0
rem(2147483647, -2147483648) = 2147483647
rem(-2147483648, 1) = 0
rem(-2147483648, 31) = -2
rem(-2147483648, -31) = -2
rem(-2147483648, 2147483647) = -1
rem(-2147483648, -2147483648) = 0
unchecked_rem(1, 1) = 0
unchecked_rem(1, -1) = 0
unchecked_rem(1, 31) = 1
unchecked_rem(1, -31) = 1
unchecked_rem(1, 2147483647) = 1
unchecked_rem(1, -2147483648) = 1
unchecked_rem(-1, 1) = 0
unchecked_rem(-1, -1) = 0
unchecked_rem(-1, 31) = -1
unchecked_rem(-1, -31) = -1
unchecked_rem(-1, 2147483647) = -1
unchecked_rem(-1, -2147483648) = -1
unchecked_rem(31, 1) = 0
unchecked_rem(31, -1) = 0
unchecked_rem(31, 31) = 0
unchecked_rem(31, -31) = 0
unchecked_rem(31, 2147483647) = 31
unchecked_rem(31, -2147483648) = 31
unchecked_rem(-31, 1) = 0
unchecked_rem(-31, -1) = 0
unchecked_rem(-31, 31) = 0
unchecked_rem(-31, -31) = 0
unchecked_rem(-31, 2147483647) = -31
unchecked_rem(-31, -2147483648) = -31
unchecked_rem(2147483647, 1) = 0
unchecked_rem(2147483647, -1) = 0
unchecked_rem(2147483647, 31) = 1
unchecked_rem(2147483647, -31) = 1
unchecked_rem(2147483647, 2147483647) = 0
unchecked_rem(2147483647, -2147483648) = 2147483647
unchecked_rem(-2147483648, 1) = 0
unchecked_rem(-2147483648, 31) = -2
unchecked_rem(-2147483648, -31) = -2
unchecked_rem(-2147483648, 2147483647) = -1
unchecked_rem(-2147483648, -2147483648) = 0
left_shift(1, 0) = 1
left_shift(1, 1) = 2
left_shift(1, 31) = 2147483648
left_shift(-1, 0) = -1
left_shift(-1, 1) = -2
left_shift(-1, 31) = -2147483648
left_shift(31, 0) = 31
left_shift(31, 1) = 62
left_shift(31, 31) = 66571993088
left_shift(-31, 0) = -31
left_shift(-31, 1) = -62
left_shift(-31, 31) = -66571993088
left_shift(2147483647, 0) = 2147483647
left_shift(2147483647, 1) = 4294967294
left_shift(2147483647, 31) = 4611686016279904256
left_shift(-2147483648, 0) = -2147483648
left_shift(-2147483648, 1) = -4294967296
left_shift(-2147483648, 31) = -4611686018427387904
unchecked_left_shift(1, 0) = 1
unchecked_left_shift(1, 1) = 2
unchecked_left_shift(1, 31) = 2147483648
unchecked_left_shift(-1, 0) = -1
unchecked_left_shift(-1, 1) = -2
unchecked_left_shift(-1, 31) = -2147483648
unchecked_left_shift(31, 0) = 31
unchecked_left_shift(31, 1) = 62
unchecked_left_shift(31, 31) = 66571993088
unchecked_left_shift(-31, 0) = -31
unchecked_left_shift(-31, 1) = -62
unchecked_left_shift(-31, 31) = -66571993088
unchecked_left_shift(2147483647, 0) = 2147483647
unchecked_left_shift(2147483647, 1) = 4294967294
unchecked_left_shift(2147483647, 31) = 4611686016279904256
unchecked_left_shift(-2147483648, 0) = -2147483648
unchecked_left_shift(-2147483648, 1) = -4294967296
unchecked_left_shift(-2147483648, 31) = -4611686018427387904
right_shift(1, 0) = 1
right_shift(1, 1) = 0
right_shift(1, 31) = 0
right_shift(-1, 0) = -1
right_shift(-1, 1) = -1
right_shift(-1, 31) = -1
right_shift(31, 0) = 31
right_shift(31, 1) = 15
right_shift(31, 31) = 0
right_shift(-31, 0) = -31
right_shift(-31, 1) = -16
right_shift(-31, 31) = -1
right_shift(2147483647, 0) = 2147483647
right_shift(2147483647, 1) = 1073741823
right_shift(2147483647, 31) = 0
right_shift(-2147483648, 0) = -2147483648
right_shift(-2147483648, 1) = -1073741824
right_shift(-2147483648, 31) = -1
unchecked_right_shift(1, 0) = 1
unchecked_right_shift(1, 1) = 0
unchecked_right_shift(1, 31) = 0
unchecked_right_shift(-1, 0) = -1
unchecked_right_shift(-1, 1) = -1
unchecked_right_shift(-1, 31) = -1
unchecked_right_shift(31, 0) = 31
unchecked_right_shift(31, 1) = 15
unchecked_right_shift(31, 31) = 0
unchecked_right_shift(-31, 0) = -31
unchecked_right_shift(-31, 1) = -16
unchecked_right_shift(-31, 31) = -1
unchecked_right_shift(2147483647, 0) = 2147483647
unchecked_right_shift(2147483647, 1) = 1073741823
unchecked_right_shift(2147483647, 31) = 0
unchecked_right_shift(-2147483648, 0) = -2147483648
unchecked_right_shift(-2147483648, 1) = -1073741824
unchecked_right_shift(-2147483648, 31) = -1