From 67cbd5b51d3700fc1976f71a711882bfdd7e8304 Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Tue, 18 Aug 2015 19:14:47 -0500 Subject: [PATCH] [dev.ssa] cmd/compile/internal/ssa: implement OHMUL Adds support for high multiply which is used by the frontend when rewriting const division. The frontend currently only does this for 8, 16, and 32 bit integer arithmetic. Change-Id: I9b6c6018f3be827a50ee6c185454ebc79b3094c8 Reviewed-on: https://go-review.googlesource.com/13696 Reviewed-by: Keith Randall --- src/cmd/compile/internal/gc/ssa.go | 30 +- src/cmd/compile/internal/gc/ssa_test.go | 3 + .../internal/gc/testdata/arithConst_ssa.go | 3979 +++++++++++++++++ .../compile/internal/gc/testdata/arith_ssa.go | 2 +- src/cmd/compile/internal/ssa/TODO | 3 +- src/cmd/compile/internal/ssa/gen/AMD64.rules | 7 + src/cmd/compile/internal/ssa/gen/AMD64Ops.go | 10 +- .../compile/internal/ssa/gen/genericOps.go | 8 + src/cmd/compile/internal/ssa/opGen.go | 120 + src/cmd/compile/internal/ssa/rewriteAMD64.go | 108 + 10 files changed, 4266 insertions(+), 4 deletions(-) create mode 100644 src/cmd/compile/internal/gc/testdata/arithConst_ssa.go diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 90b29b9b09..f2dd20bcb4 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -779,6 +779,13 @@ var opToSSA = map[opAndType]ssa.Op{ opAndType{ODIV, TFLOAT32}: ssa.OpDiv32F, opAndType{ODIV, TFLOAT64}: ssa.OpDiv64F, + opAndType{OHMUL, TINT8}: ssa.OpHmul8, + opAndType{OHMUL, TUINT8}: ssa.OpHmul8u, + opAndType{OHMUL, TINT16}: ssa.OpHmul16, + opAndType{OHMUL, TUINT16}: ssa.OpHmul16u, + opAndType{OHMUL, TINT32}: ssa.OpHmul32, + opAndType{OHMUL, TUINT32}: ssa.OpHmul32u, + opAndType{ODIV, TINT8}: ssa.OpDiv8, opAndType{ODIV, TUINT8}: ssa.OpDiv8u, opAndType{ODIV, TINT16}: ssa.OpDiv16, @@ -1201,7 +1208,7 @@ func (s *state) expr(n *Node) *ssa.Value { a := s.expr(n.Left) b := s.expr(n.Right) return s.newValue2(s.ssaOp(n.Op, n.Left.Type), Types[TBOOL], a, b) - case OADD, OAND, OMUL, OOR, OSUB, ODIV, OXOR: + case OADD, OAND, OMUL, OOR, OSUB, ODIV, OXOR, OHMUL: a := s.expr(n.Left) b := s.expr(n.Right) return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) @@ -2099,6 +2106,27 @@ func genValue(v *ssa.Value) { j2.To.Val = Pc } + case ssa.OpAMD64HMULL, ssa.OpAMD64HMULW, ssa.OpAMD64HMULB, + ssa.OpAMD64HMULLU, ssa.OpAMD64HMULWU, ssa.OpAMD64HMULBU: + // the frontend rewrites constant division by 8/16/32 bit integers into + // HMUL by a constant + + // Arg[0] is already in AX as it's the only register we allow + // and DX is the only output we care about (the high bits) + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[1]) + + // IMULB puts the high portion in AH instead of DL, + // so move it to DL for consistency + if v.Type.Size() == 1 { + m := Prog(x86.AMOVB) + m.From.Type = obj.TYPE_REG + m.From.Reg = x86.REG_AH + m.To.Type = obj.TYPE_REG + m.To.Reg = x86.REG_DX + } + case ssa.OpAMD64SHLQ, ssa.OpAMD64SHLL, ssa.OpAMD64SHLW, ssa.OpAMD64SHLB, ssa.OpAMD64SHRQ, ssa.OpAMD64SHRL, ssa.OpAMD64SHRW, ssa.OpAMD64SHRB, ssa.OpAMD64SARQ, ssa.OpAMD64SARL, ssa.OpAMD64SARW, ssa.OpAMD64SARB: diff --git a/src/cmd/compile/internal/gc/ssa_test.go b/src/cmd/compile/internal/gc/ssa_test.go index d4dfa5d5bf..071522bc2f 100644 --- a/src/cmd/compile/internal/gc/ssa_test.go +++ b/src/cmd/compile/internal/gc/ssa_test.go @@ -51,3 +51,6 @@ func TestFP(t *testing.T) { runTest(t, "fp_ssa.go") } // TestArithmeticBoundary tests boundary results for arithmetic operations. func TestArithmeticBoundary(t *testing.T) { runTest(t, "arithBoundary_ssa.go") } + +// TestArithmeticConst tests results for arithmetic operations against constants. +func TestArithmeticConst(t *testing.T) { runTest(t, "arithConst_ssa.go") } diff --git a/src/cmd/compile/internal/gc/testdata/arithConst_ssa.go b/src/cmd/compile/internal/gc/testdata/arithConst_ssa.go new file mode 100644 index 0000000000..93420aee66 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/arithConst_ssa.go @@ -0,0 +1,3979 @@ +package main + +import "fmt" + +func add_uint64_0_ssa(a uint64) uint64 { + switch { + } + return a + 0 +} +func add_0_uint64_ssa(a uint64) uint64 { + switch { + } + return 0 + a +} + +func add_uint64_1_ssa(a uint64) uint64 { + switch { + } + return a + 1 +} +func add_1_uint64_ssa(a uint64) uint64 { + switch { + } + return 1 + a +} + +func add_uint64_4294967296_ssa(a uint64) uint64 { + switch { + } + return a + 4294967296 +} +func add_4294967296_uint64_ssa(a uint64) uint64 { + switch { + } + return 4294967296 + a +} + +func add_uint64_18446744073709551615_ssa(a uint64) uint64 { + switch { + } + return a + 18446744073709551615 +} +func add_18446744073709551615_uint64_ssa(a uint64) uint64 { + switch { + } + return 18446744073709551615 + a +} + +func sub_uint64_0_ssa(a uint64) uint64 { + switch { + } + return a - 0 +} +func sub_0_uint64_ssa(a uint64) uint64 { + switch { + } + return 0 - a +} + +func sub_uint64_1_ssa(a uint64) uint64 { + switch { + } + return a - 1 +} +func sub_1_uint64_ssa(a uint64) uint64 { + switch { + } + return 1 - a +} + +func sub_uint64_4294967296_ssa(a uint64) uint64 { + switch { + } + return a - 4294967296 +} +func sub_4294967296_uint64_ssa(a uint64) uint64 { + switch { + } + return 4294967296 - a +} + +func sub_uint64_18446744073709551615_ssa(a uint64) uint64 { + switch { + } + return a - 18446744073709551615 +} +func sub_18446744073709551615_uint64_ssa(a uint64) uint64 { + switch { + } + return 18446744073709551615 - a +} + +func div_0_uint64_ssa(a uint64) uint64 { + switch { + } + return 0 / a +} + +func div_uint64_1_ssa(a uint64) uint64 { + switch { + } + return a / 1 +} +func div_1_uint64_ssa(a uint64) uint64 { + switch { + } + return 1 / a +} + +func div_uint64_4294967296_ssa(a uint64) uint64 { + switch { + } + return a / 4294967296 +} +func div_4294967296_uint64_ssa(a uint64) uint64 { + switch { + } + return 4294967296 / a +} + +func div_uint64_18446744073709551615_ssa(a uint64) uint64 { + switch { + } + return a / 18446744073709551615 +} +func div_18446744073709551615_uint64_ssa(a uint64) uint64 { + switch { + } + return 18446744073709551615 / a +} + +func mul_uint64_0_ssa(a uint64) uint64 { + switch { + } + return a * 0 +} +func mul_0_uint64_ssa(a uint64) uint64 { + switch { + } + return 0 * a +} + +func mul_uint64_1_ssa(a uint64) uint64 { + switch { + } + return a * 1 +} +func mul_1_uint64_ssa(a uint64) uint64 { + switch { + } + return 1 * a +} + +func mul_uint64_4294967296_ssa(a uint64) uint64 { + switch { + } + return a * 4294967296 +} +func mul_4294967296_uint64_ssa(a uint64) uint64 { + switch { + } + return 4294967296 * a +} + +func mul_uint64_18446744073709551615_ssa(a uint64) uint64 { + switch { + } + return a * 18446744073709551615 +} +func mul_18446744073709551615_uint64_ssa(a uint64) uint64 { + switch { + } + return 18446744073709551615 * a +} + +func add_int64_Neg9223372036854775808_ssa(a int64) int64 { + switch { + } + return a + -9223372036854775808 +} +func add_Neg9223372036854775808_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775808 + a +} + +func add_int64_Neg9223372036854775807_ssa(a int64) int64 { + switch { + } + return a + -9223372036854775807 +} +func add_Neg9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775807 + a +} + +func add_int64_Neg4294967296_ssa(a int64) int64 { + switch { + } + return a + -4294967296 +} +func add_Neg4294967296_int64_ssa(a int64) int64 { + switch { + } + return -4294967296 + a +} + +func add_int64_Neg1_ssa(a int64) int64 { + switch { + } + return a + -1 +} +func add_Neg1_int64_ssa(a int64) int64 { + switch { + } + return -1 + a +} + +func add_int64_0_ssa(a int64) int64 { + switch { + } + return a + 0 +} +func add_0_int64_ssa(a int64) int64 { + switch { + } + return 0 + a +} + +func add_int64_1_ssa(a int64) int64 { + switch { + } + return a + 1 +} +func add_1_int64_ssa(a int64) int64 { + switch { + } + return 1 + a +} + +func add_int64_4294967296_ssa(a int64) int64 { + switch { + } + return a + 4294967296 +} +func add_4294967296_int64_ssa(a int64) int64 { + switch { + } + return 4294967296 + a +} + +func add_int64_9223372036854775806_ssa(a int64) int64 { + switch { + } + return a + 9223372036854775806 +} +func add_9223372036854775806_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775806 + a +} + +func add_int64_9223372036854775807_ssa(a int64) int64 { + switch { + } + return a + 9223372036854775807 +} +func add_9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775807 + a +} + +func sub_int64_Neg9223372036854775808_ssa(a int64) int64 { + switch { + } + return a - -9223372036854775808 +} +func sub_Neg9223372036854775808_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775808 - a +} + +func sub_int64_Neg9223372036854775807_ssa(a int64) int64 { + switch { + } + return a - -9223372036854775807 +} +func sub_Neg9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775807 - a +} + +func sub_int64_Neg4294967296_ssa(a int64) int64 { + switch { + } + return a - -4294967296 +} +func sub_Neg4294967296_int64_ssa(a int64) int64 { + switch { + } + return -4294967296 - a +} + +func sub_int64_Neg1_ssa(a int64) int64 { + switch { + } + return a - -1 +} +func sub_Neg1_int64_ssa(a int64) int64 { + switch { + } + return -1 - a +} + +func sub_int64_0_ssa(a int64) int64 { + switch { + } + return a - 0 +} +func sub_0_int64_ssa(a int64) int64 { + switch { + } + return 0 - a +} + +func sub_int64_1_ssa(a int64) int64 { + switch { + } + return a - 1 +} +func sub_1_int64_ssa(a int64) int64 { + switch { + } + return 1 - a +} + +func sub_int64_4294967296_ssa(a int64) int64 { + switch { + } + return a - 4294967296 +} +func sub_4294967296_int64_ssa(a int64) int64 { + switch { + } + return 4294967296 - a +} + +func sub_int64_9223372036854775806_ssa(a int64) int64 { + switch { + } + return a - 9223372036854775806 +} +func sub_9223372036854775806_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775806 - a +} + +func sub_int64_9223372036854775807_ssa(a int64) int64 { + switch { + } + return a - 9223372036854775807 +} +func sub_9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775807 - a +} + +func div_int64_Neg9223372036854775808_ssa(a int64) int64 { + switch { + } + return a / -9223372036854775808 +} +func div_Neg9223372036854775808_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775808 / a +} + +func div_int64_Neg9223372036854775807_ssa(a int64) int64 { + switch { + } + return a / -9223372036854775807 +} +func div_Neg9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775807 / a +} + +func div_int64_Neg4294967296_ssa(a int64) int64 { + switch { + } + return a / -4294967296 +} +func div_Neg4294967296_int64_ssa(a int64) int64 { + switch { + } + return -4294967296 / a +} + +func div_int64_Neg1_ssa(a int64) int64 { + switch { + } + return a / -1 +} +func div_Neg1_int64_ssa(a int64) int64 { + switch { + } + return -1 / a +} + +func div_0_int64_ssa(a int64) int64 { + switch { + } + return 0 / a +} + +func div_int64_1_ssa(a int64) int64 { + switch { + } + return a / 1 +} +func div_1_int64_ssa(a int64) int64 { + switch { + } + return 1 / a +} + +func div_int64_4294967296_ssa(a int64) int64 { + switch { + } + return a / 4294967296 +} +func div_4294967296_int64_ssa(a int64) int64 { + switch { + } + return 4294967296 / a +} + +func div_int64_9223372036854775806_ssa(a int64) int64 { + switch { + } + return a / 9223372036854775806 +} +func div_9223372036854775806_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775806 / a +} + +func div_int64_9223372036854775807_ssa(a int64) int64 { + switch { + } + return a / 9223372036854775807 +} +func div_9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775807 / a +} + +func mul_int64_Neg9223372036854775808_ssa(a int64) int64 { + switch { + } + return a * -9223372036854775808 +} +func mul_Neg9223372036854775808_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775808 * a +} + +func mul_int64_Neg9223372036854775807_ssa(a int64) int64 { + switch { + } + return a * -9223372036854775807 +} +func mul_Neg9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return -9223372036854775807 * a +} + +func mul_int64_Neg4294967296_ssa(a int64) int64 { + switch { + } + return a * -4294967296 +} +func mul_Neg4294967296_int64_ssa(a int64) int64 { + switch { + } + return -4294967296 * a +} + +func mul_int64_Neg1_ssa(a int64) int64 { + switch { + } + return a * -1 +} +func mul_Neg1_int64_ssa(a int64) int64 { + switch { + } + return -1 * a +} + +func mul_int64_0_ssa(a int64) int64 { + switch { + } + return a * 0 +} +func mul_0_int64_ssa(a int64) int64 { + switch { + } + return 0 * a +} + +func mul_int64_1_ssa(a int64) int64 { + switch { + } + return a * 1 +} +func mul_1_int64_ssa(a int64) int64 { + switch { + } + return 1 * a +} + +func mul_int64_4294967296_ssa(a int64) int64 { + switch { + } + return a * 4294967296 +} +func mul_4294967296_int64_ssa(a int64) int64 { + switch { + } + return 4294967296 * a +} + +func mul_int64_9223372036854775806_ssa(a int64) int64 { + switch { + } + return a * 9223372036854775806 +} +func mul_9223372036854775806_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775806 * a +} + +func mul_int64_9223372036854775807_ssa(a int64) int64 { + switch { + } + return a * 9223372036854775807 +} +func mul_9223372036854775807_int64_ssa(a int64) int64 { + switch { + } + return 9223372036854775807 * a +} + +func add_uint32_0_ssa(a uint32) uint32 { + switch { + } + return a + 0 +} +func add_0_uint32_ssa(a uint32) uint32 { + switch { + } + return 0 + a +} + +func add_uint32_1_ssa(a uint32) uint32 { + switch { + } + return a + 1 +} +func add_1_uint32_ssa(a uint32) uint32 { + switch { + } + return 1 + a +} + +func add_uint32_4294967295_ssa(a uint32) uint32 { + switch { + } + return a + 4294967295 +} +func add_4294967295_uint32_ssa(a uint32) uint32 { + switch { + } + return 4294967295 + a +} + +func sub_uint32_0_ssa(a uint32) uint32 { + switch { + } + return a - 0 +} +func sub_0_uint32_ssa(a uint32) uint32 { + switch { + } + return 0 - a +} + +func sub_uint32_1_ssa(a uint32) uint32 { + switch { + } + return a - 1 +} +func sub_1_uint32_ssa(a uint32) uint32 { + switch { + } + return 1 - a +} + +func sub_uint32_4294967295_ssa(a uint32) uint32 { + switch { + } + return a - 4294967295 +} +func sub_4294967295_uint32_ssa(a uint32) uint32 { + switch { + } + return 4294967295 - a +} + +func div_0_uint32_ssa(a uint32) uint32 { + switch { + } + return 0 / a +} + +func div_uint32_1_ssa(a uint32) uint32 { + switch { + } + return a / 1 +} +func div_1_uint32_ssa(a uint32) uint32 { + switch { + } + return 1 / a +} + +func div_uint32_4294967295_ssa(a uint32) uint32 { + switch { + } + return a / 4294967295 +} +func div_4294967295_uint32_ssa(a uint32) uint32 { + switch { + } + return 4294967295 / a +} + +func mul_uint32_0_ssa(a uint32) uint32 { + switch { + } + return a * 0 +} +func mul_0_uint32_ssa(a uint32) uint32 { + switch { + } + return 0 * a +} + +func mul_uint32_1_ssa(a uint32) uint32 { + switch { + } + return a * 1 +} +func mul_1_uint32_ssa(a uint32) uint32 { + switch { + } + return 1 * a +} + +func mul_uint32_4294967295_ssa(a uint32) uint32 { + switch { + } + return a * 4294967295 +} +func mul_4294967295_uint32_ssa(a uint32) uint32 { + switch { + } + return 4294967295 * a +} + +func add_int32_Neg2147483648_ssa(a int32) int32 { + switch { + } + return a + -2147483648 +} +func add_Neg2147483648_int32_ssa(a int32) int32 { + switch { + } + return -2147483648 + a +} + +func add_int32_Neg2147483647_ssa(a int32) int32 { + switch { + } + return a + -2147483647 +} +func add_Neg2147483647_int32_ssa(a int32) int32 { + switch { + } + return -2147483647 + a +} + +func add_int32_Neg1_ssa(a int32) int32 { + switch { + } + return a + -1 +} +func add_Neg1_int32_ssa(a int32) int32 { + switch { + } + return -1 + a +} + +func add_int32_0_ssa(a int32) int32 { + switch { + } + return a + 0 +} +func add_0_int32_ssa(a int32) int32 { + switch { + } + return 0 + a +} + +func add_int32_1_ssa(a int32) int32 { + switch { + } + return a + 1 +} +func add_1_int32_ssa(a int32) int32 { + switch { + } + return 1 + a +} + +func add_int32_2147483647_ssa(a int32) int32 { + switch { + } + return a + 2147483647 +} +func add_2147483647_int32_ssa(a int32) int32 { + switch { + } + return 2147483647 + a +} + +func sub_int32_Neg2147483648_ssa(a int32) int32 { + switch { + } + return a - -2147483648 +} +func sub_Neg2147483648_int32_ssa(a int32) int32 { + switch { + } + return -2147483648 - a +} + +func sub_int32_Neg2147483647_ssa(a int32) int32 { + switch { + } + return a - -2147483647 +} +func sub_Neg2147483647_int32_ssa(a int32) int32 { + switch { + } + return -2147483647 - a +} + +func sub_int32_Neg1_ssa(a int32) int32 { + switch { + } + return a - -1 +} +func sub_Neg1_int32_ssa(a int32) int32 { + switch { + } + return -1 - a +} + +func sub_int32_0_ssa(a int32) int32 { + switch { + } + return a - 0 +} +func sub_0_int32_ssa(a int32) int32 { + switch { + } + return 0 - a +} + +func sub_int32_1_ssa(a int32) int32 { + switch { + } + return a - 1 +} +func sub_1_int32_ssa(a int32) int32 { + switch { + } + return 1 - a +} + +func sub_int32_2147483647_ssa(a int32) int32 { + switch { + } + return a - 2147483647 +} +func sub_2147483647_int32_ssa(a int32) int32 { + switch { + } + return 2147483647 - a +} + +func div_int32_Neg2147483648_ssa(a int32) int32 { + switch { + } + return a / -2147483648 +} +func div_Neg2147483648_int32_ssa(a int32) int32 { + switch { + } + return -2147483648 / a +} + +func div_int32_Neg2147483647_ssa(a int32) int32 { + switch { + } + return a / -2147483647 +} +func div_Neg2147483647_int32_ssa(a int32) int32 { + switch { + } + return -2147483647 / a +} + +func div_int32_Neg1_ssa(a int32) int32 { + switch { + } + return a / -1 +} +func div_Neg1_int32_ssa(a int32) int32 { + switch { + } + return -1 / a +} + +func div_0_int32_ssa(a int32) int32 { + switch { + } + return 0 / a +} + +func div_int32_1_ssa(a int32) int32 { + switch { + } + return a / 1 +} +func div_1_int32_ssa(a int32) int32 { + switch { + } + return 1 / a +} + +func div_int32_2147483647_ssa(a int32) int32 { + switch { + } + return a / 2147483647 +} +func div_2147483647_int32_ssa(a int32) int32 { + switch { + } + return 2147483647 / a +} + +func mul_int32_Neg2147483648_ssa(a int32) int32 { + switch { + } + return a * -2147483648 +} +func mul_Neg2147483648_int32_ssa(a int32) int32 { + switch { + } + return -2147483648 * a +} + +func mul_int32_Neg2147483647_ssa(a int32) int32 { + switch { + } + return a * -2147483647 +} +func mul_Neg2147483647_int32_ssa(a int32) int32 { + switch { + } + return -2147483647 * a +} + +func mul_int32_Neg1_ssa(a int32) int32 { + switch { + } + return a * -1 +} +func mul_Neg1_int32_ssa(a int32) int32 { + switch { + } + return -1 * a +} + +func mul_int32_0_ssa(a int32) int32 { + switch { + } + return a * 0 +} +func mul_0_int32_ssa(a int32) int32 { + switch { + } + return 0 * a +} + +func mul_int32_1_ssa(a int32) int32 { + switch { + } + return a * 1 +} +func mul_1_int32_ssa(a int32) int32 { + switch { + } + return 1 * a +} + +func mul_int32_2147483647_ssa(a int32) int32 { + switch { + } + return a * 2147483647 +} +func mul_2147483647_int32_ssa(a int32) int32 { + switch { + } + return 2147483647 * a +} + +func add_uint16_0_ssa(a uint16) uint16 { + switch { + } + return a + 0 +} +func add_0_uint16_ssa(a uint16) uint16 { + switch { + } + return 0 + a +} + +func add_uint16_1_ssa(a uint16) uint16 { + switch { + } + return a + 1 +} +func add_1_uint16_ssa(a uint16) uint16 { + switch { + } + return 1 + a +} + +func add_uint16_65535_ssa(a uint16) uint16 { + switch { + } + return a + 65535 +} +func add_65535_uint16_ssa(a uint16) uint16 { + switch { + } + return 65535 + a +} + +func sub_uint16_0_ssa(a uint16) uint16 { + switch { + } + return a - 0 +} +func sub_0_uint16_ssa(a uint16) uint16 { + switch { + } + return 0 - a +} + +func sub_uint16_1_ssa(a uint16) uint16 { + switch { + } + return a - 1 +} +func sub_1_uint16_ssa(a uint16) uint16 { + switch { + } + return 1 - a +} + +func sub_uint16_65535_ssa(a uint16) uint16 { + switch { + } + return a - 65535 +} +func sub_65535_uint16_ssa(a uint16) uint16 { + switch { + } + return 65535 - a +} + +func div_0_uint16_ssa(a uint16) uint16 { + switch { + } + return 0 / a +} + +func div_uint16_1_ssa(a uint16) uint16 { + switch { + } + return a / 1 +} +func div_1_uint16_ssa(a uint16) uint16 { + switch { + } + return 1 / a +} + +func div_uint16_65535_ssa(a uint16) uint16 { + switch { + } + return a / 65535 +} +func div_65535_uint16_ssa(a uint16) uint16 { + switch { + } + return 65535 / a +} + +func mul_uint16_0_ssa(a uint16) uint16 { + switch { + } + return a * 0 +} +func mul_0_uint16_ssa(a uint16) uint16 { + switch { + } + return 0 * a +} + +func mul_uint16_1_ssa(a uint16) uint16 { + switch { + } + return a * 1 +} +func mul_1_uint16_ssa(a uint16) uint16 { + switch { + } + return 1 * a +} + +func mul_uint16_65535_ssa(a uint16) uint16 { + switch { + } + return a * 65535 +} +func mul_65535_uint16_ssa(a uint16) uint16 { + switch { + } + return 65535 * a +} + +func add_int16_Neg32768_ssa(a int16) int16 { + switch { + } + return a + -32768 +} +func add_Neg32768_int16_ssa(a int16) int16 { + switch { + } + return -32768 + a +} + +func add_int16_Neg32767_ssa(a int16) int16 { + switch { + } + return a + -32767 +} +func add_Neg32767_int16_ssa(a int16) int16 { + switch { + } + return -32767 + a +} + +func add_int16_Neg1_ssa(a int16) int16 { + switch { + } + return a + -1 +} +func add_Neg1_int16_ssa(a int16) int16 { + switch { + } + return -1 + a +} + +func add_int16_0_ssa(a int16) int16 { + switch { + } + return a + 0 +} +func add_0_int16_ssa(a int16) int16 { + switch { + } + return 0 + a +} + +func add_int16_1_ssa(a int16) int16 { + switch { + } + return a + 1 +} +func add_1_int16_ssa(a int16) int16 { + switch { + } + return 1 + a +} + +func add_int16_32766_ssa(a int16) int16 { + switch { + } + return a + 32766 +} +func add_32766_int16_ssa(a int16) int16 { + switch { + } + return 32766 + a +} + +func add_int16_32767_ssa(a int16) int16 { + switch { + } + return a + 32767 +} +func add_32767_int16_ssa(a int16) int16 { + switch { + } + return 32767 + a +} + +func sub_int16_Neg32768_ssa(a int16) int16 { + switch { + } + return a - -32768 +} +func sub_Neg32768_int16_ssa(a int16) int16 { + switch { + } + return -32768 - a +} + +func sub_int16_Neg32767_ssa(a int16) int16 { + switch { + } + return a - -32767 +} +func sub_Neg32767_int16_ssa(a int16) int16 { + switch { + } + return -32767 - a +} + +func sub_int16_Neg1_ssa(a int16) int16 { + switch { + } + return a - -1 +} +func sub_Neg1_int16_ssa(a int16) int16 { + switch { + } + return -1 - a +} + +func sub_int16_0_ssa(a int16) int16 { + switch { + } + return a - 0 +} +func sub_0_int16_ssa(a int16) int16 { + switch { + } + return 0 - a +} + +func sub_int16_1_ssa(a int16) int16 { + switch { + } + return a - 1 +} +func sub_1_int16_ssa(a int16) int16 { + switch { + } + return 1 - a +} + +func sub_int16_32766_ssa(a int16) int16 { + switch { + } + return a - 32766 +} +func sub_32766_int16_ssa(a int16) int16 { + switch { + } + return 32766 - a +} + +func sub_int16_32767_ssa(a int16) int16 { + switch { + } + return a - 32767 +} +func sub_32767_int16_ssa(a int16) int16 { + switch { + } + return 32767 - a +} + +func div_int16_Neg32768_ssa(a int16) int16 { + switch { + } + return a / -32768 +} +func div_Neg32768_int16_ssa(a int16) int16 { + switch { + } + return -32768 / a +} + +func div_int16_Neg32767_ssa(a int16) int16 { + switch { + } + return a / -32767 +} +func div_Neg32767_int16_ssa(a int16) int16 { + switch { + } + return -32767 / a +} + +func div_int16_Neg1_ssa(a int16) int16 { + switch { + } + return a / -1 +} +func div_Neg1_int16_ssa(a int16) int16 { + switch { + } + return -1 / a +} + +func div_0_int16_ssa(a int16) int16 { + switch { + } + return 0 / a +} + +func div_int16_1_ssa(a int16) int16 { + switch { + } + return a / 1 +} +func div_1_int16_ssa(a int16) int16 { + switch { + } + return 1 / a +} + +func div_int16_32766_ssa(a int16) int16 { + switch { + } + return a / 32766 +} +func div_32766_int16_ssa(a int16) int16 { + switch { + } + return 32766 / a +} + +func div_int16_32767_ssa(a int16) int16 { + switch { + } + return a / 32767 +} +func div_32767_int16_ssa(a int16) int16 { + switch { + } + return 32767 / a +} + +func mul_int16_Neg32768_ssa(a int16) int16 { + switch { + } + return a * -32768 +} +func mul_Neg32768_int16_ssa(a int16) int16 { + switch { + } + return -32768 * a +} + +func mul_int16_Neg32767_ssa(a int16) int16 { + switch { + } + return a * -32767 +} +func mul_Neg32767_int16_ssa(a int16) int16 { + switch { + } + return -32767 * a +} + +func mul_int16_Neg1_ssa(a int16) int16 { + switch { + } + return a * -1 +} +func mul_Neg1_int16_ssa(a int16) int16 { + switch { + } + return -1 * a +} + +func mul_int16_0_ssa(a int16) int16 { + switch { + } + return a * 0 +} +func mul_0_int16_ssa(a int16) int16 { + switch { + } + return 0 * a +} + +func mul_int16_1_ssa(a int16) int16 { + switch { + } + return a * 1 +} +func mul_1_int16_ssa(a int16) int16 { + switch { + } + return 1 * a +} + +func mul_int16_32766_ssa(a int16) int16 { + switch { + } + return a * 32766 +} +func mul_32766_int16_ssa(a int16) int16 { + switch { + } + return 32766 * a +} + +func mul_int16_32767_ssa(a int16) int16 { + switch { + } + return a * 32767 +} +func mul_32767_int16_ssa(a int16) int16 { + switch { + } + return 32767 * a +} + +func add_uint8_0_ssa(a uint8) uint8 { + switch { + } + return a + 0 +} +func add_0_uint8_ssa(a uint8) uint8 { + switch { + } + return 0 + a +} + +func add_uint8_1_ssa(a uint8) uint8 { + switch { + } + return a + 1 +} +func add_1_uint8_ssa(a uint8) uint8 { + switch { + } + return 1 + a +} + +func add_uint8_255_ssa(a uint8) uint8 { + switch { + } + return a + 255 +} +func add_255_uint8_ssa(a uint8) uint8 { + switch { + } + return 255 + a +} + +func sub_uint8_0_ssa(a uint8) uint8 { + switch { + } + return a - 0 +} +func sub_0_uint8_ssa(a uint8) uint8 { + switch { + } + return 0 - a +} + +func sub_uint8_1_ssa(a uint8) uint8 { + switch { + } + return a - 1 +} +func sub_1_uint8_ssa(a uint8) uint8 { + switch { + } + return 1 - a +} + +func sub_uint8_255_ssa(a uint8) uint8 { + switch { + } + return a - 255 +} +func sub_255_uint8_ssa(a uint8) uint8 { + switch { + } + return 255 - a +} + +func div_0_uint8_ssa(a uint8) uint8 { + switch { + } + return 0 / a +} + +func div_uint8_1_ssa(a uint8) uint8 { + switch { + } + return a / 1 +} +func div_1_uint8_ssa(a uint8) uint8 { + switch { + } + return 1 / a +} + +func div_uint8_255_ssa(a uint8) uint8 { + switch { + } + return a / 255 +} +func div_255_uint8_ssa(a uint8) uint8 { + switch { + } + return 255 / a +} + +func mul_uint8_0_ssa(a uint8) uint8 { + switch { + } + return a * 0 +} +func mul_0_uint8_ssa(a uint8) uint8 { + switch { + } + return 0 * a +} + +func mul_uint8_1_ssa(a uint8) uint8 { + switch { + } + return a * 1 +} +func mul_1_uint8_ssa(a uint8) uint8 { + switch { + } + return 1 * a +} + +func mul_uint8_255_ssa(a uint8) uint8 { + switch { + } + return a * 255 +} +func mul_255_uint8_ssa(a uint8) uint8 { + switch { + } + return 255 * a +} + +func add_int8_Neg128_ssa(a int8) int8 { + switch { + } + return a + -128 +} +func add_Neg128_int8_ssa(a int8) int8 { + switch { + } + return -128 + a +} + +func add_int8_Neg127_ssa(a int8) int8 { + switch { + } + return a + -127 +} +func add_Neg127_int8_ssa(a int8) int8 { + switch { + } + return -127 + a +} + +func add_int8_Neg1_ssa(a int8) int8 { + switch { + } + return a + -1 +} +func add_Neg1_int8_ssa(a int8) int8 { + switch { + } + return -1 + a +} + +func add_int8_0_ssa(a int8) int8 { + switch { + } + return a + 0 +} +func add_0_int8_ssa(a int8) int8 { + switch { + } + return 0 + a +} + +func add_int8_1_ssa(a int8) int8 { + switch { + } + return a + 1 +} +func add_1_int8_ssa(a int8) int8 { + switch { + } + return 1 + a +} + +func add_int8_126_ssa(a int8) int8 { + switch { + } + return a + 126 +} +func add_126_int8_ssa(a int8) int8 { + switch { + } + return 126 + a +} + +func add_int8_127_ssa(a int8) int8 { + switch { + } + return a + 127 +} +func add_127_int8_ssa(a int8) int8 { + switch { + } + return 127 + a +} + +func sub_int8_Neg128_ssa(a int8) int8 { + switch { + } + return a - -128 +} +func sub_Neg128_int8_ssa(a int8) int8 { + switch { + } + return -128 - a +} + +func sub_int8_Neg127_ssa(a int8) int8 { + switch { + } + return a - -127 +} +func sub_Neg127_int8_ssa(a int8) int8 { + switch { + } + return -127 - a +} + +func sub_int8_Neg1_ssa(a int8) int8 { + switch { + } + return a - -1 +} +func sub_Neg1_int8_ssa(a int8) int8 { + switch { + } + return -1 - a +} + +func sub_int8_0_ssa(a int8) int8 { + switch { + } + return a - 0 +} +func sub_0_int8_ssa(a int8) int8 { + switch { + } + return 0 - a +} + +func sub_int8_1_ssa(a int8) int8 { + switch { + } + return a - 1 +} +func sub_1_int8_ssa(a int8) int8 { + switch { + } + return 1 - a +} + +func sub_int8_126_ssa(a int8) int8 { + switch { + } + return a - 126 +} +func sub_126_int8_ssa(a int8) int8 { + switch { + } + return 126 - a +} + +func sub_int8_127_ssa(a int8) int8 { + switch { + } + return a - 127 +} +func sub_127_int8_ssa(a int8) int8 { + switch { + } + return 127 - a +} + +func div_int8_Neg128_ssa(a int8) int8 { + switch { + } + return a / -128 +} +func div_Neg128_int8_ssa(a int8) int8 { + switch { + } + return -128 / a +} + +func div_int8_Neg127_ssa(a int8) int8 { + switch { + } + return a / -127 +} +func div_Neg127_int8_ssa(a int8) int8 { + switch { + } + return -127 / a +} + +func div_int8_Neg1_ssa(a int8) int8 { + switch { + } + return a / -1 +} +func div_Neg1_int8_ssa(a int8) int8 { + switch { + } + return -1 / a +} + +func div_0_int8_ssa(a int8) int8 { + switch { + } + return 0 / a +} + +func div_int8_1_ssa(a int8) int8 { + switch { + } + return a / 1 +} +func div_1_int8_ssa(a int8) int8 { + switch { + } + return 1 / a +} + +func div_int8_126_ssa(a int8) int8 { + switch { + } + return a / 126 +} +func div_126_int8_ssa(a int8) int8 { + switch { + } + return 126 / a +} + +func div_int8_127_ssa(a int8) int8 { + switch { + } + return a / 127 +} +func div_127_int8_ssa(a int8) int8 { + switch { + } + return 127 / a +} + +func mul_int8_Neg128_ssa(a int8) int8 { + switch { + } + return a * -128 +} +func mul_Neg128_int8_ssa(a int8) int8 { + switch { + } + return -128 * a +} + +func mul_int8_Neg127_ssa(a int8) int8 { + switch { + } + return a * -127 +} +func mul_Neg127_int8_ssa(a int8) int8 { + switch { + } + return -127 * a +} + +func mul_int8_Neg1_ssa(a int8) int8 { + switch { + } + return a * -1 +} +func mul_Neg1_int8_ssa(a int8) int8 { + switch { + } + return -1 * a +} + +func mul_int8_0_ssa(a int8) int8 { + switch { + } + return a * 0 +} +func mul_0_int8_ssa(a int8) int8 { + switch { + } + return 0 * a +} + +func mul_int8_1_ssa(a int8) int8 { + switch { + } + return a * 1 +} +func mul_1_int8_ssa(a int8) int8 { + switch { + } + return 1 * a +} + +func mul_int8_126_ssa(a int8) int8 { + switch { + } + return a * 126 +} +func mul_126_int8_ssa(a int8) int8 { + switch { + } + return 126 * a +} + +func mul_int8_127_ssa(a int8) int8 { + switch { + } + return a * 127 +} +func mul_127_int8_ssa(a int8) int8 { + switch { + } + return 127 * a +} + +var failed bool + +func main() { + + if got := div_0_uint64_ssa(1); got != 0 { + fmt.Printf("div_uint64 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_uint64_ssa(4294967296); got != 0 { + fmt.Printf("div_uint64 0/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("div_uint64 0/18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint64_1_ssa(0); got != 0 { + fmt.Printf("div_uint64 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_uint64_ssa(1); got != 1 { + fmt.Printf("div_uint64 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint64_1_ssa(1); got != 1 { + fmt.Printf("div_uint64 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_uint64_ssa(4294967296); got != 0 { + fmt.Printf("div_uint64 1/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint64_1_ssa(4294967296); got != 4294967296 { + fmt.Printf("div_uint64 4294967296/1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := div_1_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("div_uint64 1/18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint64_1_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("div_uint64 18446744073709551615/1 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := div_uint64_4294967296_ssa(0); got != 0 { + fmt.Printf("div_uint64 0/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_4294967296_uint64_ssa(1); got != 4294967296 { + fmt.Printf("div_uint64 4294967296/1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := div_uint64_4294967296_ssa(1); got != 0 { + fmt.Printf("div_uint64 1/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_4294967296_uint64_ssa(4294967296); got != 1 { + fmt.Printf("div_uint64 4294967296/4294967296 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint64_4294967296_ssa(4294967296); got != 1 { + fmt.Printf("div_uint64 4294967296/4294967296 = %d, wanted 1\n", got) + failed = true + } + + if got := div_4294967296_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("div_uint64 4294967296/18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint64_4294967296_ssa(18446744073709551615); got != 4294967295 { + fmt.Printf("div_uint64 18446744073709551615/4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := div_uint64_18446744073709551615_ssa(0); got != 0 { + fmt.Printf("div_uint64 0/18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := div_18446744073709551615_uint64_ssa(1); got != 18446744073709551615 { + fmt.Printf("div_uint64 18446744073709551615/1 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := div_uint64_18446744073709551615_ssa(1); got != 0 { + fmt.Printf("div_uint64 1/18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := div_18446744073709551615_uint64_ssa(4294967296); got != 4294967295 { + fmt.Printf("div_uint64 18446744073709551615/4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := div_uint64_18446744073709551615_ssa(4294967296); got != 0 { + fmt.Printf("div_uint64 4294967296/18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := div_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 { + fmt.Printf("div_uint64 18446744073709551615/18446744073709551615 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint64_18446744073709551615_ssa(18446744073709551615); got != 1 { + fmt.Printf("div_uint64 18446744073709551615/18446744073709551615 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 1 { + fmt.Printf("div_int64 -9223372036854775808/-9223372036854775808 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 1 { + fmt.Printf("div_int64 -9223372036854775808/-9223372036854775808 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != 1 { + fmt.Printf("div_int64 -9223372036854775808/-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 -9223372036854775807/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(-4294967296); got != 2147483648 { + fmt.Printf("div_int64 -9223372036854775808/-4294967296 = %d, wanted 2147483648\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 -4294967296/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(-1); got != -9223372036854775808 { + fmt.Printf("div_int64 -9223372036854775808/-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(-1); got != 0 { + fmt.Printf("div_int64 -1/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(0); got != 0 { + fmt.Printf("div_int64 0/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(1); got != -9223372036854775808 { + fmt.Printf("div_int64 -9223372036854775808/1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(1); got != 0 { + fmt.Printf("div_int64 1/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(4294967296); got != -2147483648 { + fmt.Printf("div_int64 -9223372036854775808/4294967296 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 4294967296/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(9223372036854775806); got != -1 { + fmt.Printf("div_int64 -9223372036854775808/9223372036854775806 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 9223372036854775806/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -1 { + fmt.Printf("div_int64 -9223372036854775808/9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775808_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 9223372036854775807/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 -9223372036854775807/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != 1 { + fmt.Printf("div_int64 -9223372036854775808/-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 1 { + fmt.Printf("div_int64 -9223372036854775807/-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 1 { + fmt.Printf("div_int64 -9223372036854775807/-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(-4294967296); got != 2147483647 { + fmt.Printf("div_int64 -9223372036854775807/-4294967296 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 -4294967296/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(-1); got != 9223372036854775807 { + fmt.Printf("div_int64 -9223372036854775807/-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(-1); got != 0 { + fmt.Printf("div_int64 -1/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(0); got != 0 { + fmt.Printf("div_int64 0/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775807 { + fmt.Printf("div_int64 -9223372036854775807/1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(1); got != 0 { + fmt.Printf("div_int64 1/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(4294967296); got != -2147483647 { + fmt.Printf("div_int64 -9223372036854775807/4294967296 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 4294967296/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(9223372036854775806); got != -1 { + fmt.Printf("div_int64 -9223372036854775807/9223372036854775806 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 9223372036854775806/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg9223372036854775807_int64_ssa(9223372036854775807); got != -1 { + fmt.Printf("div_int64 -9223372036854775807/9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_Neg9223372036854775807_ssa(9223372036854775807); got != -1 { + fmt.Printf("div_int64 9223372036854775807/-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 -4294967296/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(-9223372036854775808); got != 2147483648 { + fmt.Printf("div_int64 -9223372036854775808/-4294967296 = %d, wanted 2147483648\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 -4294967296/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(-9223372036854775807); got != 2147483647 { + fmt.Printf("div_int64 -9223372036854775807/-4294967296 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(-4294967296); got != 1 { + fmt.Printf("div_int64 -4294967296/-4294967296 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(-4294967296); got != 1 { + fmt.Printf("div_int64 -4294967296/-4294967296 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(-1); got != 4294967296 { + fmt.Printf("div_int64 -4294967296/-1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(-1); got != 0 { + fmt.Printf("div_int64 -1/-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(0); got != 0 { + fmt.Printf("div_int64 0/-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(1); got != -4294967296 { + fmt.Printf("div_int64 -4294967296/1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(1); got != 0 { + fmt.Printf("div_int64 1/-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(4294967296); got != -1 { + fmt.Printf("div_int64 -4294967296/4294967296 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(4294967296); got != -1 { + fmt.Printf("div_int64 4294967296/-4294967296 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 -4294967296/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(9223372036854775806); got != -2147483647 { + fmt.Printf("div_int64 9223372036854775806/-4294967296 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_Neg4294967296_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 -4294967296/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg4294967296_ssa(9223372036854775807); got != -2147483647 { + fmt.Printf("div_int64 9223372036854775807/-4294967296 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 -1/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("div_int64 -9223372036854775808/-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 -1/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(-9223372036854775807); got != 9223372036854775807 { + fmt.Printf("div_int64 -9223372036854775807/-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 -1/-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(-4294967296); got != 4294967296 { + fmt.Printf("div_int64 -4294967296/-1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(-1); got != 1 { + fmt.Printf("div_int64 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(-1); got != 1 { + fmt.Printf("div_int64 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(0); got != 0 { + fmt.Printf("div_int64 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(1); got != -1 { + fmt.Printf("div_int64 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(1); got != -1 { + fmt.Printf("div_int64 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 -1/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(4294967296); got != -4294967296 { + fmt.Printf("div_int64 4294967296/-1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 -1/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(9223372036854775806); got != -9223372036854775806 { + fmt.Printf("div_int64 9223372036854775806/-1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := div_Neg1_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 -1/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_Neg1_ssa(9223372036854775807); got != -9223372036854775807 { + fmt.Printf("div_int64 9223372036854775807/-1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := div_0_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 0/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 0/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 0/-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(-1); got != 0 { + fmt.Printf("div_int64 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(1); got != 0 { + fmt.Printf("div_int64 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 0/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 0/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 0/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 1/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_1_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("div_int64 -9223372036854775808/1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := div_1_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 1/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_1_ssa(-9223372036854775807); got != -9223372036854775807 { + fmt.Printf("div_int64 -9223372036854775807/1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := div_1_int64_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 1/-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_1_ssa(-4294967296); got != -4294967296 { + fmt.Printf("div_int64 -4294967296/1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := div_1_int64_ssa(-1); got != -1 { + fmt.Printf("div_int64 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_1_ssa(-1); got != -1 { + fmt.Printf("div_int64 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_1_ssa(0); got != 0 { + fmt.Printf("div_int64 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int64_ssa(1); got != 1 { + fmt.Printf("div_int64 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_1_ssa(1); got != 1 { + fmt.Printf("div_int64 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_int64_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 1/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_1_ssa(4294967296); got != 4294967296 { + fmt.Printf("div_int64 4294967296/1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := div_1_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 1/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_1_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("div_int64 9223372036854775806/1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := div_1_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 1/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_1_ssa(9223372036854775807); got != 9223372036854775807 { + fmt.Printf("div_int64 9223372036854775807/1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 4294967296/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(-9223372036854775808); got != -2147483648 { + fmt.Printf("div_int64 -9223372036854775808/4294967296 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 4294967296/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(-9223372036854775807); got != -2147483647 { + fmt.Printf("div_int64 -9223372036854775807/4294967296 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(-4294967296); got != -1 { + fmt.Printf("div_int64 4294967296/-4294967296 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(-4294967296); got != -1 { + fmt.Printf("div_int64 -4294967296/4294967296 = %d, wanted -1\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(-1); got != -4294967296 { + fmt.Printf("div_int64 4294967296/-1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(-1); got != 0 { + fmt.Printf("div_int64 -1/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(0); got != 0 { + fmt.Printf("div_int64 0/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(1); got != 4294967296 { + fmt.Printf("div_int64 4294967296/1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(1); got != 0 { + fmt.Printf("div_int64 1/4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(4294967296); got != 1 { + fmt.Printf("div_int64 4294967296/4294967296 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(4294967296); got != 1 { + fmt.Printf("div_int64 4294967296/4294967296 = %d, wanted 1\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 4294967296/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(9223372036854775806); got != 2147483647 { + fmt.Printf("div_int64 9223372036854775806/4294967296 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_4294967296_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 4294967296/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_4294967296_ssa(9223372036854775807); got != 2147483647 { + fmt.Printf("div_int64 9223372036854775807/4294967296 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 9223372036854775806/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(-9223372036854775808); got != -1 { + fmt.Printf("div_int64 -9223372036854775808/9223372036854775806 = %d, wanted -1\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("div_int64 9223372036854775806/-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(-9223372036854775807); got != -1 { + fmt.Printf("div_int64 -9223372036854775807/9223372036854775806 = %d, wanted -1\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(-4294967296); got != -2147483647 { + fmt.Printf("div_int64 9223372036854775806/-4294967296 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 -4294967296/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(-1); got != -9223372036854775806 { + fmt.Printf("div_int64 9223372036854775806/-1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(-1); got != 0 { + fmt.Printf("div_int64 -1/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(0); got != 0 { + fmt.Printf("div_int64 0/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(1); got != 9223372036854775806 { + fmt.Printf("div_int64 9223372036854775806/1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(1); got != 0 { + fmt.Printf("div_int64 1/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(4294967296); got != 2147483647 { + fmt.Printf("div_int64 9223372036854775806/4294967296 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 4294967296/9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(9223372036854775806); got != 1 { + fmt.Printf("div_int64 9223372036854775806/9223372036854775806 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(9223372036854775806); got != 1 { + fmt.Printf("div_int64 9223372036854775806/9223372036854775806 = %d, wanted 1\n", got) + failed = true + } + + if got := div_9223372036854775806_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("div_int64 9223372036854775806/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_9223372036854775806_ssa(9223372036854775807); got != 1 { + fmt.Printf("div_int64 9223372036854775807/9223372036854775806 = %d, wanted 1\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("div_int64 9223372036854775807/-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(-9223372036854775808); got != -1 { + fmt.Printf("div_int64 -9223372036854775808/9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(-9223372036854775807); got != -1 { + fmt.Printf("div_int64 9223372036854775807/-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(-9223372036854775807); got != -1 { + fmt.Printf("div_int64 -9223372036854775807/9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(-4294967296); got != -2147483647 { + fmt.Printf("div_int64 9223372036854775807/-4294967296 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(-4294967296); got != 0 { + fmt.Printf("div_int64 -4294967296/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(-1); got != -9223372036854775807 { + fmt.Printf("div_int64 9223372036854775807/-1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(-1); got != 0 { + fmt.Printf("div_int64 -1/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(0); got != 0 { + fmt.Printf("div_int64 0/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(1); got != 9223372036854775807 { + fmt.Printf("div_int64 9223372036854775807/1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(1); got != 0 { + fmt.Printf("div_int64 1/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(4294967296); got != 2147483647 { + fmt.Printf("div_int64 9223372036854775807/4294967296 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(4294967296); got != 0 { + fmt.Printf("div_int64 4294967296/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(9223372036854775806); got != 1 { + fmt.Printf("div_int64 9223372036854775807/9223372036854775806 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(9223372036854775806); got != 0 { + fmt.Printf("div_int64 9223372036854775806/9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := div_9223372036854775807_int64_ssa(9223372036854775807); got != 1 { + fmt.Printf("div_int64 9223372036854775807/9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int64_9223372036854775807_ssa(9223372036854775807); got != 1 { + fmt.Printf("div_int64 9223372036854775807/9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := div_0_uint32_ssa(1); got != 0 { + fmt.Printf("div_uint32 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_uint32_ssa(4294967295); got != 0 { + fmt.Printf("div_uint32 0/4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint32_1_ssa(0); got != 0 { + fmt.Printf("div_uint32 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_uint32_ssa(1); got != 1 { + fmt.Printf("div_uint32 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint32_1_ssa(1); got != 1 { + fmt.Printf("div_uint32 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_uint32_ssa(4294967295); got != 0 { + fmt.Printf("div_uint32 1/4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint32_1_ssa(4294967295); got != 4294967295 { + fmt.Printf("div_uint32 4294967295/1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := div_uint32_4294967295_ssa(0); got != 0 { + fmt.Printf("div_uint32 0/4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := div_4294967295_uint32_ssa(1); got != 4294967295 { + fmt.Printf("div_uint32 4294967295/1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := div_uint32_4294967295_ssa(1); got != 0 { + fmt.Printf("div_uint32 1/4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := div_4294967295_uint32_ssa(4294967295); got != 1 { + fmt.Printf("div_uint32 4294967295/4294967295 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint32_4294967295_ssa(4294967295); got != 1 { + fmt.Printf("div_uint32 4294967295/4294967295 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg2147483648_int32_ssa(-2147483648); got != 1 { + fmt.Printf("div_int32 -2147483648/-2147483648 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_Neg2147483648_ssa(-2147483648); got != 1 { + fmt.Printf("div_int32 -2147483648/-2147483648 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg2147483648_int32_ssa(-2147483647); got != 1 { + fmt.Printf("div_int32 -2147483648/-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_Neg2147483648_ssa(-2147483647); got != 0 { + fmt.Printf("div_int32 -2147483647/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg2147483648_int32_ssa(-1); got != -2147483648 { + fmt.Printf("div_int32 -2147483648/-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := div_int32_Neg2147483648_ssa(-1); got != 0 { + fmt.Printf("div_int32 -1/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_Neg2147483648_ssa(0); got != 0 { + fmt.Printf("div_int32 0/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg2147483648_int32_ssa(1); got != -2147483648 { + fmt.Printf("div_int32 -2147483648/1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := div_int32_Neg2147483648_ssa(1); got != 0 { + fmt.Printf("div_int32 1/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg2147483648_int32_ssa(2147483647); got != -1 { + fmt.Printf("div_int32 -2147483648/2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int32_Neg2147483648_ssa(2147483647); got != 0 { + fmt.Printf("div_int32 2147483647/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg2147483647_int32_ssa(-2147483648); got != 0 { + fmt.Printf("div_int32 -2147483647/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_Neg2147483647_ssa(-2147483648); got != 1 { + fmt.Printf("div_int32 -2147483648/-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg2147483647_int32_ssa(-2147483647); got != 1 { + fmt.Printf("div_int32 -2147483647/-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_Neg2147483647_ssa(-2147483647); got != 1 { + fmt.Printf("div_int32 -2147483647/-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg2147483647_int32_ssa(-1); got != 2147483647 { + fmt.Printf("div_int32 -2147483647/-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_int32_Neg2147483647_ssa(-1); got != 0 { + fmt.Printf("div_int32 -1/-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_Neg2147483647_ssa(0); got != 0 { + fmt.Printf("div_int32 0/-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg2147483647_int32_ssa(1); got != -2147483647 { + fmt.Printf("div_int32 -2147483647/1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_int32_Neg2147483647_ssa(1); got != 0 { + fmt.Printf("div_int32 1/-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg2147483647_int32_ssa(2147483647); got != -1 { + fmt.Printf("div_int32 -2147483647/2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int32_Neg2147483647_ssa(2147483647); got != -1 { + fmt.Printf("div_int32 2147483647/-2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int32_ssa(-2147483648); got != 0 { + fmt.Printf("div_int32 -1/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_Neg1_ssa(-2147483648); got != -2147483648 { + fmt.Printf("div_int32 -2147483648/-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := div_Neg1_int32_ssa(-2147483647); got != 0 { + fmt.Printf("div_int32 -1/-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_Neg1_ssa(-2147483647); got != 2147483647 { + fmt.Printf("div_int32 -2147483647/-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_Neg1_int32_ssa(-1); got != 1 { + fmt.Printf("div_int32 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_Neg1_ssa(-1); got != 1 { + fmt.Printf("div_int32 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_Neg1_ssa(0); got != 0 { + fmt.Printf("div_int32 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg1_int32_ssa(1); got != -1 { + fmt.Printf("div_int32 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int32_Neg1_ssa(1); got != -1 { + fmt.Printf("div_int32 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int32_ssa(2147483647); got != 0 { + fmt.Printf("div_int32 -1/2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_Neg1_ssa(2147483647); got != -2147483647 { + fmt.Printf("div_int32 2147483647/-1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_0_int32_ssa(-2147483648); got != 0 { + fmt.Printf("div_int32 0/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int32_ssa(-2147483647); got != 0 { + fmt.Printf("div_int32 0/-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int32_ssa(-1); got != 0 { + fmt.Printf("div_int32 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int32_ssa(1); got != 0 { + fmt.Printf("div_int32 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int32_ssa(2147483647); got != 0 { + fmt.Printf("div_int32 0/2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int32_ssa(-2147483648); got != 0 { + fmt.Printf("div_int32 1/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_1_ssa(-2147483648); got != -2147483648 { + fmt.Printf("div_int32 -2147483648/1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := div_1_int32_ssa(-2147483647); got != 0 { + fmt.Printf("div_int32 1/-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_1_ssa(-2147483647); got != -2147483647 { + fmt.Printf("div_int32 -2147483647/1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_1_int32_ssa(-1); got != -1 { + fmt.Printf("div_int32 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int32_1_ssa(-1); got != -1 { + fmt.Printf("div_int32 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int32_1_ssa(0); got != 0 { + fmt.Printf("div_int32 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int32_ssa(1); got != 1 { + fmt.Printf("div_int32 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_1_ssa(1); got != 1 { + fmt.Printf("div_int32 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_int32_ssa(2147483647); got != 0 { + fmt.Printf("div_int32 1/2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_1_ssa(2147483647); got != 2147483647 { + fmt.Printf("div_int32 2147483647/1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_2147483647_int32_ssa(-2147483648); got != 0 { + fmt.Printf("div_int32 2147483647/-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_2147483647_ssa(-2147483648); got != -1 { + fmt.Printf("div_int32 -2147483648/2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := div_2147483647_int32_ssa(-2147483647); got != -1 { + fmt.Printf("div_int32 2147483647/-2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int32_2147483647_ssa(-2147483647); got != -1 { + fmt.Printf("div_int32 -2147483647/2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := div_2147483647_int32_ssa(-1); got != -2147483647 { + fmt.Printf("div_int32 2147483647/-1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := div_int32_2147483647_ssa(-1); got != 0 { + fmt.Printf("div_int32 -1/2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int32_2147483647_ssa(0); got != 0 { + fmt.Printf("div_int32 0/2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_2147483647_int32_ssa(1); got != 2147483647 { + fmt.Printf("div_int32 2147483647/1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := div_int32_2147483647_ssa(1); got != 0 { + fmt.Printf("div_int32 1/2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := div_2147483647_int32_ssa(2147483647); got != 1 { + fmt.Printf("div_int32 2147483647/2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int32_2147483647_ssa(2147483647); got != 1 { + fmt.Printf("div_int32 2147483647/2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := div_0_uint16_ssa(1); got != 0 { + fmt.Printf("div_uint16 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_uint16_ssa(65535); got != 0 { + fmt.Printf("div_uint16 0/65535 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint16_1_ssa(0); got != 0 { + fmt.Printf("div_uint16 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_uint16_ssa(1); got != 1 { + fmt.Printf("div_uint16 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint16_1_ssa(1); got != 1 { + fmt.Printf("div_uint16 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_uint16_ssa(65535); got != 0 { + fmt.Printf("div_uint16 1/65535 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint16_1_ssa(65535); got != 65535 { + fmt.Printf("div_uint16 65535/1 = %d, wanted 65535\n", got) + failed = true + } + + if got := div_uint16_65535_ssa(0); got != 0 { + fmt.Printf("div_uint16 0/65535 = %d, wanted 0\n", got) + failed = true + } + + if got := div_65535_uint16_ssa(1); got != 65535 { + fmt.Printf("div_uint16 65535/1 = %d, wanted 65535\n", got) + failed = true + } + + if got := div_uint16_65535_ssa(1); got != 0 { + fmt.Printf("div_uint16 1/65535 = %d, wanted 0\n", got) + failed = true + } + + if got := div_65535_uint16_ssa(65535); got != 1 { + fmt.Printf("div_uint16 65535/65535 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint16_65535_ssa(65535); got != 1 { + fmt.Printf("div_uint16 65535/65535 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg32768_int16_ssa(-32768); got != 1 { + fmt.Printf("div_int16 -32768/-32768 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(-32768); got != 1 { + fmt.Printf("div_int16 -32768/-32768 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg32768_int16_ssa(-32767); got != 1 { + fmt.Printf("div_int16 -32768/-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(-32767); got != 0 { + fmt.Printf("div_int16 -32767/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32768_int16_ssa(-1); got != -32768 { + fmt.Printf("div_int16 -32768/-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(-1); got != 0 { + fmt.Printf("div_int16 -1/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(0); got != 0 { + fmt.Printf("div_int16 0/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32768_int16_ssa(1); got != -32768 { + fmt.Printf("div_int16 -32768/1 = %d, wanted -32768\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(1); got != 0 { + fmt.Printf("div_int16 1/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32768_int16_ssa(32766); got != -1 { + fmt.Printf("div_int16 -32768/32766 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(32766); got != 0 { + fmt.Printf("div_int16 32766/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32768_int16_ssa(32767); got != -1 { + fmt.Printf("div_int16 -32768/32767 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_Neg32768_ssa(32767); got != 0 { + fmt.Printf("div_int16 32767/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32767_int16_ssa(-32768); got != 0 { + fmt.Printf("div_int16 -32767/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(-32768); got != 1 { + fmt.Printf("div_int16 -32768/-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg32767_int16_ssa(-32767); got != 1 { + fmt.Printf("div_int16 -32767/-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(-32767); got != 1 { + fmt.Printf("div_int16 -32767/-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg32767_int16_ssa(-1); got != 32767 { + fmt.Printf("div_int16 -32767/-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(-1); got != 0 { + fmt.Printf("div_int16 -1/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(0); got != 0 { + fmt.Printf("div_int16 0/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32767_int16_ssa(1); got != -32767 { + fmt.Printf("div_int16 -32767/1 = %d, wanted -32767\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(1); got != 0 { + fmt.Printf("div_int16 1/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32767_int16_ssa(32766); got != -1 { + fmt.Printf("div_int16 -32767/32766 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(32766); got != 0 { + fmt.Printf("div_int16 32766/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg32767_int16_ssa(32767); got != -1 { + fmt.Printf("div_int16 -32767/32767 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_Neg32767_ssa(32767); got != -1 { + fmt.Printf("div_int16 32767/-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int16_ssa(-32768); got != 0 { + fmt.Printf("div_int16 -1/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(-32768); got != -32768 { + fmt.Printf("div_int16 -32768/-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := div_Neg1_int16_ssa(-32767); got != 0 { + fmt.Printf("div_int16 -1/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(-32767); got != 32767 { + fmt.Printf("div_int16 -32767/-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := div_Neg1_int16_ssa(-1); got != 1 { + fmt.Printf("div_int16 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(-1); got != 1 { + fmt.Printf("div_int16 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(0); got != 0 { + fmt.Printf("div_int16 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg1_int16_ssa(1); got != -1 { + fmt.Printf("div_int16 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(1); got != -1 { + fmt.Printf("div_int16 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int16_ssa(32766); got != 0 { + fmt.Printf("div_int16 -1/32766 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(32766); got != -32766 { + fmt.Printf("div_int16 32766/-1 = %d, wanted -32766\n", got) + failed = true + } + + if got := div_Neg1_int16_ssa(32767); got != 0 { + fmt.Printf("div_int16 -1/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_Neg1_ssa(32767); got != -32767 { + fmt.Printf("div_int16 32767/-1 = %d, wanted -32767\n", got) + failed = true + } + + if got := div_0_int16_ssa(-32768); got != 0 { + fmt.Printf("div_int16 0/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int16_ssa(-32767); got != 0 { + fmt.Printf("div_int16 0/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int16_ssa(-1); got != 0 { + fmt.Printf("div_int16 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int16_ssa(1); got != 0 { + fmt.Printf("div_int16 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int16_ssa(32766); got != 0 { + fmt.Printf("div_int16 0/32766 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int16_ssa(32767); got != 0 { + fmt.Printf("div_int16 0/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int16_ssa(-32768); got != 0 { + fmt.Printf("div_int16 1/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_1_ssa(-32768); got != -32768 { + fmt.Printf("div_int16 -32768/1 = %d, wanted -32768\n", got) + failed = true + } + + if got := div_1_int16_ssa(-32767); got != 0 { + fmt.Printf("div_int16 1/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_1_ssa(-32767); got != -32767 { + fmt.Printf("div_int16 -32767/1 = %d, wanted -32767\n", got) + failed = true + } + + if got := div_1_int16_ssa(-1); got != -1 { + fmt.Printf("div_int16 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_1_ssa(-1); got != -1 { + fmt.Printf("div_int16 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_1_ssa(0); got != 0 { + fmt.Printf("div_int16 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int16_ssa(1); got != 1 { + fmt.Printf("div_int16 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_1_ssa(1); got != 1 { + fmt.Printf("div_int16 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_int16_ssa(32766); got != 0 { + fmt.Printf("div_int16 1/32766 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_1_ssa(32766); got != 32766 { + fmt.Printf("div_int16 32766/1 = %d, wanted 32766\n", got) + failed = true + } + + if got := div_1_int16_ssa(32767); got != 0 { + fmt.Printf("div_int16 1/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_1_ssa(32767); got != 32767 { + fmt.Printf("div_int16 32767/1 = %d, wanted 32767\n", got) + failed = true + } + + if got := div_32766_int16_ssa(-32768); got != 0 { + fmt.Printf("div_int16 32766/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_32766_ssa(-32768); got != -1 { + fmt.Printf("div_int16 -32768/32766 = %d, wanted -1\n", got) + failed = true + } + + if got := div_32766_int16_ssa(-32767); got != 0 { + fmt.Printf("div_int16 32766/-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_32766_ssa(-32767); got != -1 { + fmt.Printf("div_int16 -32767/32766 = %d, wanted -1\n", got) + failed = true + } + + if got := div_32766_int16_ssa(-1); got != -32766 { + fmt.Printf("div_int16 32766/-1 = %d, wanted -32766\n", got) + failed = true + } + + if got := div_int16_32766_ssa(-1); got != 0 { + fmt.Printf("div_int16 -1/32766 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_32766_ssa(0); got != 0 { + fmt.Printf("div_int16 0/32766 = %d, wanted 0\n", got) + failed = true + } + + if got := div_32766_int16_ssa(1); got != 32766 { + fmt.Printf("div_int16 32766/1 = %d, wanted 32766\n", got) + failed = true + } + + if got := div_int16_32766_ssa(1); got != 0 { + fmt.Printf("div_int16 1/32766 = %d, wanted 0\n", got) + failed = true + } + + if got := div_32766_int16_ssa(32766); got != 1 { + fmt.Printf("div_int16 32766/32766 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_32766_ssa(32766); got != 1 { + fmt.Printf("div_int16 32766/32766 = %d, wanted 1\n", got) + failed = true + } + + if got := div_32766_int16_ssa(32767); got != 0 { + fmt.Printf("div_int16 32766/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_32766_ssa(32767); got != 1 { + fmt.Printf("div_int16 32767/32766 = %d, wanted 1\n", got) + failed = true + } + + if got := div_32767_int16_ssa(-32768); got != 0 { + fmt.Printf("div_int16 32767/-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_32767_ssa(-32768); got != -1 { + fmt.Printf("div_int16 -32768/32767 = %d, wanted -1\n", got) + failed = true + } + + if got := div_32767_int16_ssa(-32767); got != -1 { + fmt.Printf("div_int16 32767/-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int16_32767_ssa(-32767); got != -1 { + fmt.Printf("div_int16 -32767/32767 = %d, wanted -1\n", got) + failed = true + } + + if got := div_32767_int16_ssa(-1); got != -32767 { + fmt.Printf("div_int16 32767/-1 = %d, wanted -32767\n", got) + failed = true + } + + if got := div_int16_32767_ssa(-1); got != 0 { + fmt.Printf("div_int16 -1/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int16_32767_ssa(0); got != 0 { + fmt.Printf("div_int16 0/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_32767_int16_ssa(1); got != 32767 { + fmt.Printf("div_int16 32767/1 = %d, wanted 32767\n", got) + failed = true + } + + if got := div_int16_32767_ssa(1); got != 0 { + fmt.Printf("div_int16 1/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_32767_int16_ssa(32766); got != 1 { + fmt.Printf("div_int16 32767/32766 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_32767_ssa(32766); got != 0 { + fmt.Printf("div_int16 32766/32767 = %d, wanted 0\n", got) + failed = true + } + + if got := div_32767_int16_ssa(32767); got != 1 { + fmt.Printf("div_int16 32767/32767 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int16_32767_ssa(32767); got != 1 { + fmt.Printf("div_int16 32767/32767 = %d, wanted 1\n", got) + failed = true + } + + if got := div_0_uint8_ssa(1); got != 0 { + fmt.Printf("div_uint8 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_uint8_ssa(255); got != 0 { + fmt.Printf("div_uint8 0/255 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint8_1_ssa(0); got != 0 { + fmt.Printf("div_uint8 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_uint8_ssa(1); got != 1 { + fmt.Printf("div_uint8 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint8_1_ssa(1); got != 1 { + fmt.Printf("div_uint8 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_uint8_ssa(255); got != 0 { + fmt.Printf("adiv_uint8 1/255 = %d, wanted 0\n", got) + failed = true + } + + if got := div_uint8_1_ssa(255); got != 255 { + fmt.Printf("div_uint8 255/1 = %d, wanted 255\n", got) + failed = true + } + + if got := div_uint8_255_ssa(0); got != 0 { + fmt.Printf("div_uint8 0/255 = %d, wanted 0\n", got) + failed = true + } + + if got := div_255_uint8_ssa(1); got != 255 { + fmt.Printf("div_uint8 255/1 = %d, wanted 255\n", got) + failed = true + } + + if got := div_uint8_255_ssa(1); got != 0 { + fmt.Printf("bdiv_uint8 1/255 = %d, wanted 0\n", got) + failed = true + } + + if got := div_255_uint8_ssa(255); got != 1 { + fmt.Printf("div_uint8 255/255 = %d, wanted 1\n", got) + failed = true + } + + if got := div_uint8_255_ssa(255); got != 1 { + fmt.Printf("div_uint8 255/255 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg128_int8_ssa(-128); got != 1 { + fmt.Printf("div_int8 -128/-128 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(-128); got != 1 { + fmt.Printf("div_int8 -128/-128 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg128_int8_ssa(-127); got != 1 { + fmt.Printf("div_int8 -128/-127 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(-127); got != 0 { + fmt.Printf("div_int8 -127/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg128_int8_ssa(-1); got != -128 { + fmt.Printf("div_int8 -128/-1 = %d, wanted -128\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(-1); got != 0 { + fmt.Printf("div_int8 -1/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(0); got != 0 { + fmt.Printf("div_int8 0/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg128_int8_ssa(1); got != -128 { + fmt.Printf("div_int8 -128/1 = %d, wanted -128\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(1); got != 0 { + fmt.Printf("div_int8 1/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg128_int8_ssa(126); got != -1 { + fmt.Printf("div_int8 -128/126 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(126); got != 0 { + fmt.Printf("div_int8 126/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg128_int8_ssa(127); got != -1 { + fmt.Printf("div_int8 -128/127 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_Neg128_ssa(127); got != 0 { + fmt.Printf("div_int8 127/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg127_int8_ssa(-128); got != 0 { + fmt.Printf("div_int8 -127/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(-128); got != 1 { + fmt.Printf("div_int8 -128/-127 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg127_int8_ssa(-127); got != 1 { + fmt.Printf("div_int8 -127/-127 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(-127); got != 1 { + fmt.Printf("div_int8 -127/-127 = %d, wanted 1\n", got) + failed = true + } + + if got := div_Neg127_int8_ssa(-1); got != 127 { + fmt.Printf("div_int8 -127/-1 = %d, wanted 127\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(-1); got != 0 { + fmt.Printf("div_int8 -1/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(0); got != 0 { + fmt.Printf("div_int8 0/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg127_int8_ssa(1); got != -127 { + fmt.Printf("div_int8 -127/1 = %d, wanted -127\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(1); got != 0 { + fmt.Printf("div_int8 1/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg127_int8_ssa(126); got != -1 { + fmt.Printf("div_int8 -127/126 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(126); got != 0 { + fmt.Printf("div_int8 126/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg127_int8_ssa(127); got != -1 { + fmt.Printf("div_int8 -127/127 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_Neg127_ssa(127); got != -1 { + fmt.Printf("div_int8 127/-127 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int8_ssa(-128); got != 0 { + fmt.Printf("div_int8 -1/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(-128); got != -128 { + fmt.Printf("div_int8 -128/-1 = %d, wanted -128\n", got) + failed = true + } + + if got := div_Neg1_int8_ssa(-127); got != 0 { + fmt.Printf("div_int8 -1/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(-127); got != 127 { + fmt.Printf("div_int8 -127/-1 = %d, wanted 127\n", got) + failed = true + } + + if got := div_Neg1_int8_ssa(-1); got != 1 { + fmt.Printf("div_int8 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(-1); got != 1 { + fmt.Printf("div_int8 -1/-1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(0); got != 0 { + fmt.Printf("div_int8 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_Neg1_int8_ssa(1); got != -1 { + fmt.Printf("div_int8 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(1); got != -1 { + fmt.Printf("div_int8 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_Neg1_int8_ssa(126); got != 0 { + fmt.Printf("div_int8 -1/126 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(126); got != -126 { + fmt.Printf("div_int8 126/-1 = %d, wanted -126\n", got) + failed = true + } + + if got := div_Neg1_int8_ssa(127); got != 0 { + fmt.Printf("div_int8 -1/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_Neg1_ssa(127); got != -127 { + fmt.Printf("div_int8 127/-1 = %d, wanted -127\n", got) + failed = true + } + + if got := div_0_int8_ssa(-128); got != 0 { + fmt.Printf("div_int8 0/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int8_ssa(-127); got != 0 { + fmt.Printf("div_int8 0/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int8_ssa(-1); got != 0 { + fmt.Printf("div_int8 0/-1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int8_ssa(1); got != 0 { + fmt.Printf("div_int8 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int8_ssa(126); got != 0 { + fmt.Printf("div_int8 0/126 = %d, wanted 0\n", got) + failed = true + } + + if got := div_0_int8_ssa(127); got != 0 { + fmt.Printf("div_int8 0/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int8_ssa(-128); got != 0 { + fmt.Printf("div_int8 1/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_1_ssa(-128); got != -128 { + fmt.Printf("div_int8 -128/1 = %d, wanted -128\n", got) + failed = true + } + + if got := div_1_int8_ssa(-127); got != 0 { + fmt.Printf("div_int8 1/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_1_ssa(-127); got != -127 { + fmt.Printf("div_int8 -127/1 = %d, wanted -127\n", got) + failed = true + } + + if got := div_1_int8_ssa(-1); got != -1 { + fmt.Printf("div_int8 1/-1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_1_ssa(-1); got != -1 { + fmt.Printf("div_int8 -1/1 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_1_ssa(0); got != 0 { + fmt.Printf("div_int8 0/1 = %d, wanted 0\n", got) + failed = true + } + + if got := div_1_int8_ssa(1); got != 1 { + fmt.Printf("div_int8 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_1_ssa(1); got != 1 { + fmt.Printf("div_int8 1/1 = %d, wanted 1\n", got) + failed = true + } + + if got := div_1_int8_ssa(126); got != 0 { + fmt.Printf("div_int8 1/126 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_1_ssa(126); got != 126 { + fmt.Printf("div_int8 126/1 = %d, wanted 126\n", got) + failed = true + } + + if got := div_1_int8_ssa(127); got != 0 { + fmt.Printf("div_int8 1/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_1_ssa(127); got != 127 { + fmt.Printf("div_int8 127/1 = %d, wanted 127\n", got) + failed = true + } + + if got := div_126_int8_ssa(-128); got != 0 { + fmt.Printf("div_int8 126/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_126_ssa(-128); got != -1 { + fmt.Printf("div_int8 -128/126 = %d, wanted -1\n", got) + failed = true + } + + if got := div_126_int8_ssa(-127); got != 0 { + fmt.Printf("div_int8 126/-127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_126_ssa(-127); got != -1 { + fmt.Printf("div_int8 -127/126 = %d, wanted -1\n", got) + failed = true + } + + if got := div_126_int8_ssa(-1); got != -126 { + fmt.Printf("div_int8 126/-1 = %d, wanted -126\n", got) + failed = true + } + + if got := div_int8_126_ssa(-1); got != 0 { + fmt.Printf("div_int8 -1/126 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_126_ssa(0); got != 0 { + fmt.Printf("div_int8 0/126 = %d, wanted 0\n", got) + failed = true + } + + if got := div_126_int8_ssa(1); got != 126 { + fmt.Printf("div_int8 126/1 = %d, wanted 126\n", got) + failed = true + } + + if got := div_int8_126_ssa(1); got != 0 { + fmt.Printf("div_int8 1/126 = %d, wanted 0\n", got) + failed = true + } + + if got := div_126_int8_ssa(126); got != 1 { + fmt.Printf("div_int8 126/126 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_126_ssa(126); got != 1 { + fmt.Printf("div_int8 126/126 = %d, wanted 1\n", got) + failed = true + } + + if got := div_126_int8_ssa(127); got != 0 { + fmt.Printf("div_int8 126/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_126_ssa(127); got != 1 { + fmt.Printf("div_int8 127/126 = %d, wanted 1\n", got) + failed = true + } + + if got := div_127_int8_ssa(-128); got != 0 { + fmt.Printf("div_int8 127/-128 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_127_ssa(-128); got != -1 { + fmt.Printf("div_int8 -128/127 = %d, wanted -1\n", got) + failed = true + } + + if got := div_127_int8_ssa(-127); got != -1 { + fmt.Printf("div_int8 127/-127 = %d, wanted -1\n", got) + failed = true + } + + if got := div_int8_127_ssa(-127); got != -1 { + fmt.Printf("div_int8 -127/127 = %d, wanted -1\n", got) + failed = true + } + + if got := div_127_int8_ssa(-1); got != -127 { + fmt.Printf("div_int8 127/-1 = %d, wanted -127\n", got) + failed = true + } + + if got := div_int8_127_ssa(-1); got != 0 { + fmt.Printf("div_int8 -1/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_int8_127_ssa(0); got != 0 { + fmt.Printf("div_int8 0/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_127_int8_ssa(1); got != 127 { + fmt.Printf("div_int8 127/1 = %d, wanted 127\n", got) + failed = true + } + + if got := div_int8_127_ssa(1); got != 0 { + fmt.Printf("div_int8 1/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_127_int8_ssa(126); got != 1 { + fmt.Printf("div_int8 127/126 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_127_ssa(126); got != 0 { + fmt.Printf("div_int8 126/127 = %d, wanted 0\n", got) + failed = true + } + + if got := div_127_int8_ssa(127); got != 1 { + fmt.Printf("div_int8 127/127 = %d, wanted 1\n", got) + failed = true + } + + if got := div_int8_127_ssa(127); got != 1 { + fmt.Printf("div_int8 127/127 = %d, wanted 1\n", got) + failed = true + } + if failed { + panic("tests failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/arith_ssa.go b/src/cmd/compile/internal/gc/testdata/arith_ssa.go index 2a56e2163f..f6f123c0be 100644 --- a/src/cmd/compile/internal/gc/testdata/arith_ssa.go +++ b/src/cmd/compile/internal/gc/testdata/arith_ssa.go @@ -8,7 +8,7 @@ package main -// test64BitConstMulti tests that rewrite rules don't fold 64 bit constants +// test64BitConstMult tests that rewrite rules don't fold 64 bit constants // into multiply instructions. func test64BitConstMult() { want := int64(103079215109) diff --git a/src/cmd/compile/internal/ssa/TODO b/src/cmd/compile/internal/ssa/TODO index 1773dbbc98..9e52a67ed0 100644 --- a/src/cmd/compile/internal/ssa/TODO +++ b/src/cmd/compile/internal/ssa/TODO @@ -5,7 +5,7 @@ Coverage -------- - Floating point numbers - Complex numbers -- Integer division (HMUL & MOD) +- Integer division (MOD) - Fat objects (strings/slices/interfaces) vs. Phi - Defer? - Closure args @@ -50,6 +50,7 @@ Optimizations (better compiler) - Constant cache - Reuseable slices (e.g. []int of size NumValues()) cached in Func - Handle signed division overflow and sign extension earlier +- Implement 64 bit const division with high multiply, maybe in the frontend? Regalloc -------- diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index 0cde6f26d4..21f4d01296 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -45,6 +45,13 @@ (Div8 x y) -> (DIVW (SignExt8to16 x) (SignExt8to16 y)) (Div8u x y) -> (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y)) +(Hmul32 x y) -> (HMULL x y) +(Hmul32u x y) -> (HMULLU x y) +(Hmul16 x y) -> (HMULW x y) +(Hmul16u x y) -> (HMULWU x y) +(Hmul8 x y) -> (HMULB x y) +(Hmul8u x y) -> (HMULBU x y) + (And64 x y) -> (ANDQ x y) (And32 x y) -> (ANDL x y) (And16 x y) -> (ANDW x y) diff --git a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go index 220e5b01cd..24c8a199b5 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go +++ b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go @@ -101,6 +101,8 @@ func init() { gp21shift = regInfo{inputs: []regMask{gpsp, cx}, outputs: []regMask{gp &^ cx}, clobbers: flags} gp11div = regInfo{inputs: []regMask{ax, gpsp &^ dx}, outputs: []regMask{ax}, clobbers: dx | flags} + gp11hmul = regInfo{inputs: []regMask{ax, gpsp}, outputs: []regMask{dx}, + clobbers: ax | flags} gp2flags = regInfo{inputs: []regMask{gpsp, gpsp}, outputs: flagsonly} gp1flags = regInfo{inputs: []regMask{gpsp}, outputs: flagsonly} @@ -184,10 +186,16 @@ func init() { {name: "MULWconst", reg: gp11, asm: "IMULW"}, // arg0 * auxint {name: "MULBconst", reg: gp11, asm: "IMULW"}, // arg0 * auxint + {name: "HMULL", reg: gp11hmul, asm: "IMULL"}, // (arg0 * arg1) >> width + {name: "HMULW", reg: gp11hmul, asm: "IMULW"}, // (arg0 * arg1) >> width + {name: "HMULB", reg: gp11hmul, asm: "IMULB"}, // (arg0 * arg1) >> width + {name: "HMULLU", reg: gp11hmul, asm: "MULL"}, // (arg0 * arg1) >> width + {name: "HMULWU", reg: gp11hmul, asm: "MULW"}, // (arg0 * arg1) >> width + {name: "HMULBU", reg: gp11hmul, asm: "MULB"}, // (arg0 * arg1) >> width + {name: "DIVQ", reg: gp11div, asm: "IDIVQ"}, // arg0 / arg1 {name: "DIVL", reg: gp11div, asm: "IDIVL"}, // arg0 / arg1 {name: "DIVW", reg: gp11div, asm: "IDIVW"}, // arg0 / arg1 - {name: "DIVQU", reg: gp11div, asm: "DIVQ"}, // arg0 / arg1 {name: "DIVLU", reg: gp11div, asm: "DIVL"}, // arg0 / arg1 {name: "DIVWU", reg: gp11div, asm: "DIVW"}, // arg0 / arg1 diff --git a/src/cmd/compile/internal/ssa/gen/genericOps.go b/src/cmd/compile/internal/ssa/gen/genericOps.go index a0d8f8e000..44eed6aeba 100644 --- a/src/cmd/compile/internal/ssa/gen/genericOps.go +++ b/src/cmd/compile/internal/ssa/gen/genericOps.go @@ -37,6 +37,14 @@ var genericOps = []opData{ {name: "Div64F"}, // TODO: Div8, Div16, Div32, Div64 and unsigned + {name: "Hmul8"}, // (arg0 * arg1) >> width + {name: "Hmul8u"}, + {name: "Hmul16"}, + {name: "Hmul16u"}, + {name: "Hmul32"}, + {name: "Hmul32u"}, + // frontend currently doesn't generate a 64 bit hmul + {name: "Div8"}, // arg0 / arg1 {name: "Div8u"}, {name: "Div16"}, diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 44fd6e3737..f8e5e623b6 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -93,6 +93,12 @@ const ( OpAMD64MULLconst OpAMD64MULWconst OpAMD64MULBconst + OpAMD64HMULL + OpAMD64HMULW + OpAMD64HMULB + OpAMD64HMULLU + OpAMD64HMULWU + OpAMD64HMULBU OpAMD64DIVQ OpAMD64DIVL OpAMD64DIVW @@ -245,6 +251,12 @@ const ( OpMul64F OpDiv32F OpDiv64F + OpHmul8 + OpHmul8u + OpHmul16 + OpHmul16u + OpHmul32 + OpHmul32u OpDiv8 OpDiv8u OpDiv16 @@ -977,6 +989,90 @@ var opcodeTable = [...]opInfo{ }, }, }, + { + name: "HMULL", + asm: x86.AIMULL, + reg: regInfo{ + inputs: []inputInfo{ + {0, 1}, // .AX + {1, 65535}, // .AX .CX .DX .BX .SP .BP .SI .DI .R8 .R9 .R10 .R11 .R12 .R13 .R14 .R15 + }, + clobbers: 8589934593, // .AX .FLAGS + outputs: []regMask{ + 4, // .DX + }, + }, + }, + { + name: "HMULW", + asm: x86.AIMULW, + reg: regInfo{ + inputs: []inputInfo{ + {0, 1}, // .AX + {1, 65535}, // .AX .CX .DX .BX .SP .BP .SI .DI .R8 .R9 .R10 .R11 .R12 .R13 .R14 .R15 + }, + clobbers: 8589934593, // .AX .FLAGS + outputs: []regMask{ + 4, // .DX + }, + }, + }, + { + name: "HMULB", + asm: x86.AIMULB, + reg: regInfo{ + inputs: []inputInfo{ + {0, 1}, // .AX + {1, 65535}, // .AX .CX .DX .BX .SP .BP .SI .DI .R8 .R9 .R10 .R11 .R12 .R13 .R14 .R15 + }, + clobbers: 8589934593, // .AX .FLAGS + outputs: []regMask{ + 4, // .DX + }, + }, + }, + { + name: "HMULLU", + asm: x86.AMULL, + reg: regInfo{ + inputs: []inputInfo{ + {0, 1}, // .AX + {1, 65535}, // .AX .CX .DX .BX .SP .BP .SI .DI .R8 .R9 .R10 .R11 .R12 .R13 .R14 .R15 + }, + clobbers: 8589934593, // .AX .FLAGS + outputs: []regMask{ + 4, // .DX + }, + }, + }, + { + name: "HMULWU", + asm: x86.AMULW, + reg: regInfo{ + inputs: []inputInfo{ + {0, 1}, // .AX + {1, 65535}, // .AX .CX .DX .BX .SP .BP .SI .DI .R8 .R9 .R10 .R11 .R12 .R13 .R14 .R15 + }, + clobbers: 8589934593, // .AX .FLAGS + outputs: []regMask{ + 4, // .DX + }, + }, + }, + { + name: "HMULBU", + asm: x86.AMULB, + reg: regInfo{ + inputs: []inputInfo{ + {0, 1}, // .AX + {1, 65535}, // .AX .CX .DX .BX .SP .BP .SI .DI .R8 .R9 .R10 .R11 .R12 .R13 .R14 .R15 + }, + clobbers: 8589934593, // .AX .FLAGS + outputs: []regMask{ + 4, // .DX + }, + }, + }, { name: "DIVQ", asm: x86.AIDIVQ, @@ -2690,6 +2786,30 @@ var opcodeTable = [...]opInfo{ name: "Div64F", generic: true, }, + { + name: "Hmul8", + generic: true, + }, + { + name: "Hmul8u", + generic: true, + }, + { + name: "Hmul16", + generic: true, + }, + { + name: "Hmul16u", + generic: true, + }, + { + name: "Hmul32", + generic: true, + }, + { + name: "Hmul32u", + generic: true, + }, { name: "Div8", generic: true, diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index 993838b537..4013611b88 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -2335,6 +2335,114 @@ func rewriteValueAMD64(v *Value, config *Config) bool { goto end22eaafbcfe70447f79d9b3e6cc395bbd end22eaafbcfe70447f79d9b3e6cc395bbd: ; + case OpHmul16: + // match: (Hmul16 x y) + // cond: + // result: (HMULW x y) + { + x := v.Args[0] + y := v.Args[1] + v.Op = OpAMD64HMULW + v.AuxInt = 0 + v.Aux = nil + v.resetArgs() + v.AddArg(x) + v.AddArg(y) + return true + } + goto end1b9ff394bb3b06fc109637656b6875f5 + end1b9ff394bb3b06fc109637656b6875f5: + ; + case OpHmul16u: + // match: (Hmul16u x y) + // cond: + // result: (HMULWU x y) + { + x := v.Args[0] + y := v.Args[1] + v.Op = OpAMD64HMULWU + v.AuxInt = 0 + v.Aux = nil + v.resetArgs() + v.AddArg(x) + v.AddArg(y) + return true + } + goto endee9089e794a43f2ce1619a6ef61670f4 + endee9089e794a43f2ce1619a6ef61670f4: + ; + case OpHmul32: + // match: (Hmul32 x y) + // cond: + // result: (HMULL x y) + { + x := v.Args[0] + y := v.Args[1] + v.Op = OpAMD64HMULL + v.AuxInt = 0 + v.Aux = nil + v.resetArgs() + v.AddArg(x) + v.AddArg(y) + return true + } + goto end7c83c91ef2634f0b1da4f49350b437b1 + end7c83c91ef2634f0b1da4f49350b437b1: + ; + case OpHmul32u: + // match: (Hmul32u x y) + // cond: + // result: (HMULLU x y) + { + x := v.Args[0] + y := v.Args[1] + v.Op = OpAMD64HMULLU + v.AuxInt = 0 + v.Aux = nil + v.resetArgs() + v.AddArg(x) + v.AddArg(y) + return true + } + goto end3c4f36611dc8815aa2a63d4ec0eaa06d + end3c4f36611dc8815aa2a63d4ec0eaa06d: + ; + case OpHmul8: + // match: (Hmul8 x y) + // cond: + // result: (HMULB x y) + { + x := v.Args[0] + y := v.Args[1] + v.Op = OpAMD64HMULB + v.AuxInt = 0 + v.Aux = nil + v.resetArgs() + v.AddArg(x) + v.AddArg(y) + return true + } + goto end51b2cc9f1ed15314e68fc81024f281a7 + end51b2cc9f1ed15314e68fc81024f281a7: + ; + case OpHmul8u: + // match: (Hmul8u x y) + // cond: + // result: (HMULBU x y) + { + x := v.Args[0] + y := v.Args[1] + v.Op = OpAMD64HMULBU + v.AuxInt = 0 + v.Aux = nil + v.resetArgs() + v.AddArg(x) + v.AddArg(y) + return true + } + goto ende68d7b3a3c774cedc3522af9d635c39d + ende68d7b3a3c774cedc3522af9d635c39d: + ; case OpITab: // match: (ITab (Load ptr mem)) // cond: