diff --git a/src/cmd/compile/internal/gc/ssa_test.go b/src/cmd/compile/internal/gc/ssa_test.go index 1aebd9031133e..bb315b97e8344 100644 --- a/src/cmd/compile/internal/gc/ssa_test.go +++ b/src/cmd/compile/internal/gc/ssa_test.go @@ -63,6 +63,9 @@ func TestArithmeticConst(t *testing.T) { runTest(t, "arithConst.go") } func TestChan(t *testing.T) { runTest(t, "chan.go") } +// TestComparisonsConst tests results for comparison operations against constants. +func TestComparisonsConst(t *testing.T) { runTest(t, "cmpConst.go") } + func TestCompound(t *testing.T) { runTest(t, "compound.go") } func TestCtl(t *testing.T) { runTest(t, "ctl.go") } diff --git a/src/cmd/compile/internal/gc/testdata/cmpConst.go b/src/cmd/compile/internal/gc/testdata/cmpConst.go new file mode 100644 index 0000000000000..f7067bea2a5b2 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/cmpConst.go @@ -0,0 +1,2217 @@ +// run +// Code generated by gen/cmpConstGen.go. DO NOT EDIT. + +package main + +import ( + "fmt" + "reflect" + "runtime" +) + +// results show the expected result for the elements left of, equal to and right of the index. +type result struct{ l, e, r bool } + +var ( + eq = result{l: false, e: true, r: false} + ne = result{l: true, e: false, r: true} + lt = result{l: true, e: false, r: false} + le = result{l: true, e: true, r: false} + gt = result{l: false, e: false, r: true} + ge = result{l: false, e: true, r: true} +) + +// uint64 tests +var uint64_vals = []uint64{ + 0, + 1, + 126, + 127, + 128, + 254, + 255, + 256, + 32766, + 32767, + 32768, + 65534, + 65535, + 65536, + 2147483646, + 2147483647, + 2147483648, + 4278190080, + 4294967294, + 4294967295, + 4294967296, + 1095216660480, + 9223372036854775806, + 9223372036854775807, + 9223372036854775808, + 18374686479671623680, + 18446744073709551614, + 18446744073709551615, +} + +func lt_0_uint64(x uint64) bool { return x < 0 } +func le_0_uint64(x uint64) bool { return x <= 0 } +func gt_0_uint64(x uint64) bool { return x > 0 } +func ge_0_uint64(x uint64) bool { return x >= 0 } +func eq_0_uint64(x uint64) bool { return x == 0 } +func ne_0_uint64(x uint64) bool { return x != 0 } +func lt_1_uint64(x uint64) bool { return x < 1 } +func le_1_uint64(x uint64) bool { return x <= 1 } +func gt_1_uint64(x uint64) bool { return x > 1 } +func ge_1_uint64(x uint64) bool { return x >= 1 } +func eq_1_uint64(x uint64) bool { return x == 1 } +func ne_1_uint64(x uint64) bool { return x != 1 } +func lt_126_uint64(x uint64) bool { return x < 126 } +func le_126_uint64(x uint64) bool { return x <= 126 } +func gt_126_uint64(x uint64) bool { return x > 126 } +func ge_126_uint64(x uint64) bool { return x >= 126 } +func eq_126_uint64(x uint64) bool { return x == 126 } +func ne_126_uint64(x uint64) bool { return x != 126 } +func lt_127_uint64(x uint64) bool { return x < 127 } +func le_127_uint64(x uint64) bool { return x <= 127 } +func gt_127_uint64(x uint64) bool { return x > 127 } +func ge_127_uint64(x uint64) bool { return x >= 127 } +func eq_127_uint64(x uint64) bool { return x == 127 } +func ne_127_uint64(x uint64) bool { return x != 127 } +func lt_128_uint64(x uint64) bool { return x < 128 } +func le_128_uint64(x uint64) bool { return x <= 128 } +func gt_128_uint64(x uint64) bool { return x > 128 } +func ge_128_uint64(x uint64) bool { return x >= 128 } +func eq_128_uint64(x uint64) bool { return x == 128 } +func ne_128_uint64(x uint64) bool { return x != 128 } +func lt_254_uint64(x uint64) bool { return x < 254 } +func le_254_uint64(x uint64) bool { return x <= 254 } +func gt_254_uint64(x uint64) bool { return x > 254 } +func ge_254_uint64(x uint64) bool { return x >= 254 } +func eq_254_uint64(x uint64) bool { return x == 254 } +func ne_254_uint64(x uint64) bool { return x != 254 } +func lt_255_uint64(x uint64) bool { return x < 255 } +func le_255_uint64(x uint64) bool { return x <= 255 } +func gt_255_uint64(x uint64) bool { return x > 255 } +func ge_255_uint64(x uint64) bool { return x >= 255 } +func eq_255_uint64(x uint64) bool { return x == 255 } +func ne_255_uint64(x uint64) bool { return x != 255 } +func lt_256_uint64(x uint64) bool { return x < 256 } +func le_256_uint64(x uint64) bool { return x <= 256 } +func gt_256_uint64(x uint64) bool { return x > 256 } +func ge_256_uint64(x uint64) bool { return x >= 256 } +func eq_256_uint64(x uint64) bool { return x == 256 } +func ne_256_uint64(x uint64) bool { return x != 256 } +func lt_32766_uint64(x uint64) bool { return x < 32766 } +func le_32766_uint64(x uint64) bool { return x <= 32766 } +func gt_32766_uint64(x uint64) bool { return x > 32766 } +func ge_32766_uint64(x uint64) bool { return x >= 32766 } +func eq_32766_uint64(x uint64) bool { return x == 32766 } +func ne_32766_uint64(x uint64) bool { return x != 32766 } +func lt_32767_uint64(x uint64) bool { return x < 32767 } +func le_32767_uint64(x uint64) bool { return x <= 32767 } +func gt_32767_uint64(x uint64) bool { return x > 32767 } +func ge_32767_uint64(x uint64) bool { return x >= 32767 } +func eq_32767_uint64(x uint64) bool { return x == 32767 } +func ne_32767_uint64(x uint64) bool { return x != 32767 } +func lt_32768_uint64(x uint64) bool { return x < 32768 } +func le_32768_uint64(x uint64) bool { return x <= 32768 } +func gt_32768_uint64(x uint64) bool { return x > 32768 } +func ge_32768_uint64(x uint64) bool { return x >= 32768 } +func eq_32768_uint64(x uint64) bool { return x == 32768 } +func ne_32768_uint64(x uint64) bool { return x != 32768 } +func lt_65534_uint64(x uint64) bool { return x < 65534 } +func le_65534_uint64(x uint64) bool { return x <= 65534 } +func gt_65534_uint64(x uint64) bool { return x > 65534 } +func ge_65534_uint64(x uint64) bool { return x >= 65534 } +func eq_65534_uint64(x uint64) bool { return x == 65534 } +func ne_65534_uint64(x uint64) bool { return x != 65534 } +func lt_65535_uint64(x uint64) bool { return x < 65535 } +func le_65535_uint64(x uint64) bool { return x <= 65535 } +func gt_65535_uint64(x uint64) bool { return x > 65535 } +func ge_65535_uint64(x uint64) bool { return x >= 65535 } +func eq_65535_uint64(x uint64) bool { return x == 65535 } +func ne_65535_uint64(x uint64) bool { return x != 65535 } +func lt_65536_uint64(x uint64) bool { return x < 65536 } +func le_65536_uint64(x uint64) bool { return x <= 65536 } +func gt_65536_uint64(x uint64) bool { return x > 65536 } +func ge_65536_uint64(x uint64) bool { return x >= 65536 } +func eq_65536_uint64(x uint64) bool { return x == 65536 } +func ne_65536_uint64(x uint64) bool { return x != 65536 } +func lt_2147483646_uint64(x uint64) bool { return x < 2147483646 } +func le_2147483646_uint64(x uint64) bool { return x <= 2147483646 } +func gt_2147483646_uint64(x uint64) bool { return x > 2147483646 } +func ge_2147483646_uint64(x uint64) bool { return x >= 2147483646 } +func eq_2147483646_uint64(x uint64) bool { return x == 2147483646 } +func ne_2147483646_uint64(x uint64) bool { return x != 2147483646 } +func lt_2147483647_uint64(x uint64) bool { return x < 2147483647 } +func le_2147483647_uint64(x uint64) bool { return x <= 2147483647 } +func gt_2147483647_uint64(x uint64) bool { return x > 2147483647 } +func ge_2147483647_uint64(x uint64) bool { return x >= 2147483647 } +func eq_2147483647_uint64(x uint64) bool { return x == 2147483647 } +func ne_2147483647_uint64(x uint64) bool { return x != 2147483647 } +func lt_2147483648_uint64(x uint64) bool { return x < 2147483648 } +func le_2147483648_uint64(x uint64) bool { return x <= 2147483648 } +func gt_2147483648_uint64(x uint64) bool { return x > 2147483648 } +func ge_2147483648_uint64(x uint64) bool { return x >= 2147483648 } +func eq_2147483648_uint64(x uint64) bool { return x == 2147483648 } +func ne_2147483648_uint64(x uint64) bool { return x != 2147483648 } +func lt_4278190080_uint64(x uint64) bool { return x < 4278190080 } +func le_4278190080_uint64(x uint64) bool { return x <= 4278190080 } +func gt_4278190080_uint64(x uint64) bool { return x > 4278190080 } +func ge_4278190080_uint64(x uint64) bool { return x >= 4278190080 } +func eq_4278190080_uint64(x uint64) bool { return x == 4278190080 } +func ne_4278190080_uint64(x uint64) bool { return x != 4278190080 } +func lt_4294967294_uint64(x uint64) bool { return x < 4294967294 } +func le_4294967294_uint64(x uint64) bool { return x <= 4294967294 } +func gt_4294967294_uint64(x uint64) bool { return x > 4294967294 } +func ge_4294967294_uint64(x uint64) bool { return x >= 4294967294 } +func eq_4294967294_uint64(x uint64) bool { return x == 4294967294 } +func ne_4294967294_uint64(x uint64) bool { return x != 4294967294 } +func lt_4294967295_uint64(x uint64) bool { return x < 4294967295 } +func le_4294967295_uint64(x uint64) bool { return x <= 4294967295 } +func gt_4294967295_uint64(x uint64) bool { return x > 4294967295 } +func ge_4294967295_uint64(x uint64) bool { return x >= 4294967295 } +func eq_4294967295_uint64(x uint64) bool { return x == 4294967295 } +func ne_4294967295_uint64(x uint64) bool { return x != 4294967295 } +func lt_4294967296_uint64(x uint64) bool { return x < 4294967296 } +func le_4294967296_uint64(x uint64) bool { return x <= 4294967296 } +func gt_4294967296_uint64(x uint64) bool { return x > 4294967296 } +func ge_4294967296_uint64(x uint64) bool { return x >= 4294967296 } +func eq_4294967296_uint64(x uint64) bool { return x == 4294967296 } +func ne_4294967296_uint64(x uint64) bool { return x != 4294967296 } +func lt_1095216660480_uint64(x uint64) bool { return x < 1095216660480 } +func le_1095216660480_uint64(x uint64) bool { return x <= 1095216660480 } +func gt_1095216660480_uint64(x uint64) bool { return x > 1095216660480 } +func ge_1095216660480_uint64(x uint64) bool { return x >= 1095216660480 } +func eq_1095216660480_uint64(x uint64) bool { return x == 1095216660480 } +func ne_1095216660480_uint64(x uint64) bool { return x != 1095216660480 } +func lt_9223372036854775806_uint64(x uint64) bool { return x < 9223372036854775806 } +func le_9223372036854775806_uint64(x uint64) bool { return x <= 9223372036854775806 } +func gt_9223372036854775806_uint64(x uint64) bool { return x > 9223372036854775806 } +func ge_9223372036854775806_uint64(x uint64) bool { return x >= 9223372036854775806 } +func eq_9223372036854775806_uint64(x uint64) bool { return x == 9223372036854775806 } +func ne_9223372036854775806_uint64(x uint64) bool { return x != 9223372036854775806 } +func lt_9223372036854775807_uint64(x uint64) bool { return x < 9223372036854775807 } +func le_9223372036854775807_uint64(x uint64) bool { return x <= 9223372036854775807 } +func gt_9223372036854775807_uint64(x uint64) bool { return x > 9223372036854775807 } +func ge_9223372036854775807_uint64(x uint64) bool { return x >= 9223372036854775807 } +func eq_9223372036854775807_uint64(x uint64) bool { return x == 9223372036854775807 } +func ne_9223372036854775807_uint64(x uint64) bool { return x != 9223372036854775807 } +func lt_9223372036854775808_uint64(x uint64) bool { return x < 9223372036854775808 } +func le_9223372036854775808_uint64(x uint64) bool { return x <= 9223372036854775808 } +func gt_9223372036854775808_uint64(x uint64) bool { return x > 9223372036854775808 } +func ge_9223372036854775808_uint64(x uint64) bool { return x >= 9223372036854775808 } +func eq_9223372036854775808_uint64(x uint64) bool { return x == 9223372036854775808 } +func ne_9223372036854775808_uint64(x uint64) bool { return x != 9223372036854775808 } +func lt_18374686479671623680_uint64(x uint64) bool { return x < 18374686479671623680 } +func le_18374686479671623680_uint64(x uint64) bool { return x <= 18374686479671623680 } +func gt_18374686479671623680_uint64(x uint64) bool { return x > 18374686479671623680 } +func ge_18374686479671623680_uint64(x uint64) bool { return x >= 18374686479671623680 } +func eq_18374686479671623680_uint64(x uint64) bool { return x == 18374686479671623680 } +func ne_18374686479671623680_uint64(x uint64) bool { return x != 18374686479671623680 } +func lt_18446744073709551614_uint64(x uint64) bool { return x < 18446744073709551614 } +func le_18446744073709551614_uint64(x uint64) bool { return x <= 18446744073709551614 } +func gt_18446744073709551614_uint64(x uint64) bool { return x > 18446744073709551614 } +func ge_18446744073709551614_uint64(x uint64) bool { return x >= 18446744073709551614 } +func eq_18446744073709551614_uint64(x uint64) bool { return x == 18446744073709551614 } +func ne_18446744073709551614_uint64(x uint64) bool { return x != 18446744073709551614 } +func lt_18446744073709551615_uint64(x uint64) bool { return x < 18446744073709551615 } +func le_18446744073709551615_uint64(x uint64) bool { return x <= 18446744073709551615 } +func gt_18446744073709551615_uint64(x uint64) bool { return x > 18446744073709551615 } +func ge_18446744073709551615_uint64(x uint64) bool { return x >= 18446744073709551615 } +func eq_18446744073709551615_uint64(x uint64) bool { return x == 18446744073709551615 } +func ne_18446744073709551615_uint64(x uint64) bool { return x != 18446744073709551615 } + +var uint64_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(uint64) bool +}{ + {idx: 0, exp: lt, fn: lt_0_uint64}, + {idx: 0, exp: le, fn: le_0_uint64}, + {idx: 0, exp: gt, fn: gt_0_uint64}, + {idx: 0, exp: ge, fn: ge_0_uint64}, + {idx: 0, exp: eq, fn: eq_0_uint64}, + {idx: 0, exp: ne, fn: ne_0_uint64}, + {idx: 1, exp: lt, fn: lt_1_uint64}, + {idx: 1, exp: le, fn: le_1_uint64}, + {idx: 1, exp: gt, fn: gt_1_uint64}, + {idx: 1, exp: ge, fn: ge_1_uint64}, + {idx: 1, exp: eq, fn: eq_1_uint64}, + {idx: 1, exp: ne, fn: ne_1_uint64}, + {idx: 2, exp: lt, fn: lt_126_uint64}, + {idx: 2, exp: le, fn: le_126_uint64}, + {idx: 2, exp: gt, fn: gt_126_uint64}, + {idx: 2, exp: ge, fn: ge_126_uint64}, + {idx: 2, exp: eq, fn: eq_126_uint64}, + {idx: 2, exp: ne, fn: ne_126_uint64}, + {idx: 3, exp: lt, fn: lt_127_uint64}, + {idx: 3, exp: le, fn: le_127_uint64}, + {idx: 3, exp: gt, fn: gt_127_uint64}, + {idx: 3, exp: ge, fn: ge_127_uint64}, + {idx: 3, exp: eq, fn: eq_127_uint64}, + {idx: 3, exp: ne, fn: ne_127_uint64}, + {idx: 4, exp: lt, fn: lt_128_uint64}, + {idx: 4, exp: le, fn: le_128_uint64}, + {idx: 4, exp: gt, fn: gt_128_uint64}, + {idx: 4, exp: ge, fn: ge_128_uint64}, + {idx: 4, exp: eq, fn: eq_128_uint64}, + {idx: 4, exp: ne, fn: ne_128_uint64}, + {idx: 5, exp: lt, fn: lt_254_uint64}, + {idx: 5, exp: le, fn: le_254_uint64}, + {idx: 5, exp: gt, fn: gt_254_uint64}, + {idx: 5, exp: ge, fn: ge_254_uint64}, + {idx: 5, exp: eq, fn: eq_254_uint64}, + {idx: 5, exp: ne, fn: ne_254_uint64}, + {idx: 6, exp: lt, fn: lt_255_uint64}, + {idx: 6, exp: le, fn: le_255_uint64}, + {idx: 6, exp: gt, fn: gt_255_uint64}, + {idx: 6, exp: ge, fn: ge_255_uint64}, + {idx: 6, exp: eq, fn: eq_255_uint64}, + {idx: 6, exp: ne, fn: ne_255_uint64}, + {idx: 7, exp: lt, fn: lt_256_uint64}, + {idx: 7, exp: le, fn: le_256_uint64}, + {idx: 7, exp: gt, fn: gt_256_uint64}, + {idx: 7, exp: ge, fn: ge_256_uint64}, + {idx: 7, exp: eq, fn: eq_256_uint64}, + {idx: 7, exp: ne, fn: ne_256_uint64}, + {idx: 8, exp: lt, fn: lt_32766_uint64}, + {idx: 8, exp: le, fn: le_32766_uint64}, + {idx: 8, exp: gt, fn: gt_32766_uint64}, + {idx: 8, exp: ge, fn: ge_32766_uint64}, + {idx: 8, exp: eq, fn: eq_32766_uint64}, + {idx: 8, exp: ne, fn: ne_32766_uint64}, + {idx: 9, exp: lt, fn: lt_32767_uint64}, + {idx: 9, exp: le, fn: le_32767_uint64}, + {idx: 9, exp: gt, fn: gt_32767_uint64}, + {idx: 9, exp: ge, fn: ge_32767_uint64}, + {idx: 9, exp: eq, fn: eq_32767_uint64}, + {idx: 9, exp: ne, fn: ne_32767_uint64}, + {idx: 10, exp: lt, fn: lt_32768_uint64}, + {idx: 10, exp: le, fn: le_32768_uint64}, + {idx: 10, exp: gt, fn: gt_32768_uint64}, + {idx: 10, exp: ge, fn: ge_32768_uint64}, + {idx: 10, exp: eq, fn: eq_32768_uint64}, + {idx: 10, exp: ne, fn: ne_32768_uint64}, + {idx: 11, exp: lt, fn: lt_65534_uint64}, + {idx: 11, exp: le, fn: le_65534_uint64}, + {idx: 11, exp: gt, fn: gt_65534_uint64}, + {idx: 11, exp: ge, fn: ge_65534_uint64}, + {idx: 11, exp: eq, fn: eq_65534_uint64}, + {idx: 11, exp: ne, fn: ne_65534_uint64}, + {idx: 12, exp: lt, fn: lt_65535_uint64}, + {idx: 12, exp: le, fn: le_65535_uint64}, + {idx: 12, exp: gt, fn: gt_65535_uint64}, + {idx: 12, exp: ge, fn: ge_65535_uint64}, + {idx: 12, exp: eq, fn: eq_65535_uint64}, + {idx: 12, exp: ne, fn: ne_65535_uint64}, + {idx: 13, exp: lt, fn: lt_65536_uint64}, + {idx: 13, exp: le, fn: le_65536_uint64}, + {idx: 13, exp: gt, fn: gt_65536_uint64}, + {idx: 13, exp: ge, fn: ge_65536_uint64}, + {idx: 13, exp: eq, fn: eq_65536_uint64}, + {idx: 13, exp: ne, fn: ne_65536_uint64}, + {idx: 14, exp: lt, fn: lt_2147483646_uint64}, + {idx: 14, exp: le, fn: le_2147483646_uint64}, + {idx: 14, exp: gt, fn: gt_2147483646_uint64}, + {idx: 14, exp: ge, fn: ge_2147483646_uint64}, + {idx: 14, exp: eq, fn: eq_2147483646_uint64}, + {idx: 14, exp: ne, fn: ne_2147483646_uint64}, + {idx: 15, exp: lt, fn: lt_2147483647_uint64}, + {idx: 15, exp: le, fn: le_2147483647_uint64}, + {idx: 15, exp: gt, fn: gt_2147483647_uint64}, + {idx: 15, exp: ge, fn: ge_2147483647_uint64}, + {idx: 15, exp: eq, fn: eq_2147483647_uint64}, + {idx: 15, exp: ne, fn: ne_2147483647_uint64}, + {idx: 16, exp: lt, fn: lt_2147483648_uint64}, + {idx: 16, exp: le, fn: le_2147483648_uint64}, + {idx: 16, exp: gt, fn: gt_2147483648_uint64}, + {idx: 16, exp: ge, fn: ge_2147483648_uint64}, + {idx: 16, exp: eq, fn: eq_2147483648_uint64}, + {idx: 16, exp: ne, fn: ne_2147483648_uint64}, + {idx: 17, exp: lt, fn: lt_4278190080_uint64}, + {idx: 17, exp: le, fn: le_4278190080_uint64}, + {idx: 17, exp: gt, fn: gt_4278190080_uint64}, + {idx: 17, exp: ge, fn: ge_4278190080_uint64}, + {idx: 17, exp: eq, fn: eq_4278190080_uint64}, + {idx: 17, exp: ne, fn: ne_4278190080_uint64}, + {idx: 18, exp: lt, fn: lt_4294967294_uint64}, + {idx: 18, exp: le, fn: le_4294967294_uint64}, + {idx: 18, exp: gt, fn: gt_4294967294_uint64}, + {idx: 18, exp: ge, fn: ge_4294967294_uint64}, + {idx: 18, exp: eq, fn: eq_4294967294_uint64}, + {idx: 18, exp: ne, fn: ne_4294967294_uint64}, + {idx: 19, exp: lt, fn: lt_4294967295_uint64}, + {idx: 19, exp: le, fn: le_4294967295_uint64}, + {idx: 19, exp: gt, fn: gt_4294967295_uint64}, + {idx: 19, exp: ge, fn: ge_4294967295_uint64}, + {idx: 19, exp: eq, fn: eq_4294967295_uint64}, + {idx: 19, exp: ne, fn: ne_4294967295_uint64}, + {idx: 20, exp: lt, fn: lt_4294967296_uint64}, + {idx: 20, exp: le, fn: le_4294967296_uint64}, + {idx: 20, exp: gt, fn: gt_4294967296_uint64}, + {idx: 20, exp: ge, fn: ge_4294967296_uint64}, + {idx: 20, exp: eq, fn: eq_4294967296_uint64}, + {idx: 20, exp: ne, fn: ne_4294967296_uint64}, + {idx: 21, exp: lt, fn: lt_1095216660480_uint64}, + {idx: 21, exp: le, fn: le_1095216660480_uint64}, + {idx: 21, exp: gt, fn: gt_1095216660480_uint64}, + {idx: 21, exp: ge, fn: ge_1095216660480_uint64}, + {idx: 21, exp: eq, fn: eq_1095216660480_uint64}, + {idx: 21, exp: ne, fn: ne_1095216660480_uint64}, + {idx: 22, exp: lt, fn: lt_9223372036854775806_uint64}, + {idx: 22, exp: le, fn: le_9223372036854775806_uint64}, + {idx: 22, exp: gt, fn: gt_9223372036854775806_uint64}, + {idx: 22, exp: ge, fn: ge_9223372036854775806_uint64}, + {idx: 22, exp: eq, fn: eq_9223372036854775806_uint64}, + {idx: 22, exp: ne, fn: ne_9223372036854775806_uint64}, + {idx: 23, exp: lt, fn: lt_9223372036854775807_uint64}, + {idx: 23, exp: le, fn: le_9223372036854775807_uint64}, + {idx: 23, exp: gt, fn: gt_9223372036854775807_uint64}, + {idx: 23, exp: ge, fn: ge_9223372036854775807_uint64}, + {idx: 23, exp: eq, fn: eq_9223372036854775807_uint64}, + {idx: 23, exp: ne, fn: ne_9223372036854775807_uint64}, + {idx: 24, exp: lt, fn: lt_9223372036854775808_uint64}, + {idx: 24, exp: le, fn: le_9223372036854775808_uint64}, + {idx: 24, exp: gt, fn: gt_9223372036854775808_uint64}, + {idx: 24, exp: ge, fn: ge_9223372036854775808_uint64}, + {idx: 24, exp: eq, fn: eq_9223372036854775808_uint64}, + {idx: 24, exp: ne, fn: ne_9223372036854775808_uint64}, + {idx: 25, exp: lt, fn: lt_18374686479671623680_uint64}, + {idx: 25, exp: le, fn: le_18374686479671623680_uint64}, + {idx: 25, exp: gt, fn: gt_18374686479671623680_uint64}, + {idx: 25, exp: ge, fn: ge_18374686479671623680_uint64}, + {idx: 25, exp: eq, fn: eq_18374686479671623680_uint64}, + {idx: 25, exp: ne, fn: ne_18374686479671623680_uint64}, + {idx: 26, exp: lt, fn: lt_18446744073709551614_uint64}, + {idx: 26, exp: le, fn: le_18446744073709551614_uint64}, + {idx: 26, exp: gt, fn: gt_18446744073709551614_uint64}, + {idx: 26, exp: ge, fn: ge_18446744073709551614_uint64}, + {idx: 26, exp: eq, fn: eq_18446744073709551614_uint64}, + {idx: 26, exp: ne, fn: ne_18446744073709551614_uint64}, + {idx: 27, exp: lt, fn: lt_18446744073709551615_uint64}, + {idx: 27, exp: le, fn: le_18446744073709551615_uint64}, + {idx: 27, exp: gt, fn: gt_18446744073709551615_uint64}, + {idx: 27, exp: ge, fn: ge_18446744073709551615_uint64}, + {idx: 27, exp: eq, fn: eq_18446744073709551615_uint64}, + {idx: 27, exp: ne, fn: ne_18446744073709551615_uint64}, +} + +// uint32 tests +var uint32_vals = []uint32{ + 0, + 1, + 126, + 127, + 128, + 254, + 255, + 256, + 32766, + 32767, + 32768, + 65534, + 65535, + 65536, + 2147483646, + 2147483647, + 2147483648, + 4278190080, + 4294967294, + 4294967295, +} + +func lt_0_uint32(x uint32) bool { return x < 0 } +func le_0_uint32(x uint32) bool { return x <= 0 } +func gt_0_uint32(x uint32) bool { return x > 0 } +func ge_0_uint32(x uint32) bool { return x >= 0 } +func eq_0_uint32(x uint32) bool { return x == 0 } +func ne_0_uint32(x uint32) bool { return x != 0 } +func lt_1_uint32(x uint32) bool { return x < 1 } +func le_1_uint32(x uint32) bool { return x <= 1 } +func gt_1_uint32(x uint32) bool { return x > 1 } +func ge_1_uint32(x uint32) bool { return x >= 1 } +func eq_1_uint32(x uint32) bool { return x == 1 } +func ne_1_uint32(x uint32) bool { return x != 1 } +func lt_126_uint32(x uint32) bool { return x < 126 } +func le_126_uint32(x uint32) bool { return x <= 126 } +func gt_126_uint32(x uint32) bool { return x > 126 } +func ge_126_uint32(x uint32) bool { return x >= 126 } +func eq_126_uint32(x uint32) bool { return x == 126 } +func ne_126_uint32(x uint32) bool { return x != 126 } +func lt_127_uint32(x uint32) bool { return x < 127 } +func le_127_uint32(x uint32) bool { return x <= 127 } +func gt_127_uint32(x uint32) bool { return x > 127 } +func ge_127_uint32(x uint32) bool { return x >= 127 } +func eq_127_uint32(x uint32) bool { return x == 127 } +func ne_127_uint32(x uint32) bool { return x != 127 } +func lt_128_uint32(x uint32) bool { return x < 128 } +func le_128_uint32(x uint32) bool { return x <= 128 } +func gt_128_uint32(x uint32) bool { return x > 128 } +func ge_128_uint32(x uint32) bool { return x >= 128 } +func eq_128_uint32(x uint32) bool { return x == 128 } +func ne_128_uint32(x uint32) bool { return x != 128 } +func lt_254_uint32(x uint32) bool { return x < 254 } +func le_254_uint32(x uint32) bool { return x <= 254 } +func gt_254_uint32(x uint32) bool { return x > 254 } +func ge_254_uint32(x uint32) bool { return x >= 254 } +func eq_254_uint32(x uint32) bool { return x == 254 } +func ne_254_uint32(x uint32) bool { return x != 254 } +func lt_255_uint32(x uint32) bool { return x < 255 } +func le_255_uint32(x uint32) bool { return x <= 255 } +func gt_255_uint32(x uint32) bool { return x > 255 } +func ge_255_uint32(x uint32) bool { return x >= 255 } +func eq_255_uint32(x uint32) bool { return x == 255 } +func ne_255_uint32(x uint32) bool { return x != 255 } +func lt_256_uint32(x uint32) bool { return x < 256 } +func le_256_uint32(x uint32) bool { return x <= 256 } +func gt_256_uint32(x uint32) bool { return x > 256 } +func ge_256_uint32(x uint32) bool { return x >= 256 } +func eq_256_uint32(x uint32) bool { return x == 256 } +func ne_256_uint32(x uint32) bool { return x != 256 } +func lt_32766_uint32(x uint32) bool { return x < 32766 } +func le_32766_uint32(x uint32) bool { return x <= 32766 } +func gt_32766_uint32(x uint32) bool { return x > 32766 } +func ge_32766_uint32(x uint32) bool { return x >= 32766 } +func eq_32766_uint32(x uint32) bool { return x == 32766 } +func ne_32766_uint32(x uint32) bool { return x != 32766 } +func lt_32767_uint32(x uint32) bool { return x < 32767 } +func le_32767_uint32(x uint32) bool { return x <= 32767 } +func gt_32767_uint32(x uint32) bool { return x > 32767 } +func ge_32767_uint32(x uint32) bool { return x >= 32767 } +func eq_32767_uint32(x uint32) bool { return x == 32767 } +func ne_32767_uint32(x uint32) bool { return x != 32767 } +func lt_32768_uint32(x uint32) bool { return x < 32768 } +func le_32768_uint32(x uint32) bool { return x <= 32768 } +func gt_32768_uint32(x uint32) bool { return x > 32768 } +func ge_32768_uint32(x uint32) bool { return x >= 32768 } +func eq_32768_uint32(x uint32) bool { return x == 32768 } +func ne_32768_uint32(x uint32) bool { return x != 32768 } +func lt_65534_uint32(x uint32) bool { return x < 65534 } +func le_65534_uint32(x uint32) bool { return x <= 65534 } +func gt_65534_uint32(x uint32) bool { return x > 65534 } +func ge_65534_uint32(x uint32) bool { return x >= 65534 } +func eq_65534_uint32(x uint32) bool { return x == 65534 } +func ne_65534_uint32(x uint32) bool { return x != 65534 } +func lt_65535_uint32(x uint32) bool { return x < 65535 } +func le_65535_uint32(x uint32) bool { return x <= 65535 } +func gt_65535_uint32(x uint32) bool { return x > 65535 } +func ge_65535_uint32(x uint32) bool { return x >= 65535 } +func eq_65535_uint32(x uint32) bool { return x == 65535 } +func ne_65535_uint32(x uint32) bool { return x != 65535 } +func lt_65536_uint32(x uint32) bool { return x < 65536 } +func le_65536_uint32(x uint32) bool { return x <= 65536 } +func gt_65536_uint32(x uint32) bool { return x > 65536 } +func ge_65536_uint32(x uint32) bool { return x >= 65536 } +func eq_65536_uint32(x uint32) bool { return x == 65536 } +func ne_65536_uint32(x uint32) bool { return x != 65536 } +func lt_2147483646_uint32(x uint32) bool { return x < 2147483646 } +func le_2147483646_uint32(x uint32) bool { return x <= 2147483646 } +func gt_2147483646_uint32(x uint32) bool { return x > 2147483646 } +func ge_2147483646_uint32(x uint32) bool { return x >= 2147483646 } +func eq_2147483646_uint32(x uint32) bool { return x == 2147483646 } +func ne_2147483646_uint32(x uint32) bool { return x != 2147483646 } +func lt_2147483647_uint32(x uint32) bool { return x < 2147483647 } +func le_2147483647_uint32(x uint32) bool { return x <= 2147483647 } +func gt_2147483647_uint32(x uint32) bool { return x > 2147483647 } +func ge_2147483647_uint32(x uint32) bool { return x >= 2147483647 } +func eq_2147483647_uint32(x uint32) bool { return x == 2147483647 } +func ne_2147483647_uint32(x uint32) bool { return x != 2147483647 } +func lt_2147483648_uint32(x uint32) bool { return x < 2147483648 } +func le_2147483648_uint32(x uint32) bool { return x <= 2147483648 } +func gt_2147483648_uint32(x uint32) bool { return x > 2147483648 } +func ge_2147483648_uint32(x uint32) bool { return x >= 2147483648 } +func eq_2147483648_uint32(x uint32) bool { return x == 2147483648 } +func ne_2147483648_uint32(x uint32) bool { return x != 2147483648 } +func lt_4278190080_uint32(x uint32) bool { return x < 4278190080 } +func le_4278190080_uint32(x uint32) bool { return x <= 4278190080 } +func gt_4278190080_uint32(x uint32) bool { return x > 4278190080 } +func ge_4278190080_uint32(x uint32) bool { return x >= 4278190080 } +func eq_4278190080_uint32(x uint32) bool { return x == 4278190080 } +func ne_4278190080_uint32(x uint32) bool { return x != 4278190080 } +func lt_4294967294_uint32(x uint32) bool { return x < 4294967294 } +func le_4294967294_uint32(x uint32) bool { return x <= 4294967294 } +func gt_4294967294_uint32(x uint32) bool { return x > 4294967294 } +func ge_4294967294_uint32(x uint32) bool { return x >= 4294967294 } +func eq_4294967294_uint32(x uint32) bool { return x == 4294967294 } +func ne_4294967294_uint32(x uint32) bool { return x != 4294967294 } +func lt_4294967295_uint32(x uint32) bool { return x < 4294967295 } +func le_4294967295_uint32(x uint32) bool { return x <= 4294967295 } +func gt_4294967295_uint32(x uint32) bool { return x > 4294967295 } +func ge_4294967295_uint32(x uint32) bool { return x >= 4294967295 } +func eq_4294967295_uint32(x uint32) bool { return x == 4294967295 } +func ne_4294967295_uint32(x uint32) bool { return x != 4294967295 } + +var uint32_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(uint32) bool +}{ + {idx: 0, exp: lt, fn: lt_0_uint32}, + {idx: 0, exp: le, fn: le_0_uint32}, + {idx: 0, exp: gt, fn: gt_0_uint32}, + {idx: 0, exp: ge, fn: ge_0_uint32}, + {idx: 0, exp: eq, fn: eq_0_uint32}, + {idx: 0, exp: ne, fn: ne_0_uint32}, + {idx: 1, exp: lt, fn: lt_1_uint32}, + {idx: 1, exp: le, fn: le_1_uint32}, + {idx: 1, exp: gt, fn: gt_1_uint32}, + {idx: 1, exp: ge, fn: ge_1_uint32}, + {idx: 1, exp: eq, fn: eq_1_uint32}, + {idx: 1, exp: ne, fn: ne_1_uint32}, + {idx: 2, exp: lt, fn: lt_126_uint32}, + {idx: 2, exp: le, fn: le_126_uint32}, + {idx: 2, exp: gt, fn: gt_126_uint32}, + {idx: 2, exp: ge, fn: ge_126_uint32}, + {idx: 2, exp: eq, fn: eq_126_uint32}, + {idx: 2, exp: ne, fn: ne_126_uint32}, + {idx: 3, exp: lt, fn: lt_127_uint32}, + {idx: 3, exp: le, fn: le_127_uint32}, + {idx: 3, exp: gt, fn: gt_127_uint32}, + {idx: 3, exp: ge, fn: ge_127_uint32}, + {idx: 3, exp: eq, fn: eq_127_uint32}, + {idx: 3, exp: ne, fn: ne_127_uint32}, + {idx: 4, exp: lt, fn: lt_128_uint32}, + {idx: 4, exp: le, fn: le_128_uint32}, + {idx: 4, exp: gt, fn: gt_128_uint32}, + {idx: 4, exp: ge, fn: ge_128_uint32}, + {idx: 4, exp: eq, fn: eq_128_uint32}, + {idx: 4, exp: ne, fn: ne_128_uint32}, + {idx: 5, exp: lt, fn: lt_254_uint32}, + {idx: 5, exp: le, fn: le_254_uint32}, + {idx: 5, exp: gt, fn: gt_254_uint32}, + {idx: 5, exp: ge, fn: ge_254_uint32}, + {idx: 5, exp: eq, fn: eq_254_uint32}, + {idx: 5, exp: ne, fn: ne_254_uint32}, + {idx: 6, exp: lt, fn: lt_255_uint32}, + {idx: 6, exp: le, fn: le_255_uint32}, + {idx: 6, exp: gt, fn: gt_255_uint32}, + {idx: 6, exp: ge, fn: ge_255_uint32}, + {idx: 6, exp: eq, fn: eq_255_uint32}, + {idx: 6, exp: ne, fn: ne_255_uint32}, + {idx: 7, exp: lt, fn: lt_256_uint32}, + {idx: 7, exp: le, fn: le_256_uint32}, + {idx: 7, exp: gt, fn: gt_256_uint32}, + {idx: 7, exp: ge, fn: ge_256_uint32}, + {idx: 7, exp: eq, fn: eq_256_uint32}, + {idx: 7, exp: ne, fn: ne_256_uint32}, + {idx: 8, exp: lt, fn: lt_32766_uint32}, + {idx: 8, exp: le, fn: le_32766_uint32}, + {idx: 8, exp: gt, fn: gt_32766_uint32}, + {idx: 8, exp: ge, fn: ge_32766_uint32}, + {idx: 8, exp: eq, fn: eq_32766_uint32}, + {idx: 8, exp: ne, fn: ne_32766_uint32}, + {idx: 9, exp: lt, fn: lt_32767_uint32}, + {idx: 9, exp: le, fn: le_32767_uint32}, + {idx: 9, exp: gt, fn: gt_32767_uint32}, + {idx: 9, exp: ge, fn: ge_32767_uint32}, + {idx: 9, exp: eq, fn: eq_32767_uint32}, + {idx: 9, exp: ne, fn: ne_32767_uint32}, + {idx: 10, exp: lt, fn: lt_32768_uint32}, + {idx: 10, exp: le, fn: le_32768_uint32}, + {idx: 10, exp: gt, fn: gt_32768_uint32}, + {idx: 10, exp: ge, fn: ge_32768_uint32}, + {idx: 10, exp: eq, fn: eq_32768_uint32}, + {idx: 10, exp: ne, fn: ne_32768_uint32}, + {idx: 11, exp: lt, fn: lt_65534_uint32}, + {idx: 11, exp: le, fn: le_65534_uint32}, + {idx: 11, exp: gt, fn: gt_65534_uint32}, + {idx: 11, exp: ge, fn: ge_65534_uint32}, + {idx: 11, exp: eq, fn: eq_65534_uint32}, + {idx: 11, exp: ne, fn: ne_65534_uint32}, + {idx: 12, exp: lt, fn: lt_65535_uint32}, + {idx: 12, exp: le, fn: le_65535_uint32}, + {idx: 12, exp: gt, fn: gt_65535_uint32}, + {idx: 12, exp: ge, fn: ge_65535_uint32}, + {idx: 12, exp: eq, fn: eq_65535_uint32}, + {idx: 12, exp: ne, fn: ne_65535_uint32}, + {idx: 13, exp: lt, fn: lt_65536_uint32}, + {idx: 13, exp: le, fn: le_65536_uint32}, + {idx: 13, exp: gt, fn: gt_65536_uint32}, + {idx: 13, exp: ge, fn: ge_65536_uint32}, + {idx: 13, exp: eq, fn: eq_65536_uint32}, + {idx: 13, exp: ne, fn: ne_65536_uint32}, + {idx: 14, exp: lt, fn: lt_2147483646_uint32}, + {idx: 14, exp: le, fn: le_2147483646_uint32}, + {idx: 14, exp: gt, fn: gt_2147483646_uint32}, + {idx: 14, exp: ge, fn: ge_2147483646_uint32}, + {idx: 14, exp: eq, fn: eq_2147483646_uint32}, + {idx: 14, exp: ne, fn: ne_2147483646_uint32}, + {idx: 15, exp: lt, fn: lt_2147483647_uint32}, + {idx: 15, exp: le, fn: le_2147483647_uint32}, + {idx: 15, exp: gt, fn: gt_2147483647_uint32}, + {idx: 15, exp: ge, fn: ge_2147483647_uint32}, + {idx: 15, exp: eq, fn: eq_2147483647_uint32}, + {idx: 15, exp: ne, fn: ne_2147483647_uint32}, + {idx: 16, exp: lt, fn: lt_2147483648_uint32}, + {idx: 16, exp: le, fn: le_2147483648_uint32}, + {idx: 16, exp: gt, fn: gt_2147483648_uint32}, + {idx: 16, exp: ge, fn: ge_2147483648_uint32}, + {idx: 16, exp: eq, fn: eq_2147483648_uint32}, + {idx: 16, exp: ne, fn: ne_2147483648_uint32}, + {idx: 17, exp: lt, fn: lt_4278190080_uint32}, + {idx: 17, exp: le, fn: le_4278190080_uint32}, + {idx: 17, exp: gt, fn: gt_4278190080_uint32}, + {idx: 17, exp: ge, fn: ge_4278190080_uint32}, + {idx: 17, exp: eq, fn: eq_4278190080_uint32}, + {idx: 17, exp: ne, fn: ne_4278190080_uint32}, + {idx: 18, exp: lt, fn: lt_4294967294_uint32}, + {idx: 18, exp: le, fn: le_4294967294_uint32}, + {idx: 18, exp: gt, fn: gt_4294967294_uint32}, + {idx: 18, exp: ge, fn: ge_4294967294_uint32}, + {idx: 18, exp: eq, fn: eq_4294967294_uint32}, + {idx: 18, exp: ne, fn: ne_4294967294_uint32}, + {idx: 19, exp: lt, fn: lt_4294967295_uint32}, + {idx: 19, exp: le, fn: le_4294967295_uint32}, + {idx: 19, exp: gt, fn: gt_4294967295_uint32}, + {idx: 19, exp: ge, fn: ge_4294967295_uint32}, + {idx: 19, exp: eq, fn: eq_4294967295_uint32}, + {idx: 19, exp: ne, fn: ne_4294967295_uint32}, +} + +// uint16 tests +var uint16_vals = []uint16{ + 0, + 1, + 126, + 127, + 128, + 254, + 255, + 256, + 32766, + 32767, + 32768, + 65534, + 65535, +} + +func lt_0_uint16(x uint16) bool { return x < 0 } +func le_0_uint16(x uint16) bool { return x <= 0 } +func gt_0_uint16(x uint16) bool { return x > 0 } +func ge_0_uint16(x uint16) bool { return x >= 0 } +func eq_0_uint16(x uint16) bool { return x == 0 } +func ne_0_uint16(x uint16) bool { return x != 0 } +func lt_1_uint16(x uint16) bool { return x < 1 } +func le_1_uint16(x uint16) bool { return x <= 1 } +func gt_1_uint16(x uint16) bool { return x > 1 } +func ge_1_uint16(x uint16) bool { return x >= 1 } +func eq_1_uint16(x uint16) bool { return x == 1 } +func ne_1_uint16(x uint16) bool { return x != 1 } +func lt_126_uint16(x uint16) bool { return x < 126 } +func le_126_uint16(x uint16) bool { return x <= 126 } +func gt_126_uint16(x uint16) bool { return x > 126 } +func ge_126_uint16(x uint16) bool { return x >= 126 } +func eq_126_uint16(x uint16) bool { return x == 126 } +func ne_126_uint16(x uint16) bool { return x != 126 } +func lt_127_uint16(x uint16) bool { return x < 127 } +func le_127_uint16(x uint16) bool { return x <= 127 } +func gt_127_uint16(x uint16) bool { return x > 127 } +func ge_127_uint16(x uint16) bool { return x >= 127 } +func eq_127_uint16(x uint16) bool { return x == 127 } +func ne_127_uint16(x uint16) bool { return x != 127 } +func lt_128_uint16(x uint16) bool { return x < 128 } +func le_128_uint16(x uint16) bool { return x <= 128 } +func gt_128_uint16(x uint16) bool { return x > 128 } +func ge_128_uint16(x uint16) bool { return x >= 128 } +func eq_128_uint16(x uint16) bool { return x == 128 } +func ne_128_uint16(x uint16) bool { return x != 128 } +func lt_254_uint16(x uint16) bool { return x < 254 } +func le_254_uint16(x uint16) bool { return x <= 254 } +func gt_254_uint16(x uint16) bool { return x > 254 } +func ge_254_uint16(x uint16) bool { return x >= 254 } +func eq_254_uint16(x uint16) bool { return x == 254 } +func ne_254_uint16(x uint16) bool { return x != 254 } +func lt_255_uint16(x uint16) bool { return x < 255 } +func le_255_uint16(x uint16) bool { return x <= 255 } +func gt_255_uint16(x uint16) bool { return x > 255 } +func ge_255_uint16(x uint16) bool { return x >= 255 } +func eq_255_uint16(x uint16) bool { return x == 255 } +func ne_255_uint16(x uint16) bool { return x != 255 } +func lt_256_uint16(x uint16) bool { return x < 256 } +func le_256_uint16(x uint16) bool { return x <= 256 } +func gt_256_uint16(x uint16) bool { return x > 256 } +func ge_256_uint16(x uint16) bool { return x >= 256 } +func eq_256_uint16(x uint16) bool { return x == 256 } +func ne_256_uint16(x uint16) bool { return x != 256 } +func lt_32766_uint16(x uint16) bool { return x < 32766 } +func le_32766_uint16(x uint16) bool { return x <= 32766 } +func gt_32766_uint16(x uint16) bool { return x > 32766 } +func ge_32766_uint16(x uint16) bool { return x >= 32766 } +func eq_32766_uint16(x uint16) bool { return x == 32766 } +func ne_32766_uint16(x uint16) bool { return x != 32766 } +func lt_32767_uint16(x uint16) bool { return x < 32767 } +func le_32767_uint16(x uint16) bool { return x <= 32767 } +func gt_32767_uint16(x uint16) bool { return x > 32767 } +func ge_32767_uint16(x uint16) bool { return x >= 32767 } +func eq_32767_uint16(x uint16) bool { return x == 32767 } +func ne_32767_uint16(x uint16) bool { return x != 32767 } +func lt_32768_uint16(x uint16) bool { return x < 32768 } +func le_32768_uint16(x uint16) bool { return x <= 32768 } +func gt_32768_uint16(x uint16) bool { return x > 32768 } +func ge_32768_uint16(x uint16) bool { return x >= 32768 } +func eq_32768_uint16(x uint16) bool { return x == 32768 } +func ne_32768_uint16(x uint16) bool { return x != 32768 } +func lt_65534_uint16(x uint16) bool { return x < 65534 } +func le_65534_uint16(x uint16) bool { return x <= 65534 } +func gt_65534_uint16(x uint16) bool { return x > 65534 } +func ge_65534_uint16(x uint16) bool { return x >= 65534 } +func eq_65534_uint16(x uint16) bool { return x == 65534 } +func ne_65534_uint16(x uint16) bool { return x != 65534 } +func lt_65535_uint16(x uint16) bool { return x < 65535 } +func le_65535_uint16(x uint16) bool { return x <= 65535 } +func gt_65535_uint16(x uint16) bool { return x > 65535 } +func ge_65535_uint16(x uint16) bool { return x >= 65535 } +func eq_65535_uint16(x uint16) bool { return x == 65535 } +func ne_65535_uint16(x uint16) bool { return x != 65535 } + +var uint16_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(uint16) bool +}{ + {idx: 0, exp: lt, fn: lt_0_uint16}, + {idx: 0, exp: le, fn: le_0_uint16}, + {idx: 0, exp: gt, fn: gt_0_uint16}, + {idx: 0, exp: ge, fn: ge_0_uint16}, + {idx: 0, exp: eq, fn: eq_0_uint16}, + {idx: 0, exp: ne, fn: ne_0_uint16}, + {idx: 1, exp: lt, fn: lt_1_uint16}, + {idx: 1, exp: le, fn: le_1_uint16}, + {idx: 1, exp: gt, fn: gt_1_uint16}, + {idx: 1, exp: ge, fn: ge_1_uint16}, + {idx: 1, exp: eq, fn: eq_1_uint16}, + {idx: 1, exp: ne, fn: ne_1_uint16}, + {idx: 2, exp: lt, fn: lt_126_uint16}, + {idx: 2, exp: le, fn: le_126_uint16}, + {idx: 2, exp: gt, fn: gt_126_uint16}, + {idx: 2, exp: ge, fn: ge_126_uint16}, + {idx: 2, exp: eq, fn: eq_126_uint16}, + {idx: 2, exp: ne, fn: ne_126_uint16}, + {idx: 3, exp: lt, fn: lt_127_uint16}, + {idx: 3, exp: le, fn: le_127_uint16}, + {idx: 3, exp: gt, fn: gt_127_uint16}, + {idx: 3, exp: ge, fn: ge_127_uint16}, + {idx: 3, exp: eq, fn: eq_127_uint16}, + {idx: 3, exp: ne, fn: ne_127_uint16}, + {idx: 4, exp: lt, fn: lt_128_uint16}, + {idx: 4, exp: le, fn: le_128_uint16}, + {idx: 4, exp: gt, fn: gt_128_uint16}, + {idx: 4, exp: ge, fn: ge_128_uint16}, + {idx: 4, exp: eq, fn: eq_128_uint16}, + {idx: 4, exp: ne, fn: ne_128_uint16}, + {idx: 5, exp: lt, fn: lt_254_uint16}, + {idx: 5, exp: le, fn: le_254_uint16}, + {idx: 5, exp: gt, fn: gt_254_uint16}, + {idx: 5, exp: ge, fn: ge_254_uint16}, + {idx: 5, exp: eq, fn: eq_254_uint16}, + {idx: 5, exp: ne, fn: ne_254_uint16}, + {idx: 6, exp: lt, fn: lt_255_uint16}, + {idx: 6, exp: le, fn: le_255_uint16}, + {idx: 6, exp: gt, fn: gt_255_uint16}, + {idx: 6, exp: ge, fn: ge_255_uint16}, + {idx: 6, exp: eq, fn: eq_255_uint16}, + {idx: 6, exp: ne, fn: ne_255_uint16}, + {idx: 7, exp: lt, fn: lt_256_uint16}, + {idx: 7, exp: le, fn: le_256_uint16}, + {idx: 7, exp: gt, fn: gt_256_uint16}, + {idx: 7, exp: ge, fn: ge_256_uint16}, + {idx: 7, exp: eq, fn: eq_256_uint16}, + {idx: 7, exp: ne, fn: ne_256_uint16}, + {idx: 8, exp: lt, fn: lt_32766_uint16}, + {idx: 8, exp: le, fn: le_32766_uint16}, + {idx: 8, exp: gt, fn: gt_32766_uint16}, + {idx: 8, exp: ge, fn: ge_32766_uint16}, + {idx: 8, exp: eq, fn: eq_32766_uint16}, + {idx: 8, exp: ne, fn: ne_32766_uint16}, + {idx: 9, exp: lt, fn: lt_32767_uint16}, + {idx: 9, exp: le, fn: le_32767_uint16}, + {idx: 9, exp: gt, fn: gt_32767_uint16}, + {idx: 9, exp: ge, fn: ge_32767_uint16}, + {idx: 9, exp: eq, fn: eq_32767_uint16}, + {idx: 9, exp: ne, fn: ne_32767_uint16}, + {idx: 10, exp: lt, fn: lt_32768_uint16}, + {idx: 10, exp: le, fn: le_32768_uint16}, + {idx: 10, exp: gt, fn: gt_32768_uint16}, + {idx: 10, exp: ge, fn: ge_32768_uint16}, + {idx: 10, exp: eq, fn: eq_32768_uint16}, + {idx: 10, exp: ne, fn: ne_32768_uint16}, + {idx: 11, exp: lt, fn: lt_65534_uint16}, + {idx: 11, exp: le, fn: le_65534_uint16}, + {idx: 11, exp: gt, fn: gt_65534_uint16}, + {idx: 11, exp: ge, fn: ge_65534_uint16}, + {idx: 11, exp: eq, fn: eq_65534_uint16}, + {idx: 11, exp: ne, fn: ne_65534_uint16}, + {idx: 12, exp: lt, fn: lt_65535_uint16}, + {idx: 12, exp: le, fn: le_65535_uint16}, + {idx: 12, exp: gt, fn: gt_65535_uint16}, + {idx: 12, exp: ge, fn: ge_65535_uint16}, + {idx: 12, exp: eq, fn: eq_65535_uint16}, + {idx: 12, exp: ne, fn: ne_65535_uint16}, +} + +// uint8 tests +var uint8_vals = []uint8{ + 0, + 1, + 126, + 127, + 128, + 254, + 255, +} + +func lt_0_uint8(x uint8) bool { return x < 0 } +func le_0_uint8(x uint8) bool { return x <= 0 } +func gt_0_uint8(x uint8) bool { return x > 0 } +func ge_0_uint8(x uint8) bool { return x >= 0 } +func eq_0_uint8(x uint8) bool { return x == 0 } +func ne_0_uint8(x uint8) bool { return x != 0 } +func lt_1_uint8(x uint8) bool { return x < 1 } +func le_1_uint8(x uint8) bool { return x <= 1 } +func gt_1_uint8(x uint8) bool { return x > 1 } +func ge_1_uint8(x uint8) bool { return x >= 1 } +func eq_1_uint8(x uint8) bool { return x == 1 } +func ne_1_uint8(x uint8) bool { return x != 1 } +func lt_126_uint8(x uint8) bool { return x < 126 } +func le_126_uint8(x uint8) bool { return x <= 126 } +func gt_126_uint8(x uint8) bool { return x > 126 } +func ge_126_uint8(x uint8) bool { return x >= 126 } +func eq_126_uint8(x uint8) bool { return x == 126 } +func ne_126_uint8(x uint8) bool { return x != 126 } +func lt_127_uint8(x uint8) bool { return x < 127 } +func le_127_uint8(x uint8) bool { return x <= 127 } +func gt_127_uint8(x uint8) bool { return x > 127 } +func ge_127_uint8(x uint8) bool { return x >= 127 } +func eq_127_uint8(x uint8) bool { return x == 127 } +func ne_127_uint8(x uint8) bool { return x != 127 } +func lt_128_uint8(x uint8) bool { return x < 128 } +func le_128_uint8(x uint8) bool { return x <= 128 } +func gt_128_uint8(x uint8) bool { return x > 128 } +func ge_128_uint8(x uint8) bool { return x >= 128 } +func eq_128_uint8(x uint8) bool { return x == 128 } +func ne_128_uint8(x uint8) bool { return x != 128 } +func lt_254_uint8(x uint8) bool { return x < 254 } +func le_254_uint8(x uint8) bool { return x <= 254 } +func gt_254_uint8(x uint8) bool { return x > 254 } +func ge_254_uint8(x uint8) bool { return x >= 254 } +func eq_254_uint8(x uint8) bool { return x == 254 } +func ne_254_uint8(x uint8) bool { return x != 254 } +func lt_255_uint8(x uint8) bool { return x < 255 } +func le_255_uint8(x uint8) bool { return x <= 255 } +func gt_255_uint8(x uint8) bool { return x > 255 } +func ge_255_uint8(x uint8) bool { return x >= 255 } +func eq_255_uint8(x uint8) bool { return x == 255 } +func ne_255_uint8(x uint8) bool { return x != 255 } + +var uint8_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(uint8) bool +}{ + {idx: 0, exp: lt, fn: lt_0_uint8}, + {idx: 0, exp: le, fn: le_0_uint8}, + {idx: 0, exp: gt, fn: gt_0_uint8}, + {idx: 0, exp: ge, fn: ge_0_uint8}, + {idx: 0, exp: eq, fn: eq_0_uint8}, + {idx: 0, exp: ne, fn: ne_0_uint8}, + {idx: 1, exp: lt, fn: lt_1_uint8}, + {idx: 1, exp: le, fn: le_1_uint8}, + {idx: 1, exp: gt, fn: gt_1_uint8}, + {idx: 1, exp: ge, fn: ge_1_uint8}, + {idx: 1, exp: eq, fn: eq_1_uint8}, + {idx: 1, exp: ne, fn: ne_1_uint8}, + {idx: 2, exp: lt, fn: lt_126_uint8}, + {idx: 2, exp: le, fn: le_126_uint8}, + {idx: 2, exp: gt, fn: gt_126_uint8}, + {idx: 2, exp: ge, fn: ge_126_uint8}, + {idx: 2, exp: eq, fn: eq_126_uint8}, + {idx: 2, exp: ne, fn: ne_126_uint8}, + {idx: 3, exp: lt, fn: lt_127_uint8}, + {idx: 3, exp: le, fn: le_127_uint8}, + {idx: 3, exp: gt, fn: gt_127_uint8}, + {idx: 3, exp: ge, fn: ge_127_uint8}, + {idx: 3, exp: eq, fn: eq_127_uint8}, + {idx: 3, exp: ne, fn: ne_127_uint8}, + {idx: 4, exp: lt, fn: lt_128_uint8}, + {idx: 4, exp: le, fn: le_128_uint8}, + {idx: 4, exp: gt, fn: gt_128_uint8}, + {idx: 4, exp: ge, fn: ge_128_uint8}, + {idx: 4, exp: eq, fn: eq_128_uint8}, + {idx: 4, exp: ne, fn: ne_128_uint8}, + {idx: 5, exp: lt, fn: lt_254_uint8}, + {idx: 5, exp: le, fn: le_254_uint8}, + {idx: 5, exp: gt, fn: gt_254_uint8}, + {idx: 5, exp: ge, fn: ge_254_uint8}, + {idx: 5, exp: eq, fn: eq_254_uint8}, + {idx: 5, exp: ne, fn: ne_254_uint8}, + {idx: 6, exp: lt, fn: lt_255_uint8}, + {idx: 6, exp: le, fn: le_255_uint8}, + {idx: 6, exp: gt, fn: gt_255_uint8}, + {idx: 6, exp: ge, fn: ge_255_uint8}, + {idx: 6, exp: eq, fn: eq_255_uint8}, + {idx: 6, exp: ne, fn: ne_255_uint8}, +} + +// int64 tests +var int64_vals = []int64{ + -9223372036854775808, + -9223372036854775807, + -2147483649, + -2147483648, + -2147483647, + -32769, + -32768, + -32767, + -129, + -128, + -127, + -1, + 0, + 1, + 126, + 127, + 128, + 254, + 255, + 256, + 32766, + 32767, + 32768, + 65534, + 65535, + 65536, + 2147483646, + 2147483647, + 2147483648, + 4278190080, + 4294967294, + 4294967295, + 4294967296, + 1095216660480, + 9223372036854775806, + 9223372036854775807, +} + +func lt_neg9223372036854775808_int64(x int64) bool { return x < -9223372036854775808 } +func le_neg9223372036854775808_int64(x int64) bool { return x <= -9223372036854775808 } +func gt_neg9223372036854775808_int64(x int64) bool { return x > -9223372036854775808 } +func ge_neg9223372036854775808_int64(x int64) bool { return x >= -9223372036854775808 } +func eq_neg9223372036854775808_int64(x int64) bool { return x == -9223372036854775808 } +func ne_neg9223372036854775808_int64(x int64) bool { return x != -9223372036854775808 } +func lt_neg9223372036854775807_int64(x int64) bool { return x < -9223372036854775807 } +func le_neg9223372036854775807_int64(x int64) bool { return x <= -9223372036854775807 } +func gt_neg9223372036854775807_int64(x int64) bool { return x > -9223372036854775807 } +func ge_neg9223372036854775807_int64(x int64) bool { return x >= -9223372036854775807 } +func eq_neg9223372036854775807_int64(x int64) bool { return x == -9223372036854775807 } +func ne_neg9223372036854775807_int64(x int64) bool { return x != -9223372036854775807 } +func lt_neg2147483649_int64(x int64) bool { return x < -2147483649 } +func le_neg2147483649_int64(x int64) bool { return x <= -2147483649 } +func gt_neg2147483649_int64(x int64) bool { return x > -2147483649 } +func ge_neg2147483649_int64(x int64) bool { return x >= -2147483649 } +func eq_neg2147483649_int64(x int64) bool { return x == -2147483649 } +func ne_neg2147483649_int64(x int64) bool { return x != -2147483649 } +func lt_neg2147483648_int64(x int64) bool { return x < -2147483648 } +func le_neg2147483648_int64(x int64) bool { return x <= -2147483648 } +func gt_neg2147483648_int64(x int64) bool { return x > -2147483648 } +func ge_neg2147483648_int64(x int64) bool { return x >= -2147483648 } +func eq_neg2147483648_int64(x int64) bool { return x == -2147483648 } +func ne_neg2147483648_int64(x int64) bool { return x != -2147483648 } +func lt_neg2147483647_int64(x int64) bool { return x < -2147483647 } +func le_neg2147483647_int64(x int64) bool { return x <= -2147483647 } +func gt_neg2147483647_int64(x int64) bool { return x > -2147483647 } +func ge_neg2147483647_int64(x int64) bool { return x >= -2147483647 } +func eq_neg2147483647_int64(x int64) bool { return x == -2147483647 } +func ne_neg2147483647_int64(x int64) bool { return x != -2147483647 } +func lt_neg32769_int64(x int64) bool { return x < -32769 } +func le_neg32769_int64(x int64) bool { return x <= -32769 } +func gt_neg32769_int64(x int64) bool { return x > -32769 } +func ge_neg32769_int64(x int64) bool { return x >= -32769 } +func eq_neg32769_int64(x int64) bool { return x == -32769 } +func ne_neg32769_int64(x int64) bool { return x != -32769 } +func lt_neg32768_int64(x int64) bool { return x < -32768 } +func le_neg32768_int64(x int64) bool { return x <= -32768 } +func gt_neg32768_int64(x int64) bool { return x > -32768 } +func ge_neg32768_int64(x int64) bool { return x >= -32768 } +func eq_neg32768_int64(x int64) bool { return x == -32768 } +func ne_neg32768_int64(x int64) bool { return x != -32768 } +func lt_neg32767_int64(x int64) bool { return x < -32767 } +func le_neg32767_int64(x int64) bool { return x <= -32767 } +func gt_neg32767_int64(x int64) bool { return x > -32767 } +func ge_neg32767_int64(x int64) bool { return x >= -32767 } +func eq_neg32767_int64(x int64) bool { return x == -32767 } +func ne_neg32767_int64(x int64) bool { return x != -32767 } +func lt_neg129_int64(x int64) bool { return x < -129 } +func le_neg129_int64(x int64) bool { return x <= -129 } +func gt_neg129_int64(x int64) bool { return x > -129 } +func ge_neg129_int64(x int64) bool { return x >= -129 } +func eq_neg129_int64(x int64) bool { return x == -129 } +func ne_neg129_int64(x int64) bool { return x != -129 } +func lt_neg128_int64(x int64) bool { return x < -128 } +func le_neg128_int64(x int64) bool { return x <= -128 } +func gt_neg128_int64(x int64) bool { return x > -128 } +func ge_neg128_int64(x int64) bool { return x >= -128 } +func eq_neg128_int64(x int64) bool { return x == -128 } +func ne_neg128_int64(x int64) bool { return x != -128 } +func lt_neg127_int64(x int64) bool { return x < -127 } +func le_neg127_int64(x int64) bool { return x <= -127 } +func gt_neg127_int64(x int64) bool { return x > -127 } +func ge_neg127_int64(x int64) bool { return x >= -127 } +func eq_neg127_int64(x int64) bool { return x == -127 } +func ne_neg127_int64(x int64) bool { return x != -127 } +func lt_neg1_int64(x int64) bool { return x < -1 } +func le_neg1_int64(x int64) bool { return x <= -1 } +func gt_neg1_int64(x int64) bool { return x > -1 } +func ge_neg1_int64(x int64) bool { return x >= -1 } +func eq_neg1_int64(x int64) bool { return x == -1 } +func ne_neg1_int64(x int64) bool { return x != -1 } +func lt_0_int64(x int64) bool { return x < 0 } +func le_0_int64(x int64) bool { return x <= 0 } +func gt_0_int64(x int64) bool { return x > 0 } +func ge_0_int64(x int64) bool { return x >= 0 } +func eq_0_int64(x int64) bool { return x == 0 } +func ne_0_int64(x int64) bool { return x != 0 } +func lt_1_int64(x int64) bool { return x < 1 } +func le_1_int64(x int64) bool { return x <= 1 } +func gt_1_int64(x int64) bool { return x > 1 } +func ge_1_int64(x int64) bool { return x >= 1 } +func eq_1_int64(x int64) bool { return x == 1 } +func ne_1_int64(x int64) bool { return x != 1 } +func lt_126_int64(x int64) bool { return x < 126 } +func le_126_int64(x int64) bool { return x <= 126 } +func gt_126_int64(x int64) bool { return x > 126 } +func ge_126_int64(x int64) bool { return x >= 126 } +func eq_126_int64(x int64) bool { return x == 126 } +func ne_126_int64(x int64) bool { return x != 126 } +func lt_127_int64(x int64) bool { return x < 127 } +func le_127_int64(x int64) bool { return x <= 127 } +func gt_127_int64(x int64) bool { return x > 127 } +func ge_127_int64(x int64) bool { return x >= 127 } +func eq_127_int64(x int64) bool { return x == 127 } +func ne_127_int64(x int64) bool { return x != 127 } +func lt_128_int64(x int64) bool { return x < 128 } +func le_128_int64(x int64) bool { return x <= 128 } +func gt_128_int64(x int64) bool { return x > 128 } +func ge_128_int64(x int64) bool { return x >= 128 } +func eq_128_int64(x int64) bool { return x == 128 } +func ne_128_int64(x int64) bool { return x != 128 } +func lt_254_int64(x int64) bool { return x < 254 } +func le_254_int64(x int64) bool { return x <= 254 } +func gt_254_int64(x int64) bool { return x > 254 } +func ge_254_int64(x int64) bool { return x >= 254 } +func eq_254_int64(x int64) bool { return x == 254 } +func ne_254_int64(x int64) bool { return x != 254 } +func lt_255_int64(x int64) bool { return x < 255 } +func le_255_int64(x int64) bool { return x <= 255 } +func gt_255_int64(x int64) bool { return x > 255 } +func ge_255_int64(x int64) bool { return x >= 255 } +func eq_255_int64(x int64) bool { return x == 255 } +func ne_255_int64(x int64) bool { return x != 255 } +func lt_256_int64(x int64) bool { return x < 256 } +func le_256_int64(x int64) bool { return x <= 256 } +func gt_256_int64(x int64) bool { return x > 256 } +func ge_256_int64(x int64) bool { return x >= 256 } +func eq_256_int64(x int64) bool { return x == 256 } +func ne_256_int64(x int64) bool { return x != 256 } +func lt_32766_int64(x int64) bool { return x < 32766 } +func le_32766_int64(x int64) bool { return x <= 32766 } +func gt_32766_int64(x int64) bool { return x > 32766 } +func ge_32766_int64(x int64) bool { return x >= 32766 } +func eq_32766_int64(x int64) bool { return x == 32766 } +func ne_32766_int64(x int64) bool { return x != 32766 } +func lt_32767_int64(x int64) bool { return x < 32767 } +func le_32767_int64(x int64) bool { return x <= 32767 } +func gt_32767_int64(x int64) bool { return x > 32767 } +func ge_32767_int64(x int64) bool { return x >= 32767 } +func eq_32767_int64(x int64) bool { return x == 32767 } +func ne_32767_int64(x int64) bool { return x != 32767 } +func lt_32768_int64(x int64) bool { return x < 32768 } +func le_32768_int64(x int64) bool { return x <= 32768 } +func gt_32768_int64(x int64) bool { return x > 32768 } +func ge_32768_int64(x int64) bool { return x >= 32768 } +func eq_32768_int64(x int64) bool { return x == 32768 } +func ne_32768_int64(x int64) bool { return x != 32768 } +func lt_65534_int64(x int64) bool { return x < 65534 } +func le_65534_int64(x int64) bool { return x <= 65534 } +func gt_65534_int64(x int64) bool { return x > 65534 } +func ge_65534_int64(x int64) bool { return x >= 65534 } +func eq_65534_int64(x int64) bool { return x == 65534 } +func ne_65534_int64(x int64) bool { return x != 65534 } +func lt_65535_int64(x int64) bool { return x < 65535 } +func le_65535_int64(x int64) bool { return x <= 65535 } +func gt_65535_int64(x int64) bool { return x > 65535 } +func ge_65535_int64(x int64) bool { return x >= 65535 } +func eq_65535_int64(x int64) bool { return x == 65535 } +func ne_65535_int64(x int64) bool { return x != 65535 } +func lt_65536_int64(x int64) bool { return x < 65536 } +func le_65536_int64(x int64) bool { return x <= 65536 } +func gt_65536_int64(x int64) bool { return x > 65536 } +func ge_65536_int64(x int64) bool { return x >= 65536 } +func eq_65536_int64(x int64) bool { return x == 65536 } +func ne_65536_int64(x int64) bool { return x != 65536 } +func lt_2147483646_int64(x int64) bool { return x < 2147483646 } +func le_2147483646_int64(x int64) bool { return x <= 2147483646 } +func gt_2147483646_int64(x int64) bool { return x > 2147483646 } +func ge_2147483646_int64(x int64) bool { return x >= 2147483646 } +func eq_2147483646_int64(x int64) bool { return x == 2147483646 } +func ne_2147483646_int64(x int64) bool { return x != 2147483646 } +func lt_2147483647_int64(x int64) bool { return x < 2147483647 } +func le_2147483647_int64(x int64) bool { return x <= 2147483647 } +func gt_2147483647_int64(x int64) bool { return x > 2147483647 } +func ge_2147483647_int64(x int64) bool { return x >= 2147483647 } +func eq_2147483647_int64(x int64) bool { return x == 2147483647 } +func ne_2147483647_int64(x int64) bool { return x != 2147483647 } +func lt_2147483648_int64(x int64) bool { return x < 2147483648 } +func le_2147483648_int64(x int64) bool { return x <= 2147483648 } +func gt_2147483648_int64(x int64) bool { return x > 2147483648 } +func ge_2147483648_int64(x int64) bool { return x >= 2147483648 } +func eq_2147483648_int64(x int64) bool { return x == 2147483648 } +func ne_2147483648_int64(x int64) bool { return x != 2147483648 } +func lt_4278190080_int64(x int64) bool { return x < 4278190080 } +func le_4278190080_int64(x int64) bool { return x <= 4278190080 } +func gt_4278190080_int64(x int64) bool { return x > 4278190080 } +func ge_4278190080_int64(x int64) bool { return x >= 4278190080 } +func eq_4278190080_int64(x int64) bool { return x == 4278190080 } +func ne_4278190080_int64(x int64) bool { return x != 4278190080 } +func lt_4294967294_int64(x int64) bool { return x < 4294967294 } +func le_4294967294_int64(x int64) bool { return x <= 4294967294 } +func gt_4294967294_int64(x int64) bool { return x > 4294967294 } +func ge_4294967294_int64(x int64) bool { return x >= 4294967294 } +func eq_4294967294_int64(x int64) bool { return x == 4294967294 } +func ne_4294967294_int64(x int64) bool { return x != 4294967294 } +func lt_4294967295_int64(x int64) bool { return x < 4294967295 } +func le_4294967295_int64(x int64) bool { return x <= 4294967295 } +func gt_4294967295_int64(x int64) bool { return x > 4294967295 } +func ge_4294967295_int64(x int64) bool { return x >= 4294967295 } +func eq_4294967295_int64(x int64) bool { return x == 4294967295 } +func ne_4294967295_int64(x int64) bool { return x != 4294967295 } +func lt_4294967296_int64(x int64) bool { return x < 4294967296 } +func le_4294967296_int64(x int64) bool { return x <= 4294967296 } +func gt_4294967296_int64(x int64) bool { return x > 4294967296 } +func ge_4294967296_int64(x int64) bool { return x >= 4294967296 } +func eq_4294967296_int64(x int64) bool { return x == 4294967296 } +func ne_4294967296_int64(x int64) bool { return x != 4294967296 } +func lt_1095216660480_int64(x int64) bool { return x < 1095216660480 } +func le_1095216660480_int64(x int64) bool { return x <= 1095216660480 } +func gt_1095216660480_int64(x int64) bool { return x > 1095216660480 } +func ge_1095216660480_int64(x int64) bool { return x >= 1095216660480 } +func eq_1095216660480_int64(x int64) bool { return x == 1095216660480 } +func ne_1095216660480_int64(x int64) bool { return x != 1095216660480 } +func lt_9223372036854775806_int64(x int64) bool { return x < 9223372036854775806 } +func le_9223372036854775806_int64(x int64) bool { return x <= 9223372036854775806 } +func gt_9223372036854775806_int64(x int64) bool { return x > 9223372036854775806 } +func ge_9223372036854775806_int64(x int64) bool { return x >= 9223372036854775806 } +func eq_9223372036854775806_int64(x int64) bool { return x == 9223372036854775806 } +func ne_9223372036854775806_int64(x int64) bool { return x != 9223372036854775806 } +func lt_9223372036854775807_int64(x int64) bool { return x < 9223372036854775807 } +func le_9223372036854775807_int64(x int64) bool { return x <= 9223372036854775807 } +func gt_9223372036854775807_int64(x int64) bool { return x > 9223372036854775807 } +func ge_9223372036854775807_int64(x int64) bool { return x >= 9223372036854775807 } +func eq_9223372036854775807_int64(x int64) bool { return x == 9223372036854775807 } +func ne_9223372036854775807_int64(x int64) bool { return x != 9223372036854775807 } + +var int64_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(int64) bool +}{ + {idx: 0, exp: lt, fn: lt_neg9223372036854775808_int64}, + {idx: 0, exp: le, fn: le_neg9223372036854775808_int64}, + {idx: 0, exp: gt, fn: gt_neg9223372036854775808_int64}, + {idx: 0, exp: ge, fn: ge_neg9223372036854775808_int64}, + {idx: 0, exp: eq, fn: eq_neg9223372036854775808_int64}, + {idx: 0, exp: ne, fn: ne_neg9223372036854775808_int64}, + {idx: 1, exp: lt, fn: lt_neg9223372036854775807_int64}, + {idx: 1, exp: le, fn: le_neg9223372036854775807_int64}, + {idx: 1, exp: gt, fn: gt_neg9223372036854775807_int64}, + {idx: 1, exp: ge, fn: ge_neg9223372036854775807_int64}, + {idx: 1, exp: eq, fn: eq_neg9223372036854775807_int64}, + {idx: 1, exp: ne, fn: ne_neg9223372036854775807_int64}, + {idx: 2, exp: lt, fn: lt_neg2147483649_int64}, + {idx: 2, exp: le, fn: le_neg2147483649_int64}, + {idx: 2, exp: gt, fn: gt_neg2147483649_int64}, + {idx: 2, exp: ge, fn: ge_neg2147483649_int64}, + {idx: 2, exp: eq, fn: eq_neg2147483649_int64}, + {idx: 2, exp: ne, fn: ne_neg2147483649_int64}, + {idx: 3, exp: lt, fn: lt_neg2147483648_int64}, + {idx: 3, exp: le, fn: le_neg2147483648_int64}, + {idx: 3, exp: gt, fn: gt_neg2147483648_int64}, + {idx: 3, exp: ge, fn: ge_neg2147483648_int64}, + {idx: 3, exp: eq, fn: eq_neg2147483648_int64}, + {idx: 3, exp: ne, fn: ne_neg2147483648_int64}, + {idx: 4, exp: lt, fn: lt_neg2147483647_int64}, + {idx: 4, exp: le, fn: le_neg2147483647_int64}, + {idx: 4, exp: gt, fn: gt_neg2147483647_int64}, + {idx: 4, exp: ge, fn: ge_neg2147483647_int64}, + {idx: 4, exp: eq, fn: eq_neg2147483647_int64}, + {idx: 4, exp: ne, fn: ne_neg2147483647_int64}, + {idx: 5, exp: lt, fn: lt_neg32769_int64}, + {idx: 5, exp: le, fn: le_neg32769_int64}, + {idx: 5, exp: gt, fn: gt_neg32769_int64}, + {idx: 5, exp: ge, fn: ge_neg32769_int64}, + {idx: 5, exp: eq, fn: eq_neg32769_int64}, + {idx: 5, exp: ne, fn: ne_neg32769_int64}, + {idx: 6, exp: lt, fn: lt_neg32768_int64}, + {idx: 6, exp: le, fn: le_neg32768_int64}, + {idx: 6, exp: gt, fn: gt_neg32768_int64}, + {idx: 6, exp: ge, fn: ge_neg32768_int64}, + {idx: 6, exp: eq, fn: eq_neg32768_int64}, + {idx: 6, exp: ne, fn: ne_neg32768_int64}, + {idx: 7, exp: lt, fn: lt_neg32767_int64}, + {idx: 7, exp: le, fn: le_neg32767_int64}, + {idx: 7, exp: gt, fn: gt_neg32767_int64}, + {idx: 7, exp: ge, fn: ge_neg32767_int64}, + {idx: 7, exp: eq, fn: eq_neg32767_int64}, + {idx: 7, exp: ne, fn: ne_neg32767_int64}, + {idx: 8, exp: lt, fn: lt_neg129_int64}, + {idx: 8, exp: le, fn: le_neg129_int64}, + {idx: 8, exp: gt, fn: gt_neg129_int64}, + {idx: 8, exp: ge, fn: ge_neg129_int64}, + {idx: 8, exp: eq, fn: eq_neg129_int64}, + {idx: 8, exp: ne, fn: ne_neg129_int64}, + {idx: 9, exp: lt, fn: lt_neg128_int64}, + {idx: 9, exp: le, fn: le_neg128_int64}, + {idx: 9, exp: gt, fn: gt_neg128_int64}, + {idx: 9, exp: ge, fn: ge_neg128_int64}, + {idx: 9, exp: eq, fn: eq_neg128_int64}, + {idx: 9, exp: ne, fn: ne_neg128_int64}, + {idx: 10, exp: lt, fn: lt_neg127_int64}, + {idx: 10, exp: le, fn: le_neg127_int64}, + {idx: 10, exp: gt, fn: gt_neg127_int64}, + {idx: 10, exp: ge, fn: ge_neg127_int64}, + {idx: 10, exp: eq, fn: eq_neg127_int64}, + {idx: 10, exp: ne, fn: ne_neg127_int64}, + {idx: 11, exp: lt, fn: lt_neg1_int64}, + {idx: 11, exp: le, fn: le_neg1_int64}, + {idx: 11, exp: gt, fn: gt_neg1_int64}, + {idx: 11, exp: ge, fn: ge_neg1_int64}, + {idx: 11, exp: eq, fn: eq_neg1_int64}, + {idx: 11, exp: ne, fn: ne_neg1_int64}, + {idx: 12, exp: lt, fn: lt_0_int64}, + {idx: 12, exp: le, fn: le_0_int64}, + {idx: 12, exp: gt, fn: gt_0_int64}, + {idx: 12, exp: ge, fn: ge_0_int64}, + {idx: 12, exp: eq, fn: eq_0_int64}, + {idx: 12, exp: ne, fn: ne_0_int64}, + {idx: 13, exp: lt, fn: lt_1_int64}, + {idx: 13, exp: le, fn: le_1_int64}, + {idx: 13, exp: gt, fn: gt_1_int64}, + {idx: 13, exp: ge, fn: ge_1_int64}, + {idx: 13, exp: eq, fn: eq_1_int64}, + {idx: 13, exp: ne, fn: ne_1_int64}, + {idx: 14, exp: lt, fn: lt_126_int64}, + {idx: 14, exp: le, fn: le_126_int64}, + {idx: 14, exp: gt, fn: gt_126_int64}, + {idx: 14, exp: ge, fn: ge_126_int64}, + {idx: 14, exp: eq, fn: eq_126_int64}, + {idx: 14, exp: ne, fn: ne_126_int64}, + {idx: 15, exp: lt, fn: lt_127_int64}, + {idx: 15, exp: le, fn: le_127_int64}, + {idx: 15, exp: gt, fn: gt_127_int64}, + {idx: 15, exp: ge, fn: ge_127_int64}, + {idx: 15, exp: eq, fn: eq_127_int64}, + {idx: 15, exp: ne, fn: ne_127_int64}, + {idx: 16, exp: lt, fn: lt_128_int64}, + {idx: 16, exp: le, fn: le_128_int64}, + {idx: 16, exp: gt, fn: gt_128_int64}, + {idx: 16, exp: ge, fn: ge_128_int64}, + {idx: 16, exp: eq, fn: eq_128_int64}, + {idx: 16, exp: ne, fn: ne_128_int64}, + {idx: 17, exp: lt, fn: lt_254_int64}, + {idx: 17, exp: le, fn: le_254_int64}, + {idx: 17, exp: gt, fn: gt_254_int64}, + {idx: 17, exp: ge, fn: ge_254_int64}, + {idx: 17, exp: eq, fn: eq_254_int64}, + {idx: 17, exp: ne, fn: ne_254_int64}, + {idx: 18, exp: lt, fn: lt_255_int64}, + {idx: 18, exp: le, fn: le_255_int64}, + {idx: 18, exp: gt, fn: gt_255_int64}, + {idx: 18, exp: ge, fn: ge_255_int64}, + {idx: 18, exp: eq, fn: eq_255_int64}, + {idx: 18, exp: ne, fn: ne_255_int64}, + {idx: 19, exp: lt, fn: lt_256_int64}, + {idx: 19, exp: le, fn: le_256_int64}, + {idx: 19, exp: gt, fn: gt_256_int64}, + {idx: 19, exp: ge, fn: ge_256_int64}, + {idx: 19, exp: eq, fn: eq_256_int64}, + {idx: 19, exp: ne, fn: ne_256_int64}, + {idx: 20, exp: lt, fn: lt_32766_int64}, + {idx: 20, exp: le, fn: le_32766_int64}, + {idx: 20, exp: gt, fn: gt_32766_int64}, + {idx: 20, exp: ge, fn: ge_32766_int64}, + {idx: 20, exp: eq, fn: eq_32766_int64}, + {idx: 20, exp: ne, fn: ne_32766_int64}, + {idx: 21, exp: lt, fn: lt_32767_int64}, + {idx: 21, exp: le, fn: le_32767_int64}, + {idx: 21, exp: gt, fn: gt_32767_int64}, + {idx: 21, exp: ge, fn: ge_32767_int64}, + {idx: 21, exp: eq, fn: eq_32767_int64}, + {idx: 21, exp: ne, fn: ne_32767_int64}, + {idx: 22, exp: lt, fn: lt_32768_int64}, + {idx: 22, exp: le, fn: le_32768_int64}, + {idx: 22, exp: gt, fn: gt_32768_int64}, + {idx: 22, exp: ge, fn: ge_32768_int64}, + {idx: 22, exp: eq, fn: eq_32768_int64}, + {idx: 22, exp: ne, fn: ne_32768_int64}, + {idx: 23, exp: lt, fn: lt_65534_int64}, + {idx: 23, exp: le, fn: le_65534_int64}, + {idx: 23, exp: gt, fn: gt_65534_int64}, + {idx: 23, exp: ge, fn: ge_65534_int64}, + {idx: 23, exp: eq, fn: eq_65534_int64}, + {idx: 23, exp: ne, fn: ne_65534_int64}, + {idx: 24, exp: lt, fn: lt_65535_int64}, + {idx: 24, exp: le, fn: le_65535_int64}, + {idx: 24, exp: gt, fn: gt_65535_int64}, + {idx: 24, exp: ge, fn: ge_65535_int64}, + {idx: 24, exp: eq, fn: eq_65535_int64}, + {idx: 24, exp: ne, fn: ne_65535_int64}, + {idx: 25, exp: lt, fn: lt_65536_int64}, + {idx: 25, exp: le, fn: le_65536_int64}, + {idx: 25, exp: gt, fn: gt_65536_int64}, + {idx: 25, exp: ge, fn: ge_65536_int64}, + {idx: 25, exp: eq, fn: eq_65536_int64}, + {idx: 25, exp: ne, fn: ne_65536_int64}, + {idx: 26, exp: lt, fn: lt_2147483646_int64}, + {idx: 26, exp: le, fn: le_2147483646_int64}, + {idx: 26, exp: gt, fn: gt_2147483646_int64}, + {idx: 26, exp: ge, fn: ge_2147483646_int64}, + {idx: 26, exp: eq, fn: eq_2147483646_int64}, + {idx: 26, exp: ne, fn: ne_2147483646_int64}, + {idx: 27, exp: lt, fn: lt_2147483647_int64}, + {idx: 27, exp: le, fn: le_2147483647_int64}, + {idx: 27, exp: gt, fn: gt_2147483647_int64}, + {idx: 27, exp: ge, fn: ge_2147483647_int64}, + {idx: 27, exp: eq, fn: eq_2147483647_int64}, + {idx: 27, exp: ne, fn: ne_2147483647_int64}, + {idx: 28, exp: lt, fn: lt_2147483648_int64}, + {idx: 28, exp: le, fn: le_2147483648_int64}, + {idx: 28, exp: gt, fn: gt_2147483648_int64}, + {idx: 28, exp: ge, fn: ge_2147483648_int64}, + {idx: 28, exp: eq, fn: eq_2147483648_int64}, + {idx: 28, exp: ne, fn: ne_2147483648_int64}, + {idx: 29, exp: lt, fn: lt_4278190080_int64}, + {idx: 29, exp: le, fn: le_4278190080_int64}, + {idx: 29, exp: gt, fn: gt_4278190080_int64}, + {idx: 29, exp: ge, fn: ge_4278190080_int64}, + {idx: 29, exp: eq, fn: eq_4278190080_int64}, + {idx: 29, exp: ne, fn: ne_4278190080_int64}, + {idx: 30, exp: lt, fn: lt_4294967294_int64}, + {idx: 30, exp: le, fn: le_4294967294_int64}, + {idx: 30, exp: gt, fn: gt_4294967294_int64}, + {idx: 30, exp: ge, fn: ge_4294967294_int64}, + {idx: 30, exp: eq, fn: eq_4294967294_int64}, + {idx: 30, exp: ne, fn: ne_4294967294_int64}, + {idx: 31, exp: lt, fn: lt_4294967295_int64}, + {idx: 31, exp: le, fn: le_4294967295_int64}, + {idx: 31, exp: gt, fn: gt_4294967295_int64}, + {idx: 31, exp: ge, fn: ge_4294967295_int64}, + {idx: 31, exp: eq, fn: eq_4294967295_int64}, + {idx: 31, exp: ne, fn: ne_4294967295_int64}, + {idx: 32, exp: lt, fn: lt_4294967296_int64}, + {idx: 32, exp: le, fn: le_4294967296_int64}, + {idx: 32, exp: gt, fn: gt_4294967296_int64}, + {idx: 32, exp: ge, fn: ge_4294967296_int64}, + {idx: 32, exp: eq, fn: eq_4294967296_int64}, + {idx: 32, exp: ne, fn: ne_4294967296_int64}, + {idx: 33, exp: lt, fn: lt_1095216660480_int64}, + {idx: 33, exp: le, fn: le_1095216660480_int64}, + {idx: 33, exp: gt, fn: gt_1095216660480_int64}, + {idx: 33, exp: ge, fn: ge_1095216660480_int64}, + {idx: 33, exp: eq, fn: eq_1095216660480_int64}, + {idx: 33, exp: ne, fn: ne_1095216660480_int64}, + {idx: 34, exp: lt, fn: lt_9223372036854775806_int64}, + {idx: 34, exp: le, fn: le_9223372036854775806_int64}, + {idx: 34, exp: gt, fn: gt_9223372036854775806_int64}, + {idx: 34, exp: ge, fn: ge_9223372036854775806_int64}, + {idx: 34, exp: eq, fn: eq_9223372036854775806_int64}, + {idx: 34, exp: ne, fn: ne_9223372036854775806_int64}, + {idx: 35, exp: lt, fn: lt_9223372036854775807_int64}, + {idx: 35, exp: le, fn: le_9223372036854775807_int64}, + {idx: 35, exp: gt, fn: gt_9223372036854775807_int64}, + {idx: 35, exp: ge, fn: ge_9223372036854775807_int64}, + {idx: 35, exp: eq, fn: eq_9223372036854775807_int64}, + {idx: 35, exp: ne, fn: ne_9223372036854775807_int64}, +} + +// int32 tests +var int32_vals = []int32{ + -2147483648, + -2147483647, + -32769, + -32768, + -32767, + -129, + -128, + -127, + -1, + 0, + 1, + 126, + 127, + 128, + 254, + 255, + 256, + 32766, + 32767, + 32768, + 65534, + 65535, + 65536, + 2147483646, + 2147483647, +} + +func lt_neg2147483648_int32(x int32) bool { return x < -2147483648 } +func le_neg2147483648_int32(x int32) bool { return x <= -2147483648 } +func gt_neg2147483648_int32(x int32) bool { return x > -2147483648 } +func ge_neg2147483648_int32(x int32) bool { return x >= -2147483648 } +func eq_neg2147483648_int32(x int32) bool { return x == -2147483648 } +func ne_neg2147483648_int32(x int32) bool { return x != -2147483648 } +func lt_neg2147483647_int32(x int32) bool { return x < -2147483647 } +func le_neg2147483647_int32(x int32) bool { return x <= -2147483647 } +func gt_neg2147483647_int32(x int32) bool { return x > -2147483647 } +func ge_neg2147483647_int32(x int32) bool { return x >= -2147483647 } +func eq_neg2147483647_int32(x int32) bool { return x == -2147483647 } +func ne_neg2147483647_int32(x int32) bool { return x != -2147483647 } +func lt_neg32769_int32(x int32) bool { return x < -32769 } +func le_neg32769_int32(x int32) bool { return x <= -32769 } +func gt_neg32769_int32(x int32) bool { return x > -32769 } +func ge_neg32769_int32(x int32) bool { return x >= -32769 } +func eq_neg32769_int32(x int32) bool { return x == -32769 } +func ne_neg32769_int32(x int32) bool { return x != -32769 } +func lt_neg32768_int32(x int32) bool { return x < -32768 } +func le_neg32768_int32(x int32) bool { return x <= -32768 } +func gt_neg32768_int32(x int32) bool { return x > -32768 } +func ge_neg32768_int32(x int32) bool { return x >= -32768 } +func eq_neg32768_int32(x int32) bool { return x == -32768 } +func ne_neg32768_int32(x int32) bool { return x != -32768 } +func lt_neg32767_int32(x int32) bool { return x < -32767 } +func le_neg32767_int32(x int32) bool { return x <= -32767 } +func gt_neg32767_int32(x int32) bool { return x > -32767 } +func ge_neg32767_int32(x int32) bool { return x >= -32767 } +func eq_neg32767_int32(x int32) bool { return x == -32767 } +func ne_neg32767_int32(x int32) bool { return x != -32767 } +func lt_neg129_int32(x int32) bool { return x < -129 } +func le_neg129_int32(x int32) bool { return x <= -129 } +func gt_neg129_int32(x int32) bool { return x > -129 } +func ge_neg129_int32(x int32) bool { return x >= -129 } +func eq_neg129_int32(x int32) bool { return x == -129 } +func ne_neg129_int32(x int32) bool { return x != -129 } +func lt_neg128_int32(x int32) bool { return x < -128 } +func le_neg128_int32(x int32) bool { return x <= -128 } +func gt_neg128_int32(x int32) bool { return x > -128 } +func ge_neg128_int32(x int32) bool { return x >= -128 } +func eq_neg128_int32(x int32) bool { return x == -128 } +func ne_neg128_int32(x int32) bool { return x != -128 } +func lt_neg127_int32(x int32) bool { return x < -127 } +func le_neg127_int32(x int32) bool { return x <= -127 } +func gt_neg127_int32(x int32) bool { return x > -127 } +func ge_neg127_int32(x int32) bool { return x >= -127 } +func eq_neg127_int32(x int32) bool { return x == -127 } +func ne_neg127_int32(x int32) bool { return x != -127 } +func lt_neg1_int32(x int32) bool { return x < -1 } +func le_neg1_int32(x int32) bool { return x <= -1 } +func gt_neg1_int32(x int32) bool { return x > -1 } +func ge_neg1_int32(x int32) bool { return x >= -1 } +func eq_neg1_int32(x int32) bool { return x == -1 } +func ne_neg1_int32(x int32) bool { return x != -1 } +func lt_0_int32(x int32) bool { return x < 0 } +func le_0_int32(x int32) bool { return x <= 0 } +func gt_0_int32(x int32) bool { return x > 0 } +func ge_0_int32(x int32) bool { return x >= 0 } +func eq_0_int32(x int32) bool { return x == 0 } +func ne_0_int32(x int32) bool { return x != 0 } +func lt_1_int32(x int32) bool { return x < 1 } +func le_1_int32(x int32) bool { return x <= 1 } +func gt_1_int32(x int32) bool { return x > 1 } +func ge_1_int32(x int32) bool { return x >= 1 } +func eq_1_int32(x int32) bool { return x == 1 } +func ne_1_int32(x int32) bool { return x != 1 } +func lt_126_int32(x int32) bool { return x < 126 } +func le_126_int32(x int32) bool { return x <= 126 } +func gt_126_int32(x int32) bool { return x > 126 } +func ge_126_int32(x int32) bool { return x >= 126 } +func eq_126_int32(x int32) bool { return x == 126 } +func ne_126_int32(x int32) bool { return x != 126 } +func lt_127_int32(x int32) bool { return x < 127 } +func le_127_int32(x int32) bool { return x <= 127 } +func gt_127_int32(x int32) bool { return x > 127 } +func ge_127_int32(x int32) bool { return x >= 127 } +func eq_127_int32(x int32) bool { return x == 127 } +func ne_127_int32(x int32) bool { return x != 127 } +func lt_128_int32(x int32) bool { return x < 128 } +func le_128_int32(x int32) bool { return x <= 128 } +func gt_128_int32(x int32) bool { return x > 128 } +func ge_128_int32(x int32) bool { return x >= 128 } +func eq_128_int32(x int32) bool { return x == 128 } +func ne_128_int32(x int32) bool { return x != 128 } +func lt_254_int32(x int32) bool { return x < 254 } +func le_254_int32(x int32) bool { return x <= 254 } +func gt_254_int32(x int32) bool { return x > 254 } +func ge_254_int32(x int32) bool { return x >= 254 } +func eq_254_int32(x int32) bool { return x == 254 } +func ne_254_int32(x int32) bool { return x != 254 } +func lt_255_int32(x int32) bool { return x < 255 } +func le_255_int32(x int32) bool { return x <= 255 } +func gt_255_int32(x int32) bool { return x > 255 } +func ge_255_int32(x int32) bool { return x >= 255 } +func eq_255_int32(x int32) bool { return x == 255 } +func ne_255_int32(x int32) bool { return x != 255 } +func lt_256_int32(x int32) bool { return x < 256 } +func le_256_int32(x int32) bool { return x <= 256 } +func gt_256_int32(x int32) bool { return x > 256 } +func ge_256_int32(x int32) bool { return x >= 256 } +func eq_256_int32(x int32) bool { return x == 256 } +func ne_256_int32(x int32) bool { return x != 256 } +func lt_32766_int32(x int32) bool { return x < 32766 } +func le_32766_int32(x int32) bool { return x <= 32766 } +func gt_32766_int32(x int32) bool { return x > 32766 } +func ge_32766_int32(x int32) bool { return x >= 32766 } +func eq_32766_int32(x int32) bool { return x == 32766 } +func ne_32766_int32(x int32) bool { return x != 32766 } +func lt_32767_int32(x int32) bool { return x < 32767 } +func le_32767_int32(x int32) bool { return x <= 32767 } +func gt_32767_int32(x int32) bool { return x > 32767 } +func ge_32767_int32(x int32) bool { return x >= 32767 } +func eq_32767_int32(x int32) bool { return x == 32767 } +func ne_32767_int32(x int32) bool { return x != 32767 } +func lt_32768_int32(x int32) bool { return x < 32768 } +func le_32768_int32(x int32) bool { return x <= 32768 } +func gt_32768_int32(x int32) bool { return x > 32768 } +func ge_32768_int32(x int32) bool { return x >= 32768 } +func eq_32768_int32(x int32) bool { return x == 32768 } +func ne_32768_int32(x int32) bool { return x != 32768 } +func lt_65534_int32(x int32) bool { return x < 65534 } +func le_65534_int32(x int32) bool { return x <= 65534 } +func gt_65534_int32(x int32) bool { return x > 65534 } +func ge_65534_int32(x int32) bool { return x >= 65534 } +func eq_65534_int32(x int32) bool { return x == 65534 } +func ne_65534_int32(x int32) bool { return x != 65534 } +func lt_65535_int32(x int32) bool { return x < 65535 } +func le_65535_int32(x int32) bool { return x <= 65535 } +func gt_65535_int32(x int32) bool { return x > 65535 } +func ge_65535_int32(x int32) bool { return x >= 65535 } +func eq_65535_int32(x int32) bool { return x == 65535 } +func ne_65535_int32(x int32) bool { return x != 65535 } +func lt_65536_int32(x int32) bool { return x < 65536 } +func le_65536_int32(x int32) bool { return x <= 65536 } +func gt_65536_int32(x int32) bool { return x > 65536 } +func ge_65536_int32(x int32) bool { return x >= 65536 } +func eq_65536_int32(x int32) bool { return x == 65536 } +func ne_65536_int32(x int32) bool { return x != 65536 } +func lt_2147483646_int32(x int32) bool { return x < 2147483646 } +func le_2147483646_int32(x int32) bool { return x <= 2147483646 } +func gt_2147483646_int32(x int32) bool { return x > 2147483646 } +func ge_2147483646_int32(x int32) bool { return x >= 2147483646 } +func eq_2147483646_int32(x int32) bool { return x == 2147483646 } +func ne_2147483646_int32(x int32) bool { return x != 2147483646 } +func lt_2147483647_int32(x int32) bool { return x < 2147483647 } +func le_2147483647_int32(x int32) bool { return x <= 2147483647 } +func gt_2147483647_int32(x int32) bool { return x > 2147483647 } +func ge_2147483647_int32(x int32) bool { return x >= 2147483647 } +func eq_2147483647_int32(x int32) bool { return x == 2147483647 } +func ne_2147483647_int32(x int32) bool { return x != 2147483647 } + +var int32_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(int32) bool +}{ + {idx: 0, exp: lt, fn: lt_neg2147483648_int32}, + {idx: 0, exp: le, fn: le_neg2147483648_int32}, + {idx: 0, exp: gt, fn: gt_neg2147483648_int32}, + {idx: 0, exp: ge, fn: ge_neg2147483648_int32}, + {idx: 0, exp: eq, fn: eq_neg2147483648_int32}, + {idx: 0, exp: ne, fn: ne_neg2147483648_int32}, + {idx: 1, exp: lt, fn: lt_neg2147483647_int32}, + {idx: 1, exp: le, fn: le_neg2147483647_int32}, + {idx: 1, exp: gt, fn: gt_neg2147483647_int32}, + {idx: 1, exp: ge, fn: ge_neg2147483647_int32}, + {idx: 1, exp: eq, fn: eq_neg2147483647_int32}, + {idx: 1, exp: ne, fn: ne_neg2147483647_int32}, + {idx: 2, exp: lt, fn: lt_neg32769_int32}, + {idx: 2, exp: le, fn: le_neg32769_int32}, + {idx: 2, exp: gt, fn: gt_neg32769_int32}, + {idx: 2, exp: ge, fn: ge_neg32769_int32}, + {idx: 2, exp: eq, fn: eq_neg32769_int32}, + {idx: 2, exp: ne, fn: ne_neg32769_int32}, + {idx: 3, exp: lt, fn: lt_neg32768_int32}, + {idx: 3, exp: le, fn: le_neg32768_int32}, + {idx: 3, exp: gt, fn: gt_neg32768_int32}, + {idx: 3, exp: ge, fn: ge_neg32768_int32}, + {idx: 3, exp: eq, fn: eq_neg32768_int32}, + {idx: 3, exp: ne, fn: ne_neg32768_int32}, + {idx: 4, exp: lt, fn: lt_neg32767_int32}, + {idx: 4, exp: le, fn: le_neg32767_int32}, + {idx: 4, exp: gt, fn: gt_neg32767_int32}, + {idx: 4, exp: ge, fn: ge_neg32767_int32}, + {idx: 4, exp: eq, fn: eq_neg32767_int32}, + {idx: 4, exp: ne, fn: ne_neg32767_int32}, + {idx: 5, exp: lt, fn: lt_neg129_int32}, + {idx: 5, exp: le, fn: le_neg129_int32}, + {idx: 5, exp: gt, fn: gt_neg129_int32}, + {idx: 5, exp: ge, fn: ge_neg129_int32}, + {idx: 5, exp: eq, fn: eq_neg129_int32}, + {idx: 5, exp: ne, fn: ne_neg129_int32}, + {idx: 6, exp: lt, fn: lt_neg128_int32}, + {idx: 6, exp: le, fn: le_neg128_int32}, + {idx: 6, exp: gt, fn: gt_neg128_int32}, + {idx: 6, exp: ge, fn: ge_neg128_int32}, + {idx: 6, exp: eq, fn: eq_neg128_int32}, + {idx: 6, exp: ne, fn: ne_neg128_int32}, + {idx: 7, exp: lt, fn: lt_neg127_int32}, + {idx: 7, exp: le, fn: le_neg127_int32}, + {idx: 7, exp: gt, fn: gt_neg127_int32}, + {idx: 7, exp: ge, fn: ge_neg127_int32}, + {idx: 7, exp: eq, fn: eq_neg127_int32}, + {idx: 7, exp: ne, fn: ne_neg127_int32}, + {idx: 8, exp: lt, fn: lt_neg1_int32}, + {idx: 8, exp: le, fn: le_neg1_int32}, + {idx: 8, exp: gt, fn: gt_neg1_int32}, + {idx: 8, exp: ge, fn: ge_neg1_int32}, + {idx: 8, exp: eq, fn: eq_neg1_int32}, + {idx: 8, exp: ne, fn: ne_neg1_int32}, + {idx: 9, exp: lt, fn: lt_0_int32}, + {idx: 9, exp: le, fn: le_0_int32}, + {idx: 9, exp: gt, fn: gt_0_int32}, + {idx: 9, exp: ge, fn: ge_0_int32}, + {idx: 9, exp: eq, fn: eq_0_int32}, + {idx: 9, exp: ne, fn: ne_0_int32}, + {idx: 10, exp: lt, fn: lt_1_int32}, + {idx: 10, exp: le, fn: le_1_int32}, + {idx: 10, exp: gt, fn: gt_1_int32}, + {idx: 10, exp: ge, fn: ge_1_int32}, + {idx: 10, exp: eq, fn: eq_1_int32}, + {idx: 10, exp: ne, fn: ne_1_int32}, + {idx: 11, exp: lt, fn: lt_126_int32}, + {idx: 11, exp: le, fn: le_126_int32}, + {idx: 11, exp: gt, fn: gt_126_int32}, + {idx: 11, exp: ge, fn: ge_126_int32}, + {idx: 11, exp: eq, fn: eq_126_int32}, + {idx: 11, exp: ne, fn: ne_126_int32}, + {idx: 12, exp: lt, fn: lt_127_int32}, + {idx: 12, exp: le, fn: le_127_int32}, + {idx: 12, exp: gt, fn: gt_127_int32}, + {idx: 12, exp: ge, fn: ge_127_int32}, + {idx: 12, exp: eq, fn: eq_127_int32}, + {idx: 12, exp: ne, fn: ne_127_int32}, + {idx: 13, exp: lt, fn: lt_128_int32}, + {idx: 13, exp: le, fn: le_128_int32}, + {idx: 13, exp: gt, fn: gt_128_int32}, + {idx: 13, exp: ge, fn: ge_128_int32}, + {idx: 13, exp: eq, fn: eq_128_int32}, + {idx: 13, exp: ne, fn: ne_128_int32}, + {idx: 14, exp: lt, fn: lt_254_int32}, + {idx: 14, exp: le, fn: le_254_int32}, + {idx: 14, exp: gt, fn: gt_254_int32}, + {idx: 14, exp: ge, fn: ge_254_int32}, + {idx: 14, exp: eq, fn: eq_254_int32}, + {idx: 14, exp: ne, fn: ne_254_int32}, + {idx: 15, exp: lt, fn: lt_255_int32}, + {idx: 15, exp: le, fn: le_255_int32}, + {idx: 15, exp: gt, fn: gt_255_int32}, + {idx: 15, exp: ge, fn: ge_255_int32}, + {idx: 15, exp: eq, fn: eq_255_int32}, + {idx: 15, exp: ne, fn: ne_255_int32}, + {idx: 16, exp: lt, fn: lt_256_int32}, + {idx: 16, exp: le, fn: le_256_int32}, + {idx: 16, exp: gt, fn: gt_256_int32}, + {idx: 16, exp: ge, fn: ge_256_int32}, + {idx: 16, exp: eq, fn: eq_256_int32}, + {idx: 16, exp: ne, fn: ne_256_int32}, + {idx: 17, exp: lt, fn: lt_32766_int32}, + {idx: 17, exp: le, fn: le_32766_int32}, + {idx: 17, exp: gt, fn: gt_32766_int32}, + {idx: 17, exp: ge, fn: ge_32766_int32}, + {idx: 17, exp: eq, fn: eq_32766_int32}, + {idx: 17, exp: ne, fn: ne_32766_int32}, + {idx: 18, exp: lt, fn: lt_32767_int32}, + {idx: 18, exp: le, fn: le_32767_int32}, + {idx: 18, exp: gt, fn: gt_32767_int32}, + {idx: 18, exp: ge, fn: ge_32767_int32}, + {idx: 18, exp: eq, fn: eq_32767_int32}, + {idx: 18, exp: ne, fn: ne_32767_int32}, + {idx: 19, exp: lt, fn: lt_32768_int32}, + {idx: 19, exp: le, fn: le_32768_int32}, + {idx: 19, exp: gt, fn: gt_32768_int32}, + {idx: 19, exp: ge, fn: ge_32768_int32}, + {idx: 19, exp: eq, fn: eq_32768_int32}, + {idx: 19, exp: ne, fn: ne_32768_int32}, + {idx: 20, exp: lt, fn: lt_65534_int32}, + {idx: 20, exp: le, fn: le_65534_int32}, + {idx: 20, exp: gt, fn: gt_65534_int32}, + {idx: 20, exp: ge, fn: ge_65534_int32}, + {idx: 20, exp: eq, fn: eq_65534_int32}, + {idx: 20, exp: ne, fn: ne_65534_int32}, + {idx: 21, exp: lt, fn: lt_65535_int32}, + {idx: 21, exp: le, fn: le_65535_int32}, + {idx: 21, exp: gt, fn: gt_65535_int32}, + {idx: 21, exp: ge, fn: ge_65535_int32}, + {idx: 21, exp: eq, fn: eq_65535_int32}, + {idx: 21, exp: ne, fn: ne_65535_int32}, + {idx: 22, exp: lt, fn: lt_65536_int32}, + {idx: 22, exp: le, fn: le_65536_int32}, + {idx: 22, exp: gt, fn: gt_65536_int32}, + {idx: 22, exp: ge, fn: ge_65536_int32}, + {idx: 22, exp: eq, fn: eq_65536_int32}, + {idx: 22, exp: ne, fn: ne_65536_int32}, + {idx: 23, exp: lt, fn: lt_2147483646_int32}, + {idx: 23, exp: le, fn: le_2147483646_int32}, + {idx: 23, exp: gt, fn: gt_2147483646_int32}, + {idx: 23, exp: ge, fn: ge_2147483646_int32}, + {idx: 23, exp: eq, fn: eq_2147483646_int32}, + {idx: 23, exp: ne, fn: ne_2147483646_int32}, + {idx: 24, exp: lt, fn: lt_2147483647_int32}, + {idx: 24, exp: le, fn: le_2147483647_int32}, + {idx: 24, exp: gt, fn: gt_2147483647_int32}, + {idx: 24, exp: ge, fn: ge_2147483647_int32}, + {idx: 24, exp: eq, fn: eq_2147483647_int32}, + {idx: 24, exp: ne, fn: ne_2147483647_int32}, +} + +// int16 tests +var int16_vals = []int16{ + -32768, + -32767, + -129, + -128, + -127, + -1, + 0, + 1, + 126, + 127, + 128, + 254, + 255, + 256, + 32766, + 32767, +} + +func lt_neg32768_int16(x int16) bool { return x < -32768 } +func le_neg32768_int16(x int16) bool { return x <= -32768 } +func gt_neg32768_int16(x int16) bool { return x > -32768 } +func ge_neg32768_int16(x int16) bool { return x >= -32768 } +func eq_neg32768_int16(x int16) bool { return x == -32768 } +func ne_neg32768_int16(x int16) bool { return x != -32768 } +func lt_neg32767_int16(x int16) bool { return x < -32767 } +func le_neg32767_int16(x int16) bool { return x <= -32767 } +func gt_neg32767_int16(x int16) bool { return x > -32767 } +func ge_neg32767_int16(x int16) bool { return x >= -32767 } +func eq_neg32767_int16(x int16) bool { return x == -32767 } +func ne_neg32767_int16(x int16) bool { return x != -32767 } +func lt_neg129_int16(x int16) bool { return x < -129 } +func le_neg129_int16(x int16) bool { return x <= -129 } +func gt_neg129_int16(x int16) bool { return x > -129 } +func ge_neg129_int16(x int16) bool { return x >= -129 } +func eq_neg129_int16(x int16) bool { return x == -129 } +func ne_neg129_int16(x int16) bool { return x != -129 } +func lt_neg128_int16(x int16) bool { return x < -128 } +func le_neg128_int16(x int16) bool { return x <= -128 } +func gt_neg128_int16(x int16) bool { return x > -128 } +func ge_neg128_int16(x int16) bool { return x >= -128 } +func eq_neg128_int16(x int16) bool { return x == -128 } +func ne_neg128_int16(x int16) bool { return x != -128 } +func lt_neg127_int16(x int16) bool { return x < -127 } +func le_neg127_int16(x int16) bool { return x <= -127 } +func gt_neg127_int16(x int16) bool { return x > -127 } +func ge_neg127_int16(x int16) bool { return x >= -127 } +func eq_neg127_int16(x int16) bool { return x == -127 } +func ne_neg127_int16(x int16) bool { return x != -127 } +func lt_neg1_int16(x int16) bool { return x < -1 } +func le_neg1_int16(x int16) bool { return x <= -1 } +func gt_neg1_int16(x int16) bool { return x > -1 } +func ge_neg1_int16(x int16) bool { return x >= -1 } +func eq_neg1_int16(x int16) bool { return x == -1 } +func ne_neg1_int16(x int16) bool { return x != -1 } +func lt_0_int16(x int16) bool { return x < 0 } +func le_0_int16(x int16) bool { return x <= 0 } +func gt_0_int16(x int16) bool { return x > 0 } +func ge_0_int16(x int16) bool { return x >= 0 } +func eq_0_int16(x int16) bool { return x == 0 } +func ne_0_int16(x int16) bool { return x != 0 } +func lt_1_int16(x int16) bool { return x < 1 } +func le_1_int16(x int16) bool { return x <= 1 } +func gt_1_int16(x int16) bool { return x > 1 } +func ge_1_int16(x int16) bool { return x >= 1 } +func eq_1_int16(x int16) bool { return x == 1 } +func ne_1_int16(x int16) bool { return x != 1 } +func lt_126_int16(x int16) bool { return x < 126 } +func le_126_int16(x int16) bool { return x <= 126 } +func gt_126_int16(x int16) bool { return x > 126 } +func ge_126_int16(x int16) bool { return x >= 126 } +func eq_126_int16(x int16) bool { return x == 126 } +func ne_126_int16(x int16) bool { return x != 126 } +func lt_127_int16(x int16) bool { return x < 127 } +func le_127_int16(x int16) bool { return x <= 127 } +func gt_127_int16(x int16) bool { return x > 127 } +func ge_127_int16(x int16) bool { return x >= 127 } +func eq_127_int16(x int16) bool { return x == 127 } +func ne_127_int16(x int16) bool { return x != 127 } +func lt_128_int16(x int16) bool { return x < 128 } +func le_128_int16(x int16) bool { return x <= 128 } +func gt_128_int16(x int16) bool { return x > 128 } +func ge_128_int16(x int16) bool { return x >= 128 } +func eq_128_int16(x int16) bool { return x == 128 } +func ne_128_int16(x int16) bool { return x != 128 } +func lt_254_int16(x int16) bool { return x < 254 } +func le_254_int16(x int16) bool { return x <= 254 } +func gt_254_int16(x int16) bool { return x > 254 } +func ge_254_int16(x int16) bool { return x >= 254 } +func eq_254_int16(x int16) bool { return x == 254 } +func ne_254_int16(x int16) bool { return x != 254 } +func lt_255_int16(x int16) bool { return x < 255 } +func le_255_int16(x int16) bool { return x <= 255 } +func gt_255_int16(x int16) bool { return x > 255 } +func ge_255_int16(x int16) bool { return x >= 255 } +func eq_255_int16(x int16) bool { return x == 255 } +func ne_255_int16(x int16) bool { return x != 255 } +func lt_256_int16(x int16) bool { return x < 256 } +func le_256_int16(x int16) bool { return x <= 256 } +func gt_256_int16(x int16) bool { return x > 256 } +func ge_256_int16(x int16) bool { return x >= 256 } +func eq_256_int16(x int16) bool { return x == 256 } +func ne_256_int16(x int16) bool { return x != 256 } +func lt_32766_int16(x int16) bool { return x < 32766 } +func le_32766_int16(x int16) bool { return x <= 32766 } +func gt_32766_int16(x int16) bool { return x > 32766 } +func ge_32766_int16(x int16) bool { return x >= 32766 } +func eq_32766_int16(x int16) bool { return x == 32766 } +func ne_32766_int16(x int16) bool { return x != 32766 } +func lt_32767_int16(x int16) bool { return x < 32767 } +func le_32767_int16(x int16) bool { return x <= 32767 } +func gt_32767_int16(x int16) bool { return x > 32767 } +func ge_32767_int16(x int16) bool { return x >= 32767 } +func eq_32767_int16(x int16) bool { return x == 32767 } +func ne_32767_int16(x int16) bool { return x != 32767 } + +var int16_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(int16) bool +}{ + {idx: 0, exp: lt, fn: lt_neg32768_int16}, + {idx: 0, exp: le, fn: le_neg32768_int16}, + {idx: 0, exp: gt, fn: gt_neg32768_int16}, + {idx: 0, exp: ge, fn: ge_neg32768_int16}, + {idx: 0, exp: eq, fn: eq_neg32768_int16}, + {idx: 0, exp: ne, fn: ne_neg32768_int16}, + {idx: 1, exp: lt, fn: lt_neg32767_int16}, + {idx: 1, exp: le, fn: le_neg32767_int16}, + {idx: 1, exp: gt, fn: gt_neg32767_int16}, + {idx: 1, exp: ge, fn: ge_neg32767_int16}, + {idx: 1, exp: eq, fn: eq_neg32767_int16}, + {idx: 1, exp: ne, fn: ne_neg32767_int16}, + {idx: 2, exp: lt, fn: lt_neg129_int16}, + {idx: 2, exp: le, fn: le_neg129_int16}, + {idx: 2, exp: gt, fn: gt_neg129_int16}, + {idx: 2, exp: ge, fn: ge_neg129_int16}, + {idx: 2, exp: eq, fn: eq_neg129_int16}, + {idx: 2, exp: ne, fn: ne_neg129_int16}, + {idx: 3, exp: lt, fn: lt_neg128_int16}, + {idx: 3, exp: le, fn: le_neg128_int16}, + {idx: 3, exp: gt, fn: gt_neg128_int16}, + {idx: 3, exp: ge, fn: ge_neg128_int16}, + {idx: 3, exp: eq, fn: eq_neg128_int16}, + {idx: 3, exp: ne, fn: ne_neg128_int16}, + {idx: 4, exp: lt, fn: lt_neg127_int16}, + {idx: 4, exp: le, fn: le_neg127_int16}, + {idx: 4, exp: gt, fn: gt_neg127_int16}, + {idx: 4, exp: ge, fn: ge_neg127_int16}, + {idx: 4, exp: eq, fn: eq_neg127_int16}, + {idx: 4, exp: ne, fn: ne_neg127_int16}, + {idx: 5, exp: lt, fn: lt_neg1_int16}, + {idx: 5, exp: le, fn: le_neg1_int16}, + {idx: 5, exp: gt, fn: gt_neg1_int16}, + {idx: 5, exp: ge, fn: ge_neg1_int16}, + {idx: 5, exp: eq, fn: eq_neg1_int16}, + {idx: 5, exp: ne, fn: ne_neg1_int16}, + {idx: 6, exp: lt, fn: lt_0_int16}, + {idx: 6, exp: le, fn: le_0_int16}, + {idx: 6, exp: gt, fn: gt_0_int16}, + {idx: 6, exp: ge, fn: ge_0_int16}, + {idx: 6, exp: eq, fn: eq_0_int16}, + {idx: 6, exp: ne, fn: ne_0_int16}, + {idx: 7, exp: lt, fn: lt_1_int16}, + {idx: 7, exp: le, fn: le_1_int16}, + {idx: 7, exp: gt, fn: gt_1_int16}, + {idx: 7, exp: ge, fn: ge_1_int16}, + {idx: 7, exp: eq, fn: eq_1_int16}, + {idx: 7, exp: ne, fn: ne_1_int16}, + {idx: 8, exp: lt, fn: lt_126_int16}, + {idx: 8, exp: le, fn: le_126_int16}, + {idx: 8, exp: gt, fn: gt_126_int16}, + {idx: 8, exp: ge, fn: ge_126_int16}, + {idx: 8, exp: eq, fn: eq_126_int16}, + {idx: 8, exp: ne, fn: ne_126_int16}, + {idx: 9, exp: lt, fn: lt_127_int16}, + {idx: 9, exp: le, fn: le_127_int16}, + {idx: 9, exp: gt, fn: gt_127_int16}, + {idx: 9, exp: ge, fn: ge_127_int16}, + {idx: 9, exp: eq, fn: eq_127_int16}, + {idx: 9, exp: ne, fn: ne_127_int16}, + {idx: 10, exp: lt, fn: lt_128_int16}, + {idx: 10, exp: le, fn: le_128_int16}, + {idx: 10, exp: gt, fn: gt_128_int16}, + {idx: 10, exp: ge, fn: ge_128_int16}, + {idx: 10, exp: eq, fn: eq_128_int16}, + {idx: 10, exp: ne, fn: ne_128_int16}, + {idx: 11, exp: lt, fn: lt_254_int16}, + {idx: 11, exp: le, fn: le_254_int16}, + {idx: 11, exp: gt, fn: gt_254_int16}, + {idx: 11, exp: ge, fn: ge_254_int16}, + {idx: 11, exp: eq, fn: eq_254_int16}, + {idx: 11, exp: ne, fn: ne_254_int16}, + {idx: 12, exp: lt, fn: lt_255_int16}, + {idx: 12, exp: le, fn: le_255_int16}, + {idx: 12, exp: gt, fn: gt_255_int16}, + {idx: 12, exp: ge, fn: ge_255_int16}, + {idx: 12, exp: eq, fn: eq_255_int16}, + {idx: 12, exp: ne, fn: ne_255_int16}, + {idx: 13, exp: lt, fn: lt_256_int16}, + {idx: 13, exp: le, fn: le_256_int16}, + {idx: 13, exp: gt, fn: gt_256_int16}, + {idx: 13, exp: ge, fn: ge_256_int16}, + {idx: 13, exp: eq, fn: eq_256_int16}, + {idx: 13, exp: ne, fn: ne_256_int16}, + {idx: 14, exp: lt, fn: lt_32766_int16}, + {idx: 14, exp: le, fn: le_32766_int16}, + {idx: 14, exp: gt, fn: gt_32766_int16}, + {idx: 14, exp: ge, fn: ge_32766_int16}, + {idx: 14, exp: eq, fn: eq_32766_int16}, + {idx: 14, exp: ne, fn: ne_32766_int16}, + {idx: 15, exp: lt, fn: lt_32767_int16}, + {idx: 15, exp: le, fn: le_32767_int16}, + {idx: 15, exp: gt, fn: gt_32767_int16}, + {idx: 15, exp: ge, fn: ge_32767_int16}, + {idx: 15, exp: eq, fn: eq_32767_int16}, + {idx: 15, exp: ne, fn: ne_32767_int16}, +} + +// int8 tests +var int8_vals = []int8{ + -128, + -127, + -1, + 0, + 1, + 126, + 127, +} + +func lt_neg128_int8(x int8) bool { return x < -128 } +func le_neg128_int8(x int8) bool { return x <= -128 } +func gt_neg128_int8(x int8) bool { return x > -128 } +func ge_neg128_int8(x int8) bool { return x >= -128 } +func eq_neg128_int8(x int8) bool { return x == -128 } +func ne_neg128_int8(x int8) bool { return x != -128 } +func lt_neg127_int8(x int8) bool { return x < -127 } +func le_neg127_int8(x int8) bool { return x <= -127 } +func gt_neg127_int8(x int8) bool { return x > -127 } +func ge_neg127_int8(x int8) bool { return x >= -127 } +func eq_neg127_int8(x int8) bool { return x == -127 } +func ne_neg127_int8(x int8) bool { return x != -127 } +func lt_neg1_int8(x int8) bool { return x < -1 } +func le_neg1_int8(x int8) bool { return x <= -1 } +func gt_neg1_int8(x int8) bool { return x > -1 } +func ge_neg1_int8(x int8) bool { return x >= -1 } +func eq_neg1_int8(x int8) bool { return x == -1 } +func ne_neg1_int8(x int8) bool { return x != -1 } +func lt_0_int8(x int8) bool { return x < 0 } +func le_0_int8(x int8) bool { return x <= 0 } +func gt_0_int8(x int8) bool { return x > 0 } +func ge_0_int8(x int8) bool { return x >= 0 } +func eq_0_int8(x int8) bool { return x == 0 } +func ne_0_int8(x int8) bool { return x != 0 } +func lt_1_int8(x int8) bool { return x < 1 } +func le_1_int8(x int8) bool { return x <= 1 } +func gt_1_int8(x int8) bool { return x > 1 } +func ge_1_int8(x int8) bool { return x >= 1 } +func eq_1_int8(x int8) bool { return x == 1 } +func ne_1_int8(x int8) bool { return x != 1 } +func lt_126_int8(x int8) bool { return x < 126 } +func le_126_int8(x int8) bool { return x <= 126 } +func gt_126_int8(x int8) bool { return x > 126 } +func ge_126_int8(x int8) bool { return x >= 126 } +func eq_126_int8(x int8) bool { return x == 126 } +func ne_126_int8(x int8) bool { return x != 126 } +func lt_127_int8(x int8) bool { return x < 127 } +func le_127_int8(x int8) bool { return x <= 127 } +func gt_127_int8(x int8) bool { return x > 127 } +func ge_127_int8(x int8) bool { return x >= 127 } +func eq_127_int8(x int8) bool { return x == 127 } +func ne_127_int8(x int8) bool { return x != 127 } + +var int8_tests = []struct { + idx int // index of the constant used + exp result // expected results + fn func(int8) bool +}{ + {idx: 0, exp: lt, fn: lt_neg128_int8}, + {idx: 0, exp: le, fn: le_neg128_int8}, + {idx: 0, exp: gt, fn: gt_neg128_int8}, + {idx: 0, exp: ge, fn: ge_neg128_int8}, + {idx: 0, exp: eq, fn: eq_neg128_int8}, + {idx: 0, exp: ne, fn: ne_neg128_int8}, + {idx: 1, exp: lt, fn: lt_neg127_int8}, + {idx: 1, exp: le, fn: le_neg127_int8}, + {idx: 1, exp: gt, fn: gt_neg127_int8}, + {idx: 1, exp: ge, fn: ge_neg127_int8}, + {idx: 1, exp: eq, fn: eq_neg127_int8}, + {idx: 1, exp: ne, fn: ne_neg127_int8}, + {idx: 2, exp: lt, fn: lt_neg1_int8}, + {idx: 2, exp: le, fn: le_neg1_int8}, + {idx: 2, exp: gt, fn: gt_neg1_int8}, + {idx: 2, exp: ge, fn: ge_neg1_int8}, + {idx: 2, exp: eq, fn: eq_neg1_int8}, + {idx: 2, exp: ne, fn: ne_neg1_int8}, + {idx: 3, exp: lt, fn: lt_0_int8}, + {idx: 3, exp: le, fn: le_0_int8}, + {idx: 3, exp: gt, fn: gt_0_int8}, + {idx: 3, exp: ge, fn: ge_0_int8}, + {idx: 3, exp: eq, fn: eq_0_int8}, + {idx: 3, exp: ne, fn: ne_0_int8}, + {idx: 4, exp: lt, fn: lt_1_int8}, + {idx: 4, exp: le, fn: le_1_int8}, + {idx: 4, exp: gt, fn: gt_1_int8}, + {idx: 4, exp: ge, fn: ge_1_int8}, + {idx: 4, exp: eq, fn: eq_1_int8}, + {idx: 4, exp: ne, fn: ne_1_int8}, + {idx: 5, exp: lt, fn: lt_126_int8}, + {idx: 5, exp: le, fn: le_126_int8}, + {idx: 5, exp: gt, fn: gt_126_int8}, + {idx: 5, exp: ge, fn: ge_126_int8}, + {idx: 5, exp: eq, fn: eq_126_int8}, + {idx: 5, exp: ne, fn: ne_126_int8}, + {idx: 6, exp: lt, fn: lt_127_int8}, + {idx: 6, exp: le, fn: le_127_int8}, + {idx: 6, exp: gt, fn: gt_127_int8}, + {idx: 6, exp: ge, fn: ge_127_int8}, + {idx: 6, exp: eq, fn: eq_127_int8}, + {idx: 6, exp: ne, fn: ne_127_int8}, +} + +func main() { + for i, test := range uint64_tests { + for j, x := range uint64_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=uint64 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range uint32_tests { + for j, x := range uint32_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=uint32 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range uint16_tests { + for j, x := range uint16_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=uint16 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range uint8_tests { + for j, x := range uint8_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=uint8 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range int64_tests { + for j, x := range int64_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=int64 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range int32_tests { + for j, x := range int32_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=int32 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range int16_tests { + for j, x := range int16_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=int16 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } + for i, test := range int8_tests { + for j, x := range int8_vals { + want := test.exp.l + if j == test.idx { + want = test.exp.e + } else if j > test.idx { + want = test.exp.r + } + if test.fn(x) != want { + fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name() + msg := fmt.Sprintf("test failed: %v(%v) != %v [type=int8 i=%v j=%v idx=%v]", fn, x, want, i, j, test.idx) + panic(msg) + } + } + } +} diff --git a/src/cmd/compile/internal/gc/testdata/gen/cmpConstGen.go b/src/cmd/compile/internal/gc/testdata/gen/cmpConstGen.go new file mode 100644 index 0000000000000..defa4a9f7bfdd --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/gen/cmpConstGen.go @@ -0,0 +1,248 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This program generates a test to verify that the standard comparison +// operators properly handle one const operand. The test file should be +// generated with a known working version of go. +// launch with `go run cmpConstGen.go` a file called cmpConst.go +// will be written into the parent directory containing the tests + +package main + +import ( + "bytes" + "fmt" + "go/format" + "io/ioutil" + "log" + "math/big" + "sort" +) + +const ( + maxU64 = (1 << 64) - 1 + maxU32 = (1 << 32) - 1 + maxU16 = (1 << 16) - 1 + maxU8 = (1 << 8) - 1 + + maxI64 = (1 << 63) - 1 + maxI32 = (1 << 31) - 1 + maxI16 = (1 << 15) - 1 + maxI8 = (1 << 7) - 1 + + minI64 = -(1 << 63) + minI32 = -(1 << 31) + minI16 = -(1 << 15) + minI8 = -(1 << 7) +) + +func cmp(left *big.Int, op string, right *big.Int) bool { + switch left.Cmp(right) { + case -1: // less than + return op == "<" || op == "<=" || op == "!=" + case 0: // equal + return op == "==" || op == "<=" || op == ">=" + case 1: // greater than + return op == ">" || op == ">=" || op == "!=" + } + panic("unexpected comparison value") +} + +func inRange(typ string, val *big.Int) bool { + min, max := &big.Int{}, &big.Int{} + switch typ { + case "uint64": + max = max.SetUint64(maxU64) + case "uint32": + max = max.SetUint64(maxU32) + case "uint16": + max = max.SetUint64(maxU16) + case "uint8": + max = max.SetUint64(maxU8) + case "int64": + min = min.SetInt64(minI64) + max = max.SetInt64(maxI64) + case "int32": + min = min.SetInt64(minI32) + max = max.SetInt64(maxI32) + case "int16": + min = min.SetInt64(minI16) + max = max.SetInt64(maxI16) + case "int8": + min = min.SetInt64(minI8) + max = max.SetInt64(maxI8) + default: + panic("unexpected type") + } + return cmp(min, "<=", val) && cmp(val, "<=", max) +} + +func getValues(typ string) []*big.Int { + Uint := func(v uint64) *big.Int { return big.NewInt(0).SetUint64(v) } + Int := func(v int64) *big.Int { return big.NewInt(0).SetInt64(v) } + values := []*big.Int{ + // limits + Uint(maxU64), + Uint(maxU64 - 1), + Uint(maxI64 + 1), + Uint(maxI64), + Uint(maxI64 - 1), + Uint(maxU32 + 1), + Uint(maxU32), + Uint(maxU32 - 1), + Uint(maxI32 + 1), + Uint(maxI32), + Uint(maxI32 - 1), + Uint(maxU16 + 1), + Uint(maxU16), + Uint(maxU16 - 1), + Uint(maxI16 + 1), + Uint(maxI16), + Uint(maxI16 - 1), + Uint(maxU8 + 1), + Uint(maxU8), + Uint(maxU8 - 1), + Uint(maxI8 + 1), + Uint(maxI8), + Uint(maxI8 - 1), + Uint(0), + Int(minI8 + 1), + Int(minI8), + Int(minI8 - 1), + Int(minI16 + 1), + Int(minI16), + Int(minI16 - 1), + Int(minI32 + 1), + Int(minI32), + Int(minI32 - 1), + Int(minI64 + 1), + Int(minI64), + + // other possibly interesting values + Uint(1), + Int(-1), + Uint(0xff << 56), + Uint(0xff << 32), + Uint(0xff << 24), + } + sort.Slice(values, func(i, j int) bool { return values[i].Cmp(values[j]) == -1 }) + var ret []*big.Int + for _, val := range values { + if !inRange(typ, val) { + continue + } + ret = append(ret, val) + } + return ret +} + +func sigString(v *big.Int) string { + var t big.Int + t.Abs(v) + if v.Sign() == -1 { + return "neg" + t.String() + } + return t.String() +} + +func main() { + types := []string{ + "uint64", "uint32", "uint16", "uint8", + "int64", "int32", "int16", "int8", + } + + w := new(bytes.Buffer) + fmt.Fprintf(w, "// run\n") + fmt.Fprintf(w, "// Code generated by gen/cmpConstGen.go. DO NOT EDIT.\n\n") + fmt.Fprintf(w, "package main;\n") + fmt.Fprintf(w, "import (\"fmt\"; \"reflect\"; \"runtime\";)\n") + fmt.Fprintf(w, "// results show the expected result for the elements left of, equal to and right of the index.\n") + fmt.Fprintf(w, "type result struct{l, e, r bool}\n") + fmt.Fprintf(w, "var (\n") + fmt.Fprintf(w, " eq = result{l: false, e: true, r: false}\n") + fmt.Fprintf(w, " ne = result{l: true, e: false, r: true}\n") + fmt.Fprintf(w, " lt = result{l: true, e: false, r: false}\n") + fmt.Fprintf(w, " le = result{l: true, e: true, r: false}\n") + fmt.Fprintf(w, " gt = result{l: false, e: false, r: true}\n") + fmt.Fprintf(w, " ge = result{l: false, e: true, r: true}\n") + fmt.Fprintf(w, ")\n") + + operators := []struct{ op, name string }{ + {"<", "lt"}, + {"<=", "le"}, + {">", "gt"}, + {">=", "ge"}, + {"==", "eq"}, + {"!=", "ne"}, + } + + for _, typ := range types { + // generate a slice containing valid values for this type + fmt.Fprintf(w, "\n// %v tests\n", typ) + values := getValues(typ) + fmt.Fprintf(w, "var %v_vals = []%v{\n", typ, typ) + for _, val := range values { + fmt.Fprintf(w, "%v,\n", val.String()) + } + fmt.Fprintf(w, "}\n") + + // generate test functions + for _, r := range values { + // TODO: could also test constant on lhs. + sig := sigString(r) + for _, op := range operators { + // no need for go:noinline because the function is called indirectly + fmt.Fprintf(w, "func %v_%v_%v(x %v) bool { return x %v %v; }\n", op.name, sig, typ, typ, op.op, r.String()) + } + } + + // generate a table of test cases + fmt.Fprintf(w, "var %v_tests = []struct{\n", typ) + fmt.Fprintf(w, " idx int // index of the constant used\n") + fmt.Fprintf(w, " exp result // expected results\n") + fmt.Fprintf(w, " fn func(%v) bool\n", typ) + fmt.Fprintf(w, "}{\n") + for i, r := range values { + sig := sigString(r) + for _, op := range operators { + fmt.Fprintf(w, "{idx: %v,", i) + fmt.Fprintf(w, "exp: %v,", op.name) + fmt.Fprintf(w, "fn: %v_%v_%v},\n", op.name, sig, typ) + } + } + fmt.Fprintf(w, "}\n") + } + + // emit the main function, looping over all test cases + fmt.Fprintf(w, "func main() {\n") + for _, typ := range types { + fmt.Fprintf(w, "for i, test := range %v_tests {\n", typ) + fmt.Fprintf(w, " for j, x := range %v_vals {\n", typ) + fmt.Fprintf(w, " want := test.exp.l\n") + fmt.Fprintf(w, " if j == test.idx {\nwant = test.exp.e\n}") + fmt.Fprintf(w, " else if j > test.idx {\nwant = test.exp.r\n}\n") + fmt.Fprintf(w, " if test.fn(x) != want {\n") + fmt.Fprintf(w, " fn := runtime.FuncForPC(reflect.ValueOf(test.fn).Pointer()).Name()\n") + fmt.Fprintf(w, " msg := fmt.Sprintf(\"test failed: %%v(%%v) != %%v [type=%v i=%%v j=%%v idx=%%v]\", fn, x, want, i, j, test.idx)\n", typ) + fmt.Fprintf(w, " panic(msg)\n") + fmt.Fprintf(w, " }\n") + fmt.Fprintf(w, " }\n") + fmt.Fprintf(w, "}\n") + } + fmt.Fprintf(w, "}\n") + + // gofmt result + b := w.Bytes() + src, err := format.Source(b) + if err != nil { + fmt.Printf("%s\n", b) + panic(err) + } + + // write to file + err = ioutil.WriteFile("../cmpConst.go", src, 0666) + if err != nil { + log.Fatalf("can't write output: %v\n", err) + } +} diff --git a/src/cmd/compile/internal/ssa/gen/S390X.rules b/src/cmd/compile/internal/ssa/gen/S390X.rules index 7ecea02daeddc..caea0506fa979 100644 --- a/src/cmd/compile/internal/ssa/gen/S390X.rules +++ b/src/cmd/compile/internal/ssa/gen/S390X.rules @@ -537,8 +537,8 @@ (CMP (MOVDconst [c]) x) && is32Bit(c) -> (InvertFlags (CMPconst x [c])) (CMPW x (MOVDconst [c])) -> (CMPWconst x [c]) (CMPW (MOVDconst [c]) x) -> (InvertFlags (CMPWconst x [c])) -(CMPU x (MOVDconst [c])) && is32Bit(c) -> (CMPUconst x [int64(uint32(c))]) -(CMPU (MOVDconst [c]) x) && is32Bit(c) -> (InvertFlags (CMPUconst x [int64(uint32(c))])) +(CMPU x (MOVDconst [c])) && isU32Bit(c) -> (CMPUconst x [int64(uint32(c))]) +(CMPU (MOVDconst [c]) x) && isU32Bit(c) -> (InvertFlags (CMPUconst x [int64(uint32(c))])) (CMPWU x (MOVDconst [c])) -> (CMPWUconst x [int64(uint32(c))]) (CMPWU (MOVDconst [c]) x) -> (InvertFlags (CMPWUconst x [int64(uint32(c))])) diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go index 866cf50041540..af8fd1d45613a 100644 --- a/src/cmd/compile/internal/ssa/rewriteS390X.go +++ b/src/cmd/compile/internal/ssa/rewriteS390X.go @@ -6784,7 +6784,7 @@ func rewriteValueS390X_OpS390XCMPU(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMPU x (MOVDconst [c])) - // cond: is32Bit(c) + // cond: isU32Bit(c) // result: (CMPUconst x [int64(uint32(c))]) for { x := v.Args[0] @@ -6793,7 +6793,7 @@ func rewriteValueS390X_OpS390XCMPU(v *Value, config *Config) bool { break } c := v_1.AuxInt - if !(is32Bit(c)) { + if !(isU32Bit(c)) { break } v.reset(OpS390XCMPUconst) @@ -6802,7 +6802,7 @@ func rewriteValueS390X_OpS390XCMPU(v *Value, config *Config) bool { return true } // match: (CMPU (MOVDconst [c]) x) - // cond: is32Bit(c) + // cond: isU32Bit(c) // result: (InvertFlags (CMPUconst x [int64(uint32(c))])) for { v_0 := v.Args[0] @@ -6811,7 +6811,7 @@ func rewriteValueS390X_OpS390XCMPU(v *Value, config *Config) bool { } c := v_0.AuxInt x := v.Args[1] - if !(is32Bit(c)) { + if !(isU32Bit(c)) { break } v.reset(OpS390XInvertFlags)