diff options
| author | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-03-01 21:36:45 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-03-01 21:36:45 +0000 |
| commit | a6fb2aede7c8d47b4d913eb83fa45bbeca76c433 (patch) | |
| tree | 1dd5039e5515959a8d162fbdac964663dd2ec778 /src/cmd/compile/internal/gc | |
| parent | 998aaf8a64b7d90269815a2ae9d778da519d0a87 (diff) | |
| parent | 9d854fd44ae669f60c15133a4d2ce407ea2bccc4 (diff) | |
| download | go-a6fb2aede7c8d47b4d913eb83fa45bbeca76c433.tar.xz | |
Merge "Merge branch 'dev.ssa' into mergebranch"
Diffstat (limited to 'src/cmd/compile/internal/gc')
47 files changed, 25420 insertions, 44 deletions
diff --git a/src/cmd/compile/internal/gc/closure.go b/src/cmd/compile/internal/gc/closure.go index d8ec05973e..a33ddeb9b5 100644 --- a/src/cmd/compile/internal/gc/closure.go +++ b/src/cmd/compile/internal/gc/closure.go @@ -588,6 +588,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node { ptr.Ullman = 1 ptr.Used = true ptr.Name.Curfn = xfunc + ptr.Xoffset = 0 xfunc.Func.Dcl = append(xfunc.Func.Dcl, ptr) var body []*Node if Isptr[rcvrtype.Etype] || Isinter(rcvrtype) { diff --git a/src/cmd/compile/internal/gc/fmt.go b/src/cmd/compile/internal/gc/fmt.go index 39b74f6968..8864b57f5d 100644 --- a/src/cmd/compile/internal/gc/fmt.go +++ b/src/cmd/compile/internal/gc/fmt.go @@ -403,6 +403,7 @@ var etnames = []string{ TFORW: "FORW", TFIELD: "FIELD", TSTRING: "STRING", + TUNSAFEPTR: "TUNSAFEPTR", TANY: "ANY", } diff --git a/src/cmd/compile/internal/gc/gen.go b/src/cmd/compile/internal/gc/gen.go index 2292a564b3..c151ca3559 100644 --- a/src/cmd/compile/internal/gc/gen.go +++ b/src/cmd/compile/internal/gc/gen.go @@ -142,6 +142,8 @@ func newlab(n *Node) *Label { return lab } +// There is a copy of checkgoto in the new SSA backend. +// Please keep them in sync. func checkgoto(from *Node, to *Node) { if from.Sym == to.Sym { return @@ -840,7 +842,7 @@ func gen(n *Node) { cgen_dcl(n.Left) case OAS: - if gen_as_init(n) { + if gen_as_init(n, false) { break } Cgen_as(n.Left, n.Right) diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go index ce3ad003c0..263d6d45b5 100644 --- a/src/cmd/compile/internal/gc/go.go +++ b/src/cmd/compile/internal/gc/go.go @@ -131,7 +131,7 @@ type Type struct { Note *string // literal string annotation // TARRAY - Bound int64 // negative is dynamic array + Bound int64 // negative is slice // TMAP Bucket *Type // internal type representing a hash bucket @@ -759,4 +759,13 @@ var Panicindex *Node var panicslice *Node +var panicdivide *Node + var throwreturn *Node + +var growslice *Node + +var writebarrierptr *Node +var typedmemmove *Node + +var panicdottype *Node diff --git a/src/cmd/compile/internal/gc/gsubr.go b/src/cmd/compile/internal/gc/gsubr.go index f5d7a8d2de..73f71dd0fb 100644 --- a/src/cmd/compile/internal/gc/gsubr.go +++ b/src/cmd/compile/internal/gc/gsubr.go @@ -530,6 +530,16 @@ func newplist() *obj.Plist { return pl } +// nodarg does something that depends on the value of +// fp (this was previously completely undocumented). +// +// fp=1 corresponds to input args +// fp=0 corresponds to output args +// fp=-1 is a special case of output args for a +// specific call from walk that previously (and +// incorrectly) passed a 1; the behavior is exactly +// the same as it is for 1, except that PARAMOUT is +// generated instead of PARAM. func nodarg(t *Type, fp int) *Node { var n *Node @@ -555,7 +565,7 @@ func nodarg(t *Type, fp int) *Node { Fatalf("nodarg: not field %v", t) } - if fp == 1 { + if fp == 1 || fp == -1 { for _, n := range Curfn.Func.Dcl { if (n.Class == PPARAM || n.Class == PPARAMOUT) && !isblanksym(t.Sym) && n.Sym == t.Sym { return n @@ -592,6 +602,9 @@ fp: case 1: // input arg n.Class = PPARAM + case -1: // output arg from paramstoheap + n.Class = PPARAMOUT + case 2: // offset output arg Fatalf("shouldn't be used") } diff --git a/src/cmd/compile/internal/gc/init.go b/src/cmd/compile/internal/gc/init.go index d7db786725..acfa19bd2d 100644 --- a/src/cmd/compile/internal/gc/init.go +++ b/src/cmd/compile/internal/gc/init.go @@ -33,10 +33,10 @@ func renameinit() *Sym { // hand-craft the following initialization code // var initdone· uint8 (1) // func init() (2) -// if initdone· != 0 { (3) -// if initdone· == 2 (4) -// return -// throw(); (5) +// if initdone· > 1 { (3) +// return (3a) +// if initdone· == 1 { (4) +// throw(); (4a) // } // initdone· = 1; (6) // // over all matching imported symbols @@ -118,22 +118,21 @@ func fninit(n *NodeList) { // (3) a := Nod(OIF, nil, nil) - - a.Left = Nod(ONE, gatevar, Nodintconst(0)) + a.Left = Nod(OGT, gatevar, Nodintconst(1)) + a.Likely = 1 r = append(r, a) + // (3a) + a.Nbody.Set([]*Node{Nod(ORETURN, nil, nil)}) // (4) b := Nod(OIF, nil, nil) - - b.Left = Nod(OEQ, gatevar, Nodintconst(2)) - b.Nbody.Set([]*Node{Nod(ORETURN, nil, nil)}) - a.Nbody.Set([]*Node{b}) - - // (5) - b = syslook("throwinit", 0) - - b = Nod(OCALL, b, nil) - a.Nbody.Append(b) + b.Left = Nod(OEQ, gatevar, Nodintconst(1)) + // this actually isn't likely, but code layout is better + // like this: no JMP needed after the call. + b.Likely = 1 + r = append(r, b) + // (4a) + b.Nbody.Set([]*Node{Nod(OCALL, syslook("throwinit", 0), nil)}) // (6) a = Nod(OAS, gatevar, Nodintconst(1)) diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index d05ef2738c..bb8bfdf80f 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -7,6 +7,7 @@ package gc import ( + "cmd/compile/internal/ssa" "cmd/internal/obj" "flag" "fmt" @@ -286,6 +287,23 @@ func Main() { } } } + // special case for ssa for now + if strings.HasPrefix(name, "ssa/") { + // expect form ssa/phase/flag + // e.g. -d=ssa/generic_cse/time + // _ in phase name also matches space + phase := name[4:] + flag := "debug" // default flag is debug + if i := strings.Index(phase, "/"); i >= 0 { + flag = phase[i+1:] + phase = phase[:i] + } + err := ssa.PhaseOption(phase, flag, val) + if err != "" { + log.Fatalf(err) + } + continue Split + } log.Fatalf("unknown debug key -d %s\n", name) } } @@ -844,7 +862,7 @@ func plan9quote(s string) string { return s } -type Pragma uint8 +type Pragma uint16 const ( Nointerface Pragma = 1 << iota @@ -855,6 +873,7 @@ const ( Systemstack // func must run on system stack Nowritebarrier // emit compiler error instead of write barrier Nowritebarrierrec // error on write barrier in this or recursive callees + CgoUnsafeArgs // treat a pointer to one arg as a pointer to them all ) type lexer struct { @@ -1677,6 +1696,8 @@ func (l *lexer) getlinepragma() rune { Yyerror("//go:nowritebarrierrec only allowed in runtime") } l.pragma |= Nowritebarrierrec | Nowritebarrier // implies Nowritebarrier + case "go:cgo_unsafe_args": + l.pragma |= CgoUnsafeArgs } return c } diff --git a/src/cmd/compile/internal/gc/opnames.go b/src/cmd/compile/internal/gc/opnames.go index 06096437bf..df0d8cb7fb 100644 --- a/src/cmd/compile/internal/gc/opnames.go +++ b/src/cmd/compile/internal/gc/opnames.go @@ -160,5 +160,9 @@ var opnames = []string{ OLROT: "LROT", ORROTC: "RROTC", ORETJMP: "RETJMP", + OPS: "OPS", + OPC: "OPC", + OSQRT: "OSQRT", + OGETG: "OGETG", OEND: "END", } diff --git a/src/cmd/compile/internal/gc/order.go b/src/cmd/compile/internal/gc/order.go index e94ff210b6..94bc6338cc 100644 --- a/src/cmd/compile/internal/gc/order.go +++ b/src/cmd/compile/internal/gc/order.go @@ -230,6 +230,7 @@ func cleantempnopop(mark ordermarker, order *Order, out *[]*Node) { n := order.temp[i] if n.Name.Keepalive { n.Name.Keepalive = false + n.Addrtaken = true // ensure SSA keeps the n variable kill = Nod(OVARLIVE, n, nil) typecheck(&kill, Etop) *out = append(*out, kill) diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go index 31cc3bcf39..41038d342f 100644 --- a/src/cmd/compile/internal/gc/pgen.go +++ b/src/cmd/compile/internal/gc/pgen.go @@ -5,6 +5,7 @@ package gc import ( + "cmd/compile/internal/ssa" "cmd/internal/obj" "crypto/md5" "fmt" @@ -341,7 +342,12 @@ func compile(fn *Node) { Deferreturn = Sysfunc("deferreturn") Panicindex = Sysfunc("panicindex") panicslice = Sysfunc("panicslice") + panicdivide = Sysfunc("panicdivide") throwreturn = Sysfunc("throwreturn") + growslice = Sysfunc("growslice") + writebarrierptr = Sysfunc("writebarrierptr") + typedmemmove = Sysfunc("typedmemmove") + panicdottype = Sysfunc("panicdottype") } lno := setlineno(fn) @@ -358,6 +364,7 @@ func compile(fn *Node) { var nam *Node var gcargs *Sym var gclocals *Sym + var ssafn *ssa.Func if len(fn.Nbody.Slice()) == 0 { if pure_go != 0 || strings.HasPrefix(fn.Func.Nname.Sym.Name, "init.") { Yyerror("missing function body for %q", fn.Func.Nname.Sym.Name) @@ -409,6 +416,11 @@ func compile(fn *Node) { goto ret } + // Build an SSA backend function. + if shouldssa(Curfn) { + ssafn = buildssa(Curfn) + } + continpc = nil breakpc = nil @@ -471,6 +483,14 @@ func compile(fn *Node) { } } + if ssafn != nil { + genssa(ssafn, ptxt, gcargs, gclocals) + if Curfn.Func.Endlineno != 0 { + lineno = Curfn.Func.Endlineno + } + ssafn.Free() + return + } Genslice(Curfn.Func.Enter.Slice()) Genslice(Curfn.Nbody.Slice()) gclean() diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go index 84a24a827a..78872c1af2 100644 --- a/src/cmd/compile/internal/gc/plive.go +++ b/src/cmd/compile/internal/gc/plive.go @@ -19,6 +19,7 @@ import ( "cmd/internal/obj" "fmt" "sort" + "strings" ) const ( @@ -410,7 +411,7 @@ func newcfg(firstp *obj.Prog) []*BasicBlock { bb := newblock(firstp) cfg = append(cfg, bb) - for p := firstp; p != nil; p = p.Link { + for p := firstp; p != nil && p.As != obj.AEND; p = p.Link { Thearch.Proginfo(p) if p.To.Type == obj.TYPE_BRANCH { if p.To.Val == nil { @@ -438,7 +439,7 @@ func newcfg(firstp *obj.Prog) []*BasicBlock { // contained instructions until a label is reached. Add edges // for branches and fall-through instructions. for _, bb := range cfg { - for p := bb.last; p != nil; p = p.Link { + for p := bb.last; p != nil && p.As != obj.AEND; p = p.Link { if p.Opt != nil && p != bb.last { break } @@ -447,6 +448,8 @@ func newcfg(firstp *obj.Prog) []*BasicBlock { // Stop before an unreachable RET, to avoid creating // unreachable control flow nodes. if p.Link != nil && p.Link.As == obj.ARET && p.Link.Mode == 1 { + // TODO: remove after SSA is done. SSA does not + // generate any unreachable RET instructions. break } @@ -1364,7 +1367,7 @@ func livenessepilogue(lv *Liveness) { } n = lv.vars[j] if n.Class != PPARAM { - yyerrorl(int(p.Lineno), "internal error: %v %v recorded as live on entry", Curfn.Func.Nname, Nconv(n, obj.FmtLong)) + yyerrorl(int(p.Lineno), "internal error: %v %v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, Nconv(n, obj.FmtLong), p.Pc) } } } @@ -1389,8 +1392,13 @@ func livenessepilogue(lv *Liveness) { if msg != nil { fmt_ = "" fmt_ += fmt.Sprintf("%v: live at ", p.Line()) - if p.As == obj.ACALL && p.To.Node != nil { - fmt_ += fmt.Sprintf("call to %s:", ((p.To.Node).(*Node)).Sym.Name) + if p.As == obj.ACALL && p.To.Sym != nil { + name := p.To.Sym.Name + i := strings.Index(name, ".") + if i >= 0 { + name = name[i+1:] + } + fmt_ += fmt.Sprintf("call to %s:", name) } else if p.As == obj.ACALL { fmt_ += "indirect call:" } else { diff --git a/src/cmd/compile/internal/gc/racewalk.go b/src/cmd/compile/internal/gc/racewalk.go index 352a399ed8..376928f756 100644 --- a/src/cmd/compile/internal/gc/racewalk.go +++ b/src/cmd/compile/internal/gc/racewalk.go @@ -13,7 +13,7 @@ import ( // // For flag_race it modifies the function as follows: // -// 1. It inserts a call to racefuncenter at the beginning of each function. +// 1. It inserts a call to racefuncenterfp at the beginning of each function. // 2. It inserts a call to racefuncexit at the end of each function. // 3. It inserts a call to raceread before each memory read. // 4. It inserts a call to racewrite before each memory write. @@ -33,7 +33,7 @@ import ( // at best instrumentation would cause infinite recursion. var omit_pkgs = []string{"runtime/internal/atomic", "runtime/internal/sys", "runtime", "runtime/race", "runtime/msan"} -// Only insert racefuncenter/racefuncexit into the following packages. +// Only insert racefuncenterfp/racefuncexit into the following packages. // Memory accesses in the packages are either uninteresting or will cause false positives. var norace_inst_pkgs = []string{"sync", "sync/atomic"} diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index b3f6b6ac55..43c6db0a00 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -55,8 +55,7 @@ const ( func makefield(name string, t *Type) *Type { f := typ(TFIELD) f.Type = t - f.Sym = new(Sym) - f.Sym.Name = name + f.Sym = nopkg.Lookup(name) return f } diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go index 12bdfbada5..bee045f567 100644 --- a/src/cmd/compile/internal/gc/sinit.go +++ b/src/cmd/compile/internal/gc/sinit.go @@ -1209,6 +1209,7 @@ func getlit(lit *Node) int { return -1 } +// stataddr sets nam to the static address of n and reports whether it succeeeded. func stataddr(nam *Node, n *Node) bool { if n == nil { return false @@ -1376,7 +1377,9 @@ func entry(p *InitPlan) *InitEntry { return &p.E[len(p.E)-1] } -func gen_as_init(n *Node) bool { +// gen_as_init attempts to emit static data for n and reports whether it succeeded. +// If reportOnly is true, it does not emit static data and does not modify the AST. +func gen_as_init(n *Node, reportOnly bool) bool { var nr *Node var nl *Node var nam Node @@ -1425,7 +1428,6 @@ func gen_as_init(n *Node) bool { case OSLICEARR: if nr.Right.Op == OKEY && nr.Right.Left == nil && nr.Right.Right == nil { nr = nr.Left - gused(nil) // in case the data is the dest of a goto nl := nr if nr == nil || nr.Op != OADDR { goto no @@ -1440,16 +1442,18 @@ func gen_as_init(n *Node) bool { goto no } - nam.Xoffset += int64(Array_array) - gdata(&nam, nl, int(Types[Tptr].Width)) + if !reportOnly { + nam.Xoffset += int64(Array_array) + gdata(&nam, nl, int(Types[Tptr].Width)) - nam.Xoffset += int64(Array_nel) - int64(Array_array) - var nod1 Node - Nodconst(&nod1, Types[TINT], nr.Type.Bound) - gdata(&nam, &nod1, Widthint) + nam.Xoffset += int64(Array_nel) - int64(Array_array) + var nod1 Node + Nodconst(&nod1, Types[TINT], nr.Type.Bound) + gdata(&nam, &nod1, Widthint) - nam.Xoffset += int64(Array_cap) - int64(Array_nel) - gdata(&nam, &nod1, Widthint) + nam.Xoffset += int64(Array_cap) - int64(Array_nel) + gdata(&nam, &nod1, Widthint) + } return true } @@ -1480,13 +1484,19 @@ func gen_as_init(n *Node) bool { TPTR64, TFLOAT32, TFLOAT64: - gdata(&nam, nr, int(nr.Type.Width)) + if !reportOnly { + gdata(&nam, nr, int(nr.Type.Width)) + } case TCOMPLEX64, TCOMPLEX128: - gdatacomplex(&nam, nr.Val().U.(*Mpcplx)) + if !reportOnly { + gdatacomplex(&nam, nr.Val().U.(*Mpcplx)) + } case TSTRING: - gdatastring(&nam, nr.Val().U.(string)) + if !reportOnly { + gdatastring(&nam, nr.Val().U.(string)) + } } return true diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go new file mode 100644 index 0000000000..6bf08617f0 --- /dev/null +++ b/src/cmd/compile/internal/gc/ssa.go @@ -0,0 +1,5235 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gc + +import ( + "bytes" + "fmt" + "html" + "math" + "os" + "strings" + + "cmd/compile/internal/ssa" + "cmd/internal/obj" + "cmd/internal/obj/x86" +) + +// Smallest possible faulting page at address zero. +const minZeroPage = 4096 + +var ssaConfig *ssa.Config +var ssaExp ssaExport + +func initssa() *ssa.Config { + ssaExp.unimplemented = false + ssaExp.mustImplement = true + if ssaConfig == nil { + ssaConfig = ssa.NewConfig(Thearch.Thestring, &ssaExp, Ctxt, Debug['N'] == 0) + } + return ssaConfig +} + +func shouldssa(fn *Node) bool { + if Thearch.Thestring != "amd64" { + return false + } + + // Environment variable control of SSA CG + // 1. IF GOSSAFUNC == current function name THEN + // compile this function with SSA and log output to ssa.html + + // 2. IF GOSSAHASH == "" THEN + // compile this function (and everything else) with SSA + + // 3. IF GOSSAHASH == "n" or "N" + // IF GOSSAPKG == current package name THEN + // compile this function (and everything in this package) with SSA + // ELSE + // use the old back end for this function. + // This is for compatibility with existing test harness and should go away. + + // 4. IF GOSSAHASH is a suffix of the binary-rendered SHA1 hash of the function name THEN + // compile this function with SSA + // ELSE + // compile this function with the old back end. + + // Plan is for 3 to be removed when the tests are revised. + // SSA is now default, and is disabled by setting + // GOSSAHASH to n or N, or selectively with strings of + // 0 and 1. + + name := fn.Func.Nname.Sym.Name + + funcname := os.Getenv("GOSSAFUNC") + if funcname != "" { + // If GOSSAFUNC is set, compile only that function. + return name == funcname + } + + pkg := os.Getenv("GOSSAPKG") + if pkg != "" { + // If GOSSAPKG is set, compile only that package. + return localpkg.Name == pkg + } + + return initssa().DebugHashMatch("GOSSAHASH", name) +} + +// buildssa builds an SSA function. +func buildssa(fn *Node) *ssa.Func { + name := fn.Func.Nname.Sym.Name + printssa := strings.HasSuffix(name, "_ssa") || strings.Contains(name, "_ssa.") || name == os.Getenv("GOSSAFUNC") + if printssa { + fmt.Println("generating SSA for", name) + dumpslice("buildssa-enter", fn.Func.Enter.Slice()) + dumpslice("buildssa-body", fn.Nbody.Slice()) + dumpslice("buildssa-exit", fn.Func.Exit.Slice()) + } + + var s state + s.pushLine(fn.Lineno) + defer s.popLine() + + if fn.Func.Pragma&CgoUnsafeArgs != 0 { + s.cgoUnsafeArgs = true + } + // TODO(khr): build config just once at the start of the compiler binary + + ssaExp.log = printssa + + s.config = initssa() + s.f = s.config.NewFunc() + s.f.Name = name + s.exitCode = fn.Func.Exit + s.panics = map[funcLine]*ssa.Block{} + + if name == os.Getenv("GOSSAFUNC") { + // TODO: tempfile? it is handy to have the location + // of this file be stable, so you can just reload in the browser. + s.config.HTML = ssa.NewHTMLWriter("ssa.html", s.config, name) + // TODO: generate and print a mapping from nodes to values and blocks + } + defer func() { + if !printssa { + s.config.HTML.Close() + } + }() + + // Allocate starting block + s.f.Entry = s.f.NewBlock(ssa.BlockPlain) + + // Allocate starting values + s.labels = map[string]*ssaLabel{} + s.labeledNodes = map[*Node]*ssaLabel{} + s.startmem = s.entryNewValue0(ssa.OpInitMem, ssa.TypeMem) + s.sp = s.entryNewValue0(ssa.OpSP, Types[TUINTPTR]) // TODO: use generic pointer type (unsafe.Pointer?) instead + s.sb = s.entryNewValue0(ssa.OpSB, Types[TUINTPTR]) + + s.startBlock(s.f.Entry) + s.vars[&memVar] = s.startmem + + s.varsyms = map[*Node]interface{}{} + + // Generate addresses of local declarations + s.decladdrs = map[*Node]*ssa.Value{} + for _, n := range fn.Func.Dcl { + switch n.Class { + case PPARAM, PPARAMOUT: + aux := s.lookupSymbol(n, &ssa.ArgSymbol{Typ: n.Type, Node: n}) + s.decladdrs[n] = s.entryNewValue1A(ssa.OpAddr, Ptrto(n.Type), aux, s.sp) + if n.Class == PPARAMOUT && s.canSSA(n) { + // Save ssa-able PPARAMOUT variables so we can + // store them back to the stack at the end of + // the function. + s.returns = append(s.returns, n) + } + case PAUTO | PHEAP: + // TODO this looks wrong for PAUTO|PHEAP, no vardef, but also no definition + aux := s.lookupSymbol(n, &ssa.AutoSymbol{Typ: n.Type, Node: n}) + s.decladdrs[n] = s.entryNewValue1A(ssa.OpAddr, Ptrto(n.Type), aux, s.sp) + case PPARAM | PHEAP, PPARAMOUT | PHEAP: + // This ends up wrong, have to do it at the PARAM node instead. + case PAUTO: + // processed at each use, to prevent Addr coming + // before the decl. + case PFUNC: + // local function - already handled by frontend + default: + str := "" + if n.Class&PHEAP != 0 { + str = ",heap" + } + s.Unimplementedf("local variable with class %s%s unimplemented", classnames[n.Class&^PHEAP], str) + } + } + + // Convert the AST-based IR to the SSA-based IR + s.stmts(fn.Func.Enter) + s.stmts(fn.Nbody) + + // fallthrough to exit + if s.curBlock != nil { + s.stmts(s.exitCode) + m := s.mem() + b := s.endBlock() + b.Kind = ssa.BlockRet + b.Control = m + } + + // Check that we used all labels + for name, lab := range s.labels { + if !lab.used() && !lab.reported { + yyerrorl(int(lab.defNode.Lineno), "label %v defined and not used", name) + lab.reported = true + } + if lab.used() && !lab.defined() && !lab.reported { + yyerrorl(int(lab.useNode.Lineno), "label %v not defined", name) + lab.reported = true + } + } + + // Check any forward gotos. Non-forward gotos have already been checked. + for _, n := range s.fwdGotos { + lab := s.labels[n.Left.Sym.Name] + // If the label is undefined, we have already have printed an error. + if lab.defined() { + s.checkgoto(n, lab.defNode) + } + } + + if nerrors > 0 { + s.f.Free() + return nil + } + + // Link up variable uses to variable definitions + s.linkForwardReferences() + + // Don't carry reference this around longer than necessary + s.exitCode = Nodes{} + + // Main call to ssa package to compile function + ssa.Compile(s.f) + + return s.f +} + +type state struct { + // configuration (arch) information + config *ssa.Config + + // function we're building + f *ssa.Func + + // labels and labeled control flow nodes (OFOR, OSWITCH, OSELECT) in f + labels map[string]*ssaLabel + labeledNodes map[*Node]*ssaLabel + + // gotos that jump forward; required for deferred checkgoto calls + fwdGotos []*Node + // Code that must precede any return + // (e.g., copying value of heap-escaped paramout back to true paramout) + exitCode Nodes + + // unlabeled break and continue statement tracking + breakTo *ssa.Block // current target for plain break statement + continueTo *ssa.Block // current target for plain continue statement + + // current location where we're interpreting the AST + curBlock *ssa.Block + + // variable assignments in the current block (map from variable symbol to ssa value) + // *Node is the unique identifier (an ONAME Node) for the variable. + vars map[*Node]*ssa.Value + + // all defined variables at the end of each block. Indexed by block ID. + defvars []map[*Node]*ssa.Value + + // addresses of PPARAM and PPARAMOUT variables. + decladdrs map[*Node]*ssa.Value + + // symbols for PEXTERN, PAUTO and PPARAMOUT variables so they can be reused. + varsyms map[*Node]interface{} + + // starting values. Memory, stack pointer, and globals pointer + startmem *ssa.Value + sp *ssa.Value + sb *ssa.Value + + // line number stack. The current line number is top of stack + line []int32 + + // list of panic calls by function name and line number. + // Used to deduplicate panic calls. + panics map[funcLine]*ssa.Block + + // list of FwdRef values. + fwdRefs []*ssa.Value + + // list of PPARAMOUT (return) variables. Does not include PPARAM|PHEAP vars. + returns []*Node + + cgoUnsafeArgs bool +} + +type funcLine struct { + f *Node + line int32 +} + +type ssaLabel struct { + target *ssa.Block // block identified by this label + breakTarget *ssa.Block // block to break to in control flow node identified by this label + continueTarget *ssa.Block // block to continue to in control flow node identified by this label + defNode *Node // label definition Node (OLABEL) + // Label use Node (OGOTO, OBREAK, OCONTINUE). + // Used only for error detection and reporting. + // There might be multiple uses, but we only need to track one. + useNode *Node + reported bool // reported indicates whether an error has already been reported for this label +} + +// defined reports whether the label has a definition (OLABEL node). +func (l *ssaLabel) defined() bool { return l.defNode != nil } + +// used reports whether the label has a use (OGOTO, OBREAK, or OCONTINUE node). +func (l *ssaLabel) used() bool { return l.useNode != nil } + +// label returns the label associated with sym, creating it if necessary. +func (s *state) label(sym *Sym) *ssaLabel { + lab := s.labels[sym.Name] + if lab == nil { + lab = new(ssaLabel) + s.labels[sym.Name] = lab + } + return lab +} + +func (s *state) Logf(msg string, args ...interface{}) { s.config.Logf(msg, args...) } +func (s *state) Log() bool { return s.config.Log() } +func (s *state) Fatalf(msg string, args ...interface{}) { s.config.Fatalf(s.peekLine(), msg, args...) } +func (s *state) Unimplementedf(msg string, args ...interface{}) { + s.config.Unimplementedf(s.peekLine(), msg, args...) +} +func (s *state) Warnl(line int, msg string, args ...interface{}) { s.config.Warnl(line, msg, args...) } +func (s *state) Debug_checknil() bool { return s.config.Debug_checknil() } + +var ( + // dummy node for the memory variable + memVar = Node{Op: ONAME, Class: Pxxx, Sym: &Sym{Name: "mem"}} + + // dummy nodes for temporary variables + ptrVar = Node{Op: ONAME, Class: Pxxx, Sym: &Sym{Name: "ptr"}} + capVar = Node{Op: ONAME, Class: Pxxx, Sym: &Sym{Name: "cap"}} + typVar = Node{Op: ONAME, Class: Pxxx, Sym: &Sym{Name: "typ"}} + idataVar = Node{Op: ONAME, Class: Pxxx, Sym: &Sym{Name: "idata"}} + okVar = Node{Op: ONAME, Class: Pxxx, Sym: &Sym{Name: "ok"}} +) + +// startBlock sets the current block we're generating code in to b. +func (s *state) startBlock(b *ssa.Block) { + if s.curBlock != nil { + s.Fatalf("starting block %v when block %v has not ended", b, s.curBlock) + } + s.curBlock = b + s.vars = map[*Node]*ssa.Value{} +} + +// endBlock marks the end of generating code for the current block. +// Returns the (former) current block. Returns nil if there is no current +// block, i.e. if no code flows to the current execution point. +func (s *state) endBlock() *ssa.Block { + b := s.curBlock + if b == nil { + return nil + } + for len(s.defvars) <= int(b.ID) { + s.defvars = append(s.defvars, nil) + } + s.defvars[b.ID] = s.vars + s.curBlock = nil + s.vars = nil + b.Line = s.peekLine() + return b +} + +// pushLine pushes a line number on the line number stack. +func (s *state) pushLine(line int32) { + s.line = append(s.line, line) +} + +// popLine pops the top of the line number stack. +func (s *state) popLine() { + s.line = s.line[:len(s.line)-1] +} + +// peekLine peek the top of the line number stack. +func (s *state) peekLine() int32 { + return s.line[len(s.line)-1] +} + +func (s *state) Error(msg string, args ...interface{}) { + yyerrorl(int(s.peekLine()), msg, args...) +} + +// newValue0 adds a new value with no arguments to the current block. +func (s *state) newValue0(op ssa.Op, t ssa.Type) *ssa.Value { + return s.curBlock.NewValue0(s.peekLine(), op, t) +} + +// newValue0A adds a new value with no arguments and an aux value to the current block. +func (s *state) newValue0A(op ssa.Op, t ssa.Type, aux interface{}) *ssa.Value { + return s.curBlock.NewValue0A(s.peekLine(), op, t, aux) +} + +// newValue0I adds a new value with no arguments and an auxint value to the current block. +func (s *state) newValue0I(op ssa.Op, t ssa.Type, auxint int64) *ssa.Value { + return s.curBlock.NewValue0I(s.peekLine(), op, t, auxint) +} + +// newValue1 adds a new value with one argument to the current block. +func (s *state) newValue1(op ssa.Op, t ssa.Type, arg *ssa.Value) *ssa.Value { + return s.curBlock.NewValue1(s.peekLine(), op, t, arg) +} + +// newValue1A adds a new value with one argument and an aux value to the current block. +func (s *state) newValue1A(op ssa.Op, t ssa.Type, aux interface{}, arg *ssa.Value) *ssa.Value { + return s.curBlock.NewValue1A(s.peekLine(), op, t, aux, arg) +} + +// newValue1I adds a new value with one argument and an auxint value to the current block. +func (s *state) newValue1I(op ssa.Op, t ssa.Type, aux int64, arg *ssa.Value) *ssa.Value { + return s.curBlock.NewValue1I(s.peekLine(), op, t, aux, arg) +} + +// newValue2 adds a new value with two arguments to the current block. +func (s *state) newValue2(op ssa.Op, t ssa.Type, arg0, arg1 *ssa.Value) *ssa.Value { + return s.curBlock.NewValue2(s.peekLine(), op, t, arg0, arg1) +} + +// newValue2I adds a new value with two arguments and an auxint value to the current block. +func (s *state) newValue2I(op ssa.Op, t ssa.Type, aux int64, arg0, arg1 *ssa.Value) *ssa.Value { + return s.curBlock.NewValue2I(s.peekLine(), op, t, aux, arg0, arg1) +} + +// newValue3 adds a new value with three arguments to the current block. +func (s *state) newValue3(op ssa.Op, t ssa.Type, arg0, arg1, arg2 *ssa.Value) *ssa.Value { + return s.curBlock.NewValue3(s.peekLine(), op, t, arg0, arg1, arg2) +} + +// newValue3I adds a new value with three arguments and an auxint value to the current block. +func (s *state) newValue3I(op ssa.Op, t ssa.Type, aux int64, arg0, arg1, arg2 *ssa.Value) *ssa.Value { + return s.curBlock.NewValue3I(s.peekLine(), op, t, aux, arg0, arg1, arg2) +} + +// entryNewValue0 adds a new value with no arguments to the entry block. +func (s *state) entryNewValue0(op ssa.Op, t ssa.Type) *ssa.Value { + return s.f.Entry.NewValue0(s.peekLine(), op, t) +} + +// entryNewValue0A adds a new value with no arguments and an aux value to the entry block. +func (s *state) entryNewValue0A(op ssa.Op, t ssa.Type, aux interface{}) *ssa.Value { + return s.f.Entry.NewValue0A(s.peekLine(), op, t, aux) +} + +// entryNewValue0I adds a new value with no arguments and an auxint value to the entry block. +func (s *state) entryNewValue0I(op ssa.Op, t ssa.Type, auxint int64) *ssa.Value { + return s.f.Entry.NewValue0I(s.peekLine(), op, t, auxint) +} + +// entryNewValue1 adds a new value with one argument to the entry block. +func (s *state) entryNewValue1(op ssa.Op, t ssa.Type, arg *ssa.Value) *ssa.Value { + return s.f.Entry.NewValue1(s.peekLine(), op, t, arg) +} + +// entryNewValue1 adds a new value with one argument and an auxint value to the entry block. +func (s *state) entryNewValue1I(op ssa.Op, t ssa.Type, auxint int64, arg *ssa.Value) *ssa.Value { + return s.f.Entry.NewValue1I(s.peekLine(), op, t, auxint, arg) +} + +// entryNewValue1A adds a new value with one argument and an aux value to the entry block. +func (s *state) entryNewValue1A(op ssa.Op, t ssa.Type, aux interface{}, arg *ssa.Value) *ssa.Value { + return s.f.Entry.NewValue1A(s.peekLine(), op, t, aux, arg) +} + +// entryNewValue2 adds a new value with two arguments to the entry block. +func (s *state) entryNewValue2(op ssa.Op, t ssa.Type, arg0, arg1 *ssa.Value) *ssa.Value { + return s.f.Entry.NewValue2(s.peekLine(), op, t, arg0, arg1) +} + +// const* routines add a new const value to the entry block. +func (s *state) constBool(c bool) *ssa.Value { + return s.f.ConstBool(s.peekLine(), Types[TBOOL], c) +} +func (s *state) constInt8(t ssa.Type, c int8) *ssa.Value { + return s.f.ConstInt8(s.peekLine(), t, c) +} +func (s *state) constInt16(t ssa.Type, c int16) *ssa.Value { + return s.f.ConstInt16(s.peekLine(), t, c) +} +func (s *state) constInt32(t ssa.Type, c int32) *ssa.Value { + return s.f.ConstInt32(s.peekLine(), t, c) +} +func (s *state) constInt64(t ssa.Type, c int64) *ssa.Value { + return s.f.ConstInt64(s.peekLine(), t, c) +} +func (s *state) constFloat32(t ssa.Type, c float64) *ssa.Value { + return s.f.ConstFloat32(s.peekLine(), t, c) +} +func (s *state) constFloat64(t ssa.Type, c float64) *ssa.Value { + return s.f.ConstFloat64(s.peekLine(), t, c) +} +func (s *state) constInt(t ssa.Type, c int64) *ssa.Value { + if s.config.IntSize == 8 { + return s.constInt64(t, c) + } + if int64(int32(c)) != c { + s.Fatalf("integer constant too big %d", c) + } + return s.constInt32(t, int32(c)) +} + +func (s *state) stmts(a Nodes) { + for _, x := range a.Slice() { + s.stmt(x) + } +} + +// ssaStmtList converts the statement n to SSA and adds it to s. +func (s *state) stmtList(l *NodeList) { + for ; l != nil; l = l.Next { + s.stmt(l.N) + } +} + +// ssaStmt converts the statement n to SSA and adds it to s. +func (s *state) stmt(n *Node) { + s.pushLine(n.Lineno) + defer s.popLine() + + // If s.curBlock is nil, then we're about to generate dead code. + // We can't just short-circuit here, though, + // because we check labels and gotos as part of SSA generation. + // Provide a block for the dead code so that we don't have + // to add special cases everywhere else. + if s.curBlock == nil { + dead := s.f.NewBlock(ssa.BlockPlain) + s.startBlock(dead) + } + + s.stmtList(n.Ninit) + switch n.Op { + + case OBLOCK: + s.stmtList(n.List) + + // No-ops + case OEMPTY, ODCLCONST, ODCLTYPE, OFALL: + + // Expression statements + case OCALLFUNC, OCALLMETH, OCALLINTER: + s.call(n, callNormal) + if n.Op == OCALLFUNC && n.Left.Op == ONAME && n.Left.Class == PFUNC && + (compiling_runtime != 0 && n.Left.Sym.Name == "throw" || + n.Left.Sym.Pkg == Runtimepkg && (n.Left.Sym.Name == "gopanic" || n.Left.Sym.Name == "selectgo" || n.Left.Sym.Name == "block")) { + m := s.mem() + b := s.endBlock() + b.Kind = ssa.BlockExit + b.Control = m + // TODO: never rewrite OPANIC to OCALLFUNC in the + // first place. Need to wait until all backends + // go through SSA. + } + case ODEFER: + s.call(n.Left, callDefer) + case OPROC: + s.call(n.Left, callGo) + + case OAS2DOTTYPE: + res, resok := s.dottype(n.Rlist.N, true) + s.assign(n.List.N, res, needwritebarrier(n.List.N, n.Rlist.N), false, n.Lineno) + s.assign(n.List.Next.N, resok, false, false, n.Lineno) + return + + case ODCL: + if n.Left.Class&PHEAP == 0 { + return + } + if compiling_runtime != 0 { + Fatalf("%v escapes to heap, not allowed in runtime.", n) + } + + // TODO: the old pass hides the details of PHEAP + // variables behind ONAME nodes. Figure out if it's better + // to rewrite the tree and make the heapaddr construct explicit + // or to keep this detail hidden behind the scenes. + palloc := prealloc[n.Left] + if palloc == nil { + palloc = callnew(n.Left.Type) + prealloc[n.Left] = palloc + } + r := s.expr(palloc) + s.assign(n.Left.Name.Heapaddr, r, false, false, n.Lineno) + + case OLABEL: + sym := n.Left.Sym + + if isblanksym(sym) { + // Empty identifier is valid but useless. + // See issues 11589, 11593. + return + } + + lab := s.label(sym) + + // Associate label with its control flow node, if any + if ctl := n.Name.Defn; ctl != nil { + switch ctl.Op { + case OFOR, OSWITCH, OSELECT: + s.labeledNodes[ctl] = lab + } + } + + if !lab.defined() { + lab.defNode = n + } else { + s.Error("label %v already defined at %v", sym, Ctxt.Line(int(lab.defNode.Lineno))) + lab.reported = true + } + // The label might already have a target block via a goto. + if lab.target == nil { + lab.target = s.f.NewBlock(ssa.BlockPlain) + } + + // go to that label (we pretend "label:" is preceded by "goto label") + b := s.endBlock() + b.AddEdgeTo(lab.target) + s.startBlock(lab.target) + + case OGOTO: + sym := n.Left.Sym + + lab := s.label(sym) + if lab.target == nil { + lab.target = s.f.NewBlock(ssa.BlockPlain) + } + if !lab.used() { + lab.useNode = n + } + + if lab.defined() { + s.checkgoto(n, lab.defNode) + } else { + s.fwdGotos = append(s.fwdGotos, n) + } + + b := s.endBlock() + b.AddEdgeTo(lab.target) + + case OAS, OASWB: + // Check whether we can generate static data rather than code. + // If so, ignore n and defer data generation until codegen. + // Failure to do this causes writes to readonly symbols. + if gen_as_init(n, true) { + var data []*Node + if s.f.StaticData != nil { + data = s.f.StaticData.([]*Node) + } + s.f.StaticData = append(data, n) + return + } + + var t *Type + if n.Right != nil { + t = n.Right.Type + } else { + t = n.Left.Type + } + + // Evaluate RHS. + rhs := n.Right + if rhs != nil && (rhs.Op == OSTRUCTLIT || rhs.Op == OARRAYLIT) { + // All literals with nonzero fields have already been + // rewritten during walk. Any that remain are just T{} + // or equivalents. Use the zero value. + if !iszero(rhs) { + Fatalf("literal with nonzero value in SSA: %v", rhs) + } + rhs = nil + } + var r *ssa.Value + needwb := n.Op == OASWB && rhs != nil + deref := !canSSAType(t) + if deref { + if rhs == nil { + r = nil // Signal assign to use OpZero. + } else { + r = s.addr(rhs, false) + } + } else { + if rhs == nil { + r = s.zeroVal(t) + } else { + r = s.expr(rhs) + } + } + if rhs != nil && rhs.Op == OAPPEND { + // Yuck! The frontend gets rid of the write barrier, but we need it! + // At least, we need it in the case where growslice is called. + // TODO: Do the write barrier on just the growslice branch. + // TODO: just add a ptr graying to the end of growslice? + // TODO: check whether we need to do this for ODOTTYPE and ORECV also. + // They get similar wb-removal treatment in walk.go:OAS. + needwb = true + } + + s.assign(n.Left, r, needwb, deref, n.Lineno) + + case OIF: + bThen := s.f.NewBlock(ssa.BlockPlain) + bEnd := s.f.NewBlock(ssa.BlockPlain) + var bElse *ssa.Block + if n.Rlist != nil { + bElse = s.f.NewBlock(ssa.BlockPlain) + s.condBranch(n.Left, bThen, bElse, n.Likely) + } else { + s.condBranch(n.Left, bThen, bEnd, n.Likely) + } + + s.startBlock(bThen) + s.stmts(n.Nbody) + if b := s.endBlock(); b != nil { + b.AddEdgeTo(bEnd) + } + + if n.Rlist != nil { + s.startBlock(bElse) + s.stmtList(n.Rlist) + if b := s.endBlock(); b != nil { + b.AddEdgeTo(bEnd) + } + } + s.startBlock(bEnd) + + case ORETURN: + s.stmtList(n.List) + s.exit() + case ORETJMP: + s.stmtList(n.List) + b := s.exit() + b.Kind = ssa.BlockRetJmp // override BlockRet + b.Aux = n.Left.Sym + + case OCONTINUE, OBREAK: + var op string + var to *ssa.Block + switch n.Op { + case OCONTINUE: + op = "continue" + to = s.continueTo + case OBREAK: + op = "break" + to = s.breakTo + } + if n.Left == nil { + // plain break/continue + if to == nil { + s.Error("%s is not in a loop", op) + return + } + // nothing to do; "to" is already the correct target + } else { + // labeled break/continue; look up the target + sym := n.Left.Sym + lab := s.label(sym) + if !lab.used() { + lab.useNode = n.Left + } + if !lab.defined() { + s.Error("%s label not defined: %v", op, sym) + lab.reported = true + return + } + switch n.Op { + case OCONTINUE: + to = lab.continueTarget + case OBREAK: + to = lab.breakTarget + } + if to == nil { + // Valid label but not usable with a break/continue here, e.g.: + // for { + // continue abc + // } + // abc: + // for {} + s.Error("invalid %s label %v", op, sym) + lab.reported = true + return + } + } + + b := s.endBlock() + b.AddEdgeTo(to) + + case OFOR: + // OFOR: for Ninit; Left; Right { Nbody } + bCond := s.f.NewBlock(ssa.BlockPlain) + bBody := s.f.NewBlock(ssa.BlockPlain) + bIncr := s.f.NewBlock(ssa.BlockPlain) + bEnd := s.f.NewBlock(ssa.BlockPlain) + + // first, jump to condition test + b := s.endBlock() + b.AddEdgeTo(bCond) + + // generate code to test condition + s.startBlock(bCond) + if n.Left != nil { + s.condBranch(n.Left, bBody, bEnd, 1) + } else { + b := s.endBlock() + b.Kind = ssa.BlockPlain + b.AddEdgeTo(bBody) + } + + // set up for continue/break in body + prevContinue := s.continueTo + prevBreak := s.breakTo + s.continueTo = bIncr + s.breakTo = bEnd + lab := s.labeledNodes[n] + if lab != nil { + // labeled for loop + lab.continueTarget = bIncr + lab.breakTarget = bEnd + } + + // generate body + s.startBlock(bBody) + s.stmts(n.Nbody) + + // tear down continue/break + s.continueTo = prevContinue + s.breakTo = prevBreak + if lab != nil { + lab.continueTarget = nil + lab.breakTarget = nil + } + + // done with body, goto incr + if b := s.endBlock(); b != nil { + b.AddEdgeTo(bIncr) + } + + // generate incr + s.startBlock(bIncr) + if n.Right != nil { + s.stmt(n.Right) + } + if b := s.endBlock(); b != nil { + b.AddEdgeTo(bCond) + } + s.startBlock(bEnd) + + case OSWITCH, OSELECT: + // These have been mostly rewritten by the front end into their Nbody fields. + // Our main task is to correctly hook up any break statements. + bEnd := s.f.NewBlock(ssa.BlockPlain) + + prevBreak := s.breakTo + s.breakTo = bEnd + lab := s.labeledNodes[n] + if lab != nil { + // labeled + lab.breakTarget = bEnd + } + + // generate body code + s.stmts(n.Nbody) + + s.breakTo = prevBreak + if lab != nil { + lab.breakTarget = nil + } + + // OSWITCH never falls through (s.curBlock == nil here). + // OSELECT does not fall through if we're calling selectgo. + // OSELECT does fall through if we're calling selectnb{send,recv}[2]. + // In those latter cases, go to the code after the select. + if b := s.endBlock(); b != nil { + b.AddEdgeTo(bEnd) + } + s.startBlock(bEnd) + + case OVARKILL: + // Insert a varkill op to record that a variable is no longer live. + // We only care about liveness info at call sites, so putting the + // varkill in the store chain is enough to keep it correctly ordered + // with respect to call ops. + if !s.canSSA(n.Left) { + s.vars[&memVar] = s.newValue1A(ssa.OpVarKill, ssa.TypeMem, n.Left, s.mem()) + } + + case OVARLIVE: + // Insert a varlive op to record that a variable is still live. + if !n.Left.Addrtaken { + s.Fatalf("VARLIVE variable %s must have Addrtaken set", n.Left) + } + s.vars[&memVar] = s.newValue1A(ssa.OpVarLive, ssa.TypeMem, n.Left, s.mem()) + + case OCHECKNIL: + p := s.expr(n.Left) + s.nilCheck(p) + + default: + s.Unimplementedf("unhandled stmt %s", opnames[n.Op]) + } +} + +// exit processes any code that needs to be generated just before returning. +// It returns a BlockRet block that ends the control flow. Its control value +// will be set to the final memory state. +func (s *state) exit() *ssa.Block { + // Run exit code. Typically, this code copies heap-allocated PPARAMOUT + // variables back to the stack. + s.stmts(s.exitCode) + + // Store SSAable PPARAMOUT variables back to stack locations. + for _, n := range s.returns { + aux := &ssa.ArgSymbol{Typ: n.Type, Node: n} + addr := s.newValue1A(ssa.OpAddr, Ptrto(n.Type), aux, s.sp) + val := s.variable(n, n.Type) + s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, ssa.TypeMem, n, s.mem()) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, n.Type.Size(), addr, val, s.mem()) + // TODO: if val is ever spilled, we'd like to use the + // PPARAMOUT slot for spilling it. That won't happen + // currently. + } + + // Do actual return. + m := s.mem() + b := s.endBlock() + b.Kind = ssa.BlockRet + b.Control = m + return b +} + +type opAndType struct { + op Op + etype EType +} + +var opToSSA = map[opAndType]ssa.Op{ + opAndType{OADD, TINT8}: ssa.OpAdd8, + opAndType{OADD, TUINT8}: ssa.OpAdd8, + opAndType{OADD, TINT16}: ssa.OpAdd16, + opAndType{OADD, TUINT16}: ssa.OpAdd16, + opAndType{OADD, TINT32}: ssa.OpAdd32, + opAndType{OADD, TUINT32}: ssa.OpAdd32, + opAndType{OADD, TPTR32}: ssa.OpAdd32, + opAndType{OADD, TINT64}: ssa.OpAdd64, + opAndType{OADD, TUINT64}: ssa.OpAdd64, + opAndType{OADD, TPTR64}: ssa.OpAdd64, + opAndType{OADD, TFLOAT32}: ssa.OpAdd32F, + opAndType{OADD, TFLOAT64}: ssa.OpAdd64F, + + opAndType{OSUB, TINT8}: ssa.OpSub8, + opAndType{OSUB, TUINT8}: ssa.OpSub8, + opAndType{OSUB, TINT16}: ssa.OpSub16, + opAndType{OSUB, TUINT16}: ssa.OpSub16, + opAndType{OSUB, TINT32}: ssa.OpSub32, + opAndType{OSUB, TUINT32}: ssa.OpSub32, + opAndType{OSUB, TINT64}: ssa.OpSub64, + opAndType{OSUB, TUINT64}: ssa.OpSub64, + opAndType{OSUB, TFLOAT32}: ssa.OpSub32F, + opAndType{OSUB, TFLOAT64}: ssa.OpSub64F, + + opAndType{ONOT, TBOOL}: ssa.OpNot, + + opAndType{OMINUS, TINT8}: ssa.OpNeg8, + opAndType{OMINUS, TUINT8}: ssa.OpNeg8, + opAndType{OMINUS, TINT16}: ssa.OpNeg16, + opAndType{OMINUS, TUINT16}: ssa.OpNeg16, + opAndType{OMINUS, TINT32}: ssa.OpNeg32, + opAndType{OMINUS, TUINT32}: ssa.OpNeg32, + opAndType{OMINUS, TINT64}: ssa.OpNeg64, + opAndType{OMINUS, TUINT64}: ssa.OpNeg64, + opAndType{OMINUS, TFLOAT32}: ssa.OpNeg32F, + opAndType{OMINUS, TFLOAT64}: ssa.OpNeg64F, + + opAndType{OCOM, TINT8}: ssa.OpCom8, + opAndType{OCOM, TUINT8}: ssa.OpCom8, + opAndType{OCOM, TINT16}: ssa.OpCom16, + opAndType{OCOM, TUINT16}: ssa.OpCom16, + opAndType{OCOM, TINT32}: ssa.OpCom32, + opAndType{OCOM, TUINT32}: ssa.OpCom32, + opAndType{OCOM, TINT64}: ssa.OpCom64, + opAndType{OCOM, TUINT64}: ssa.OpCom64, + + opAndType{OIMAG, TCOMPLEX64}: ssa.OpComplexImag, + opAndType{OIMAG, TCOMPLEX128}: ssa.OpComplexImag, + opAndType{OREAL, TCOMPLEX64}: ssa.OpComplexReal, + opAndType{OREAL, TCOMPLEX128}: ssa.OpComplexReal, + + opAndType{OMUL, TINT8}: ssa.OpMul8, + opAndType{OMUL, TUINT8}: ssa.OpMul8, + opAndType{OMUL, TINT16}: ssa.OpMul16, + opAndType{OMUL, TUINT16}: ssa.OpMul16, + opAndType{OMUL, TINT32}: ssa.OpMul32, + opAndType{OMUL, TUINT32}: ssa.OpMul32, + opAndType{OMUL, TINT64}: ssa.OpMul64, + opAndType{OMUL, TUINT64}: ssa.OpMul64, + opAndType{OMUL, TFLOAT32}: ssa.OpMul32F, + opAndType{OMUL, TFLOAT64}: ssa.OpMul64F, + + 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, + opAndType{ODIV, TUINT16}: ssa.OpDiv16u, + opAndType{ODIV, TINT32}: ssa.OpDiv32, + opAndType{ODIV, TUINT32}: ssa.OpDiv32u, + opAndType{ODIV, TINT64}: ssa.OpDiv64, + opAndType{ODIV, TUINT64}: ssa.OpDiv64u, + + opAndType{OMOD, TINT8}: ssa.OpMod8, + opAndType{OMOD, TUINT8}: ssa.OpMod8u, + opAndType{OMOD, TINT16}: ssa.OpMod16, + opAndType{OMOD, TUINT16}: ssa.OpMod16u, + opAndType{OMOD, TINT32}: ssa.OpMod32, + opAndType{OMOD, TUINT32}: ssa.OpMod32u, + opAndType{OMOD, TINT64}: ssa.OpMod64, + opAndType{OMOD, TUINT64}: ssa.OpMod64u, + + opAndType{OAND, TINT8}: ssa.OpAnd8, + opAndType{OAND, TUINT8}: ssa.OpAnd8, + opAndType{OAND, TINT16}: ssa.OpAnd16, + opAndType{OAND, TUINT16}: ssa.OpAnd16, + opAndType{OAND, TINT32}: ssa.OpAnd32, + opAndType{OAND, TUINT32}: ssa.OpAnd32, + opAndType{OAND, TINT64}: ssa.OpAnd64, + opAndType{OAND, TUINT64}: ssa.OpAnd64, + + opAndType{OOR, TINT8}: ssa.OpOr8, + opAndType{OOR, TUINT8}: ssa.OpOr8, + opAndType{OOR, TINT16}: ssa.OpOr16, + opAndType{OOR, TUINT16}: ssa.OpOr16, + opAndType{OOR, TINT32}: ssa.OpOr32, + opAndType{OOR, TUINT32}: ssa.OpOr32, + opAndType{OOR, TINT64}: ssa.OpOr64, + opAndType{OOR, TUINT64}: ssa.OpOr64, + + opAndType{OXOR, TINT8}: ssa.OpXor8, + opAndType{OXOR, TUINT8}: ssa.OpXor8, + opAndType{OXOR, TINT16}: ssa.OpXor16, + opAndType{OXOR, TUINT16}: ssa.OpXor16, + opAndType{OXOR, TINT32}: ssa.OpXor32, + opAndType{OXOR, TUINT32}: ssa.OpXor32, + opAndType{OXOR, TINT64}: ssa.OpXor64, + opAndType{OXOR, TUINT64}: ssa.OpXor64, + + opAndType{OEQ, TBOOL}: ssa.OpEq8, + opAndType{OEQ, TINT8}: ssa.OpEq8, + opAndType{OEQ, TUINT8}: ssa.OpEq8, + opAndType{OEQ, TINT16}: ssa.OpEq16, + opAndType{OEQ, TUINT16}: ssa.OpEq16, + opAndType{OEQ, TINT32}: ssa.OpEq32, + opAndType{OEQ, TUINT32}: ssa.OpEq32, + opAndType{OEQ, TINT64}: ssa.OpEq64, + opAndType{OEQ, TUINT64}: ssa.OpEq64, + opAndType{OEQ, TINTER}: ssa.OpEqInter, + opAndType{OEQ, TARRAY}: ssa.OpEqSlice, + opAndType{OEQ, TFUNC}: ssa.OpEqPtr, + opAndType{OEQ, TMAP}: ssa.OpEqPtr, + opAndType{OEQ, TCHAN}: ssa.OpEqPtr, + opAndType{OEQ, TPTR64}: ssa.OpEqPtr, + opAndType{OEQ, TUINTPTR}: ssa.OpEqPtr, + opAndType{OEQ, TUNSAFEPTR}: ssa.OpEqPtr, + opAndType{OEQ, TFLOAT64}: ssa.OpEq64F, + opAndType{OEQ, TFLOAT32}: ssa.OpEq32F, + + opAndType{ONE, TBOOL}: ssa.OpNeq8, + opAndType{ONE, TINT8}: ssa.OpNeq8, + opAndType{ONE, TUINT8}: ssa.OpNeq8, + opAndType{ONE, TINT16}: ssa.OpNeq16, + opAndType{ONE, TUINT16}: ssa.OpNeq16, + opAndType{ONE, TINT32}: ssa.OpNeq32, + opAndType{ONE, TUINT32}: ssa.OpNeq32, + opAndType{ONE, TINT64}: ssa.OpNeq64, + opAndType{ONE, TUINT64}: ssa.OpNeq64, + opAndType{ONE, TINTER}: ssa.OpNeqInter, + opAndType{ONE, TARRAY}: ssa.OpNeqSlice, + opAndType{ONE, TFUNC}: ssa.OpNeqPtr, + opAndType{ONE, TMAP}: ssa.OpNeqPtr, + opAndType{ONE, TCHAN}: ssa.OpNeqPtr, + opAndType{ONE, TPTR64}: ssa.OpNeqPtr, + opAndType{ONE, TUINTPTR}: ssa.OpNeqPtr, + opAndType{ONE, TUNSAFEPTR}: ssa.OpNeqPtr, + opAndType{ONE, TFLOAT64}: ssa.OpNeq64F, + opAndType{ONE, TFLOAT32}: ssa.OpNeq32F, + + opAndType{OLT, TINT8}: ssa.OpLess8, + opAndType{OLT, TUINT8}: ssa.OpLess8U, + opAndType{OLT, TINT16}: ssa.OpLess16, + opAndType{OLT, TUINT16}: ssa.OpLess16U, + opAndType{OLT, TINT32}: ssa.OpLess32, + opAndType{OLT, TUINT32}: ssa.OpLess32U, + opAndType{OLT, TINT64}: ssa.OpLess64, + opAndType{OLT, TUINT64}: ssa.OpLess64U, + opAndType{OLT, TFLOAT64}: ssa.OpLess64F, + opAndType{OLT, TFLOAT32}: ssa.OpLess32F, + + opAndType{OGT, TINT8}: ssa.OpGreater8, + opAndType{OGT, TUINT8}: ssa.OpGreater8U, + opAndType{OGT, TINT16}: ssa.OpGreater16, + opAndType{OGT, TUINT16}: ssa.OpGreater16U, + opAndType{OGT, TINT32}: ssa.OpGreater32, + opAndType{OGT, TUINT32}: ssa.OpGreater32U, + opAndType{OGT, TINT64}: ssa.OpGreater64, + opAndType{OGT, TUINT64}: ssa.OpGreater64U, + opAndType{OGT, TFLOAT64}: ssa.OpGreater64F, + opAndType{OGT, TFLOAT32}: ssa.OpGreater32F, + + opAndType{OLE, TINT8}: ssa.OpLeq8, + opAndType{OLE, TUINT8}: ssa.OpLeq8U, + opAndType{OLE, TINT16}: ssa.OpLeq16, + opAndType{OLE, TUINT16}: ssa.OpLeq16U, + opAndType{OLE, TINT32}: ssa.OpLeq32, + opAndType{OLE, TUINT32}: ssa.OpLeq32U, + opAndType{OLE, TINT64}: ssa.OpLeq64, + opAndType{OLE, TUINT64}: ssa.OpLeq64U, + opAndType{OLE, TFLOAT64}: ssa.OpLeq64F, + opAndType{OLE, TFLOAT32}: ssa.OpLeq32F, + + opAndType{OGE, TINT8}: ssa.OpGeq8, + opAndType{OGE, TUINT8}: ssa.OpGeq8U, + opAndType{OGE, TINT16}: ssa.OpGeq16, + opAndType{OGE, TUINT16}: ssa.OpGeq16U, + opAndType{OGE, TINT32}: ssa.OpGeq32, + opAndType{OGE, TUINT32}: ssa.OpGeq32U, + opAndType{OGE, TINT64}: ssa.OpGeq64, + opAndType{OGE, TUINT64}: ssa.OpGeq64U, + opAndType{OGE, TFLOAT64}: ssa.OpGeq64F, + opAndType{OGE, TFLOAT32}: ssa.OpGeq32F, + + opAndType{OLROT, TUINT8}: ssa.OpLrot8, + opAndType{OLROT, TUINT16}: ssa.OpLrot16, + opAndType{OLROT, TUINT32}: ssa.OpLrot32, + opAndType{OLROT, TUINT64}: ssa.OpLrot64, + + opAndType{OSQRT, TFLOAT64}: ssa.OpSqrt, +} + +func (s *state) concreteEtype(t *Type) EType { + e := t.Etype + switch e { + default: + return e + case TINT: + if s.config.IntSize == 8 { + return TINT64 + } + return TINT32 + case TUINT: + if s.config.IntSize == 8 { + return TUINT64 + } + return TUINT32 + case TUINTPTR: + if s.config.PtrSize == 8 { + return TUINT64 + } + return TUINT32 + } +} + +func (s *state) ssaOp(op Op, t *Type) ssa.Op { + etype := s.concreteEtype(t) + x, ok := opToSSA[opAndType{op, etype}] + if !ok { + s.Unimplementedf("unhandled binary op %s %s", opnames[op], Econv(etype)) + } + return x +} + +func floatForComplex(t *Type) *Type { + if t.Size() == 8 { + return Types[TFLOAT32] + } else { + return Types[TFLOAT64] + } +} + +type opAndTwoTypes struct { + op Op + etype1 EType + etype2 EType +} + +type twoTypes struct { + etype1 EType + etype2 EType +} + +type twoOpsAndType struct { + op1 ssa.Op + op2 ssa.Op + intermediateType EType +} + +var fpConvOpToSSA = map[twoTypes]twoOpsAndType{ + + twoTypes{TINT8, TFLOAT32}: twoOpsAndType{ssa.OpSignExt8to32, ssa.OpCvt32to32F, TINT32}, + twoTypes{TINT16, TFLOAT32}: twoOpsAndType{ssa.OpSignExt16to32, ssa.OpCvt32to32F, TINT32}, + twoTypes{TINT32, TFLOAT32}: twoOpsAndType{ssa.OpCopy, ssa.OpCvt32to32F, TINT32}, + twoTypes{TINT64, TFLOAT32}: twoOpsAndType{ssa.OpCopy, ssa.OpCvt64to32F, TINT64}, + + twoTypes{TINT8, TFLOAT64}: twoOpsAndType{ssa.OpSignExt8to32, ssa.OpCvt32to64F, TINT32}, + twoTypes{TINT16, TFLOAT64}: twoOpsAndType{ssa.OpSignExt16to32, ssa.OpCvt32to64F, TINT32}, + twoTypes{TINT32, TFLOAT64}: twoOpsAndType{ssa.OpCopy, ssa.OpCvt32to64F, TINT32}, + twoTypes{TINT64, TFLOAT64}: twoOpsAndType{ssa.OpCopy, ssa.OpCvt64to64F, TINT64}, + + twoTypes{TFLOAT32, TINT8}: twoOpsAndType{ssa.OpCvt32Fto32, ssa.OpTrunc32to8, TINT32}, + twoTypes{TFLOAT32, TINT16}: twoOpsAndType{ssa.OpCvt32Fto32, ssa.OpTrunc32to16, TINT32}, + twoTypes{TFLOAT32, TINT32}: twoOpsAndType{ssa.OpCvt32Fto32, ssa.OpCopy, TINT32}, + twoTypes{TFLOAT32, TINT64}: twoOpsAndType{ssa.OpCvt32Fto64, ssa.OpCopy, TINT64}, + + twoTypes{TFLOAT64, TINT8}: twoOpsAndType{ssa.OpCvt64Fto32, ssa.OpTrunc32to8, TINT32}, + twoTypes{TFLOAT64, TINT16}: twoOpsAndType{ssa.OpCvt64Fto32, ssa.OpTrunc32to16, TINT32}, + twoTypes{TFLOAT64, TINT32}: twoOpsAndType{ssa.OpCvt64Fto32, ssa.OpCopy, TINT32}, + twoTypes{TFLOAT64, TINT64}: twoOpsAndType{ssa.OpCvt64Fto64, ssa.OpCopy, TINT64}, + // unsigned + twoTypes{TUINT8, TFLOAT32}: twoOpsAndType{ssa.OpZeroExt8to32, ssa.OpCvt32to32F, TINT32}, + twoTypes{TUINT16, TFLOAT32}: twoOpsAndType{ssa.OpZeroExt16to32, ssa.OpCvt32to32F, TINT32}, + twoTypes{TUINT32, TFLOAT32}: twoOpsAndType{ssa.OpZeroExt32to64, ssa.OpCvt64to32F, TINT64}, // go wide to dodge unsigned + twoTypes{TUINT64, TFLOAT32}: twoOpsAndType{ssa.OpCopy, ssa.OpInvalid, TUINT64}, // Cvt64Uto32F, branchy code expansion instead + + twoTypes{TUINT8, TFLOAT64}: twoOpsAndType{ssa.OpZeroExt8to32, ssa.OpCvt32to64F, TINT32}, + twoTypes{TUINT16, TFLOAT64}: twoOpsAndType{ssa.OpZeroExt16to32, ssa.OpCvt32to64F, TINT32}, + twoTypes{TUINT32, TFLOAT64}: twoOpsAndType{ssa.OpZeroExt32to64, ssa.OpCvt64to64F, TINT64}, // go wide to dodge unsigned + twoTypes{TUINT64, TFLOAT64}: twoOpsAndType{ssa.OpCopy, ssa.OpInvalid, TUINT64}, // Cvt64Uto64F, branchy code expansion instead + + twoTypes{TFLOAT32, TUINT8}: twoOpsAndType{ssa.OpCvt32Fto32, ssa.OpTrunc32to8, TINT32}, + twoTypes{TFLOAT32, TUINT16}: twoOpsAndType{ssa.OpCvt32Fto32, ssa.OpTrunc32to16, TINT32}, + twoTypes{TFLOAT32, TUINT32}: twoOpsAndType{ssa.OpCvt32Fto64, ssa.OpTrunc64to32, TINT64}, // go wide to dodge unsigned + twoTypes{TFLOAT32, TUINT64}: twoOpsAndType{ssa.OpInvalid, ssa.OpCopy, TUINT64}, // Cvt32Fto64U, branchy code expansion instead + + twoTypes{TFLOAT64, TUINT8}: twoOpsAndType{ssa.OpCvt64Fto32, ssa.OpTrunc32to8, TINT32}, + twoTypes{TFLOAT64, TUINT16}: twoOpsAndType{ssa.OpCvt64Fto32, ssa.OpTrunc32to16, TINT32}, + twoTypes{TFLOAT64, TUINT32}: twoOpsAndType{ssa.OpCvt64Fto64, ssa.OpTrunc64to32, TINT64}, // go wide to dodge unsigned + twoTypes{TFLOAT64, TUINT64}: twoOpsAndType{ssa.OpInvalid, ssa.OpCopy, TUINT64}, // Cvt64Fto64U, branchy code expansion instead + + // float + twoTypes{TFLOAT64, TFLOAT32}: twoOpsAndType{ssa.OpCvt64Fto32F, ssa.OpCopy, TFLOAT32}, + twoTypes{TFLOAT64, TFLOAT64}: twoOpsAndType{ssa.OpCopy, ssa.OpCopy, TFLOAT64}, + twoTypes{TFLOAT32, TFLOAT32}: twoOpsAndType{ssa.OpCopy, ssa.OpCopy, TFLOAT32}, + twoTypes{TFLOAT32, TFLOAT64}: twoOpsAndType{ssa.OpCvt32Fto64F, ssa.OpCopy, TFLOAT64}, +} + +var shiftOpToSSA = map[opAndTwoTypes]ssa.Op{ + opAndTwoTypes{OLSH, TINT8, TUINT8}: ssa.OpLsh8x8, + opAndTwoTypes{OLSH, TUINT8, TUINT8}: ssa.OpLsh8x8, + opAndTwoTypes{OLSH, TINT8, TUINT16}: ssa.OpLsh8x16, + opAndTwoTypes{OLSH, TUINT8, TUINT16}: ssa.OpLsh8x16, + opAndTwoTypes{OLSH, TINT8, TUINT32}: ssa.OpLsh8x32, + opAndTwoTypes{OLSH, TUINT8, TUINT32}: ssa.OpLsh8x32, + opAndTwoTypes{OLSH, TINT8, TUINT64}: ssa.OpLsh8x64, + opAndTwoTypes{OLSH, TUINT8, TUINT64}: ssa.OpLsh8x64, + + opAndTwoTypes{OLSH, TINT16, TUINT8}: ssa.OpLsh16x8, + opAndTwoTypes{OLSH, TUINT16, TUINT8}: ssa.OpLsh16x8, + opAndTwoTypes{OLSH, TINT16, TUINT16}: ssa.OpLsh16x16, + opAndTwoTypes{OLSH, TUINT16, TUINT16}: ssa.OpLsh16x16, + opAndTwoTypes{OLSH, TINT16, TUINT32}: ssa.OpLsh16x32, + opAndTwoTypes{OLSH, TUINT16, TUINT32}: ssa.OpLsh16x32, + opAndTwoTypes{OLSH, TINT16, TUINT64}: ssa.OpLsh16x64, + opAndTwoTypes{OLSH, TUINT16, TUINT64}: ssa.OpLsh16x64, + + opAndTwoTypes{OLSH, TINT32, TUINT8}: ssa.OpLsh32x8, + opAndTwoTypes{OLSH, TUINT32, TUINT8}: ssa.OpLsh32x8, + opAndTwoTypes{OLSH, TINT32, TUINT16}: ssa.OpLsh32x16, + opAndTwoTypes{OLSH, TUINT32, TUINT16}: ssa.OpLsh32x16, + opAndTwoTypes{OLSH, TINT32, TUINT32}: ssa.OpLsh32x32, + opAndTwoTypes{OLSH, TUINT32, TUINT32}: ssa.OpLsh32x32, + opAndTwoTypes{OLSH, TINT32, TUINT64}: ssa.OpLsh32x64, + opAndTwoTypes{OLSH, TUINT32, TUINT64}: ssa.OpLsh32x64, + + opAndTwoTypes{OLSH, TINT64, TUINT8}: ssa.OpLsh64x8, + opAndTwoTypes{OLSH, TUINT64, TUINT8}: ssa.OpLsh64x8, + opAndTwoTypes{OLSH, TINT64, TUINT16}: ssa.OpLsh64x16, + opAndTwoTypes{OLSH, TUINT64, TUINT16}: ssa.OpLsh64x16, + opAndTwoTypes{OLSH, TINT64, TUINT32}: ssa.OpLsh64x32, + opAndTwoTypes{OLSH, TUINT64, TUINT32}: ssa.OpLsh64x32, + opAndTwoTypes{OLSH, TINT64, TUINT64}: ssa.OpLsh64x64, + opAndTwoTypes{OLSH, TUINT64, TUINT64}: ssa.OpLsh64x64, + + opAndTwoTypes{ORSH, TINT8, TUINT8}: ssa.OpRsh8x8, + opAndTwoTypes{ORSH, TUINT8, TUINT8}: ssa.OpRsh8Ux8, + opAndTwoTypes{ORSH, TINT8, TUINT16}: ssa.OpRsh8x16, + opAndTwoTypes{ORSH, TUINT8, TUINT16}: ssa.OpRsh8Ux16, + opAndTwoTypes{ORSH, TINT8, TUINT32}: ssa.OpRsh8x32, + opAndTwoTypes{ORSH, TUINT8, TUINT32}: ssa.OpRsh8Ux32, + opAndTwoTypes{ORSH, TINT8, TUINT64}: ssa.OpRsh8x64, + opAndTwoTypes{ORSH, TUINT8, TUINT64}: ssa.OpRsh8Ux64, + + opAndTwoTypes{ORSH, TINT16, TUINT8}: ssa.OpRsh16x8, + opAndTwoTypes{ORSH, TUINT16, TUINT8}: ssa.OpRsh16Ux8, + opAndTwoTypes{ORSH, TINT16, TUINT16}: ssa.OpRsh16x16, + opAndTwoTypes{ORSH, TUINT16, TUINT16}: ssa.OpRsh16Ux16, + opAndTwoTypes{ORSH, TINT16, TUINT32}: ssa.OpRsh16x32, + opAndTwoTypes{ORSH, TUINT16, TUINT32}: ssa.OpRsh16Ux32, + opAndTwoTypes{ORSH, TINT16, TUINT64}: ssa.OpRsh16x64, + opAndTwoTypes{ORSH, TUINT16, TUINT64}: ssa.OpRsh16Ux64, + + opAndTwoTypes{ORSH, TINT32, TUINT8}: ssa.OpRsh32x8, + opAndTwoTypes{ORSH, TUINT32, TUINT8}: ssa.OpRsh32Ux8, + opAndTwoTypes{ORSH, TINT32, TUINT16}: ssa.OpRsh32x16, + opAndTwoTypes{ORSH, TUINT32, TUINT16}: ssa.OpRsh32Ux16, + opAndTwoTypes{ORSH, TINT32, TUINT32}: ssa.OpRsh32x32, + opAndTwoTypes{ORSH, TUINT32, TUINT32}: ssa.OpRsh32Ux32, + opAndTwoTypes{ORSH, TINT32, TUINT64}: ssa.OpRsh32x64, + opAndTwoTypes{ORSH, TUINT32, TUINT64}: ssa.OpRsh32Ux64, + + opAndTwoTypes{ORSH, TINT64, TUINT8}: ssa.OpRsh64x8, + opAndTwoTypes{ORSH, TUINT64, TUINT8}: ssa.OpRsh64Ux8, + opAndTwoTypes{ORSH, TINT64, TUINT16}: ssa.OpRsh64x16, + opAndTwoTypes{ORSH, TUINT64, TUINT16}: ssa.OpRsh64Ux16, + opAndTwoTypes{ORSH, TINT64, TUINT32}: ssa.OpRsh64x32, + opAndTwoTypes{ORSH, TUINT64, TUINT32}: ssa.OpRsh64Ux32, + opAndTwoTypes{ORSH, TINT64, TUINT64}: ssa.OpRsh64x64, + opAndTwoTypes{ORSH, TUINT64, TUINT64}: ssa.OpRsh64Ux64, +} + +func (s *state) ssaShiftOp(op Op, t *Type, u *Type) ssa.Op { + etype1 := s.concreteEtype(t) + etype2 := s.concreteEtype(u) + x, ok := shiftOpToSSA[opAndTwoTypes{op, etype1, etype2}] + if !ok { + s.Unimplementedf("unhandled shift op %s etype=%s/%s", opnames[op], Econv(etype1), Econv(etype2)) + } + return x +} + +func (s *state) ssaRotateOp(op Op, t *Type) ssa.Op { + etype1 := s.concreteEtype(t) + x, ok := opToSSA[opAndType{op, etype1}] + if !ok { + s.Unimplementedf("unhandled rotate op %s etype=%s", opnames[op], Econv(etype1)) + } + return x +} + +// expr converts the expression n to ssa, adds it to s and returns the ssa result. +func (s *state) expr(n *Node) *ssa.Value { + s.pushLine(n.Lineno) + defer s.popLine() + + s.stmtList(n.Ninit) + switch n.Op { + case OCFUNC: + aux := s.lookupSymbol(n, &ssa.ExternSymbol{n.Type, n.Left.Sym}) + return s.entryNewValue1A(ssa.OpAddr, n.Type, aux, s.sb) + case OPARAM: + addr := s.addr(n, false) + return s.newValue2(ssa.OpLoad, n.Left.Type, addr, s.mem()) + case ONAME: + if n.Class == PFUNC { + // "value" of a function is the address of the function's closure + sym := funcsym(n.Sym) + aux := &ssa.ExternSymbol{n.Type, sym} + return s.entryNewValue1A(ssa.OpAddr, Ptrto(n.Type), aux, s.sb) + } + if s.canSSA(n) { + return s.variable(n, n.Type) + } + addr := s.addr(n, false) + return s.newValue2(ssa.OpLoad, n.Type, addr, s.mem()) + case OCLOSUREVAR: + addr := s.addr(n, false) + return s.newValue2(ssa.OpLoad, n.Type, addr, s.mem()) + case OLITERAL: + switch n.Val().Ctype() { + case CTINT: + i := Mpgetfix(n.Val().U.(*Mpint)) + switch n.Type.Size() { + case 1: + return s.constInt8(n.Type, int8(i)) + case 2: + return s.constInt16(n.Type, int16(i)) + case 4: + return s.constInt32(n.Type, int32(i)) + case 8: + return s.constInt64(n.Type, i) + default: + s.Fatalf("bad integer size %d", n.Type.Size()) + return nil + } + case CTSTR: + return s.entryNewValue0A(ssa.OpConstString, n.Type, n.Val().U) + case CTBOOL: + v := s.constBool(n.Val().U.(bool)) + // For some reason the frontend gets the line numbers of + // CTBOOL literals totally wrong. Fix it here by grabbing + // the line number of the enclosing AST node. + if len(s.line) >= 2 { + v.Line = s.line[len(s.line)-2] + } + return v + case CTNIL: + t := n.Type + switch { + case t.IsSlice(): + return s.entryNewValue0(ssa.OpConstSlice, t) + case t.IsInterface(): + return s.entryNewValue0(ssa.OpConstInterface, t) + default: + return s.entryNewValue0(ssa.OpConstNil, t) + } + case CTFLT: + f := n.Val().U.(*Mpflt) + switch n.Type.Size() { + case 4: + return s.constFloat32(n.Type, mpgetflt32(f)) + case 8: + return s.constFloat64(n.Type, mpgetflt(f)) + default: + s.Fatalf("bad float size %d", n.Type.Size()) + return nil + } + case CTCPLX: + c := n.Val().U.(*Mpcplx) + r := &c.Real + i := &c.Imag + switch n.Type.Size() { + case 8: + { + pt := Types[TFLOAT32] + return s.newValue2(ssa.OpComplexMake, n.Type, + s.constFloat32(pt, mpgetflt32(r)), + s.constFloat32(pt, mpgetflt32(i))) + } + case 16: + { + pt := Types[TFLOAT64] + return s.newValue2(ssa.OpComplexMake, n.Type, + s.constFloat64(pt, mpgetflt(r)), + s.constFloat64(pt, mpgetflt(i))) + } + default: + s.Fatalf("bad float size %d", n.Type.Size()) + return nil + } + + default: + s.Unimplementedf("unhandled OLITERAL %v", n.Val().Ctype()) + return nil + } + case OCONVNOP: + to := n.Type + from := n.Left.Type + + // Assume everything will work out, so set up our return value. + // Anything interesting that happens from here is a fatal. + x := s.expr(n.Left) + + // Special case for not confusing GC and liveness. + // We don't want pointers accidentally classified + // as not-pointers or vice-versa because of copy + // elision. + if to.IsPtr() != from.IsPtr() { + return s.newValue2(ssa.OpConvert, to, x, s.mem()) + } + + v := s.newValue1(ssa.OpCopy, to, x) // ensure that v has the right type + + // CONVNOP closure + if to.Etype == TFUNC && from.IsPtr() { + return v + } + + // named <--> unnamed type or typed <--> untyped const + if from.Etype == to.Etype { + return v + } + + // unsafe.Pointer <--> *T + if to.Etype == TUNSAFEPTR && from.IsPtr() || from.Etype == TUNSAFEPTR && to.IsPtr() { + return v + } + + dowidth(from) + dowidth(to) + if from.Width != to.Width { + s.Fatalf("CONVNOP width mismatch %v (%d) -> %v (%d)\n", from, from.Width, to, to.Width) + return nil + } + if etypesign(from.Etype) != etypesign(to.Etype) { + s.Fatalf("CONVNOP sign mismatch %v (%s) -> %v (%s)\n", from, Econv(from.Etype), to, Econv(to.Etype)) + return nil + } + + if flag_race != 0 { + // These appear to be fine, but they fail the + // integer constraint below, so okay them here. + // Sample non-integer conversion: map[string]string -> *uint8 + return v + } + + if etypesign(from.Etype) == 0 { + s.Fatalf("CONVNOP unrecognized non-integer %v -> %v\n", from, to) + return nil + } + + // integer, same width, same sign + return v + + case OCONV: + x := s.expr(n.Left) + ft := n.Left.Type // from type + tt := n.Type // to type + if ft.IsInteger() && tt.IsInteger() { + var op ssa.Op + if tt.Size() == ft.Size() { + op = ssa.OpCopy + } else if tt.Size() < ft.Size() { + // truncation + switch 10*ft.Size() + tt.Size() { + case 21: + op = ssa.OpTrunc16to8 + case 41: + op = ssa.OpTrunc32to8 + case 42: + op = ssa.OpTrunc32to16 + case 81: + op = ssa.OpTrunc64to8 + case 82: + op = ssa.OpTrunc64to16 + case 84: + op = ssa.OpTrunc64to32 + default: + s.Fatalf("weird integer truncation %s -> %s", ft, tt) + } + } else if ft.IsSigned() { + // sign extension + switch 10*ft.Size() + tt.Size() { + case 12: + op = ssa.OpSignExt8to16 + case 14: + op = ssa.OpSignExt8to32 + case 18: + op = ssa.OpSignExt8to64 + case 24: + op = ssa.OpSignExt16to32 + case 28: + op = ssa.OpSignExt16to64 + case 48: + op = ssa.OpSignExt32to64 + default: + s.Fatalf("bad integer sign extension %s -> %s", ft, tt) + } + } else { + // zero extension + switch 10*ft.Size() + tt.Size() { + case 12: + op = ssa.OpZeroExt8to16 + case 14: + op = ssa.OpZeroExt8to32 + case 18: + op = ssa.OpZeroExt8to64 + case 24: + op = ssa.OpZeroExt16to32 + case 28: + op = ssa.OpZeroExt16to64 + case 48: + op = ssa.OpZeroExt32to64 + default: + s.Fatalf("weird integer sign extension %s -> %s", ft, tt) + } + } + return s.newValue1(op, n.Type, x) + } + + if ft.IsFloat() || tt.IsFloat() { + conv, ok := fpConvOpToSSA[twoTypes{s.concreteEtype(ft), s.concreteEtype(tt)}] + if !ok { + s.Fatalf("weird float conversion %s -> %s", ft, tt) + } + op1, op2, it := conv.op1, conv.op2, conv.intermediateType + + if op1 != ssa.OpInvalid && op2 != ssa.OpInvalid { + // normal case, not tripping over unsigned 64 + if op1 == ssa.OpCopy { + if op2 == ssa.OpCopy { + return x + } + return s.newValue1(op2, n.Type, x) + } + if op2 == ssa.OpCopy { + return s.newValue1(op1, n.Type, x) + } + return s.newValue1(op2, n.Type, s.newValue1(op1, Types[it], x)) + } + // Tricky 64-bit unsigned cases. + if ft.IsInteger() { + // therefore tt is float32 or float64, and ft is also unsigned + if tt.Size() == 4 { + return s.uint64Tofloat32(n, x, ft, tt) + } + if tt.Size() == 8 { + return s.uint64Tofloat64(n, x, ft, tt) + } + s.Fatalf("weird unsigned integer to float conversion %s -> %s", ft, tt) + } + // therefore ft is float32 or float64, and tt is unsigned integer + if ft.Size() == 4 { + return s.float32ToUint64(n, x, ft, tt) + } + if ft.Size() == 8 { + return s.float64ToUint64(n, x, ft, tt) + } + s.Fatalf("weird float to unsigned integer conversion %s -> %s", ft, tt) + return nil + } + + if ft.IsComplex() && tt.IsComplex() { + var op ssa.Op + if ft.Size() == tt.Size() { + op = ssa.OpCopy + } else if ft.Size() == 8 && tt.Size() == 16 { + op = ssa.OpCvt32Fto64F + } else if ft.Size() == 16 && tt.Size() == 8 { + op = ssa.OpCvt64Fto32F + } else { + s.Fatalf("weird complex conversion %s -> %s", ft, tt) + } + ftp := floatForComplex(ft) + ttp := floatForComplex(tt) + return s.newValue2(ssa.OpComplexMake, tt, + s.newValue1(op, ttp, s.newValue1(ssa.OpComplexReal, ftp, x)), + s.newValue1(op, ttp, s.newValue1(ssa.OpComplexImag, ftp, x))) + } + + s.Unimplementedf("unhandled OCONV %s -> %s", Econv(n.Left.Type.Etype), Econv(n.Type.Etype)) + return nil + + case ODOTTYPE: + res, _ := s.dottype(n, false) + return res + + // binary ops + case OLT, OEQ, ONE, OLE, OGE, OGT: + a := s.expr(n.Left) + b := s.expr(n.Right) + if n.Left.Type.IsComplex() { + pt := floatForComplex(n.Left.Type) + op := s.ssaOp(OEQ, pt) + r := s.newValue2(op, Types[TBOOL], s.newValue1(ssa.OpComplexReal, pt, a), s.newValue1(ssa.OpComplexReal, pt, b)) + i := s.newValue2(op, Types[TBOOL], s.newValue1(ssa.OpComplexImag, pt, a), s.newValue1(ssa.OpComplexImag, pt, b)) + c := s.newValue2(ssa.OpAnd8, Types[TBOOL], r, i) + switch n.Op { + case OEQ: + return c + case ONE: + return s.newValue1(ssa.OpNot, Types[TBOOL], c) + default: + s.Fatalf("ordered complex compare %s", opnames[n.Op]) + } + } + return s.newValue2(s.ssaOp(n.Op, n.Left.Type), Types[TBOOL], a, b) + case OMUL: + a := s.expr(n.Left) + b := s.expr(n.Right) + if n.Type.IsComplex() { + mulop := ssa.OpMul64F + addop := ssa.OpAdd64F + subop := ssa.OpSub64F + pt := floatForComplex(n.Type) // Could be Float32 or Float64 + wt := Types[TFLOAT64] // Compute in Float64 to minimize cancellation error + + areal := s.newValue1(ssa.OpComplexReal, pt, a) + breal := s.newValue1(ssa.OpComplexReal, pt, b) + aimag := s.newValue1(ssa.OpComplexImag, pt, a) + bimag := s.newValue1(ssa.OpComplexImag, pt, b) + + if pt != wt { // Widen for calculation + areal = s.newValue1(ssa.OpCvt32Fto64F, wt, areal) + breal = s.newValue1(ssa.OpCvt32Fto64F, wt, breal) + aimag = s.newValue1(ssa.OpCvt32Fto64F, wt, aimag) + bimag = s.newValue1(ssa.OpCvt32Fto64F, wt, bimag) + } + + xreal := s.newValue2(subop, wt, s.newValue2(mulop, wt, areal, breal), s.newValue2(mulop, wt, aimag, bimag)) + ximag := s.newValue2(addop, wt, s.newValue2(mulop, wt, areal, bimag), s.newValue2(mulop, wt, aimag, breal)) + + if pt != wt { // Narrow to store back + xreal = s.newValue1(ssa.OpCvt64Fto32F, pt, xreal) + ximag = s.newValue1(ssa.OpCvt64Fto32F, pt, ximag) + } + + return s.newValue2(ssa.OpComplexMake, n.Type, xreal, ximag) + } + return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) + + case ODIV: + a := s.expr(n.Left) + b := s.expr(n.Right) + if n.Type.IsComplex() { + // TODO this is not executed because the front-end substitutes a runtime call. + // That probably ought to change; with modest optimization the widen/narrow + // conversions could all be elided in larger expression trees. + mulop := ssa.OpMul64F + addop := ssa.OpAdd64F + subop := ssa.OpSub64F + divop := ssa.OpDiv64F + pt := floatForComplex(n.Type) // Could be Float32 or Float64 + wt := Types[TFLOAT64] // Compute in Float64 to minimize cancellation error + + areal := s.newValue1(ssa.OpComplexReal, pt, a) + breal := s.newValue1(ssa.OpComplexReal, pt, b) + aimag := s.newValue1(ssa.OpComplexImag, pt, a) + bimag := s.newValue1(ssa.OpComplexImag, pt, b) + + if pt != wt { // Widen for calculation + areal = s.newValue1(ssa.OpCvt32Fto64F, wt, areal) + breal = s.newValue1(ssa.OpCvt32Fto64F, wt, breal) + aimag = s.newValue1(ssa.OpCvt32Fto64F, wt, aimag) + bimag = s.newValue1(ssa.OpCvt32Fto64F, wt, bimag) + } + + denom := s.newValue2(addop, wt, s.newValue2(mulop, wt, breal, breal), s.newValue2(mulop, wt, bimag, bimag)) + xreal := s.newValue2(addop, wt, s.newValue2(mulop, wt, areal, breal), s.newValue2(mulop, wt, aimag, bimag)) + ximag := s.newValue2(subop, wt, s.newValue2(mulop, wt, aimag, breal), s.newValue2(mulop, wt, areal, bimag)) + + // TODO not sure if this is best done in wide precision or narrow + // Double-rounding might be an issue. + // Note that the pre-SSA implementation does the entire calculation + // in wide format, so wide is compatible. + xreal = s.newValue2(divop, wt, xreal, denom) + ximag = s.newValue2(divop, wt, ximag, denom) + + if pt != wt { // Narrow to store back + xreal = s.newValue1(ssa.OpCvt64Fto32F, pt, xreal) + ximag = s.newValue1(ssa.OpCvt64Fto32F, pt, ximag) + } + return s.newValue2(ssa.OpComplexMake, n.Type, xreal, ximag) + } + if n.Type.IsFloat() { + return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) + } else { + // do a size-appropriate check for zero + cmp := s.newValue2(s.ssaOp(ONE, n.Type), Types[TBOOL], b, s.zeroVal(n.Type)) + s.check(cmp, panicdivide) + return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) + } + case OMOD: + a := s.expr(n.Left) + b := s.expr(n.Right) + // do a size-appropriate check for zero + cmp := s.newValue2(s.ssaOp(ONE, n.Type), Types[TBOOL], b, s.zeroVal(n.Type)) + s.check(cmp, panicdivide) + return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) + case OADD, OSUB: + a := s.expr(n.Left) + b := s.expr(n.Right) + if n.Type.IsComplex() { + pt := floatForComplex(n.Type) + op := s.ssaOp(n.Op, pt) + return s.newValue2(ssa.OpComplexMake, n.Type, + s.newValue2(op, pt, s.newValue1(ssa.OpComplexReal, pt, a), s.newValue1(ssa.OpComplexReal, pt, b)), + s.newValue2(op, pt, s.newValue1(ssa.OpComplexImag, pt, a), s.newValue1(ssa.OpComplexImag, pt, b))) + } + return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) + case OAND, OOR, OHMUL, OXOR: + a := s.expr(n.Left) + b := s.expr(n.Right) + return s.newValue2(s.ssaOp(n.Op, n.Type), a.Type, a, b) + case OLSH, ORSH: + a := s.expr(n.Left) + b := s.expr(n.Right) + return s.newValue2(s.ssaShiftOp(n.Op, n.Type, n.Right.Type), a.Type, a, b) + case OLROT: + a := s.expr(n.Left) + i := n.Right.Int() + if i <= 0 || i >= n.Type.Size()*8 { + s.Fatalf("Wrong rotate distance for LROT, expected 1 through %d, saw %d", n.Type.Size()*8-1, i) + } + return s.newValue1I(s.ssaRotateOp(n.Op, n.Type), a.Type, i, a) + case OANDAND, OOROR: + // To implement OANDAND (and OOROR), we introduce a + // new temporary variable to hold the result. The + // variable is associated with the OANDAND node in the + // s.vars table (normally variables are only + // associated with ONAME nodes). We convert + // A && B + // to + // var = A + // if var { + // var = B + // } + // Using var in the subsequent block introduces the + // necessary phi variable. + el := s.expr(n.Left) + s.vars[n] = el + + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = el + // In theory, we should set b.Likely here based on context. + // However, gc only gives us likeliness hints + // in a single place, for plain OIF statements, + // and passing around context is finnicky, so don't bother for now. + + bRight := s.f.NewBlock(ssa.BlockPlain) + bResult := s.f.NewBlock(ssa.BlockPlain) + if n.Op == OANDAND { + b.AddEdgeTo(bRight) + b.AddEdgeTo(bResult) + } else if n.Op == OOROR { + b.AddEdgeTo(bResult) + b.AddEdgeTo(bRight) + } + + s.startBlock(bRight) + er := s.expr(n.Right) + s.vars[n] = er + + b = s.endBlock() + b.AddEdgeTo(bResult) + + s.startBlock(bResult) + return s.variable(n, Types[TBOOL]) + case OCOMPLEX: + r := s.expr(n.Left) + i := s.expr(n.Right) + return s.newValue2(ssa.OpComplexMake, n.Type, r, i) + + // unary ops + case OMINUS: + a := s.expr(n.Left) + if n.Type.IsComplex() { + tp := floatForComplex(n.Type) + negop := s.ssaOp(n.Op, tp) + return s.newValue2(ssa.OpComplexMake, n.Type, + s.newValue1(negop, tp, s.newValue1(ssa.OpComplexReal, tp, a)), + s.newValue1(negop, tp, s.newValue1(ssa.OpComplexImag, tp, a))) + } + return s.newValue1(s.ssaOp(n.Op, n.Type), a.Type, a) + case ONOT, OCOM, OSQRT: + a := s.expr(n.Left) + return s.newValue1(s.ssaOp(n.Op, n.Type), a.Type, a) + case OIMAG, OREAL: + a := s.expr(n.Left) + return s.newValue1(s.ssaOp(n.Op, n.Left.Type), n.Type, a) + case OPLUS: + return s.expr(n.Left) + + case OADDR: + return s.addr(n.Left, n.Bounded) + + case OINDREG: + if int(n.Reg) != Thearch.REGSP { + s.Unimplementedf("OINDREG of non-SP register %s in expr: %v", obj.Rconv(int(n.Reg)), n) + return nil + } + addr := s.entryNewValue1I(ssa.OpOffPtr, Ptrto(n.Type), n.Xoffset, s.sp) + return s.newValue2(ssa.OpLoad, n.Type, addr, s.mem()) + + case OIND: + p := s.expr(n.Left) + s.nilCheck(p) + return s.newValue2(ssa.OpLoad, n.Type, p, s.mem()) + + case ODOT: + t := n.Left.Type + if canSSAType(t) { + v := s.expr(n.Left) + return s.newValue1I(ssa.OpStructSelect, n.Type, fieldIdx(n), v) + } + p := s.addr(n, false) + return s.newValue2(ssa.OpLoad, n.Type, p, s.mem()) + + case ODOTPTR: + p := s.expr(n.Left) + s.nilCheck(p) + p = s.newValue2(ssa.OpAddPtr, p.Type, p, s.constInt(Types[TINT], n.Xoffset)) + return s.newValue2(ssa.OpLoad, n.Type, p, s.mem()) + + case OINDEX: + switch { + case n.Left.Type.IsString(): + a := s.expr(n.Left) + i := s.expr(n.Right) + i = s.extendIndex(i) + if !n.Bounded { + len := s.newValue1(ssa.OpStringLen, Types[TINT], a) + s.boundsCheck(i, len) + } + ptrtyp := Ptrto(Types[TUINT8]) + ptr := s.newValue1(ssa.OpStringPtr, ptrtyp, a) + ptr = s.newValue2(ssa.OpAddPtr, ptrtyp, ptr, i) + return s.newValue2(ssa.OpLoad, Types[TUINT8], ptr, s.mem()) + case n.Left.Type.IsSlice(): + p := s.addr(n, false) + return s.newValue2(ssa.OpLoad, n.Left.Type.Type, p, s.mem()) + case n.Left.Type.IsArray(): + // TODO: fix when we can SSA arrays of length 1. + p := s.addr(n, false) + return s.newValue2(ssa.OpLoad, n.Left.Type.Type, p, s.mem()) + default: + s.Fatalf("bad type for index %v", n.Left.Type) + return nil + } + + case OLEN, OCAP: + switch { + case n.Left.Type.IsSlice(): + op := ssa.OpSliceLen + if n.Op == OCAP { + op = ssa.OpSliceCap + } + return s.newValue1(op, Types[TINT], s.expr(n.Left)) + case n.Left.Type.IsString(): // string; not reachable for OCAP + return s.newValue1(ssa.OpStringLen, Types[TINT], s.expr(n.Left)) + case n.Left.Type.IsMap(), n.Left.Type.IsChan(): + return s.referenceTypeBuiltin(n, s.expr(n.Left)) + default: // array + return s.constInt(Types[TINT], n.Left.Type.Bound) + } + + case OSPTR: + a := s.expr(n.Left) + if n.Left.Type.IsSlice() { + return s.newValue1(ssa.OpSlicePtr, n.Type, a) + } else { + return s.newValue1(ssa.OpStringPtr, n.Type, a) + } + + case OITAB: + a := s.expr(n.Left) + return s.newValue1(ssa.OpITab, n.Type, a) + + case OEFACE: + tab := s.expr(n.Left) + data := s.expr(n.Right) + // The frontend allows putting things like struct{*byte} in + // the data portion of an eface. But we don't want struct{*byte} + // as a register type because (among other reasons) the liveness + // analysis is confused by the "fat" variables that result from + // such types being spilled. + // So here we ensure that we are selecting the underlying pointer + // when we build an eface. + // TODO: get rid of this now that structs can be SSA'd? + for !data.Type.IsPtr() { + switch { + case data.Type.IsArray(): + data = s.newValue2(ssa.OpArrayIndex, data.Type.Elem(), data, s.constInt(Types[TINT], 0)) + case data.Type.IsStruct(): + for i := data.Type.NumFields() - 1; i >= 0; i-- { + f := data.Type.FieldType(i) + if f.Size() == 0 { + // eface type could also be struct{p *byte; q [0]int} + continue + } + data = s.newValue1I(ssa.OpStructSelect, f, i, data) + break + } + default: + s.Fatalf("type being put into an eface isn't a pointer") + } + } + return s.newValue2(ssa.OpIMake, n.Type, tab, data) + + case OSLICE, OSLICEARR: + v := s.expr(n.Left) + var i, j *ssa.Value + if n.Right.Left != nil { + i = s.extendIndex(s.expr(n.Right.Left)) + } + if n.Right.Right != nil { + j = s.extendIndex(s.expr(n.Right.Right)) + } + p, l, c := s.slice(n.Left.Type, v, i, j, nil) + return s.newValue3(ssa.OpSliceMake, n.Type, p, l, c) + case OSLICESTR: + v := s.expr(n.Left) + var i, j *ssa.Value + if n.Right.Left != nil { + i = s.extendIndex(s.expr(n.Right.Left)) + } + if n.Right.Right != nil { + j = s.extendIndex(s.expr(n.Right.Right)) + } + p, l, _ := s.slice(n.Left.Type, v, i, j, nil) + return s.newValue2(ssa.OpStringMake, n.Type, p, l) + case OSLICE3, OSLICE3ARR: + v := s.expr(n.Left) + var i *ssa.Value + if n.Right.Left != nil { + i = s.extendIndex(s.expr(n.Right.Left)) + } + j := s.extendIndex(s.expr(n.Right.Right.Left)) + k := s.extendIndex(s.expr(n.Right.Right.Right)) + p, l, c := s.slice(n.Left.Type, v, i, j, k) + return s.newValue3(ssa.OpSliceMake, n.Type, p, l, c) + + case OCALLFUNC, OCALLINTER, OCALLMETH: + a := s.call(n, callNormal) + return s.newValue2(ssa.OpLoad, n.Type, a, s.mem()) + + case OGETG: + return s.newValue1(ssa.OpGetG, n.Type, s.mem()) + + case OAPPEND: + // append(s, e1, e2, e3). Compile like: + // ptr,len,cap := s + // newlen := len + 3 + // if newlen > s.cap { + // ptr,_,cap = growslice(s, newlen) + // } + // *(ptr+len) = e1 + // *(ptr+len+1) = e2 + // *(ptr+len+2) = e3 + // makeslice(ptr,newlen,cap) + + et := n.Type.Type + pt := Ptrto(et) + + // Evaluate slice + slice := s.expr(n.List.N) + + // Allocate new blocks + grow := s.f.NewBlock(ssa.BlockPlain) + assign := s.f.NewBlock(ssa.BlockPlain) + + // Decide if we need to grow + nargs := int64(count(n.List) - 1) + p := s.newValue1(ssa.OpSlicePtr, pt, slice) + l := s.newValue1(ssa.OpSliceLen, Types[TINT], slice) + c := s.newValue1(ssa.OpSliceCap, Types[TINT], slice) + nl := s.newValue2(s.ssaOp(OADD, Types[TINT]), Types[TINT], l, s.constInt(Types[TINT], nargs)) + cmp := s.newValue2(s.ssaOp(OGT, Types[TINT]), Types[TBOOL], nl, c) + s.vars[&ptrVar] = p + s.vars[&capVar] = c + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Likely = ssa.BranchUnlikely + b.Control = cmp + b.AddEdgeTo(grow) + b.AddEdgeTo(assign) + + // Call growslice + s.startBlock(grow) + taddr := s.newValue1A(ssa.OpAddr, Types[TUINTPTR], &ssa.ExternSymbol{Types[TUINTPTR], typenamesym(n.Type)}, s.sb) + + r := s.rtcall(growslice, true, []*Type{pt, Types[TINT], Types[TINT]}, taddr, p, l, c, nl) + + s.vars[&ptrVar] = r[0] + // Note: we don't need to read r[1], the result's length. It will be nl. + // (or maybe we should, we just have to spill/restore nl otherwise?) + s.vars[&capVar] = r[2] + b = s.endBlock() + b.AddEdgeTo(assign) + + // assign new elements to slots + s.startBlock(assign) + + // Evaluate args + args := make([]*ssa.Value, 0, nargs) + store := make([]bool, 0, nargs) + for l := n.List.Next; l != nil; l = l.Next { + if canSSAType(l.N.Type) { + args = append(args, s.expr(l.N)) + store = append(store, true) + } else { + args = append(args, s.addr(l.N, false)) + store = append(store, false) + } + } + + p = s.variable(&ptrVar, pt) // generates phi for ptr + c = s.variable(&capVar, Types[TINT]) // generates phi for cap + p2 := s.newValue2(ssa.OpPtrIndex, pt, p, l) + // TODO: just one write barrier call for all of these writes? + // TODO: maybe just one writeBarrier.enabled check? + for i, arg := range args { + addr := s.newValue2(ssa.OpPtrIndex, pt, p2, s.constInt(Types[TINT], int64(i))) + if store[i] { + if haspointers(et) { + s.insertWBstore(et, addr, arg, n.Lineno) + } else { + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, et.Size(), addr, arg, s.mem()) + } + } else { + if haspointers(et) { + s.insertWBmove(et, addr, arg, n.Lineno) + } else { + s.vars[&memVar] = s.newValue3I(ssa.OpMove, ssa.TypeMem, et.Size(), addr, arg, s.mem()) + } + } + } + + // make result + delete(s.vars, &ptrVar) + delete(s.vars, &capVar) + return s.newValue3(ssa.OpSliceMake, n.Type, p, nl, c) + + default: + s.Unimplementedf("unhandled expr %s", opnames[n.Op]) + return nil + } +} + +// condBranch evaluates the boolean expression cond and branches to yes +// if cond is true and no if cond is false. +// This function is intended to handle && and || better than just calling +// s.expr(cond) and branching on the result. +func (s *state) condBranch(cond *Node, yes, no *ssa.Block, likely int8) { + if cond.Op == OANDAND { + mid := s.f.NewBlock(ssa.BlockPlain) + s.stmtList(cond.Ninit) + s.condBranch(cond.Left, mid, no, max8(likely, 0)) + s.startBlock(mid) + s.condBranch(cond.Right, yes, no, likely) + return + // Note: if likely==1, then both recursive calls pass 1. + // If likely==-1, then we don't have enough information to decide + // whether the first branch is likely or not. So we pass 0 for + // the likeliness of the first branch. + // TODO: have the frontend give us branch prediction hints for + // OANDAND and OOROR nodes (if it ever has such info). + } + if cond.Op == OOROR { + mid := s.f.NewBlock(ssa.BlockPlain) + s.stmtList(cond.Ninit) + s.condBranch(cond.Left, yes, mid, min8(likely, 0)) + s.startBlock(mid) + s.condBranch(cond.Right, yes, no, likely) + return + // Note: if likely==-1, then both recursive calls pass -1. + // If likely==1, then we don't have enough info to decide + // the likelihood of the first branch. + } + if cond.Op == ONOT { + s.stmtList(cond.Ninit) + s.condBranch(cond.Left, no, yes, -likely) + return + } + c := s.expr(cond) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = c + b.Likely = ssa.BranchPrediction(likely) // gc and ssa both use -1/0/+1 for likeliness + b.AddEdgeTo(yes) + b.AddEdgeTo(no) +} + +// assign does left = right. +// Right has already been evaluated to ssa, left has not. +// If deref is true, then we do left = *right instead (and right has already been nil-checked). +// If deref is true and right == nil, just do left = 0. +// Include a write barrier if wb is true. +func (s *state) assign(left *Node, right *ssa.Value, wb, deref bool, line int32) { + if left.Op == ONAME && isblank(left) { + return + } + t := left.Type + dowidth(t) + if s.canSSA(left) { + if deref { + s.Fatalf("can SSA LHS %s but not RHS %s", left, right) + } + if left.Op == ODOT { + // We're assigning to a field of an ssa-able value. + // We need to build a new structure with the new value for the + // field we're assigning and the old values for the other fields. + // For instance: + // type T struct {a, b, c int} + // var T x + // x.b = 5 + // For the x.b = 5 assignment we want to generate x = T{x.a, 5, x.c} + + // Grab information about the structure type. + t := left.Left.Type + nf := t.NumFields() + idx := fieldIdx(left) + + // Grab old value of structure. + old := s.expr(left.Left) + + // Make new structure. + new := s.newValue0(ssa.StructMakeOp(t.NumFields()), t) + + // Add fields as args. + for i := int64(0); i < nf; i++ { + if i == idx { + new.AddArg(right) + } else { + new.AddArg(s.newValue1I(ssa.OpStructSelect, t.FieldType(i), i, old)) + } + } + + // Recursively assign the new value we've made to the base of the dot op. + s.assign(left.Left, new, false, false, line) + // TODO: do we need to update named values here? + return + } + // Update variable assignment. + s.vars[left] = right + s.addNamedValue(left, right) + return + } + // Left is not ssa-able. Compute its address. + addr := s.addr(left, false) + if left.Op == ONAME { + s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, ssa.TypeMem, left, s.mem()) + } + if deref { + // Treat as a mem->mem move. + if right == nil { + s.vars[&memVar] = s.newValue2I(ssa.OpZero, ssa.TypeMem, t.Size(), addr, s.mem()) + return + } + if wb { + s.insertWBmove(t, addr, right, line) + return + } + s.vars[&memVar] = s.newValue3I(ssa.OpMove, ssa.TypeMem, t.Size(), addr, right, s.mem()) + return + } + // Treat as a store. + if wb { + s.insertWBstore(t, addr, right, line) + return + } + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, t.Size(), addr, right, s.mem()) +} + +// zeroVal returns the zero value for type t. +func (s *state) zeroVal(t *Type) *ssa.Value { + switch { + case t.IsInteger(): + switch t.Size() { + case 1: + return s.constInt8(t, 0) + case 2: + return s.constInt16(t, 0) + case 4: + return s.constInt32(t, 0) + case 8: + return s.constInt64(t, 0) + default: + s.Fatalf("bad sized integer type %s", t) + } + case t.IsFloat(): + switch t.Size() { + case 4: + return s.constFloat32(t, 0) + case 8: + return s.constFloat64(t, 0) + default: + s.Fatalf("bad sized float type %s", t) + } + case t.IsComplex(): + switch t.Size() { + case 8: + z := s.constFloat32(Types[TFLOAT32], 0) + return s.entryNewValue2(ssa.OpComplexMake, t, z, z) + case 16: + z := s.constFloat64(Types[TFLOAT64], 0) + return s.entryNewValue2(ssa.OpComplexMake, t, z, z) + default: + s.Fatalf("bad sized complex type %s", t) + } + + case t.IsString(): + return s.entryNewValue0A(ssa.OpConstString, t, "") + case t.IsPtr(): + return s.entryNewValue0(ssa.OpConstNil, t) + case t.IsBoolean(): + return s.constBool(false) + case t.IsInterface(): + return s.entryNewValue0(ssa.OpConstInterface, t) + case t.IsSlice(): + return s.entryNewValue0(ssa.OpConstSlice, t) + case t.IsStruct(): + n := t.NumFields() + v := s.entryNewValue0(ssa.StructMakeOp(t.NumFields()), t) + for i := int64(0); i < n; i++ { + v.AddArg(s.zeroVal(t.FieldType(i).(*Type))) + } + return v + } + s.Unimplementedf("zero for type %v not implemented", t) + return nil +} + +type callKind int8 + +const ( + callNormal callKind = iota + callDefer + callGo +) + +// Calls the function n using the specified call type. +// Returns the address of the return value (or nil if none). +func (s *state) call(n *Node, k callKind) *ssa.Value { + var sym *Sym // target symbol (if static) + var closure *ssa.Value // ptr to closure to run (if dynamic) + var codeptr *ssa.Value // ptr to target code (if dynamic) + var rcvr *ssa.Value // receiver to set + fn := n.Left + switch n.Op { + case OCALLFUNC: + if k == callNormal && fn.Op == ONAME && fn.Class == PFUNC { + sym = fn.Sym + break + } + closure = s.expr(fn) + case OCALLMETH: + if fn.Op != ODOTMETH { + Fatalf("OCALLMETH: n.Left not an ODOTMETH: %v", fn) + } + if fn.Right.Op != ONAME { + Fatalf("OCALLMETH: n.Left.Right not a ONAME: %v", fn.Right) + } + if k == callNormal { + sym = fn.Right.Sym + break + } + n2 := *fn.Right + n2.Class = PFUNC + closure = s.expr(&n2) + // Note: receiver is already assigned in n.List, so we don't + // want to set it here. + case OCALLINTER: + if fn.Op != ODOTINTER { + Fatalf("OCALLINTER: n.Left not an ODOTINTER: %v", Oconv(int(fn.Op), 0)) + } + i := s.expr(fn.Left) + itab := s.newValue1(ssa.OpITab, Types[TUINTPTR], i) + itabidx := fn.Xoffset + 3*int64(Widthptr) + 8 // offset of fun field in runtime.itab + itab = s.newValue1I(ssa.OpOffPtr, Types[TUINTPTR], itabidx, itab) + if k == callNormal { + codeptr = s.newValue2(ssa.OpLoad, Types[TUINTPTR], itab, s.mem()) + } else { + closure = itab + } + rcvr = s.newValue1(ssa.OpIData, Types[TUINTPTR], i) + } + dowidth(fn.Type) + stksize := fn.Type.Argwid // includes receiver + + // Run all argument assignments. The arg slots have already + // been offset by the appropriate amount (+2*widthptr for go/defer, + // +widthptr for interface calls). + // For OCALLMETH, the receiver is set in these statements. + s.stmtList(n.List) + + // Set receiver (for interface calls) + if rcvr != nil { + argStart := Ctxt.FixedFrameSize() + if k != callNormal { + argStart += int64(2 * Widthptr) + } + addr := s.entryNewValue1I(ssa.OpOffPtr, Types[TUINTPTR], argStart, s.sp) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, int64(Widthptr), addr, rcvr, s.mem()) + } + + // Defer/go args + if k != callNormal { + // Write argsize and closure (args to Newproc/Deferproc). + argsize := s.constInt32(Types[TUINT32], int32(stksize)) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, 4, s.sp, argsize, s.mem()) + addr := s.entryNewValue1I(ssa.OpOffPtr, Ptrto(Types[TUINTPTR]), int64(Widthptr), s.sp) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, int64(Widthptr), addr, closure, s.mem()) + stksize += 2 * int64(Widthptr) + } + + // call target + bNext := s.f.NewBlock(ssa.BlockPlain) + var call *ssa.Value + switch { + case k == callDefer: + call = s.newValue1(ssa.OpDeferCall, ssa.TypeMem, s.mem()) + case k == callGo: + call = s.newValue1(ssa.OpGoCall, ssa.TypeMem, s.mem()) + case closure != nil: + codeptr = s.newValue2(ssa.OpLoad, Types[TUINTPTR], closure, s.mem()) + call = s.newValue3(ssa.OpClosureCall, ssa.TypeMem, codeptr, closure, s.mem()) + case codeptr != nil: + call = s.newValue2(ssa.OpInterCall, ssa.TypeMem, codeptr, s.mem()) + case sym != nil: + call = s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, sym, s.mem()) + default: + Fatalf("bad call type %s %v", opnames[n.Op], n) + } + call.AuxInt = stksize // Call operations carry the argsize of the callee along with them + + // Finish call block + s.vars[&memVar] = call + b := s.endBlock() + b.Kind = ssa.BlockCall + b.Control = call + b.AddEdgeTo(bNext) + + // Start exit block, find address of result. + s.startBlock(bNext) + var titer Iter + fp := Structfirst(&titer, Getoutarg(n.Left.Type)) + if fp == nil || k != callNormal { + // call has no return value. Continue with the next statement. + return nil + } + return s.entryNewValue1I(ssa.OpOffPtr, Ptrto(fp.Type), fp.Width, s.sp) +} + +// etypesign returns the signed-ness of e, for integer/pointer etypes. +// -1 means signed, +1 means unsigned, 0 means non-integer/non-pointer. +func etypesign(e EType) int8 { + switch e { + case TINT8, TINT16, TINT32, TINT64, TINT: + return -1 + case TUINT8, TUINT16, TUINT32, TUINT64, TUINT, TUINTPTR, TUNSAFEPTR: + return +1 + } + return 0 +} + +// lookupSymbol is used to retrieve the symbol (Extern, Arg or Auto) used for a particular node. +// This improves the effectiveness of cse by using the same Aux values for the +// same symbols. +func (s *state) lookupSymbol(n *Node, sym interface{}) interface{} { + switch sym.(type) { + default: + s.Fatalf("sym %v is of uknown type %T", sym, sym) + case *ssa.ExternSymbol, *ssa.ArgSymbol, *ssa.AutoSymbol: + // these are the only valid types + } + + if lsym, ok := s.varsyms[n]; ok { + return lsym + } else { + s.varsyms[n] = sym + return sym + } +} + +// addr converts the address of the expression n to SSA, adds it to s and returns the SSA result. +// The value that the returned Value represents is guaranteed to be non-nil. +// If bounded is true then this address does not require a nil check for its operand +// even if that would otherwise be implied. +func (s *state) addr(n *Node, bounded bool) *ssa.Value { + t := Ptrto(n.Type) + switch n.Op { + case ONAME: + switch n.Class { + case PEXTERN: + // global variable + aux := s.lookupSymbol(n, &ssa.ExternSymbol{n.Type, n.Sym}) + v := s.entryNewValue1A(ssa.OpAddr, t, aux, s.sb) + // TODO: Make OpAddr use AuxInt as well as Aux. + if n.Xoffset != 0 { + v = s.entryNewValue1I(ssa.OpOffPtr, v.Type, n.Xoffset, v) + } + return v + case PPARAM: + // parameter slot + v := s.decladdrs[n] + if v != nil { + return v + } + if n.String() == ".fp" { + // Special arg that points to the frame pointer. + // (Used by the race detector, others?) + aux := s.lookupSymbol(n, &ssa.ArgSymbol{Typ: n.Type, Node: n}) + return s.entryNewValue1A(ssa.OpAddr, t, aux, s.sp) + } + s.Fatalf("addr of undeclared ONAME %v. declared: %v", n, s.decladdrs) + return nil + case PAUTO: + // We need to regenerate the address of autos + // at every use. This prevents LEA instructions + // from occurring before the corresponding VarDef + // op and confusing the liveness analysis into thinking + // the variable is live at function entry. + // TODO: I'm not sure if this really works or we're just + // getting lucky. We might need a real dependency edge + // between vardef and addr ops. + aux := &ssa.AutoSymbol{Typ: n.Type, Node: n} + return s.newValue1A(ssa.OpAddr, t, aux, s.sp) + case PPARAMOUT: // Same as PAUTO -- cannot generate LEA early. + // ensure that we reuse symbols for out parameters so + // that cse works on their addresses + aux := s.lookupSymbol(n, &ssa.ArgSymbol{Typ: n.Type, Node: n}) + return s.newValue1A(ssa.OpAddr, t, aux, s.sp) + case PAUTO | PHEAP, PPARAM | PHEAP, PPARAMOUT | PHEAP, PPARAMREF: + return s.expr(n.Name.Heapaddr) + default: + s.Unimplementedf("variable address class %v not implemented", n.Class) + return nil + } + case OINDREG: + // indirect off a register + // used for storing/loading arguments/returns to/from callees + if int(n.Reg) != Thearch.REGSP { + s.Unimplementedf("OINDREG of non-SP register %s in addr: %v", obj.Rconv(int(n.Reg)), n) + return nil + } + return s.entryNewValue1I(ssa.OpOffPtr, t, n.Xoffset, s.sp) + case OINDEX: + if n.Left.Type.IsSlice() { + a := s.expr(n.Left) + i := s.expr(n.Right) + i = s.extendIndex(i) + len := s.newValue1(ssa.OpSliceLen, Types[TINT], a) + if !n.Bounded { + s.boundsCheck(i, len) + } + p := s.newValue1(ssa.OpSlicePtr, t, a) + return s.newValue2(ssa.OpPtrIndex, t, p, i) + } else { // array + a := s.addr(n.Left, bounded) + i := s.expr(n.Right) + i = s.extendIndex(i) + len := s.constInt(Types[TINT], n.Left.Type.Bound) + if !n.Bounded { + s.boundsCheck(i, len) + } + return s.newValue2(ssa.OpPtrIndex, Ptrto(n.Left.Type.Type), a, i) + } + case OIND: + p := s.expr(n.Left) + if !bounded { + s.nilCheck(p) + } + return p + case ODOT: + p := s.addr(n.Left, bounded) + return s.newValue2(ssa.OpAddPtr, t, p, s.constInt(Types[TINT], n.Xoffset)) + case ODOTPTR: + p := s.expr(n.Left) + if !bounded { + s.nilCheck(p) + } + return s.newValue2(ssa.OpAddPtr, t, p, s.constInt(Types[TINT], n.Xoffset)) + case OCLOSUREVAR: + return s.newValue2(ssa.OpAddPtr, t, + s.entryNewValue0(ssa.OpGetClosurePtr, Ptrto(Types[TUINT8])), + s.constInt(Types[TINT], n.Xoffset)) + case OPARAM: + p := n.Left + if p.Op != ONAME || !(p.Class == PPARAM|PHEAP || p.Class == PPARAMOUT|PHEAP) { + s.Fatalf("OPARAM not of ONAME,{PPARAM,PPARAMOUT}|PHEAP, instead %s", nodedump(p, 0)) + } + + // Recover original offset to address passed-in param value. + original_p := *p + original_p.Xoffset = n.Xoffset + aux := &ssa.ArgSymbol{Typ: n.Type, Node: &original_p} + return s.entryNewValue1A(ssa.OpAddr, t, aux, s.sp) + case OCONVNOP: + addr := s.addr(n.Left, bounded) + return s.newValue1(ssa.OpCopy, t, addr) // ensure that addr has the right type + case OCALLFUNC, OCALLINTER, OCALLMETH: + return s.call(n, callNormal) + + default: + s.Unimplementedf("unhandled addr %v", Oconv(int(n.Op), 0)) + return nil + } +} + +// canSSA reports whether n is SSA-able. +// n must be an ONAME (or an ODOT sequence with an ONAME base). +func (s *state) canSSA(n *Node) bool { + for n.Op == ODOT { + n = n.Left + } + if n.Op != ONAME { + return false + } + if n.Addrtaken { + return false + } + if n.Class&PHEAP != 0 { + return false + } + switch n.Class { + case PEXTERN, PPARAMREF: + // TODO: maybe treat PPARAMREF with an Arg-like op to read from closure? + return false + case PPARAMOUT: + if hasdefer { + // TODO: handle this case? Named return values must be + // in memory so that the deferred function can see them. + // Maybe do: if !strings.HasPrefix(n.String(), "~") { return false } + return false + } + if s.cgoUnsafeArgs { + // Cgo effectively takes the address of all result args, + // but the compiler can't see that. + return false + } + } + if n.Class == PPARAM && n.String() == ".this" { + // wrappers generated by genwrapper need to update + // the .this pointer in place. + // TODO: treat as a PPARMOUT? + return false + } + return canSSAType(n.Type) + // TODO: try to make more variables SSAable? +} + +// canSSA reports whether variables of type t are SSA-able. +func canSSAType(t *Type) bool { + dowidth(t) + if t.Width > int64(4*Widthptr) { + // 4*Widthptr is an arbitrary constant. We want it + // to be at least 3*Widthptr so slices can be registerized. + // Too big and we'll introduce too much register pressure. + return false + } + switch t.Etype { + case TARRAY: + if Isslice(t) { + return true + } + // We can't do arrays because dynamic indexing is + // not supported on SSA variables. + // TODO: maybe allow if length is <=1? All indexes + // are constant? Might be good for the arrays + // introduced by the compiler for variadic functions. + return false + case TSTRUCT: + if countfield(t) > ssa.MaxStruct { + return false + } + for t1 := t.Type; t1 != nil; t1 = t1.Down { + if !canSSAType(t1.Type) { + return false + } + } + return true + default: + return true + } +} + +// nilCheck generates nil pointer checking code. +// Starts a new block on return, unless nil checks are disabled. +// Used only for automatically inserted nil checks, +// not for user code like 'x != nil'. +func (s *state) nilCheck(ptr *ssa.Value) { + if Disable_checknil != 0 { + return + } + chk := s.newValue2(ssa.OpNilCheck, ssa.TypeVoid, ptr, s.mem()) + b := s.endBlock() + b.Kind = ssa.BlockCheck + b.Control = chk + bNext := s.f.NewBlock(ssa.BlockPlain) + b.AddEdgeTo(bNext) + s.startBlock(bNext) +} + +// boundsCheck generates bounds checking code. Checks if 0 <= idx < len, branches to exit if not. +// Starts a new block on return. +func (s *state) boundsCheck(idx, len *ssa.Value) { + if Debug['B'] != 0 { + return + } + // TODO: convert index to full width? + // TODO: if index is 64-bit and we're compiling to 32-bit, check that high 32 bits are zero. + + // bounds check + cmp := s.newValue2(ssa.OpIsInBounds, Types[TBOOL], idx, len) + s.check(cmp, Panicindex) +} + +// sliceBoundsCheck generates slice bounds checking code. Checks if 0 <= idx <= len, branches to exit if not. +// Starts a new block on return. +func (s *state) sliceBoundsCheck(idx, len *ssa.Value) { + if Debug['B'] != 0 { + return + } + // TODO: convert index to full width? + // TODO: if index is 64-bit and we're compiling to 32-bit, check that high 32 bits are zero. + + // bounds check + cmp := s.newValue2(ssa.OpIsSliceInBounds, Types[TBOOL], idx, len) + s.check(cmp, panicslice) +} + +// If cmp (a bool) is true, panic using the given function. +func (s *state) check(cmp *ssa.Value, fn *Node) { + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = cmp + b.Likely = ssa.BranchLikely + bNext := s.f.NewBlock(ssa.BlockPlain) + line := s.peekLine() + bPanic := s.panics[funcLine{fn, line}] + if bPanic == nil { + bPanic = s.f.NewBlock(ssa.BlockPlain) + s.panics[funcLine{fn, line}] = bPanic + s.startBlock(bPanic) + // The panic call takes/returns memory to ensure that the right + // memory state is observed if the panic happens. + s.rtcall(fn, false, nil) + } + b.AddEdgeTo(bNext) + b.AddEdgeTo(bPanic) + s.startBlock(bNext) +} + +// rtcall issues a call to the given runtime function fn with the listed args. +// Returns a slice of results of the given result types. +// The call is added to the end of the current block. +// If returns is false, the block is marked as an exit block. +// If returns is true, the block is marked as a call block. A new block +// is started to load the return values. +func (s *state) rtcall(fn *Node, returns bool, results []*Type, args ...*ssa.Value) []*ssa.Value { + // Write args to the stack + var off int64 // TODO: arch-dependent starting offset? + for _, arg := range args { + t := arg.Type + off = Rnd(off, t.Alignment()) + ptr := s.sp + if off != 0 { + ptr = s.newValue1I(ssa.OpOffPtr, Types[TUINTPTR], off, s.sp) + } + size := t.Size() + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, size, ptr, arg, s.mem()) + off += size + } + off = Rnd(off, int64(Widthptr)) + + // Issue call + call := s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, fn.Sym, s.mem()) + s.vars[&memVar] = call + + // Finish block + b := s.endBlock() + if !returns { + b.Kind = ssa.BlockExit + b.Control = call + call.AuxInt = off + if len(results) > 0 { + Fatalf("panic call can't have results") + } + return nil + } + b.Kind = ssa.BlockCall + b.Control = call + bNext := s.f.NewBlock(ssa.BlockPlain) + b.AddEdgeTo(bNext) + s.startBlock(bNext) + + // Load results + res := make([]*ssa.Value, len(results)) + for i, t := range results { + off = Rnd(off, t.Alignment()) + ptr := s.sp + if off != 0 { + ptr = s.newValue1I(ssa.OpOffPtr, Types[TUINTPTR], off, s.sp) + } + res[i] = s.newValue2(ssa.OpLoad, t, ptr, s.mem()) + off += t.Size() + } + off = Rnd(off, int64(Widthptr)) + + // Remember how much callee stack space we needed. + call.AuxInt = off + + return res +} + +// insertWBmove inserts the assignment *left = *right including a write barrier. +// t is the type being assigned. +func (s *state) insertWBmove(t *Type, left, right *ssa.Value, line int32) { + // if writeBarrier.enabled { + // typedmemmove(&t, left, right) + // } else { + // *left = *right + // } + bThen := s.f.NewBlock(ssa.BlockPlain) + bElse := s.f.NewBlock(ssa.BlockPlain) + bEnd := s.f.NewBlock(ssa.BlockPlain) + + aux := &ssa.ExternSymbol{Types[TBOOL], syslook("writeBarrier", 0).Sym} + flagaddr := s.newValue1A(ssa.OpAddr, Ptrto(Types[TUINT32]), aux, s.sb) + // TODO: select the .enabled field. It is currently first, so not needed for now. + // Load word, test byte, avoiding partial register write from load byte. + flag := s.newValue2(ssa.OpLoad, Types[TUINT32], flagaddr, s.mem()) + flag = s.newValue1(ssa.OpTrunc64to8, Types[TBOOL], flag) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Likely = ssa.BranchUnlikely + b.Control = flag + b.AddEdgeTo(bThen) + b.AddEdgeTo(bElse) + + s.startBlock(bThen) + taddr := s.newValue1A(ssa.OpAddr, Types[TUINTPTR], &ssa.ExternSymbol{Types[TUINTPTR], typenamesym(t)}, s.sb) + s.rtcall(typedmemmove, true, nil, taddr, left, right) + s.endBlock().AddEdgeTo(bEnd) + + s.startBlock(bElse) + s.vars[&memVar] = s.newValue3I(ssa.OpMove, ssa.TypeMem, t.Size(), left, right, s.mem()) + s.endBlock().AddEdgeTo(bEnd) + + s.startBlock(bEnd) + + if Debug_wb > 0 { + Warnl(int(line), "write barrier") + } +} + +// insertWBstore inserts the assignment *left = right including a write barrier. +// t is the type being assigned. +func (s *state) insertWBstore(t *Type, left, right *ssa.Value, line int32) { + // store scalar fields + // if writeBarrier.enabled { + // writebarrierptr for pointer fields + // } else { + // store pointer fields + // } + + s.storeTypeScalars(t, left, right) + + bThen := s.f.NewBlock(ssa.BlockPlain) + bElse := s.f.NewBlock(ssa.BlockPlain) + bEnd := s.f.NewBlock(ssa.BlockPlain) + + aux := &ssa.ExternSymbol{Types[TBOOL], syslook("writeBarrier", 0).Sym} + flagaddr := s.newValue1A(ssa.OpAddr, Ptrto(Types[TUINT32]), aux, s.sb) + // TODO: select the .enabled field. It is currently first, so not needed for now. + // Load word, test byte, avoiding partial register write from load byte. + flag := s.newValue2(ssa.OpLoad, Types[TUINT32], flagaddr, s.mem()) + flag = s.newValue1(ssa.OpTrunc64to8, Types[TBOOL], flag) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Likely = ssa.BranchUnlikely + b.Control = flag + b.AddEdgeTo(bThen) + b.AddEdgeTo(bElse) + + // Issue write barriers for pointer writes. + s.startBlock(bThen) + s.storeTypePtrsWB(t, left, right) + s.endBlock().AddEdgeTo(bEnd) + + // Issue regular stores for pointer writes. + s.startBlock(bElse) + s.storeTypePtrs(t, left, right) + s.endBlock().AddEdgeTo(bEnd) + + s.startBlock(bEnd) + + if Debug_wb > 0 { + Warnl(int(line), "write barrier") + } +} + +// do *left = right for all scalar (non-pointer) parts of t. +func (s *state) storeTypeScalars(t *Type, left, right *ssa.Value) { + switch { + case t.IsBoolean() || t.IsInteger() || t.IsFloat() || t.IsComplex(): + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, t.Size(), left, right, s.mem()) + case t.IsPtr() || t.IsMap() || t.IsChan(): + // no scalar fields. + case t.IsString(): + len := s.newValue1(ssa.OpStringLen, Types[TINT], right) + lenAddr := s.newValue1I(ssa.OpOffPtr, Ptrto(Types[TINT]), s.config.IntSize, left) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, lenAddr, len, s.mem()) + case t.IsSlice(): + len := s.newValue1(ssa.OpSliceLen, Types[TINT], right) + cap := s.newValue1(ssa.OpSliceCap, Types[TINT], right) + lenAddr := s.newValue1I(ssa.OpOffPtr, Ptrto(Types[TINT]), s.config.IntSize, left) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, lenAddr, len, s.mem()) + capAddr := s.newValue1I(ssa.OpOffPtr, Ptrto(Types[TINT]), 2*s.config.IntSize, left) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, capAddr, cap, s.mem()) + case t.IsInterface(): + // itab field doesn't need a write barrier (even though it is a pointer). + itab := s.newValue1(ssa.OpITab, Ptrto(Types[TUINT8]), right) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, left, itab, s.mem()) + case t.IsStruct(): + n := t.NumFields() + for i := int64(0); i < n; i++ { + ft := t.FieldType(i) + addr := s.newValue1I(ssa.OpOffPtr, ft.PtrTo(), t.FieldOff(i), left) + val := s.newValue1I(ssa.OpStructSelect, ft, i, right) + s.storeTypeScalars(ft.(*Type), addr, val) + } + default: + s.Fatalf("bad write barrier type %s", t) + } +} + +// do *left = right for all pointer parts of t. +func (s *state) storeTypePtrs(t *Type, left, right *ssa.Value) { + switch { + case t.IsPtr() || t.IsMap() || t.IsChan(): + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.PtrSize, left, right, s.mem()) + case t.IsString(): + ptr := s.newValue1(ssa.OpStringPtr, Ptrto(Types[TUINT8]), right) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.PtrSize, left, ptr, s.mem()) + case t.IsSlice(): + ptr := s.newValue1(ssa.OpSlicePtr, Ptrto(Types[TUINT8]), right) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.PtrSize, left, ptr, s.mem()) + case t.IsInterface(): + // itab field is treated as a scalar. + idata := s.newValue1(ssa.OpIData, Ptrto(Types[TUINT8]), right) + idataAddr := s.newValue1I(ssa.OpOffPtr, Ptrto(Types[TUINT8]), s.config.PtrSize, left) + s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.PtrSize, idataAddr, idata, s.mem()) + case t.IsStruct(): + n := t.NumFields() + for i := int64(0); i < n; i++ { + ft := t.FieldType(i) + if !haspointers(ft.(*Type)) { + continue + } + addr := s.newValue1I(ssa.OpOffPtr, ft.PtrTo(), t.FieldOff(i), left) + val := s.newValue1I(ssa.OpStructSelect, ft, i, right) + s.storeTypePtrs(ft.(*Type), addr, val) + } + default: + s.Fatalf("bad write barrier type %s", t) + } +} + +// do *left = right with a write barrier for all pointer parts of t. +func (s *state) storeTypePtrsWB(t *Type, left, right *ssa.Value) { + switch { + case t.IsPtr() || t.IsMap() || t.IsChan(): + s.rtcall(writebarrierptr, true, nil, left, right) + case t.IsString(): + ptr := s.newValue1(ssa.OpStringPtr, Ptrto(Types[TUINT8]), right) + s.rtcall(writebarrierptr, true, nil, left, ptr) + case t.IsSlice(): + ptr := s.newValue1(ssa.OpSlicePtr, Ptrto(Types[TUINT8]), right) + s.rtcall(writebarrierptr, true, nil, left, ptr) + case t.IsInterface(): + idata := s.newValue1(ssa.OpIData, Ptrto(Types[TUINT8]), right) + idataAddr := s.newValue1I(ssa.OpOffPtr, Ptrto(Types[TUINT8]), s.config.PtrSize, left) + s.rtcall(writebarrierptr, true, nil, idataAddr, idata) + case t.IsStruct(): + n := t.NumFields() + for i := int64(0); i < n; i++ { + ft := t.FieldType(i) + if !haspointers(ft.(*Type)) { + continue + } + addr := s.newValue1I(ssa.OpOffPtr, ft.PtrTo(), t.FieldOff(i), left) + val := s.newValue1I(ssa.OpStructSelect, ft, i, right) + s.storeTypePtrsWB(ft.(*Type), addr, val) + } + default: + s.Fatalf("bad write barrier type %s", t) + } +} + +// slice computes the slice v[i:j:k] and returns ptr, len, and cap of result. +// i,j,k may be nil, in which case they are set to their default value. +// t is a slice, ptr to array, or string type. +func (s *state) slice(t *Type, v, i, j, k *ssa.Value) (p, l, c *ssa.Value) { + var elemtype *Type + var ptrtype *Type + var ptr *ssa.Value + var len *ssa.Value + var cap *ssa.Value + zero := s.constInt(Types[TINT], 0) + switch { + case t.IsSlice(): + elemtype = t.Type + ptrtype = Ptrto(elemtype) + ptr = s.newValue1(ssa.OpSlicePtr, ptrtype, v) + len = s.newValue1(ssa.OpSliceLen, Types[TINT], v) + cap = s.newValue1(ssa.OpSliceCap, Types[TINT], v) + case t.IsString(): + elemtype = Types[TUINT8] + ptrtype = Ptrto(elemtype) + ptr = s.newValue1(ssa.OpStringPtr, ptrtype, v) + len = s.newValue1(ssa.OpStringLen, Types[TINT], v) + cap = len + case t.IsPtr(): + if !t.Type.IsArray() { + s.Fatalf("bad ptr to array in slice %v\n", t) + } + elemtype = t.Type.Type + ptrtype = Ptrto(elemtype) + s.nilCheck(v) + ptr = v + len = s.constInt(Types[TINT], t.Type.Bound) + cap = len + default: + s.Fatalf("bad type in slice %v\n", t) + } + + // Set default values + if i == nil { + i = zero + } + if j == nil { + j = len + } + if k == nil { + k = cap + } + + // Panic if slice indices are not in bounds. + s.sliceBoundsCheck(i, j) + if j != k { + s.sliceBoundsCheck(j, k) + } + if k != cap { + s.sliceBoundsCheck(k, cap) + } + + // Generate the following code assuming that indexes are in bounds. + // The conditional is to make sure that we don't generate a slice + // that points to the next object in memory. + // rlen = (Sub64 j i) + // rcap = (Sub64 k i) + // p = ptr + // if rcap != 0 { + // p = (AddPtr ptr (Mul64 low (Const64 size))) + // } + // result = (SliceMake p size) + subOp := s.ssaOp(OSUB, Types[TINT]) + neqOp := s.ssaOp(ONE, Types[TINT]) + mulOp := s.ssaOp(OMUL, Types[TINT]) + rlen := s.newValue2(subOp, Types[TINT], j, i) + var rcap *ssa.Value + switch { + case t.IsString(): + // Capacity of the result is unimportant. However, we use + // rcap to test if we've generated a zero-length slice. + // Use length of strings for that. + rcap = rlen + case j == k: + rcap = rlen + default: + rcap = s.newValue2(subOp, Types[TINT], k, i) + } + + s.vars[&ptrVar] = ptr + + // Generate code to test the resulting slice length. + cmp := s.newValue2(neqOp, Types[TBOOL], rcap, s.constInt(Types[TINT], 0)) + + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Likely = ssa.BranchLikely + b.Control = cmp + + // Generate code for non-zero length slice case. + nz := s.f.NewBlock(ssa.BlockPlain) + b.AddEdgeTo(nz) + s.startBlock(nz) + var inc *ssa.Value + if elemtype.Width == 1 { + inc = i + } else { + inc = s.newValue2(mulOp, Types[TINT], i, s.constInt(Types[TINT], elemtype.Width)) + } + s.vars[&ptrVar] = s.newValue2(ssa.OpAddPtr, ptrtype, ptr, inc) + s.endBlock() + + // All done. + merge := s.f.NewBlock(ssa.BlockPlain) + b.AddEdgeTo(merge) + nz.AddEdgeTo(merge) + s.startBlock(merge) + rptr := s.variable(&ptrVar, ptrtype) + delete(s.vars, &ptrVar) + return rptr, rlen, rcap +} + +type u2fcvtTab struct { + geq, cvt2F, and, rsh, or, add ssa.Op + one func(*state, ssa.Type, int64) *ssa.Value +} + +var u64_f64 u2fcvtTab = u2fcvtTab{ + geq: ssa.OpGeq64, + cvt2F: ssa.OpCvt64to64F, + and: ssa.OpAnd64, + rsh: ssa.OpRsh64Ux64, + or: ssa.OpOr64, + add: ssa.OpAdd64F, + one: (*state).constInt64, +} + +var u64_f32 u2fcvtTab = u2fcvtTab{ + geq: ssa.OpGeq64, + cvt2F: ssa.OpCvt64to32F, + and: ssa.OpAnd64, + rsh: ssa.OpRsh64Ux64, + or: ssa.OpOr64, + add: ssa.OpAdd32F, + one: (*state).constInt64, +} + +// Excess generality on a machine with 64-bit integer registers. +// Not used on AMD64. +var u32_f32 u2fcvtTab = u2fcvtTab{ + geq: ssa.OpGeq32, + cvt2F: ssa.OpCvt32to32F, + and: ssa.OpAnd32, + rsh: ssa.OpRsh32Ux32, + or: ssa.OpOr32, + add: ssa.OpAdd32F, + one: func(s *state, t ssa.Type, x int64) *ssa.Value { + return s.constInt32(t, int32(x)) + }, +} + +func (s *state) uint64Tofloat64(n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value { + return s.uintTofloat(&u64_f64, n, x, ft, tt) +} + +func (s *state) uint64Tofloat32(n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value { + return s.uintTofloat(&u64_f32, n, x, ft, tt) +} + +func (s *state) uintTofloat(cvttab *u2fcvtTab, n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value { + // if x >= 0 { + // result = (floatY) x + // } else { + // y = uintX(x) ; y = x & 1 + // z = uintX(x) ; z = z >> 1 + // z = z >> 1 + // z = z | y + // result = floatY(z) + // result = result + result + // } + // + // Code borrowed from old code generator. + // What's going on: large 64-bit "unsigned" looks like + // negative number to hardware's integer-to-float + // conversion. However, because the mantissa is only + // 63 bits, we don't need the LSB, so instead we do an + // unsigned right shift (divide by two), convert, and + // double. However, before we do that, we need to be + // sure that we do not lose a "1" if that made the + // difference in the resulting rounding. Therefore, we + // preserve it, and OR (not ADD) it back in. The case + // that matters is when the eleven discarded bits are + // equal to 10000000001; that rounds up, and the 1 cannot + // be lost else it would round down if the LSB of the + // candidate mantissa is 0. + cmp := s.newValue2(cvttab.geq, Types[TBOOL], x, s.zeroVal(ft)) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = cmp + b.Likely = ssa.BranchLikely + + bThen := s.f.NewBlock(ssa.BlockPlain) + bElse := s.f.NewBlock(ssa.BlockPlain) + bAfter := s.f.NewBlock(ssa.BlockPlain) + + b.AddEdgeTo(bThen) + s.startBlock(bThen) + a0 := s.newValue1(cvttab.cvt2F, tt, x) + s.vars[n] = a0 + s.endBlock() + bThen.AddEdgeTo(bAfter) + + b.AddEdgeTo(bElse) + s.startBlock(bElse) + one := cvttab.one(s, ft, 1) + y := s.newValue2(cvttab.and, ft, x, one) + z := s.newValue2(cvttab.rsh, ft, x, one) + z = s.newValue2(cvttab.or, ft, z, y) + a := s.newValue1(cvttab.cvt2F, tt, z) + a1 := s.newValue2(cvttab.add, tt, a, a) + s.vars[n] = a1 + s.endBlock() + bElse.AddEdgeTo(bAfter) + + s.startBlock(bAfter) + return s.variable(n, n.Type) +} + +// referenceTypeBuiltin generates code for the len/cap builtins for maps and channels. +func (s *state) referenceTypeBuiltin(n *Node, x *ssa.Value) *ssa.Value { + if !n.Left.Type.IsMap() && !n.Left.Type.IsChan() { + s.Fatalf("node must be a map or a channel") + } + // if n == nil { + // return 0 + // } else { + // // len + // return *((*int)n) + // // cap + // return *(((*int)n)+1) + // } + lenType := n.Type + nilValue := s.newValue0(ssa.OpConstNil, Types[TUINTPTR]) + cmp := s.newValue2(ssa.OpEqPtr, Types[TBOOL], x, nilValue) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = cmp + b.Likely = ssa.BranchUnlikely + + bThen := s.f.NewBlock(ssa.BlockPlain) + bElse := s.f.NewBlock(ssa.BlockPlain) + bAfter := s.f.NewBlock(ssa.BlockPlain) + + // length/capacity of a nil map/chan is zero + b.AddEdgeTo(bThen) + s.startBlock(bThen) + s.vars[n] = s.zeroVal(lenType) + s.endBlock() + bThen.AddEdgeTo(bAfter) + + b.AddEdgeTo(bElse) + s.startBlock(bElse) + if n.Op == OLEN { + // length is stored in the first word for map/chan + s.vars[n] = s.newValue2(ssa.OpLoad, lenType, x, s.mem()) + } else if n.Op == OCAP { + // capacity is stored in the second word for chan + sw := s.newValue1I(ssa.OpOffPtr, lenType.PtrTo(), lenType.Width, x) + s.vars[n] = s.newValue2(ssa.OpLoad, lenType, sw, s.mem()) + } else { + s.Fatalf("op must be OLEN or OCAP") + } + s.endBlock() + bElse.AddEdgeTo(bAfter) + + s.startBlock(bAfter) + return s.variable(n, lenType) +} + +type f2uCvtTab struct { + ltf, cvt2U, subf ssa.Op + value func(*state, ssa.Type, float64) *ssa.Value +} + +var f32_u64 f2uCvtTab = f2uCvtTab{ + ltf: ssa.OpLess32F, + cvt2U: ssa.OpCvt32Fto64, + subf: ssa.OpSub32F, + value: (*state).constFloat32, +} + +var f64_u64 f2uCvtTab = f2uCvtTab{ + ltf: ssa.OpLess64F, + cvt2U: ssa.OpCvt64Fto64, + subf: ssa.OpSub64F, + value: (*state).constFloat64, +} + +func (s *state) float32ToUint64(n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value { + return s.floatToUint(&f32_u64, n, x, ft, tt) +} +func (s *state) float64ToUint64(n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value { + return s.floatToUint(&f64_u64, n, x, ft, tt) +} + +func (s *state) floatToUint(cvttab *f2uCvtTab, n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value { + // if x < 9223372036854775808.0 { + // result = uintY(x) + // } else { + // y = x - 9223372036854775808.0 + // z = uintY(y) + // result = z | -9223372036854775808 + // } + twoToThe63 := cvttab.value(s, ft, 9223372036854775808.0) + cmp := s.newValue2(cvttab.ltf, Types[TBOOL], x, twoToThe63) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = cmp + b.Likely = ssa.BranchLikely + + bThen := s.f.NewBlock(ssa.BlockPlain) + bElse := s.f.NewBlock(ssa.BlockPlain) + bAfter := s.f.NewBlock(ssa.BlockPlain) + + b.AddEdgeTo(bThen) + s.startBlock(bThen) + a0 := s.newValue1(cvttab.cvt2U, tt, x) + s.vars[n] = a0 + s.endBlock() + bThen.AddEdgeTo(bAfter) + + b.AddEdgeTo(bElse) + s.startBlock(bElse) + y := s.newValue2(cvttab.subf, ft, x, twoToThe63) + y = s.newValue1(cvttab.cvt2U, tt, y) + z := s.constInt64(tt, -9223372036854775808) + a1 := s.newValue2(ssa.OpOr64, tt, y, z) + s.vars[n] = a1 + s.endBlock() + bElse.AddEdgeTo(bAfter) + + s.startBlock(bAfter) + return s.variable(n, n.Type) +} + +// ifaceType returns the value for the word containing the type. +// n is the node for the interface expression. +// v is the corresponding value. +func (s *state) ifaceType(n *Node, v *ssa.Value) *ssa.Value { + byteptr := Ptrto(Types[TUINT8]) // type used in runtime prototypes for runtime type (*byte) + + if isnilinter(n.Type) { + // Have *eface. The type is the first word in the struct. + return s.newValue1(ssa.OpITab, byteptr, v) + } + + // Have *iface. + // The first word in the struct is the *itab. + // If the *itab is nil, return 0. + // Otherwise, the second word in the *itab is the type. + + tab := s.newValue1(ssa.OpITab, byteptr, v) + s.vars[&typVar] = tab + isnonnil := s.newValue2(ssa.OpNeqPtr, Types[TBOOL], tab, s.entryNewValue0(ssa.OpConstNil, byteptr)) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = isnonnil + b.Likely = ssa.BranchLikely + + bLoad := s.f.NewBlock(ssa.BlockPlain) + bEnd := s.f.NewBlock(ssa.BlockPlain) + + b.AddEdgeTo(bLoad) + b.AddEdgeTo(bEnd) + bLoad.AddEdgeTo(bEnd) + + s.startBlock(bLoad) + off := s.newValue1I(ssa.OpOffPtr, byteptr, int64(Widthptr), tab) + s.vars[&typVar] = s.newValue2(ssa.OpLoad, byteptr, off, s.mem()) + s.endBlock() + + s.startBlock(bEnd) + typ := s.variable(&typVar, byteptr) + delete(s.vars, &typVar) + return typ +} + +// dottype generates SSA for a type assertion node. +// commaok indicates whether to panic or return a bool. +// If commaok is false, resok will be nil. +func (s *state) dottype(n *Node, commaok bool) (res, resok *ssa.Value) { + iface := s.expr(n.Left) + typ := s.ifaceType(n.Left, iface) // actual concrete type + target := s.expr(typename(n.Type)) // target type + if !isdirectiface(n.Type) { + // walk rewrites ODOTTYPE/OAS2DOTTYPE into runtime calls except for this case. + Fatalf("dottype needs a direct iface type %s", n.Type) + } + + if Debug_typeassert > 0 { + Warnl(int(n.Lineno), "type assertion inlined") + } + + // TODO: If we have a nonempty interface and its itab field is nil, + // then this test is redundant and ifaceType should just branch directly to bFail. + cond := s.newValue2(ssa.OpEqPtr, Types[TBOOL], typ, target) + b := s.endBlock() + b.Kind = ssa.BlockIf + b.Control = cond + b.Likely = ssa.BranchLikely + + byteptr := Ptrto(Types[TUINT8]) + + bOk := s.f.NewBlock(ssa.BlockPlain) + bFail := s.f.NewBlock(ssa.BlockPlain) + b.AddEdgeTo(bOk) + b.AddEdgeTo(bFail) + + if !commaok { + // on failure, panic by calling panicdottype + s.startBlock(bFail) + taddr := s.newValue1A(ssa.OpAddr, byteptr, &ssa.ExternSymbol{byteptr, typenamesym(n.Left.Type)}, s.sb) + s.rtcall(panicdottype, false, nil, typ, target, taddr) + + // on success, return idata field + s.startBlock(bOk) + return s.newValue1(ssa.OpIData, n.Type, iface), nil + } + + // commaok is the more complicated case because we have + // a control flow merge point. + bEnd := s.f.NewBlock(ssa.BlockPlain) + + // type assertion succeeded + s.startBlock(bOk) + s.vars[&idataVar] = s.newValue1(ssa.OpIData, n.Type, iface) + s.vars[&okVar] = s.constBool(true) + s.endBlock() + bOk.AddEdgeTo(bEnd) + + // type assertion failed + s.startBlock(bFail) + s.vars[&idataVar] = s.entryNewValue0(ssa.OpConstNil, byteptr) + s.vars[&okVar] = s.constBool(false) + s.endBlock() + bFail.AddEdgeTo(bEnd) + + // merge point + s.startBlock(bEnd) + res = s.variable(&idataVar, byteptr) + resok = s.variable(&okVar, Types[TBOOL]) + delete(s.vars, &idataVar) + delete(s.vars, &okVar) + return res, resok +} + +// checkgoto checks that a goto from from to to does not +// jump into a block or jump over variable declarations. +// It is a copy of checkgoto in the pre-SSA backend, +// modified only for line number handling. +// TODO: document how this works and why it is designed the way it is. +func (s *state) checkgoto(from *Node, to *Node) { + if from.Sym == to.Sym { + return + } + + nf := 0 + for fs := from.Sym; fs != nil; fs = fs.Link { + nf++ + } + nt := 0 + for fs := to.Sym; fs != nil; fs = fs.Link { + nt++ + } + fs := from.Sym + for ; nf > nt; nf-- { + fs = fs.Link + } + if fs != to.Sym { + // decide what to complain about. + // prefer to complain about 'into block' over declarations, + // so scan backward to find most recent block or else dcl. + var block *Sym + + var dcl *Sym + ts := to.Sym + for ; nt > nf; nt-- { + if ts.Pkg == nil { + block = ts + } else { + dcl = ts + } + ts = ts.Link + } + + for ts != fs { + if ts.Pkg == nil { + block = ts + } else { + dcl = ts + } + ts = ts.Link + fs = fs.Link + } + + lno := int(from.Left.Lineno) + if block != nil { + yyerrorl(lno, "goto %v jumps into block starting at %v", from.Left.Sym, Ctxt.Line(int(block.Lastlineno))) + } else { + yyerrorl(lno, "goto %v jumps over declaration of %v at %v", from.Left.Sym, dcl, Ctxt.Line(int(dcl.Lastlineno))) + } + } +} + +// variable returns the value of a variable at the current location. +func (s *state) variable(name *Node, t ssa.Type) *ssa.Value { + v := s.vars[name] + if v == nil { + v = s.newValue0A(ssa.OpFwdRef, t, name) + s.fwdRefs = append(s.fwdRefs, v) + s.vars[name] = v + s.addNamedValue(name, v) + } + return v +} + +func (s *state) mem() *ssa.Value { + return s.variable(&memVar, ssa.TypeMem) +} + +func (s *state) linkForwardReferences() { + // Build SSA graph. Each variable on its first use in a basic block + // leaves a FwdRef in that block representing the incoming value + // of that variable. This function links that ref up with possible definitions, + // inserting Phi values as needed. This is essentially the algorithm + // described by Braun, Buchwald, Hack, Leißa, Mallon, and Zwinkau: + // http://pp.info.uni-karlsruhe.de/uploads/publikationen/braun13cc.pdf + // Differences: + // - We use FwdRef nodes to postpone phi building until the CFG is + // completely built. That way we can avoid the notion of "sealed" + // blocks. + // - Phi optimization is a separate pass (in ../ssa/phielim.go). + for len(s.fwdRefs) > 0 { + v := s.fwdRefs[len(s.fwdRefs)-1] + s.fwdRefs = s.fwdRefs[:len(s.fwdRefs)-1] + s.resolveFwdRef(v) + } +} + +// resolveFwdRef modifies v to be the variable's value at the start of its block. +// v must be a FwdRef op. +func (s *state) resolveFwdRef(v *ssa.Value) { + b := v.Block + name := v.Aux.(*Node) + v.Aux = nil + if b == s.f.Entry { + // Live variable at start of function. + if s.canSSA(name) { + v.Op = ssa.OpArg + v.Aux = name + return + } + // Not SSAable. Load it. + addr := s.decladdrs[name] + if addr == nil { + // TODO: closure args reach here. + s.Unimplementedf("unhandled closure arg %s at entry to function %s", name, b.Func.Name) + } + if _, ok := addr.Aux.(*ssa.ArgSymbol); !ok { + s.Fatalf("variable live at start of function %s is not an argument %s", b.Func.Name, name) + } + v.Op = ssa.OpLoad + v.AddArgs(addr, s.startmem) + return + } + if len(b.Preds) == 0 { + // This block is dead; we have no predecessors and we're not the entry block. + // It doesn't matter what we use here as long as it is well-formed. + v.Op = ssa.OpUnknown + return + } + // Find variable value on each predecessor. + var argstore [4]*ssa.Value + args := argstore[:0] + for _, p := range b.Preds { + args = append(args, s.lookupVarOutgoing(p, v.Type, name, v.Line)) + } + + // Decide if we need a phi or not. We need a phi if there + // are two different args (which are both not v). + var w *ssa.Value + for _, a := range args { + if a == v { + continue // self-reference + } + if a == w { + continue // already have this witness + } + if w != nil { + // two witnesses, need a phi value + v.Op = ssa.OpPhi + v.AddArgs(args...) + return + } + w = a // save witness + } + if w == nil { + s.Fatalf("no witness for reachable phi %s", v) + } + // One witness. Make v a copy of w. + v.Op = ssa.OpCopy + v.AddArg(w) +} + +// lookupVarOutgoing finds the variable's value at the end of block b. +func (s *state) lookupVarOutgoing(b *ssa.Block, t ssa.Type, name *Node, line int32) *ssa.Value { + m := s.defvars[b.ID] + if v, ok := m[name]; ok { + return v + } + // The variable is not defined by b and we haven't + // looked it up yet. Generate a FwdRef for the variable and return that. + v := b.NewValue0A(line, ssa.OpFwdRef, t, name) + s.fwdRefs = append(s.fwdRefs, v) + m[name] = v + s.addNamedValue(name, v) + return v +} + +func (s *state) addNamedValue(n *Node, v *ssa.Value) { + if n.Class == Pxxx { + // Don't track our dummy nodes (&memVar etc.). + return + } + if strings.HasPrefix(n.Sym.Name, "autotmp_") { + // Don't track autotmp_ variables. + return + } + if n.Class == PAUTO && (v.Type.IsString() || v.Type.IsSlice() || v.Type.IsInterface()) { + // TODO: can't handle auto compound objects with pointers yet. + // The live variable analysis barfs because we don't put VARDEF + // pseudos in the right place when we spill to these nodes. + return + } + if n.Class == PAUTO && n.Xoffset != 0 { + s.Fatalf("AUTO var with offset %s %d", n, n.Xoffset) + } + loc := ssa.LocalSlot{N: n, Type: n.Type, Off: 0} + values, ok := s.f.NamedValues[loc] + if !ok { + s.f.Names = append(s.f.Names, loc) + } + s.f.NamedValues[loc] = append(values, v) +} + +// an unresolved branch +type branch struct { + p *obj.Prog // branch instruction + b *ssa.Block // target +} + +type genState struct { + // branches remembers all the branch instructions we've seen + // and where they would like to go. + branches []branch + + // bstart remembers where each block starts (indexed by block ID) + bstart []*obj.Prog + + // deferBranches remembers all the defer branches we've seen. + deferBranches []*obj.Prog + + // deferTarget remembers the (last) deferreturn call site. + deferTarget *obj.Prog +} + +// genssa appends entries to ptxt for each instruction in f. +// gcargs and gclocals are filled in with pointer maps for the frame. +func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) { + var s genState + + e := f.Config.Frontend().(*ssaExport) + // We're about to emit a bunch of Progs. + // Since the only way to get here is to explicitly request it, + // just fail on unimplemented instead of trying to unwind our mess. + e.mustImplement = true + + // Remember where each block starts. + s.bstart = make([]*obj.Prog, f.NumBlocks()) + + var valueProgs map[*obj.Prog]*ssa.Value + var blockProgs map[*obj.Prog]*ssa.Block + const logProgs = true + if logProgs { + valueProgs = make(map[*obj.Prog]*ssa.Value, f.NumValues()) + blockProgs = make(map[*obj.Prog]*ssa.Block, f.NumBlocks()) + f.Logf("genssa %s\n", f.Name) + blockProgs[Pc] = f.Blocks[0] + } + + // Emit basic blocks + for i, b := range f.Blocks { + s.bstart[b.ID] = Pc + // Emit values in block + s.markMoves(b) + for _, v := range b.Values { + x := Pc + s.genValue(v) + if logProgs { + for ; x != Pc; x = x.Link { + valueProgs[x] = v + } + } + } + // Emit control flow instructions for block + var next *ssa.Block + if i < len(f.Blocks)-1 && (Debug['N'] == 0 || b.Kind == ssa.BlockCall) { + // If -N, leave next==nil so every block with successors + // ends in a JMP (except call blocks - plive doesn't like + // select{send,recv} followed by a JMP call). Helps keep + // line numbers for otherwise empty blocks. + next = f.Blocks[i+1] + } + x := Pc + s.genBlock(b, next) + if logProgs { + for ; x != Pc; x = x.Link { + blockProgs[x] = b + } + } + } + + // Resolve branches + for _, br := range s.branches { + br.p.To.Val = s.bstart[br.b.ID] + } + if s.deferBranches != nil && s.deferTarget == nil { + // This can happen when the function has a defer but + // no return (because it has an infinite loop). + s.deferReturn() + Prog(obj.ARET) + } + for _, p := range s.deferBranches { + p.To.Val = s.deferTarget + } + + if logProgs { + for p := ptxt; p != nil; p = p.Link { + var s string + if v, ok := valueProgs[p]; ok { + s = v.String() + } else if b, ok := blockProgs[p]; ok { + s = b.String() + } else { + s = " " // most value and branch strings are 2-3 characters long + } + f.Logf("%s\t%s\n", s, p) + } + if f.Config.HTML != nil { + saved := ptxt.Ctxt.LineHist.PrintFilenameOnly + ptxt.Ctxt.LineHist.PrintFilenameOnly = true + var buf bytes.Buffer + buf.WriteString("<code>") + buf.WriteString("<dl class=\"ssa-gen\">") + for p := ptxt; p != nil; p = p.Link { + buf.WriteString("<dt class=\"ssa-prog-src\">") + if v, ok := valueProgs[p]; ok { + buf.WriteString(v.HTML()) + } else if b, ok := blockProgs[p]; ok { + buf.WriteString(b.HTML()) + } + buf.WriteString("</dt>") + buf.WriteString("<dd class=\"ssa-prog\">") + buf.WriteString(html.EscapeString(p.String())) + buf.WriteString("</dd>") + buf.WriteString("</li>") + } + buf.WriteString("</dl>") + buf.WriteString("</code>") + f.Config.HTML.WriteColumn("genssa", buf.String()) + ptxt.Ctxt.LineHist.PrintFilenameOnly = saved + } + } + + // Emit static data + if f.StaticData != nil { + for _, n := range f.StaticData.([]*Node) { + if !gen_as_init(n, false) { + Fatalf("non-static data marked as static: %v\n\n", n, f) + } + } + } + + // Allocate stack frame + allocauto(ptxt) + + // Generate gc bitmaps. + liveness(Curfn, ptxt, gcargs, gclocals) + gcsymdup(gcargs) + gcsymdup(gclocals) + + // Add frame prologue. Zero ambiguously live variables. + Thearch.Defframe(ptxt) + if Debug['f'] != 0 { + frame(0) + } + + // Remove leftover instrumentation from the instruction stream. + removevardef(ptxt) + + f.Config.HTML.Close() +} + +// opregreg emits instructions for +// dest := dest(To) op src(From) +// and also returns the created obj.Prog so it +// may be further adjusted (offset, scale, etc). +func opregreg(op int, dest, src int16) *obj.Prog { + p := Prog(op) + p.From.Type = obj.TYPE_REG + p.To.Type = obj.TYPE_REG + p.To.Reg = dest + p.From.Reg = src + return p +} + +func (s *genState) genValue(v *ssa.Value) { + lineno = v.Line + switch v.Op { + case ssa.OpAMD64ADDQ, ssa.OpAMD64ADDL, ssa.OpAMD64ADDW: + r := regnum(v) + r1 := regnum(v.Args[0]) + r2 := regnum(v.Args[1]) + switch { + case r == r1: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = r2 + p.To.Type = obj.TYPE_REG + p.To.Reg = r + case r == r2: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = r1 + p.To.Type = obj.TYPE_REG + p.To.Reg = r + default: + var asm int + switch v.Op { + case ssa.OpAMD64ADDQ: + asm = x86.ALEAQ + case ssa.OpAMD64ADDL: + asm = x86.ALEAL + case ssa.OpAMD64ADDW: + asm = x86.ALEAL + } + p := Prog(asm) + p.From.Type = obj.TYPE_MEM + p.From.Reg = r1 + p.From.Scale = 1 + p.From.Index = r2 + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + // 2-address opcode arithmetic, symmetric + case ssa.OpAMD64ADDB, ssa.OpAMD64ADDSS, ssa.OpAMD64ADDSD, + ssa.OpAMD64ANDQ, ssa.OpAMD64ANDL, ssa.OpAMD64ANDW, ssa.OpAMD64ANDB, + ssa.OpAMD64ORQ, ssa.OpAMD64ORL, ssa.OpAMD64ORW, ssa.OpAMD64ORB, + ssa.OpAMD64XORQ, ssa.OpAMD64XORL, ssa.OpAMD64XORW, ssa.OpAMD64XORB, + ssa.OpAMD64MULQ, ssa.OpAMD64MULL, ssa.OpAMD64MULW, ssa.OpAMD64MULB, + ssa.OpAMD64MULSS, ssa.OpAMD64MULSD, ssa.OpAMD64PXOR: + r := regnum(v) + x := regnum(v.Args[0]) + y := regnum(v.Args[1]) + if x != r && y != r { + opregreg(moveByType(v.Type), r, x) + x = r + } + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.To.Type = obj.TYPE_REG + p.To.Reg = r + if x == r { + p.From.Reg = y + } else { + p.From.Reg = x + } + // 2-address opcode arithmetic, not symmetric + case ssa.OpAMD64SUBQ, ssa.OpAMD64SUBL, ssa.OpAMD64SUBW, ssa.OpAMD64SUBB: + r := regnum(v) + x := regnum(v.Args[0]) + y := regnum(v.Args[1]) + var neg bool + if y == r { + // compute -(y-x) instead + x, y = y, x + neg = true + } + if x != r { + opregreg(moveByType(v.Type), r, x) + } + opregreg(v.Op.Asm(), r, y) + + if neg { + if v.Op == ssa.OpAMD64SUBQ { + p := Prog(x86.ANEGQ) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } else { // Avoids partial registers write + p := Prog(x86.ANEGL) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + } + case ssa.OpAMD64SUBSS, ssa.OpAMD64SUBSD, ssa.OpAMD64DIVSS, ssa.OpAMD64DIVSD: + r := regnum(v) + x := regnum(v.Args[0]) + y := regnum(v.Args[1]) + if y == r && x != r { + // r/y := x op r/y, need to preserve x and rewrite to + // r/y := r/y op x15 + x15 := int16(x86.REG_X15) + // register move y to x15 + // register move x to y + // rename y with x15 + opregreg(moveByType(v.Type), x15, y) + opregreg(moveByType(v.Type), r, x) + y = x15 + } else if x != r { + opregreg(moveByType(v.Type), r, x) + } + opregreg(v.Op.Asm(), r, y) + + case ssa.OpAMD64DIVQ, ssa.OpAMD64DIVL, ssa.OpAMD64DIVW, + ssa.OpAMD64DIVQU, ssa.OpAMD64DIVLU, ssa.OpAMD64DIVWU, + ssa.OpAMD64MODQ, ssa.OpAMD64MODL, ssa.OpAMD64MODW, + ssa.OpAMD64MODQU, ssa.OpAMD64MODLU, ssa.OpAMD64MODWU: + + // Arg[0] is already in AX as it's the only register we allow + // and AX is the only output + x := regnum(v.Args[1]) + + // CPU faults upon signed overflow, which occurs when most + // negative int is divided by -1. + var j *obj.Prog + if v.Op == ssa.OpAMD64DIVQ || v.Op == ssa.OpAMD64DIVL || + v.Op == ssa.OpAMD64DIVW || v.Op == ssa.OpAMD64MODQ || + v.Op == ssa.OpAMD64MODL || v.Op == ssa.OpAMD64MODW { + + var c *obj.Prog + switch v.Op { + case ssa.OpAMD64DIVQ, ssa.OpAMD64MODQ: + c = Prog(x86.ACMPQ) + j = Prog(x86.AJEQ) + // go ahead and sign extend to save doing it later + Prog(x86.ACQO) + + case ssa.OpAMD64DIVL, ssa.OpAMD64MODL: + c = Prog(x86.ACMPL) + j = Prog(x86.AJEQ) + Prog(x86.ACDQ) + + case ssa.OpAMD64DIVW, ssa.OpAMD64MODW: + c = Prog(x86.ACMPW) + j = Prog(x86.AJEQ) + Prog(x86.ACWD) + } + c.From.Type = obj.TYPE_REG + c.From.Reg = x + c.To.Type = obj.TYPE_CONST + c.To.Offset = -1 + + j.To.Type = obj.TYPE_BRANCH + + } + + // for unsigned ints, we sign extend by setting DX = 0 + // signed ints were sign extended above + if v.Op == ssa.OpAMD64DIVQU || v.Op == ssa.OpAMD64MODQU || + v.Op == ssa.OpAMD64DIVLU || v.Op == ssa.OpAMD64MODLU || + v.Op == ssa.OpAMD64DIVWU || v.Op == ssa.OpAMD64MODWU { + c := Prog(x86.AXORQ) + c.From.Type = obj.TYPE_REG + c.From.Reg = x86.REG_DX + c.To.Type = obj.TYPE_REG + c.To.Reg = x86.REG_DX + } + + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = x + + // signed division, rest of the check for -1 case + if j != nil { + j2 := Prog(obj.AJMP) + j2.To.Type = obj.TYPE_BRANCH + + var n *obj.Prog + if v.Op == ssa.OpAMD64DIVQ || v.Op == ssa.OpAMD64DIVL || + v.Op == ssa.OpAMD64DIVW { + // n * -1 = -n + n = Prog(x86.ANEGQ) + n.To.Type = obj.TYPE_REG + n.To.Reg = x86.REG_AX + } else { + // n % -1 == 0 + n = Prog(x86.AXORQ) + n.From.Type = obj.TYPE_REG + n.From.Reg = x86.REG_DX + n.To.Type = obj.TYPE_REG + n.To.Reg = x86.REG_DX + } + + j.To.Val = n + j2.To.Val = Pc + } + + case ssa.OpAMD64HMULQ, ssa.OpAMD64HMULL, ssa.OpAMD64HMULW, ssa.OpAMD64HMULB, + ssa.OpAMD64HMULQU, ssa.OpAMD64HMULLU, ssa.OpAMD64HMULWU, ssa.OpAMD64HMULBU: + // the frontend rewrites constant division by 8/16/32 bit integers into + // HMUL by a constant + // SSA rewrites generate the 64 bit versions + + // 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.OpAMD64AVGQU: + // compute (x+y)/2 unsigned. + // Do a 64-bit add, the overflow goes into the carry. + // Shift right once and pull the carry back into the 63rd bit. + r := regnum(v) + x := regnum(v.Args[0]) + y := regnum(v.Args[1]) + if x != r && y != r { + opregreg(moveByType(v.Type), r, x) + x = r + } + p := Prog(x86.AADDQ) + p.From.Type = obj.TYPE_REG + p.To.Type = obj.TYPE_REG + p.To.Reg = r + if x == r { + p.From.Reg = y + } else { + p.From.Reg = x + } + p = Prog(x86.ARCRQ) + p.From.Type = obj.TYPE_CONST + p.From.Offset = 1 + p.To.Type = obj.TYPE_REG + p.To.Reg = r + + 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: + x := regnum(v.Args[0]) + r := regnum(v) + if x != r { + if r == x86.REG_CX { + v.Fatalf("can't implement %s, target and shift both in CX", v.LongString()) + } + p := Prog(moveByType(v.Type)) + p.From.Type = obj.TYPE_REG + p.From.Reg = x + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[1]) // should be CX + p.To.Type = obj.TYPE_REG + p.To.Reg = r + case ssa.OpAMD64ADDQconst, ssa.OpAMD64ADDLconst, ssa.OpAMD64ADDWconst: + r := regnum(v) + a := regnum(v.Args[0]) + if r == a { + if v.AuxInt2Int64() == 1 { + var asm int + switch v.Op { + // Software optimization manual recommends add $1,reg. + // But inc/dec is 1 byte smaller. ICC always uses inc + // Clang/GCC choose depending on flags, but prefer add. + // Experiments show that inc/dec is both a little faster + // and make a binary a little smaller. + case ssa.OpAMD64ADDQconst: + asm = x86.AINCQ + case ssa.OpAMD64ADDLconst: + asm = x86.AINCL + case ssa.OpAMD64ADDWconst: + asm = x86.AINCL + } + p := Prog(asm) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + return + } else if v.AuxInt2Int64() == -1 { + var asm int + switch v.Op { + case ssa.OpAMD64ADDQconst: + asm = x86.ADECQ + case ssa.OpAMD64ADDLconst: + asm = x86.ADECL + case ssa.OpAMD64ADDWconst: + asm = x86.ADECL + } + p := Prog(asm) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + return + } else { + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = r + return + } + } + var asm int + switch v.Op { + case ssa.OpAMD64ADDQconst: + asm = x86.ALEAQ + case ssa.OpAMD64ADDLconst: + asm = x86.ALEAL + case ssa.OpAMD64ADDWconst: + asm = x86.ALEAL + } + p := Prog(asm) + p.From.Type = obj.TYPE_MEM + p.From.Reg = a + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = r + case ssa.OpAMD64MULQconst, ssa.OpAMD64MULLconst, ssa.OpAMD64MULWconst, ssa.OpAMD64MULBconst: + r := regnum(v) + x := regnum(v.Args[0]) + if r != x { + p := Prog(moveByType(v.Type)) + p.From.Type = obj.TYPE_REG + p.From.Reg = x + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = r + // TODO: Teach doasm to compile the three-address multiply imul $c, r1, r2 + // instead of using the MOVQ above. + //p.From3 = new(obj.Addr) + //p.From3.Type = obj.TYPE_REG + //p.From3.Reg = regnum(v.Args[0]) + case ssa.OpAMD64SUBQconst, ssa.OpAMD64SUBLconst, ssa.OpAMD64SUBWconst: + x := regnum(v.Args[0]) + r := regnum(v) + // We have 3-op add (lea), so transforming a = b - const into + // a = b + (- const), saves us 1 instruction. We can't fit + // - (-1 << 31) into 4 bytes offset in lea. + // We handle 2-address just fine below. + if v.AuxInt2Int64() == -1<<31 || x == r { + if x != r { + // This code compensates for the fact that the register allocator + // doesn't understand 2-address instructions yet. TODO: fix that. + p := Prog(moveByType(v.Type)) + p.From.Type = obj.TYPE_REG + p.From.Reg = x + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } else if x == r && v.AuxInt2Int64() == -1 { + var asm int + // x = x - (-1) is the same as x++ + // See OpAMD64ADDQconst comments about inc vs add $1,reg + switch v.Op { + case ssa.OpAMD64SUBQconst: + asm = x86.AINCQ + case ssa.OpAMD64SUBLconst: + asm = x86.AINCL + case ssa.OpAMD64SUBWconst: + asm = x86.AINCL + } + p := Prog(asm) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } else if x == r && v.AuxInt2Int64() == 1 { + var asm int + switch v.Op { + case ssa.OpAMD64SUBQconst: + asm = x86.ADECQ + case ssa.OpAMD64SUBLconst: + asm = x86.ADECL + case ssa.OpAMD64SUBWconst: + asm = x86.ADECL + } + p := Prog(asm) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } else { + var asm int + switch v.Op { + case ssa.OpAMD64SUBQconst: + asm = x86.ALEAQ + case ssa.OpAMD64SUBLconst: + asm = x86.ALEAL + case ssa.OpAMD64SUBWconst: + asm = x86.ALEAL + } + p := Prog(asm) + p.From.Type = obj.TYPE_MEM + p.From.Reg = x + p.From.Offset = -v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + + case ssa.OpAMD64ADDBconst, + ssa.OpAMD64ANDQconst, ssa.OpAMD64ANDLconst, ssa.OpAMD64ANDWconst, ssa.OpAMD64ANDBconst, + ssa.OpAMD64ORQconst, ssa.OpAMD64ORLconst, ssa.OpAMD64ORWconst, ssa.OpAMD64ORBconst, + ssa.OpAMD64XORQconst, ssa.OpAMD64XORLconst, ssa.OpAMD64XORWconst, ssa.OpAMD64XORBconst, + ssa.OpAMD64SUBBconst, ssa.OpAMD64SHLQconst, ssa.OpAMD64SHLLconst, ssa.OpAMD64SHLWconst, + ssa.OpAMD64SHLBconst, ssa.OpAMD64SHRQconst, ssa.OpAMD64SHRLconst, ssa.OpAMD64SHRWconst, + ssa.OpAMD64SHRBconst, ssa.OpAMD64SARQconst, ssa.OpAMD64SARLconst, ssa.OpAMD64SARWconst, + ssa.OpAMD64SARBconst, ssa.OpAMD64ROLQconst, ssa.OpAMD64ROLLconst, ssa.OpAMD64ROLWconst, + ssa.OpAMD64ROLBconst: + // This code compensates for the fact that the register allocator + // doesn't understand 2-address instructions yet. TODO: fix that. + x := regnum(v.Args[0]) + r := regnum(v) + if x != r { + p := Prog(moveByType(v.Type)) + p.From.Type = obj.TYPE_REG + p.From.Reg = x + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = r + case ssa.OpAMD64SBBQcarrymask, ssa.OpAMD64SBBLcarrymask: + r := regnum(v) + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = r + p.To.Type = obj.TYPE_REG + p.To.Reg = r + case ssa.OpAMD64LEAQ1, ssa.OpAMD64LEAQ2, ssa.OpAMD64LEAQ4, ssa.OpAMD64LEAQ8: + p := Prog(x86.ALEAQ) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + switch v.Op { + case ssa.OpAMD64LEAQ1: + p.From.Scale = 1 + case ssa.OpAMD64LEAQ2: + p.From.Scale = 2 + case ssa.OpAMD64LEAQ4: + p.From.Scale = 4 + case ssa.OpAMD64LEAQ8: + p.From.Scale = 8 + } + p.From.Index = regnum(v.Args[1]) + addAux(&p.From, v) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64LEAQ: + p := Prog(x86.ALEAQ) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + addAux(&p.From, v) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64CMPQ, ssa.OpAMD64CMPL, ssa.OpAMD64CMPW, ssa.OpAMD64CMPB, + ssa.OpAMD64TESTQ, ssa.OpAMD64TESTL, ssa.OpAMD64TESTW, ssa.OpAMD64TESTB: + opregreg(v.Op.Asm(), regnum(v.Args[1]), regnum(v.Args[0])) + case ssa.OpAMD64UCOMISS, ssa.OpAMD64UCOMISD: + // Go assembler has swapped operands for UCOMISx relative to CMP, + // must account for that right here. + opregreg(v.Op.Asm(), regnum(v.Args[0]), regnum(v.Args[1])) + case ssa.OpAMD64CMPQconst, ssa.OpAMD64CMPLconst, ssa.OpAMD64CMPWconst, ssa.OpAMD64CMPBconst: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[0]) + p.To.Type = obj.TYPE_CONST + p.To.Offset = v.AuxInt2Int64() + case ssa.OpAMD64TESTQconst, ssa.OpAMD64TESTLconst, ssa.OpAMD64TESTWconst, ssa.OpAMD64TESTBconst: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v.Args[0]) + case ssa.OpAMD64MOVBconst, ssa.OpAMD64MOVWconst, ssa.OpAMD64MOVLconst, ssa.OpAMD64MOVQconst: + x := regnum(v) + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = v.AuxInt2Int64() + p.To.Type = obj.TYPE_REG + p.To.Reg = x + // If flags are live at this instruction, suppress the + // MOV $0,AX -> XOR AX,AX optimization. + if v.Aux != nil { + p.Mark |= x86.PRESERVEFLAGS + } + case ssa.OpAMD64MOVSSconst, ssa.OpAMD64MOVSDconst: + x := regnum(v) + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_FCONST + p.From.Val = math.Float64frombits(uint64(v.AuxInt)) + p.To.Type = obj.TYPE_REG + p.To.Reg = x + case ssa.OpAMD64MOVQload, ssa.OpAMD64MOVSSload, ssa.OpAMD64MOVSDload, ssa.OpAMD64MOVLload, ssa.OpAMD64MOVWload, ssa.OpAMD64MOVBload, ssa.OpAMD64MOVBQSXload, ssa.OpAMD64MOVBQZXload, ssa.OpAMD64MOVWQSXload, ssa.OpAMD64MOVWQZXload, ssa.OpAMD64MOVLQSXload, ssa.OpAMD64MOVLQZXload, ssa.OpAMD64MOVOload: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + addAux(&p.From, v) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64MOVQloadidx8, ssa.OpAMD64MOVSDloadidx8: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + addAux(&p.From, v) + p.From.Scale = 8 + p.From.Index = regnum(v.Args[1]) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64MOVLloadidx4, ssa.OpAMD64MOVSSloadidx4: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + addAux(&p.From, v) + p.From.Scale = 4 + p.From.Index = regnum(v.Args[1]) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64MOVWloadidx2: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + addAux(&p.From, v) + p.From.Scale = 2 + p.From.Index = regnum(v.Args[1]) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64MOVBloadidx1: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_MEM + p.From.Reg = regnum(v.Args[0]) + addAux(&p.From, v) + p.From.Scale = 1 + p.From.Index = regnum(v.Args[1]) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpAMD64MOVQstore, ssa.OpAMD64MOVSSstore, ssa.OpAMD64MOVSDstore, ssa.OpAMD64MOVLstore, ssa.OpAMD64MOVWstore, ssa.OpAMD64MOVBstore, ssa.OpAMD64MOVOstore: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[1]) + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + addAux(&p.To, v) + case ssa.OpAMD64MOVQstoreidx8, ssa.OpAMD64MOVSDstoreidx8: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[2]) + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + p.To.Scale = 8 + p.To.Index = regnum(v.Args[1]) + addAux(&p.To, v) + case ssa.OpAMD64MOVSSstoreidx4, ssa.OpAMD64MOVLstoreidx4: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[2]) + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + p.To.Scale = 4 + p.To.Index = regnum(v.Args[1]) + addAux(&p.To, v) + case ssa.OpAMD64MOVWstoreidx2: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[2]) + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + p.To.Scale = 2 + p.To.Index = regnum(v.Args[1]) + addAux(&p.To, v) + case ssa.OpAMD64MOVBstoreidx1: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[2]) + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + p.To.Scale = 1 + p.To.Index = regnum(v.Args[1]) + addAux(&p.To, v) + case ssa.OpAMD64MOVQstoreconst, ssa.OpAMD64MOVLstoreconst, ssa.OpAMD64MOVWstoreconst, ssa.OpAMD64MOVBstoreconst: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + sc := v.AuxValAndOff() + i := sc.Val() + switch v.Op { + case ssa.OpAMD64MOVBstoreconst: + i = int64(int8(i)) + case ssa.OpAMD64MOVWstoreconst: + i = int64(int16(i)) + case ssa.OpAMD64MOVLstoreconst: + i = int64(int32(i)) + case ssa.OpAMD64MOVQstoreconst: + } + p.From.Offset = i + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + addAux2(&p.To, v, sc.Off()) + case ssa.OpAMD64MOVQstoreconstidx8, ssa.OpAMD64MOVLstoreconstidx4, ssa.OpAMD64MOVWstoreconstidx2, ssa.OpAMD64MOVBstoreconstidx1: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_CONST + sc := v.AuxValAndOff() + switch v.Op { + case ssa.OpAMD64MOVBstoreconstidx1: + p.From.Offset = int64(int8(sc.Val())) + p.To.Scale = 1 + case ssa.OpAMD64MOVWstoreconstidx2: + p.From.Offset = int64(int16(sc.Val())) + p.To.Scale = 2 + case ssa.OpAMD64MOVLstoreconstidx4: + p.From.Offset = int64(int32(sc.Val())) + p.To.Scale = 4 + case ssa.OpAMD64MOVQstoreconstidx8: + p.From.Offset = sc.Val() + p.To.Scale = 8 + } + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + p.To.Index = regnum(v.Args[1]) + addAux2(&p.To, v, sc.Off()) + case ssa.OpAMD64MOVLQSX, ssa.OpAMD64MOVWQSX, ssa.OpAMD64MOVBQSX, ssa.OpAMD64MOVLQZX, ssa.OpAMD64MOVWQZX, ssa.OpAMD64MOVBQZX, + ssa.OpAMD64CVTSL2SS, ssa.OpAMD64CVTSL2SD, ssa.OpAMD64CVTSQ2SS, ssa.OpAMD64CVTSQ2SD, + ssa.OpAMD64CVTTSS2SL, ssa.OpAMD64CVTTSD2SL, ssa.OpAMD64CVTTSS2SQ, ssa.OpAMD64CVTTSD2SQ, + ssa.OpAMD64CVTSS2SD, ssa.OpAMD64CVTSD2SS: + opregreg(v.Op.Asm(), regnum(v), regnum(v.Args[0])) + case ssa.OpAMD64DUFFZERO: + p := Prog(obj.ADUFFZERO) + p.To.Type = obj.TYPE_ADDR + p.To.Sym = Linksym(Pkglookup("duffzero", Runtimepkg)) + p.To.Offset = v.AuxInt + case ssa.OpAMD64MOVOconst: + if v.AuxInt != 0 { + v.Unimplementedf("MOVOconst can only do constant=0") + } + r := regnum(v) + opregreg(x86.AXORPS, r, r) + case ssa.OpAMD64DUFFCOPY: + p := Prog(obj.ADUFFCOPY) + p.To.Type = obj.TYPE_ADDR + p.To.Sym = Linksym(Pkglookup("duffcopy", Runtimepkg)) + p.To.Offset = v.AuxInt + + case ssa.OpCopy, ssa.OpAMD64MOVQconvert: // TODO: use MOVQreg for reg->reg copies instead of OpCopy? + if v.Type.IsMemory() { + return + } + x := regnum(v.Args[0]) + y := regnum(v) + if x != y { + opregreg(moveByType(v.Type), y, x) + } + case ssa.OpLoadReg: + if v.Type.IsFlags() { + v.Unimplementedf("load flags not implemented: %v", v.LongString()) + return + } + p := Prog(loadByType(v.Type)) + n, off := autoVar(v.Args[0]) + p.From.Type = obj.TYPE_MEM + p.From.Node = n + p.From.Sym = Linksym(n.Sym) + p.From.Offset = off + if n.Class == PPARAM || n.Class == PPARAMOUT { + p.From.Name = obj.NAME_PARAM + p.From.Offset += n.Xoffset + } else { + p.From.Name = obj.NAME_AUTO + } + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + + case ssa.OpStoreReg: + if v.Type.IsFlags() { + v.Unimplementedf("store flags not implemented: %v", v.LongString()) + return + } + p := Prog(storeByType(v.Type)) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[0]) + n, off := autoVar(v) + p.To.Type = obj.TYPE_MEM + p.To.Node = n + p.To.Sym = Linksym(n.Sym) + p.To.Offset = off + if n.Class == PPARAM || n.Class == PPARAMOUT { + p.To.Name = obj.NAME_PARAM + p.To.Offset += n.Xoffset + } else { + p.To.Name = obj.NAME_AUTO + } + case ssa.OpPhi: + // just check to make sure regalloc and stackalloc did it right + if v.Type.IsMemory() { + return + } + f := v.Block.Func + loc := f.RegAlloc[v.ID] + for _, a := range v.Args { + if aloc := f.RegAlloc[a.ID]; aloc != loc { // TODO: .Equal() instead? + v.Fatalf("phi arg at different location than phi: %v @ %v, but arg %v @ %v\n%s\n", v, loc, a, aloc, v.Block.Func) + } + } + case ssa.OpInitMem: + // memory arg needs no code + case ssa.OpArg: + // input args need no code + case ssa.OpAMD64LoweredGetClosurePtr: + // Output is hardwired to DX only, + // and DX contains the closure pointer on + // closure entry, and this "instruction" + // is scheduled to the very beginning + // of the entry block. + case ssa.OpAMD64LoweredGetG: + r := regnum(v) + // See the comments in cmd/internal/obj/x86/obj6.go + // near CanUse1InsnTLS for a detailed explanation of these instructions. + if x86.CanUse1InsnTLS(Ctxt) { + // MOVQ (TLS), r + p := Prog(x86.AMOVQ) + p.From.Type = obj.TYPE_MEM + p.From.Reg = x86.REG_TLS + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } else { + // MOVQ TLS, r + // MOVQ (r)(TLS*1), r + p := Prog(x86.AMOVQ) + p.From.Type = obj.TYPE_REG + p.From.Reg = x86.REG_TLS + p.To.Type = obj.TYPE_REG + p.To.Reg = r + q := Prog(x86.AMOVQ) + q.From.Type = obj.TYPE_MEM + q.From.Reg = r + q.From.Index = x86.REG_TLS + q.From.Scale = 1 + q.To.Type = obj.TYPE_REG + q.To.Reg = r + } + case ssa.OpAMD64CALLstatic: + p := Prog(obj.ACALL) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = Linksym(v.Aux.(*Sym)) + if Maxarg < v.AuxInt { + Maxarg = v.AuxInt + } + case ssa.OpAMD64CALLclosure: + p := Prog(obj.ACALL) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v.Args[0]) + if Maxarg < v.AuxInt { + Maxarg = v.AuxInt + } + case ssa.OpAMD64CALLdefer: + p := Prog(obj.ACALL) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = Linksym(Deferproc.Sym) + if Maxarg < v.AuxInt { + Maxarg = v.AuxInt + } + // defer returns in rax: + // 0 if we should continue executing + // 1 if we should jump to deferreturn call + p = Prog(x86.ATESTL) + p.From.Type = obj.TYPE_REG + p.From.Reg = x86.REG_AX + p.To.Type = obj.TYPE_REG + p.To.Reg = x86.REG_AX + p = Prog(x86.AJNE) + p.To.Type = obj.TYPE_BRANCH + s.deferBranches = append(s.deferBranches, p) + case ssa.OpAMD64CALLgo: + p := Prog(obj.ACALL) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = Linksym(Newproc.Sym) + if Maxarg < v.AuxInt { + Maxarg = v.AuxInt + } + case ssa.OpAMD64CALLinter: + p := Prog(obj.ACALL) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v.Args[0]) + if Maxarg < v.AuxInt { + Maxarg = v.AuxInt + } + case ssa.OpAMD64NEGQ, ssa.OpAMD64NEGL, ssa.OpAMD64NEGW, ssa.OpAMD64NEGB, + ssa.OpAMD64NOTQ, ssa.OpAMD64NOTL, ssa.OpAMD64NOTW, ssa.OpAMD64NOTB: + x := regnum(v.Args[0]) + r := regnum(v) + if x != r { + p := Prog(moveByType(v.Type)) + p.From.Type = obj.TYPE_REG + p.From.Reg = x + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } + p := Prog(v.Op.Asm()) + p.To.Type = obj.TYPE_REG + p.To.Reg = r + case ssa.OpAMD64SQRTSD: + p := Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = regnum(v.Args[0]) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + case ssa.OpSP, ssa.OpSB: + // nothing to do + case ssa.OpAMD64SETEQ, ssa.OpAMD64SETNE, + ssa.OpAMD64SETL, ssa.OpAMD64SETLE, + ssa.OpAMD64SETG, ssa.OpAMD64SETGE, + ssa.OpAMD64SETGF, ssa.OpAMD64SETGEF, + ssa.OpAMD64SETB, ssa.OpAMD64SETBE, + ssa.OpAMD64SETORD, ssa.OpAMD64SETNAN, + ssa.OpAMD64SETA, ssa.OpAMD64SETAE: + p := Prog(v.Op.Asm()) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + + case ssa.OpAMD64SETNEF: + p := Prog(v.Op.Asm()) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + q := Prog(x86.ASETPS) + q.To.Type = obj.TYPE_REG + q.To.Reg = x86.REG_AX + // ORL avoids partial register write and is smaller than ORQ, used by old compiler + opregreg(x86.AORL, regnum(v), x86.REG_AX) + + case ssa.OpAMD64SETEQF: + p := Prog(v.Op.Asm()) + p.To.Type = obj.TYPE_REG + p.To.Reg = regnum(v) + q := Prog(x86.ASETPC) + q.To.Type = obj.TYPE_REG + q.To.Reg = x86.REG_AX + // ANDL avoids partial register write and is smaller than ANDQ, used by old compiler + opregreg(x86.AANDL, regnum(v), x86.REG_AX) + + case ssa.OpAMD64InvertFlags: + v.Fatalf("InvertFlags should never make it to codegen %v", v) + case ssa.OpAMD64FlagEQ, ssa.OpAMD64FlagLT_ULT, ssa.OpAMD64FlagLT_UGT, ssa.OpAMD64FlagGT_ULT, ssa.OpAMD64FlagGT_UGT: + v.Fatalf("Flag* ops should never make it to codegen %v", v) + case ssa.OpAMD64REPSTOSQ: + Prog(x86.AREP) + Prog(x86.ASTOSQ) + case ssa.OpAMD64REPMOVSQ: + Prog(x86.AREP) + Prog(x86.AMOVSQ) + case ssa.OpVarDef: + Gvardef(v.Aux.(*Node)) + case ssa.OpVarKill: + gvarkill(v.Aux.(*Node)) + case ssa.OpVarLive: + gvarlive(v.Aux.(*Node)) + case ssa.OpAMD64LoweredNilCheck: + // Optimization - if the subsequent block has a load or store + // at the same address, we don't need to issue this instruction. + mem := v.Args[1] + for _, w := range v.Block.Succs[0].Values { + if w.Op == ssa.OpPhi { + if w.Type.IsMemory() { + mem = w + } + continue + } + if len(w.Args) == 0 || !w.Args[len(w.Args)-1].Type.IsMemory() { + // w doesn't use a store - can't be a memory op. + continue + } + if w.Args[len(w.Args)-1] != mem { + v.Fatalf("wrong store after nilcheck v=%s w=%s", v, w) + } + switch w.Op { + case ssa.OpAMD64MOVQload, ssa.OpAMD64MOVLload, ssa.OpAMD64MOVWload, ssa.OpAMD64MOVBload, + ssa.OpAMD64MOVQstore, ssa.OpAMD64MOVLstore, ssa.OpAMD64MOVWstore, ssa.OpAMD64MOVBstore, + ssa.OpAMD64MOVBQSXload, ssa.OpAMD64MOVBQZXload, ssa.OpAMD64MOVWQSXload, + ssa.OpAMD64MOVWQZXload, ssa.OpAMD64MOVLQSXload, ssa.OpAMD64MOVLQZXload, + ssa.OpAMD64MOVSSload, ssa.OpAMD64MOVSDload, ssa.OpAMD64MOVOload, + ssa.OpAMD64MOVSSstore, ssa.OpAMD64MOVSDstore, ssa.OpAMD64MOVOstore: + if w.Args[0] == v.Args[0] && w.Aux == nil && w.AuxInt >= 0 && w.AuxInt < minZeroPage { + if Debug_checknil != 0 && int(v.Line) > 1 { + Warnl(int(v.Line), "removed nil check") + } + return + } + case ssa.OpAMD64MOVQstoreconst, ssa.OpAMD64MOVLstoreconst, ssa.OpAMD64MOVWstoreconst, ssa.OpAMD64MOVBstoreconst: + off := ssa.ValAndOff(v.AuxInt).Off() + if w.Args[0] == v.Args[0] && w.Aux == nil && off >= 0 && off < minZeroPage { + if Debug_checknil != 0 && int(v.Line) > 1 { + Warnl(int(v.Line), "removed nil check") + } + return + } + } + if w.Type.IsMemory() { + if w.Op == ssa.OpVarDef || w.Op == ssa.OpVarKill || w.Op == ssa.OpVarLive { + // these ops are OK + mem = w + continue + } + // We can't delay the nil check past the next store. + break + } + } + // Issue a load which will fault if the input is nil. + // TODO: We currently use the 2-byte instruction TESTB AX, (reg). + // Should we use the 3-byte TESTB $0, (reg) instead? It is larger + // but it doesn't have false dependency on AX. + // Or maybe allocate an output register and use MOVL (reg),reg2 ? + // That trades clobbering flags for clobbering a register. + p := Prog(x86.ATESTB) + p.From.Type = obj.TYPE_REG + p.From.Reg = x86.REG_AX + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum(v.Args[0]) + addAux(&p.To, v) + if Debug_checknil != 0 && v.Line > 1 { // v.Line==1 in generated wrappers + Warnl(int(v.Line), "generated nil check") + } + default: + v.Unimplementedf("genValue not implemented: %s", v.LongString()) + } +} + +// markMoves marks any MOVXconst ops that need to avoid clobbering flags. +func (s *genState) markMoves(b *ssa.Block) { + flive := b.FlagsLiveAtEnd + if b.Control != nil && b.Control.Type.IsFlags() { + flive = true + } + for i := len(b.Values) - 1; i >= 0; i-- { + v := b.Values[i] + if flive && (v.Op == ssa.OpAMD64MOVBconst || v.Op == ssa.OpAMD64MOVWconst || v.Op == ssa.OpAMD64MOVLconst || v.Op == ssa.OpAMD64MOVQconst) { + // The "mark" is any non-nil Aux value. + v.Aux = v + } + if v.Type.IsFlags() { + flive = false + } + for _, a := range v.Args { + if a.Type.IsFlags() { + flive = true + } + } + } +} + +// movZero generates a register indirect move with a 0 immediate and keeps track of bytes left and next offset +func movZero(as int, width int64, nbytes int64, offset int64, regnum int16) (nleft int64, noff int64) { + p := Prog(as) + // TODO: use zero register on archs that support it. + p.From.Type = obj.TYPE_CONST + p.From.Offset = 0 + p.To.Type = obj.TYPE_MEM + p.To.Reg = regnum + p.To.Offset = offset + offset += width + nleft = nbytes - width + return nleft, offset +} + +var blockJump = [...]struct { + asm, invasm int +}{ + ssa.BlockAMD64EQ: {x86.AJEQ, x86.AJNE}, + ssa.BlockAMD64NE: {x86.AJNE, x86.AJEQ}, + ssa.BlockAMD64LT: {x86.AJLT, x86.AJGE}, + ssa.BlockAMD64GE: {x86.AJGE, x86.AJLT}, + ssa.BlockAMD64LE: {x86.AJLE, x86.AJGT}, + ssa.BlockAMD64GT: {x86.AJGT, x86.AJLE}, + ssa.BlockAMD64ULT: {x86.AJCS, x86.AJCC}, + ssa.BlockAMD64UGE: {x86.AJCC, x86.AJCS}, + ssa.BlockAMD64UGT: {x86.AJHI, x86.AJLS}, + ssa.BlockAMD64ULE: {x86.AJLS, x86.AJHI}, + ssa.BlockAMD64ORD: {x86.AJPC, x86.AJPS}, + ssa.BlockAMD64NAN: {x86.AJPS, x86.AJPC}, +} + +type floatingEQNEJump struct { + jump, index int +} + +var eqfJumps = [2][2]floatingEQNEJump{ + {{x86.AJNE, 1}, {x86.AJPS, 1}}, // next == b.Succs[0] + {{x86.AJNE, 1}, {x86.AJPC, 0}}, // next == b.Succs[1] +} +var nefJumps = [2][2]floatingEQNEJump{ + {{x86.AJNE, 0}, {x86.AJPC, 1}}, // next == b.Succs[0] + {{x86.AJNE, 0}, {x86.AJPS, 0}}, // next == b.Succs[1] +} + +func oneFPJump(b *ssa.Block, jumps *floatingEQNEJump, likely ssa.BranchPrediction, branches []branch) []branch { + p := Prog(jumps.jump) + p.To.Type = obj.TYPE_BRANCH + to := jumps.index + branches = append(branches, branch{p, b.Succs[to]}) + if to == 1 { + likely = -likely + } + // liblink reorders the instruction stream as it sees fit. + // Pass along what we know so liblink can make use of it. + // TODO: Once we've fully switched to SSA, + // make liblink leave our output alone. + switch likely { + case ssa.BranchUnlikely: + p.From.Type = obj.TYPE_CONST + p.From.Offset = 0 + case ssa.BranchLikely: + p.From.Type = obj.TYPE_CONST + p.From.Offset = 1 + } + return branches +} + +func genFPJump(s *genState, b, next *ssa.Block, jumps *[2][2]floatingEQNEJump) { + likely := b.Likely + switch next { + case b.Succs[0]: + s.branches = oneFPJump(b, &jumps[0][0], likely, s.branches) + s.branches = oneFPJump(b, &jumps[0][1], likely, s.branches) + case b.Succs[1]: + s.branches = oneFPJump(b, &jumps[1][0], likely, s.branches) + s.branches = oneFPJump(b, &jumps[1][1], likely, s.branches) + default: + s.branches = oneFPJump(b, &jumps[1][0], likely, s.branches) + s.branches = oneFPJump(b, &jumps[1][1], likely, s.branches) + q := Prog(obj.AJMP) + q.To.Type = obj.TYPE_BRANCH + s.branches = append(s.branches, branch{q, b.Succs[1]}) + } +} + +func (s *genState) genBlock(b, next *ssa.Block) { + lineno = b.Line + + switch b.Kind { + case ssa.BlockPlain, ssa.BlockCall, ssa.BlockCheck: + if b.Succs[0] != next { + p := Prog(obj.AJMP) + p.To.Type = obj.TYPE_BRANCH + s.branches = append(s.branches, branch{p, b.Succs[0]}) + } + case ssa.BlockExit: + Prog(obj.AUNDEF) // tell plive.go that we never reach here + case ssa.BlockRet: + if hasdefer { + s.deferReturn() + } + Prog(obj.ARET) + case ssa.BlockRetJmp: + p := Prog(obj.AJMP) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = Linksym(b.Aux.(*Sym)) + + case ssa.BlockAMD64EQF: + genFPJump(s, b, next, &eqfJumps) + + case ssa.BlockAMD64NEF: + genFPJump(s, b, next, &nefJumps) + + case ssa.BlockAMD64EQ, ssa.BlockAMD64NE, + ssa.BlockAMD64LT, ssa.BlockAMD64GE, + ssa.BlockAMD64LE, ssa.BlockAMD64GT, + ssa.BlockAMD64ULT, ssa.BlockAMD64UGT, + ssa.BlockAMD64ULE, ssa.BlockAMD64UGE: + jmp := blockJump[b.Kind] + likely := b.Likely + var p *obj.Prog + switch next { + case b.Succs[0]: + p = Prog(jmp.invasm) + likely *= -1 + p.To.Type = obj.TYPE_BRANCH + s.branches = append(s.branches, branch{p, b.Succs[1]}) + case b.Succs[1]: + p = Prog(jmp.asm) + p.To.Type = obj.TYPE_BRANCH + s.branches = append(s.branches, branch{p, b.Succs[0]}) + default: + p = Prog(jmp.asm) + p.To.Type = obj.TYPE_BRANCH + s.branches = append(s.branches, branch{p, b.Succs[0]}) + q := Prog(obj.AJMP) + q.To.Type = obj.TYPE_BRANCH + s.branches = append(s.branches, branch{q, b.Succs[1]}) + } + + // liblink reorders the instruction stream as it sees fit. + // Pass along what we know so liblink can make use of it. + // TODO: Once we've fully switched to SSA, + // make liblink leave our output alone. + switch likely { + case ssa.BranchUnlikely: + p.From.Type = obj.TYPE_CONST + p.From.Offset = 0 + case ssa.BranchLikely: + p.From.Type = obj.TYPE_CONST + p.From.Offset = 1 + } + + default: + b.Unimplementedf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString()) + } +} + +func (s *genState) deferReturn() { + // Deferred calls will appear to be returning to + // the CALL deferreturn(SB) that we are about to emit. + // However, the stack trace code will show the line + // of the instruction byte before the return PC. + // To avoid that being an unrelated instruction, + // insert an actual hardware NOP that will have the right line number. + // This is different from obj.ANOP, which is a virtual no-op + // that doesn't make it into the instruction stream. + s.deferTarget = Pc + Thearch.Ginsnop() + p := Prog(obj.ACALL) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = Linksym(Deferreturn.Sym) +} + +// addAux adds the offset in the aux fields (AuxInt and Aux) of v to a. +func addAux(a *obj.Addr, v *ssa.Value) { + addAux2(a, v, v.AuxInt) +} +func addAux2(a *obj.Addr, v *ssa.Value, offset int64) { + if a.Type != obj.TYPE_MEM { + v.Fatalf("bad addAux addr %s", a) + } + // add integer offset + a.Offset += offset + + // If no additional symbol offset, we're done. + if v.Aux == nil { + return + } + // Add symbol's offset from its base register. + switch sym := v.Aux.(type) { + case *ssa.ExternSymbol: + a.Name = obj.NAME_EXTERN + a.Sym = Linksym(sym.Sym.(*Sym)) + case *ssa.ArgSymbol: + n := sym.Node.(*Node) + a.Name = obj.NAME_PARAM + a.Node = n + a.Sym = Linksym(n.Orig.Sym) + a.Offset += n.Xoffset // TODO: why do I have to add this here? I don't for auto variables. + case *ssa.AutoSymbol: + n := sym.Node.(*Node) + a.Name = obj.NAME_AUTO + a.Node = n + a.Sym = Linksym(n.Sym) + default: + v.Fatalf("aux in %s not implemented %#v", v, v.Aux) + } +} + +// extendIndex extends v to a full int width. +func (s *state) extendIndex(v *ssa.Value) *ssa.Value { + size := v.Type.Size() + if size == s.config.IntSize { + return v + } + if size > s.config.IntSize { + // TODO: truncate 64-bit indexes on 32-bit pointer archs. We'd need to test + // the high word and branch to out-of-bounds failure if it is not 0. + s.Unimplementedf("64->32 index truncation not implemented") + return v + } + + // Extend value to the required size + var op ssa.Op + if v.Type.IsSigned() { + switch 10*size + s.config.IntSize { + case 14: + op = ssa.OpSignExt8to32 + case 18: + op = ssa.OpSignExt8to64 + case 24: + op = ssa.OpSignExt16to32 + case 28: + op = ssa.OpSignExt16to64 + case 48: + op = ssa.OpSignExt32to64 + default: + s.Fatalf("bad signed index extension %s", v.Type) + } + } else { + switch 10*size + s.config.IntSize { + case 14: + op = ssa.OpZeroExt8to32 + case 18: + op = ssa.OpZeroExt8to64 + case 24: + op = ssa.OpZeroExt16to32 + case 28: + op = ssa.OpZeroExt16to64 + case 48: + op = ssa.OpZeroExt32to64 + default: + s.Fatalf("bad unsigned index extension %s", v.Type) + } + } + return s.newValue1(op, Types[TINT], v) +} + +// ssaRegToReg maps ssa register numbers to obj register numbers. +var ssaRegToReg = [...]int16{ + x86.REG_AX, + x86.REG_CX, + x86.REG_DX, + x86.REG_BX, + x86.REG_SP, + x86.REG_BP, + x86.REG_SI, + x86.REG_DI, + x86.REG_R8, + x86.REG_R9, + x86.REG_R10, + x86.REG_R11, + x86.REG_R12, + x86.REG_R13, + x86.REG_R14, + x86.REG_R15, + x86.REG_X0, + x86.REG_X1, + x86.REG_X2, + x86.REG_X3, + x86.REG_X4, + x86.REG_X5, + x86.REG_X6, + x86.REG_X7, + x86.REG_X8, + x86.REG_X9, + x86.REG_X10, + x86.REG_X11, + x86.REG_X12, + x86.REG_X13, + x86.REG_X14, + x86.REG_X15, + 0, // SB isn't a real register. We fill an Addr.Reg field with 0 in this case. + // TODO: arch-dependent +} + +// loadByType returns the load instruction of the given type. +func loadByType(t ssa.Type) int { + // Avoid partial register write + if !t.IsFloat() && t.Size() <= 2 { + if t.Size() == 1 { + return x86.AMOVBLZX + } else { + return x86.AMOVWLZX + } + } + // Otherwise, there's no difference between load and store opcodes. + return storeByType(t) +} + +// storeByType returns the store instruction of the given type. +func storeByType(t ssa.Type) int { + width := t.Size() + if t.IsFloat() { + switch width { + case 4: + return x86.AMOVSS + case 8: + return x86.AMOVSD + } + } else { + switch width { + case 1: + return x86.AMOVB + case 2: + return x86.AMOVW + case 4: + return x86.AMOVL + case 8: + return x86.AMOVQ + } + } + panic("bad store type") +} + +// moveByType returns the reg->reg move instruction of the given type. +func moveByType(t ssa.Type) int { + if t.IsFloat() { + // Moving the whole sse2 register is faster + // than moving just the correct low portion of it. + // There is no xmm->xmm move with 1 byte opcode, + // so use movups, which has 2 byte opcode. + return x86.AMOVUPS + } else { + switch t.Size() { + case 1: + // Avoids partial register write + return x86.AMOVL + case 2: + return x86.AMOVL + case 4: + return x86.AMOVL + case 8: + return x86.AMOVQ + default: + panic("bad int register width") + } + } + panic("bad register type") +} + +// regnum returns the register (in cmd/internal/obj numbering) to +// which v has been allocated. Panics if v is not assigned to a +// register. +// TODO: Make this panic again once it stops happening routinely. +func regnum(v *ssa.Value) int16 { + reg := v.Block.Func.RegAlloc[v.ID] + if reg == nil { + v.Unimplementedf("nil regnum for value: %s\n%s\n", v.LongString(), v.Block.Func) + return 0 + } + return ssaRegToReg[reg.(*ssa.Register).Num] +} + +// autoVar returns a *Node and int64 representing the auto variable and offset within it +// where v should be spilled. +func autoVar(v *ssa.Value) (*Node, int64) { + loc := v.Block.Func.RegAlloc[v.ID].(ssa.LocalSlot) + if v.Type.Size() > loc.Type.Size() { + v.Fatalf("spill/restore type %s doesn't fit in slot type %s", v.Type, loc.Type) + } + return loc.N.(*Node), loc.Off +} + +// fieldIdx finds the index of the field referred to by the ODOT node n. +func fieldIdx(n *Node) int64 { + t := n.Left.Type + f := n.Right + if t.Etype != TSTRUCT { + panic("ODOT's LHS is not a struct") + } + + var i int64 + for t1 := t.Type; t1 != nil; t1 = t1.Down { + if t1.Etype != TFIELD { + panic("non-TFIELD in TSTRUCT") + } + if t1.Sym != f.Sym { + i++ + continue + } + if t1.Width != n.Xoffset { + panic("field offset doesn't match") + } + return i + } + panic(fmt.Sprintf("can't find field in expr %s\n", n)) + + // TODO: keep the result of this fucntion somewhere in the ODOT Node + // so we don't have to recompute it each time we need it. +} + +// ssaExport exports a bunch of compiler services for the ssa backend. +type ssaExport struct { + log bool + unimplemented bool + mustImplement bool +} + +func (s *ssaExport) TypeBool() ssa.Type { return Types[TBOOL] } +func (s *ssaExport) TypeInt8() ssa.Type { return Types[TINT8] } +func (s *ssaExport) TypeInt16() ssa.Type { return Types[TINT16] } +func (s *ssaExport) TypeInt32() ssa.Type { return Types[TINT32] } +func (s *ssaExport) TypeInt64() ssa.Type { return Types[TINT64] } +func (s *ssaExport) TypeUInt8() ssa.Type { return Types[TUINT8] } +func (s *ssaExport) TypeUInt16() ssa.Type { return Types[TUINT16] } +func (s *ssaExport) TypeUInt32() ssa.Type { return Types[TUINT32] } +func (s *ssaExport) TypeUInt64() ssa.Type { return Types[TUINT64] } +func (s *ssaExport) TypeFloat32() ssa.Type { return Types[TFLOAT32] } +func (s *ssaExport) TypeFloat64() ssa.Type { return Types[TFLOAT64] } +func (s *ssaExport) TypeInt() ssa.Type { return Types[TINT] } +func (s *ssaExport) TypeUintptr() ssa.Type { return Types[TUINTPTR] } +func (s *ssaExport) TypeString() ssa.Type { return Types[TSTRING] } +func (s *ssaExport) TypeBytePtr() ssa.Type { return Ptrto(Types[TUINT8]) } + +// StringData returns a symbol (a *Sym wrapped in an interface) which +// is the data component of a global string constant containing s. +func (*ssaExport) StringData(s string) interface{} { + // TODO: is idealstring correct? It might not matter... + _, data := stringsym(s) + return &ssa.ExternSymbol{Typ: idealstring, Sym: data} +} + +func (e *ssaExport) Auto(t ssa.Type) ssa.GCNode { + n := temp(t.(*Type)) // Note: adds new auto to Curfn.Func.Dcl list + e.mustImplement = true // This modifies the input to SSA, so we want to make sure we succeed from here! + return n +} + +func (e *ssaExport) CanSSA(t ssa.Type) bool { + return canSSAType(t.(*Type)) +} + +func (e *ssaExport) Line(line int32) string { + return Ctxt.Line(int(line)) +} + +// Log logs a message from the compiler. +func (e *ssaExport) Logf(msg string, args ...interface{}) { + // If e was marked as unimplemented, anything could happen. Ignore. + if e.log && !e.unimplemented { + fmt.Printf(msg, args...) + } +} + +func (e *ssaExport) Log() bool { + return e.log +} + +// Fatal reports a compiler error and exits. +func (e *ssaExport) Fatalf(line int32, msg string, args ...interface{}) { + // If e was marked as unimplemented, anything could happen. Ignore. + if !e.unimplemented { + lineno = line + Fatalf(msg, args...) + } +} + +// Unimplemented reports that the function cannot be compiled. +// It will be removed once SSA work is complete. +func (e *ssaExport) Unimplementedf(line int32, msg string, args ...interface{}) { + if e.mustImplement { + lineno = line + Fatalf(msg, args...) + } + const alwaysLog = false // enable to calculate top unimplemented features + if !e.unimplemented && (e.log || alwaysLog) { + // first implementation failure, print explanation + fmt.Printf("SSA unimplemented: "+msg+"\n", args...) + } + e.unimplemented = true +} + +// Warnl reports a "warning", which is usually flag-triggered +// logging output for the benefit of tests. +func (e *ssaExport) Warnl(line int, fmt_ string, args ...interface{}) { + Warnl(line, fmt_, args...) +} + +func (e *ssaExport) Debug_checknil() bool { + return Debug_checknil != 0 +} + +func (n *Node) Typ() ssa.Type { + return n.Type +} diff --git a/src/cmd/compile/internal/gc/ssa_test.go b/src/cmd/compile/internal/gc/ssa_test.go new file mode 100644 index 0000000000..d0c44b5dce --- /dev/null +++ b/src/cmd/compile/internal/gc/ssa_test.go @@ -0,0 +1,99 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gc + +import ( + "bytes" + "internal/testenv" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +// TODO: move all these tests elsewhere? +// Perhaps teach test/run.go how to run them with a new action verb. +func runTest(t *testing.T, filename string) { + doTest(t, filename, "run") +} +func buildTest(t *testing.T, filename string) { + doTest(t, filename, "build") +} +func doTest(t *testing.T, filename string, kind string) { + if runtime.GOARCH != "amd64" { + t.Skipf("skipping SSA tests on %s for now", runtime.GOARCH) + } + testenv.MustHaveGoBuild(t) + var stdout, stderr bytes.Buffer + cmd := exec.Command("go", kind, filepath.Join("testdata", filename)) + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + t.Fatalf("Failed: %v:\nOut: %s\nStderr: %s\n", err, &stdout, &stderr) + } + if s := stdout.String(); s != "" { + t.Errorf("Stdout = %s\nWant empty", s) + } + if s := stderr.String(); strings.Contains(s, "SSA unimplemented") { + t.Errorf("Unimplemented message found in stderr:\n%s", s) + } +} + +// TestShortCircuit tests OANDAND and OOROR expressions and short circuiting. +func TestShortCircuit(t *testing.T) { runTest(t, "short_ssa.go") } + +// TestBreakContinue tests that continue and break statements do what they say. +func TestBreakContinue(t *testing.T) { runTest(t, "break_ssa.go") } + +// TestTypeAssertion tests type assertions. +func TestTypeAssertion(t *testing.T) { runTest(t, "assert_ssa.go") } + +// TestArithmetic tests that both backends have the same result for arithmetic expressions. +func TestArithmetic(t *testing.T) { runTest(t, "arith_ssa.go") } + +// TestFP tests that both backends have the same result for floating point expressions. +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") } + +func TestChan(t *testing.T) { runTest(t, "chan_ssa.go") } + +func TestCompound(t *testing.T) { runTest(t, "compound_ssa.go") } + +func TestCtl(t *testing.T) { runTest(t, "ctl_ssa.go") } + +func TestFp(t *testing.T) { runTest(t, "fp_ssa.go") } + +func TestLoadStore(t *testing.T) { runTest(t, "loadstore_ssa.go") } + +func TestMap(t *testing.T) { runTest(t, "map_ssa.go") } + +func TestRegalloc(t *testing.T) { runTest(t, "regalloc_ssa.go") } + +func TestString(t *testing.T) { runTest(t, "string_ssa.go") } + +func TestDeferNoReturn(t *testing.T) { buildTest(t, "deferNoReturn_ssa.go") } + +// TestClosure tests closure related behavior. +func TestClosure(t *testing.T) { runTest(t, "closure_ssa.go") } + +func TestArray(t *testing.T) { runTest(t, "array_ssa.go") } + +func TestAppend(t *testing.T) { runTest(t, "append_ssa.go") } + +func TestZero(t *testing.T) { runTest(t, "zero_ssa.go") } + +func TestAddressed(t *testing.T) { runTest(t, "addressed_ssa.go") } + +func TestCopy(t *testing.T) { runTest(t, "copy_ssa.go") } + +func TestUnsafe(t *testing.T) { runTest(t, "unsafe_ssa.go") } + +func TestPhi(t *testing.T) { runTest(t, "phi_ssa.go") } diff --git a/src/cmd/compile/internal/gc/syntax.go b/src/cmd/compile/internal/gc/syntax.go index 72944a749e..6e1406e3bb 100644 --- a/src/cmd/compile/internal/gc/syntax.go +++ b/src/cmd/compile/internal/gc/syntax.go @@ -149,7 +149,7 @@ type Param struct { // Func holds Node fields used only with function-like nodes. type Func struct { Shortname *Node - Enter Nodes + Enter Nodes // for example, allocate and initialize memory for escaping parameters Exit Nodes Cvars Nodes // closure params Dcl []*Node // autodcl for this func/closure diff --git a/src/cmd/compile/internal/gc/testdata/addressed_ssa.go b/src/cmd/compile/internal/gc/testdata/addressed_ssa.go new file mode 100644 index 0000000000..f9f459360b --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/addressed_ssa.go @@ -0,0 +1,216 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "fmt" + +var output string + +func mypanic(s string) { + fmt.Printf(output) + panic(s) +} + +func assertEqual(x, y int) { + if x != y { + mypanic("assertEqual failed") + } +} + +func main() { + x := f1_ssa(2, 3) + output += fmt.Sprintln("*x is", *x) + output += fmt.Sprintln("Gratuitously use some stack") + output += fmt.Sprintln("*x is", *x) + assertEqual(*x, 9) + + w := f3a_ssa(6) + output += fmt.Sprintln("*w is", *w) + output += fmt.Sprintln("Gratuitously use some stack") + output += fmt.Sprintln("*w is", *w) + assertEqual(*w, 6) + + y := f3b_ssa(12) + output += fmt.Sprintln("*y.(*int) is", *y.(*int)) + output += fmt.Sprintln("Gratuitously use some stack") + output += fmt.Sprintln("*y.(*int) is", *y.(*int)) + assertEqual(*y.(*int), 12) + + z := f3c_ssa(8) + output += fmt.Sprintln("*z.(*int) is", *z.(*int)) + output += fmt.Sprintln("Gratuitously use some stack") + output += fmt.Sprintln("*z.(*int) is", *z.(*int)) + assertEqual(*z.(*int), 8) + + args() + test_autos() +} + +func f1_ssa(x, y int) *int { + switch { + } //go:noinline + x = x*y + y + return &x +} + +func f3a_ssa(x int) *int { + switch { + } //go:noinline + return &x +} + +func f3b_ssa(x int) interface{} { // ./foo.go:15: internal error: f3b_ssa ~r1 (type interface {}) recorded as live on entry + switch { + } //go:noinline + return &x +} + +func f3c_ssa(y int) interface{} { + switch { + } //go:noinline + x := y + return &x +} + +type V struct { + p *V + w, x int64 +} + +func args() { + v := V{p: nil, w: 1, x: 1} + a := V{p: &v, w: 2, x: 2} + b := V{p: &v, w: 0, x: 0} + i := v.args_ssa(a, b) + output += fmt.Sprintln("i=", i) + assertEqual(int(i), 2) +} + +func (v V) args_ssa(a, b V) int64 { + switch { + } //go:noinline + if v.w == 0 { + return v.x + } + if v.w == 1 { + return a.x + } + if v.w == 2 { + return b.x + } + b.p.p = &a // v.p in caller = &a + + return -1 +} + +func test_autos() { + test(11) + test(12) + test(13) + test(21) + test(22) + test(23) + test(31) + test(32) +} + +func test(which int64) { + output += fmt.Sprintln("test", which) + v1 := V{w: 30, x: 3, p: nil} + v2, v3 := v1.autos_ssa(which, 10, 1, 20, 2) + if which != v2.val() { + output += fmt.Sprintln("Expected which=", which, "got v2.val()=", v2.val()) + mypanic("Failure of expected V value") + } + if v2.p.val() != v3.val() { + output += fmt.Sprintln("Expected v2.p.val()=", v2.p.val(), "got v3.val()=", v3.val()) + mypanic("Failure of expected V.p value") + } + if which != v3.p.p.p.p.p.p.p.val() { + output += fmt.Sprintln("Expected which=", which, "got v3.p.p.p.p.p.p.p.val()=", v3.p.p.p.p.p.p.p.val()) + mypanic("Failure of expected V.p value") + } +} + +func (v V) val() int64 { + return v.w + v.x +} + +// autos_ssa uses contents of v and parameters w1, w2, x1, x2 +// to initialize a bunch of locals, all of which have their +// address taken to force heap allocation, and then based on +// the value of which a pair of those locals are copied in +// various ways to the two results y, and z, which are also +// addressed. Which is expected to be one of 11-13, 21-23, 31, 32, +// and y.val() should be equal to which and y.p.val() should +// be equal to z.val(). Also, x(.p)**8 == x; that is, the +// autos are all linked into a ring. +func (v V) autos_ssa(which, w1, x1, w2, x2 int64) (y, z V) { + switch { + } //go:noinline + fill_ssa(v.w, v.x, &v, v.p) // gratuitous no-op to force addressing + var a, b, c, d, e, f, g, h V + fill_ssa(w1, x1, &a, &b) + fill_ssa(w1, x2, &b, &c) + fill_ssa(w1, v.x, &c, &d) + fill_ssa(w2, x1, &d, &e) + fill_ssa(w2, x2, &e, &f) + fill_ssa(w2, v.x, &f, &g) + fill_ssa(v.w, x1, &g, &h) + fill_ssa(v.w, x2, &h, &a) + switch which { + case 11: + y = a + z.getsI(&b) + case 12: + y.gets(&b) + z = c + case 13: + y.gets(&c) + z = d + case 21: + y.getsI(&d) + z.gets(&e) + case 22: + y = e + z = f + case 23: + y.gets(&f) + z.getsI(&g) + case 31: + y = g + z.gets(&h) + case 32: + y.getsI(&h) + z = a + default: + + panic("") + } + return +} + +// gets is an address-mentioning way of implementing +// structure assignment. +func (to *V) gets(from *V) { + switch { + } //go:noinline + *to = *from +} + +// gets is an address-and-interface-mentioning way of +// implementing structure assignment. +func (to *V) getsI(from interface{}) { + switch { + } //go:noinline + *to = *from.(*V) +} + +// fill_ssa initializes r with V{w:w, x:x, p:p} +func fill_ssa(w, x int64, r, p *V) { + switch { + } //go:noinline + *r = V{w: w, x: x, p: p} +} diff --git a/src/cmd/compile/internal/gc/testdata/append_ssa.go b/src/cmd/compile/internal/gc/testdata/append_ssa.go new file mode 100644 index 0000000000..03cd219c32 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/append_ssa.go @@ -0,0 +1,70 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// append_ssa.go tests append operations. +package main + +import "fmt" + +var failed = false + +//go:noinline +func appendOne_ssa(a []int, x int) []int { + return append(a, x) +} + +//go:noinline +func appendThree_ssa(a []int, x, y, z int) []int { + return append(a, x, y, z) +} + +func eq(a, b []int) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} + +func expect(got, want []int) { + if eq(got, want) { + return + } + fmt.Printf("expected %v, got %v\n", want, got) + failed = true +} + +func testAppend() { + var store [7]int + a := store[:0] + + a = appendOne_ssa(a, 1) + expect(a, []int{1}) + a = appendThree_ssa(a, 2, 3, 4) + expect(a, []int{1, 2, 3, 4}) + a = appendThree_ssa(a, 5, 6, 7) + expect(a, []int{1, 2, 3, 4, 5, 6, 7}) + if &a[0] != &store[0] { + fmt.Println("unnecessary grow") + failed = true + } + a = appendOne_ssa(a, 8) + expect(a, []int{1, 2, 3, 4, 5, 6, 7, 8}) + if &a[0] == &store[0] { + fmt.Println("didn't grow") + failed = true + } +} + +func main() { + testAppend() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/arithBoundary_ssa.go b/src/cmd/compile/internal/gc/testdata/arithBoundary_ssa.go new file mode 100644 index 0000000000..929e4e1f0b --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/arithBoundary_ssa.go @@ -0,0 +1,735 @@ +package main + +import "fmt" + +type utd64 struct { + a, b uint64 + add, sub, mul, div, mod uint64 +} +type itd64 struct { + a, b int64 + add, sub, mul, div, mod int64 +} +type utd32 struct { + a, b uint32 + add, sub, mul, div, mod uint32 +} +type itd32 struct { + a, b int32 + add, sub, mul, div, mod int32 +} +type utd16 struct { + a, b uint16 + add, sub, mul, div, mod uint16 +} +type itd16 struct { + a, b int16 + add, sub, mul, div, mod int16 +} +type utd8 struct { + a, b uint8 + add, sub, mul, div, mod uint8 +} +type itd8 struct { + a, b int8 + add, sub, mul, div, mod int8 +} + +//go:noinline +func add_uint64_ssa(a, b uint64) uint64 { + return a + b +} + +//go:noinline +func sub_uint64_ssa(a, b uint64) uint64 { + return a - b +} + +//go:noinline +func div_uint64_ssa(a, b uint64) uint64 { + return a / b +} + +//go:noinline +func mod_uint64_ssa(a, b uint64) uint64 { + return a % b +} + +//go:noinline +func mul_uint64_ssa(a, b uint64) uint64 { + return a * b +} + +//go:noinline +func add_int64_ssa(a, b int64) int64 { + return a + b +} + +//go:noinline +func sub_int64_ssa(a, b int64) int64 { + return a - b +} + +//go:noinline +func div_int64_ssa(a, b int64) int64 { + return a / b +} + +//go:noinline +func mod_int64_ssa(a, b int64) int64 { + return a % b +} + +//go:noinline +func mul_int64_ssa(a, b int64) int64 { + return a * b +} + +//go:noinline +func add_uint32_ssa(a, b uint32) uint32 { + return a + b +} + +//go:noinline +func sub_uint32_ssa(a, b uint32) uint32 { + return a - b +} + +//go:noinline +func div_uint32_ssa(a, b uint32) uint32 { + return a / b +} + +//go:noinline +func mod_uint32_ssa(a, b uint32) uint32 { + return a % b +} + +//go:noinline +func mul_uint32_ssa(a, b uint32) uint32 { + return a * b +} + +//go:noinline +func add_int32_ssa(a, b int32) int32 { + return a + b +} + +//go:noinline +func sub_int32_ssa(a, b int32) int32 { + return a - b +} + +//go:noinline +func div_int32_ssa(a, b int32) int32 { + return a / b +} + +//go:noinline +func mod_int32_ssa(a, b int32) int32 { + return a % b +} + +//go:noinline +func mul_int32_ssa(a, b int32) int32 { + return a * b +} + +//go:noinline +func add_uint16_ssa(a, b uint16) uint16 { + return a + b +} + +//go:noinline +func sub_uint16_ssa(a, b uint16) uint16 { + return a - b +} + +//go:noinline +func div_uint16_ssa(a, b uint16) uint16 { + return a / b +} + +//go:noinline +func mod_uint16_ssa(a, b uint16) uint16 { + return a % b +} + +//go:noinline +func mul_uint16_ssa(a, b uint16) uint16 { + return a * b +} + +//go:noinline +func add_int16_ssa(a, b int16) int16 { + return a + b +} + +//go:noinline +func sub_int16_ssa(a, b int16) int16 { + return a - b +} + +//go:noinline +func div_int16_ssa(a, b int16) int16 { + return a / b +} + +//go:noinline +func mod_int16_ssa(a, b int16) int16 { + return a % b +} + +//go:noinline +func mul_int16_ssa(a, b int16) int16 { + return a * b +} + +//go:noinline +func add_uint8_ssa(a, b uint8) uint8 { + return a + b +} + +//go:noinline +func sub_uint8_ssa(a, b uint8) uint8 { + return a - b +} + +//go:noinline +func div_uint8_ssa(a, b uint8) uint8 { + return a / b +} + +//go:noinline +func mod_uint8_ssa(a, b uint8) uint8 { + return a % b +} + +//go:noinline +func mul_uint8_ssa(a, b uint8) uint8 { + return a * b +} + +//go:noinline +func add_int8_ssa(a, b int8) int8 { + return a + b +} + +//go:noinline +func sub_int8_ssa(a, b int8) int8 { + return a - b +} + +//go:noinline +func div_int8_ssa(a, b int8) int8 { + return a / b +} + +//go:noinline +func mod_int8_ssa(a, b int8) int8 { + return a % b +} + +//go:noinline +func mul_int8_ssa(a, b int8) int8 { + return a * b +} + +var uint64_data []utd64 = []utd64{utd64{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + utd64{a: 0, b: 1, add: 1, sub: 18446744073709551615, mul: 0, div: 0, mod: 0}, + utd64{a: 0, b: 4294967296, add: 4294967296, sub: 18446744069414584320, mul: 0, div: 0, mod: 0}, + utd64{a: 0, b: 18446744073709551615, add: 18446744073709551615, sub: 1, mul: 0, div: 0, mod: 0}, + utd64{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + utd64{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + utd64{a: 1, b: 4294967296, add: 4294967297, sub: 18446744069414584321, mul: 4294967296, div: 0, mod: 1}, + utd64{a: 1, b: 18446744073709551615, add: 0, sub: 2, mul: 18446744073709551615, div: 0, mod: 1}, + utd64{a: 4294967296, b: 0, add: 4294967296, sub: 4294967296, mul: 0}, + utd64{a: 4294967296, b: 1, add: 4294967297, sub: 4294967295, mul: 4294967296, div: 4294967296, mod: 0}, + utd64{a: 4294967296, b: 4294967296, add: 8589934592, sub: 0, mul: 0, div: 1, mod: 0}, + utd64{a: 4294967296, b: 18446744073709551615, add: 4294967295, sub: 4294967297, mul: 18446744069414584320, div: 0, mod: 4294967296}, + utd64{a: 18446744073709551615, b: 0, add: 18446744073709551615, sub: 18446744073709551615, mul: 0}, + utd64{a: 18446744073709551615, b: 1, add: 0, sub: 18446744073709551614, mul: 18446744073709551615, div: 18446744073709551615, mod: 0}, + utd64{a: 18446744073709551615, b: 4294967296, add: 4294967295, sub: 18446744069414584319, mul: 18446744069414584320, div: 4294967295, mod: 4294967295}, + utd64{a: 18446744073709551615, b: 18446744073709551615, add: 18446744073709551614, sub: 0, mul: 1, div: 1, mod: 0}, +} +var int64_data []itd64 = []itd64{itd64{a: -9223372036854775808, b: -9223372036854775808, add: 0, sub: 0, mul: 0, div: 1, mod: 0}, + itd64{a: -9223372036854775808, b: -9223372036854775807, add: 1, sub: -1, mul: -9223372036854775808, div: 1, mod: -1}, + itd64{a: -9223372036854775808, b: -4294967296, add: 9223372032559808512, sub: -9223372032559808512, mul: 0, div: 2147483648, mod: 0}, + itd64{a: -9223372036854775808, b: -1, add: 9223372036854775807, sub: -9223372036854775807, mul: -9223372036854775808, div: -9223372036854775808, mod: 0}, + itd64{a: -9223372036854775808, b: 0, add: -9223372036854775808, sub: -9223372036854775808, mul: 0}, + itd64{a: -9223372036854775808, b: 1, add: -9223372036854775807, sub: 9223372036854775807, mul: -9223372036854775808, div: -9223372036854775808, mod: 0}, + itd64{a: -9223372036854775808, b: 4294967296, add: -9223372032559808512, sub: 9223372032559808512, mul: 0, div: -2147483648, mod: 0}, + itd64{a: -9223372036854775808, b: 9223372036854775806, add: -2, sub: 2, mul: 0, div: -1, mod: -2}, + itd64{a: -9223372036854775808, b: 9223372036854775807, add: -1, sub: 1, mul: -9223372036854775808, div: -1, mod: -1}, + itd64{a: -9223372036854775807, b: -9223372036854775808, add: 1, sub: 1, mul: -9223372036854775808, div: 0, mod: -9223372036854775807}, + itd64{a: -9223372036854775807, b: -9223372036854775807, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd64{a: -9223372036854775807, b: -4294967296, add: 9223372032559808513, sub: -9223372032559808511, mul: -4294967296, div: 2147483647, mod: -4294967295}, + itd64{a: -9223372036854775807, b: -1, add: -9223372036854775808, sub: -9223372036854775806, mul: 9223372036854775807, div: 9223372036854775807, mod: 0}, + itd64{a: -9223372036854775807, b: 0, add: -9223372036854775807, sub: -9223372036854775807, mul: 0}, + itd64{a: -9223372036854775807, b: 1, add: -9223372036854775806, sub: -9223372036854775808, mul: -9223372036854775807, div: -9223372036854775807, mod: 0}, + itd64{a: -9223372036854775807, b: 4294967296, add: -9223372032559808511, sub: 9223372032559808513, mul: 4294967296, div: -2147483647, mod: -4294967295}, + itd64{a: -9223372036854775807, b: 9223372036854775806, add: -1, sub: 3, mul: 9223372036854775806, div: -1, mod: -1}, + itd64{a: -9223372036854775807, b: 9223372036854775807, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd64{a: -4294967296, b: -9223372036854775808, add: 9223372032559808512, sub: 9223372032559808512, mul: 0, div: 0, mod: -4294967296}, + itd64{a: -4294967296, b: -9223372036854775807, add: 9223372032559808513, sub: 9223372032559808511, mul: -4294967296, div: 0, mod: -4294967296}, + itd64{a: -4294967296, b: -4294967296, add: -8589934592, sub: 0, mul: 0, div: 1, mod: 0}, + itd64{a: -4294967296, b: -1, add: -4294967297, sub: -4294967295, mul: 4294967296, div: 4294967296, mod: 0}, + itd64{a: -4294967296, b: 0, add: -4294967296, sub: -4294967296, mul: 0}, + itd64{a: -4294967296, b: 1, add: -4294967295, sub: -4294967297, mul: -4294967296, div: -4294967296, mod: 0}, + itd64{a: -4294967296, b: 4294967296, add: 0, sub: -8589934592, mul: 0, div: -1, mod: 0}, + itd64{a: -4294967296, b: 9223372036854775806, add: 9223372032559808510, sub: 9223372032559808514, mul: 8589934592, div: 0, mod: -4294967296}, + itd64{a: -4294967296, b: 9223372036854775807, add: 9223372032559808511, sub: 9223372032559808513, mul: 4294967296, div: 0, mod: -4294967296}, + itd64{a: -1, b: -9223372036854775808, add: 9223372036854775807, sub: 9223372036854775807, mul: -9223372036854775808, div: 0, mod: -1}, + itd64{a: -1, b: -9223372036854775807, add: -9223372036854775808, sub: 9223372036854775806, mul: 9223372036854775807, div: 0, mod: -1}, + itd64{a: -1, b: -4294967296, add: -4294967297, sub: 4294967295, mul: 4294967296, div: 0, mod: -1}, + itd64{a: -1, b: -1, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, + itd64{a: -1, b: 0, add: -1, sub: -1, mul: 0}, + itd64{a: -1, b: 1, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd64{a: -1, b: 4294967296, add: 4294967295, sub: -4294967297, mul: -4294967296, div: 0, mod: -1}, + itd64{a: -1, b: 9223372036854775806, add: 9223372036854775805, sub: -9223372036854775807, mul: -9223372036854775806, div: 0, mod: -1}, + itd64{a: -1, b: 9223372036854775807, add: 9223372036854775806, sub: -9223372036854775808, mul: -9223372036854775807, div: 0, mod: -1}, + itd64{a: 0, b: -9223372036854775808, add: -9223372036854775808, sub: -9223372036854775808, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: -9223372036854775807, add: -9223372036854775807, sub: 9223372036854775807, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: -4294967296, add: -4294967296, sub: 4294967296, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: -1, add: -1, sub: 1, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + itd64{a: 0, b: 1, add: 1, sub: -1, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: 4294967296, add: 4294967296, sub: -4294967296, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: 9223372036854775806, add: 9223372036854775806, sub: -9223372036854775806, mul: 0, div: 0, mod: 0}, + itd64{a: 0, b: 9223372036854775807, add: 9223372036854775807, sub: -9223372036854775807, mul: 0, div: 0, mod: 0}, + itd64{a: 1, b: -9223372036854775808, add: -9223372036854775807, sub: -9223372036854775807, mul: -9223372036854775808, div: 0, mod: 1}, + itd64{a: 1, b: -9223372036854775807, add: -9223372036854775806, sub: -9223372036854775808, mul: -9223372036854775807, div: 0, mod: 1}, + itd64{a: 1, b: -4294967296, add: -4294967295, sub: 4294967297, mul: -4294967296, div: 0, mod: 1}, + itd64{a: 1, b: -1, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd64{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + itd64{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd64{a: 1, b: 4294967296, add: 4294967297, sub: -4294967295, mul: 4294967296, div: 0, mod: 1}, + itd64{a: 1, b: 9223372036854775806, add: 9223372036854775807, sub: -9223372036854775805, mul: 9223372036854775806, div: 0, mod: 1}, + itd64{a: 1, b: 9223372036854775807, add: -9223372036854775808, sub: -9223372036854775806, mul: 9223372036854775807, div: 0, mod: 1}, + itd64{a: 4294967296, b: -9223372036854775808, add: -9223372032559808512, sub: -9223372032559808512, mul: 0, div: 0, mod: 4294967296}, + itd64{a: 4294967296, b: -9223372036854775807, add: -9223372032559808511, sub: -9223372032559808513, mul: 4294967296, div: 0, mod: 4294967296}, + itd64{a: 4294967296, b: -4294967296, add: 0, sub: 8589934592, mul: 0, div: -1, mod: 0}, + itd64{a: 4294967296, b: -1, add: 4294967295, sub: 4294967297, mul: -4294967296, div: -4294967296, mod: 0}, + itd64{a: 4294967296, b: 0, add: 4294967296, sub: 4294967296, mul: 0}, + itd64{a: 4294967296, b: 1, add: 4294967297, sub: 4294967295, mul: 4294967296, div: 4294967296, mod: 0}, + itd64{a: 4294967296, b: 4294967296, add: 8589934592, sub: 0, mul: 0, div: 1, mod: 0}, + itd64{a: 4294967296, b: 9223372036854775806, add: -9223372032559808514, sub: -9223372032559808510, mul: -8589934592, div: 0, mod: 4294967296}, + itd64{a: 4294967296, b: 9223372036854775807, add: -9223372032559808513, sub: -9223372032559808511, mul: -4294967296, div: 0, mod: 4294967296}, + itd64{a: 9223372036854775806, b: -9223372036854775808, add: -2, sub: -2, mul: 0, div: 0, mod: 9223372036854775806}, + itd64{a: 9223372036854775806, b: -9223372036854775807, add: -1, sub: -3, mul: 9223372036854775806, div: 0, mod: 9223372036854775806}, + itd64{a: 9223372036854775806, b: -4294967296, add: 9223372032559808510, sub: -9223372032559808514, mul: 8589934592, div: -2147483647, mod: 4294967294}, + itd64{a: 9223372036854775806, b: -1, add: 9223372036854775805, sub: 9223372036854775807, mul: -9223372036854775806, div: -9223372036854775806, mod: 0}, + itd64{a: 9223372036854775806, b: 0, add: 9223372036854775806, sub: 9223372036854775806, mul: 0}, + itd64{a: 9223372036854775806, b: 1, add: 9223372036854775807, sub: 9223372036854775805, mul: 9223372036854775806, div: 9223372036854775806, mod: 0}, + itd64{a: 9223372036854775806, b: 4294967296, add: -9223372032559808514, sub: 9223372032559808510, mul: -8589934592, div: 2147483647, mod: 4294967294}, + itd64{a: 9223372036854775806, b: 9223372036854775806, add: -4, sub: 0, mul: 4, div: 1, mod: 0}, + itd64{a: 9223372036854775806, b: 9223372036854775807, add: -3, sub: -1, mul: -9223372036854775806, div: 0, mod: 9223372036854775806}, + itd64{a: 9223372036854775807, b: -9223372036854775808, add: -1, sub: -1, mul: -9223372036854775808, div: 0, mod: 9223372036854775807}, + itd64{a: 9223372036854775807, b: -9223372036854775807, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd64{a: 9223372036854775807, b: -4294967296, add: 9223372032559808511, sub: -9223372032559808513, mul: 4294967296, div: -2147483647, mod: 4294967295}, + itd64{a: 9223372036854775807, b: -1, add: 9223372036854775806, sub: -9223372036854775808, mul: -9223372036854775807, div: -9223372036854775807, mod: 0}, + itd64{a: 9223372036854775807, b: 0, add: 9223372036854775807, sub: 9223372036854775807, mul: 0}, + itd64{a: 9223372036854775807, b: 1, add: -9223372036854775808, sub: 9223372036854775806, mul: 9223372036854775807, div: 9223372036854775807, mod: 0}, + itd64{a: 9223372036854775807, b: 4294967296, add: -9223372032559808513, sub: 9223372032559808511, mul: -4294967296, div: 2147483647, mod: 4294967295}, + itd64{a: 9223372036854775807, b: 9223372036854775806, add: -3, sub: 1, mul: -9223372036854775806, div: 1, mod: 1}, + itd64{a: 9223372036854775807, b: 9223372036854775807, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, +} +var uint32_data []utd32 = []utd32{utd32{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + utd32{a: 0, b: 1, add: 1, sub: 4294967295, mul: 0, div: 0, mod: 0}, + utd32{a: 0, b: 4294967295, add: 4294967295, sub: 1, mul: 0, div: 0, mod: 0}, + utd32{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + utd32{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + utd32{a: 1, b: 4294967295, add: 0, sub: 2, mul: 4294967295, div: 0, mod: 1}, + utd32{a: 4294967295, b: 0, add: 4294967295, sub: 4294967295, mul: 0}, + utd32{a: 4294967295, b: 1, add: 0, sub: 4294967294, mul: 4294967295, div: 4294967295, mod: 0}, + utd32{a: 4294967295, b: 4294967295, add: 4294967294, sub: 0, mul: 1, div: 1, mod: 0}, +} +var int32_data []itd32 = []itd32{itd32{a: -2147483648, b: -2147483648, add: 0, sub: 0, mul: 0, div: 1, mod: 0}, + itd32{a: -2147483648, b: -2147483647, add: 1, sub: -1, mul: -2147483648, div: 1, mod: -1}, + itd32{a: -2147483648, b: -1, add: 2147483647, sub: -2147483647, mul: -2147483648, div: -2147483648, mod: 0}, + itd32{a: -2147483648, b: 0, add: -2147483648, sub: -2147483648, mul: 0}, + itd32{a: -2147483648, b: 1, add: -2147483647, sub: 2147483647, mul: -2147483648, div: -2147483648, mod: 0}, + itd32{a: -2147483648, b: 2147483647, add: -1, sub: 1, mul: -2147483648, div: -1, mod: -1}, + itd32{a: -2147483647, b: -2147483648, add: 1, sub: 1, mul: -2147483648, div: 0, mod: -2147483647}, + itd32{a: -2147483647, b: -2147483647, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd32{a: -2147483647, b: -1, add: -2147483648, sub: -2147483646, mul: 2147483647, div: 2147483647, mod: 0}, + itd32{a: -2147483647, b: 0, add: -2147483647, sub: -2147483647, mul: 0}, + itd32{a: -2147483647, b: 1, add: -2147483646, sub: -2147483648, mul: -2147483647, div: -2147483647, mod: 0}, + itd32{a: -2147483647, b: 2147483647, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd32{a: -1, b: -2147483648, add: 2147483647, sub: 2147483647, mul: -2147483648, div: 0, mod: -1}, + itd32{a: -1, b: -2147483647, add: -2147483648, sub: 2147483646, mul: 2147483647, div: 0, mod: -1}, + itd32{a: -1, b: -1, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, + itd32{a: -1, b: 0, add: -1, sub: -1, mul: 0}, + itd32{a: -1, b: 1, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd32{a: -1, b: 2147483647, add: 2147483646, sub: -2147483648, mul: -2147483647, div: 0, mod: -1}, + itd32{a: 0, b: -2147483648, add: -2147483648, sub: -2147483648, mul: 0, div: 0, mod: 0}, + itd32{a: 0, b: -2147483647, add: -2147483647, sub: 2147483647, mul: 0, div: 0, mod: 0}, + itd32{a: 0, b: -1, add: -1, sub: 1, mul: 0, div: 0, mod: 0}, + itd32{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + itd32{a: 0, b: 1, add: 1, sub: -1, mul: 0, div: 0, mod: 0}, + itd32{a: 0, b: 2147483647, add: 2147483647, sub: -2147483647, mul: 0, div: 0, mod: 0}, + itd32{a: 1, b: -2147483648, add: -2147483647, sub: -2147483647, mul: -2147483648, div: 0, mod: 1}, + itd32{a: 1, b: -2147483647, add: -2147483646, sub: -2147483648, mul: -2147483647, div: 0, mod: 1}, + itd32{a: 1, b: -1, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd32{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + itd32{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd32{a: 1, b: 2147483647, add: -2147483648, sub: -2147483646, mul: 2147483647, div: 0, mod: 1}, + itd32{a: 2147483647, b: -2147483648, add: -1, sub: -1, mul: -2147483648, div: 0, mod: 2147483647}, + itd32{a: 2147483647, b: -2147483647, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd32{a: 2147483647, b: -1, add: 2147483646, sub: -2147483648, mul: -2147483647, div: -2147483647, mod: 0}, + itd32{a: 2147483647, b: 0, add: 2147483647, sub: 2147483647, mul: 0}, + itd32{a: 2147483647, b: 1, add: -2147483648, sub: 2147483646, mul: 2147483647, div: 2147483647, mod: 0}, + itd32{a: 2147483647, b: 2147483647, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, +} +var uint16_data []utd16 = []utd16{utd16{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + utd16{a: 0, b: 1, add: 1, sub: 65535, mul: 0, div: 0, mod: 0}, + utd16{a: 0, b: 65535, add: 65535, sub: 1, mul: 0, div: 0, mod: 0}, + utd16{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + utd16{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + utd16{a: 1, b: 65535, add: 0, sub: 2, mul: 65535, div: 0, mod: 1}, + utd16{a: 65535, b: 0, add: 65535, sub: 65535, mul: 0}, + utd16{a: 65535, b: 1, add: 0, sub: 65534, mul: 65535, div: 65535, mod: 0}, + utd16{a: 65535, b: 65535, add: 65534, sub: 0, mul: 1, div: 1, mod: 0}, +} +var int16_data []itd16 = []itd16{itd16{a: -32768, b: -32768, add: 0, sub: 0, mul: 0, div: 1, mod: 0}, + itd16{a: -32768, b: -32767, add: 1, sub: -1, mul: -32768, div: 1, mod: -1}, + itd16{a: -32768, b: -1, add: 32767, sub: -32767, mul: -32768, div: -32768, mod: 0}, + itd16{a: -32768, b: 0, add: -32768, sub: -32768, mul: 0}, + itd16{a: -32768, b: 1, add: -32767, sub: 32767, mul: -32768, div: -32768, mod: 0}, + itd16{a: -32768, b: 32766, add: -2, sub: 2, mul: 0, div: -1, mod: -2}, + itd16{a: -32768, b: 32767, add: -1, sub: 1, mul: -32768, div: -1, mod: -1}, + itd16{a: -32767, b: -32768, add: 1, sub: 1, mul: -32768, div: 0, mod: -32767}, + itd16{a: -32767, b: -32767, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd16{a: -32767, b: -1, add: -32768, sub: -32766, mul: 32767, div: 32767, mod: 0}, + itd16{a: -32767, b: 0, add: -32767, sub: -32767, mul: 0}, + itd16{a: -32767, b: 1, add: -32766, sub: -32768, mul: -32767, div: -32767, mod: 0}, + itd16{a: -32767, b: 32766, add: -1, sub: 3, mul: 32766, div: -1, mod: -1}, + itd16{a: -32767, b: 32767, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd16{a: -1, b: -32768, add: 32767, sub: 32767, mul: -32768, div: 0, mod: -1}, + itd16{a: -1, b: -32767, add: -32768, sub: 32766, mul: 32767, div: 0, mod: -1}, + itd16{a: -1, b: -1, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, + itd16{a: -1, b: 0, add: -1, sub: -1, mul: 0}, + itd16{a: -1, b: 1, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd16{a: -1, b: 32766, add: 32765, sub: -32767, mul: -32766, div: 0, mod: -1}, + itd16{a: -1, b: 32767, add: 32766, sub: -32768, mul: -32767, div: 0, mod: -1}, + itd16{a: 0, b: -32768, add: -32768, sub: -32768, mul: 0, div: 0, mod: 0}, + itd16{a: 0, b: -32767, add: -32767, sub: 32767, mul: 0, div: 0, mod: 0}, + itd16{a: 0, b: -1, add: -1, sub: 1, mul: 0, div: 0, mod: 0}, + itd16{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + itd16{a: 0, b: 1, add: 1, sub: -1, mul: 0, div: 0, mod: 0}, + itd16{a: 0, b: 32766, add: 32766, sub: -32766, mul: 0, div: 0, mod: 0}, + itd16{a: 0, b: 32767, add: 32767, sub: -32767, mul: 0, div: 0, mod: 0}, + itd16{a: 1, b: -32768, add: -32767, sub: -32767, mul: -32768, div: 0, mod: 1}, + itd16{a: 1, b: -32767, add: -32766, sub: -32768, mul: -32767, div: 0, mod: 1}, + itd16{a: 1, b: -1, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd16{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + itd16{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd16{a: 1, b: 32766, add: 32767, sub: -32765, mul: 32766, div: 0, mod: 1}, + itd16{a: 1, b: 32767, add: -32768, sub: -32766, mul: 32767, div: 0, mod: 1}, + itd16{a: 32766, b: -32768, add: -2, sub: -2, mul: 0, div: 0, mod: 32766}, + itd16{a: 32766, b: -32767, add: -1, sub: -3, mul: 32766, div: 0, mod: 32766}, + itd16{a: 32766, b: -1, add: 32765, sub: 32767, mul: -32766, div: -32766, mod: 0}, + itd16{a: 32766, b: 0, add: 32766, sub: 32766, mul: 0}, + itd16{a: 32766, b: 1, add: 32767, sub: 32765, mul: 32766, div: 32766, mod: 0}, + itd16{a: 32766, b: 32766, add: -4, sub: 0, mul: 4, div: 1, mod: 0}, + itd16{a: 32766, b: 32767, add: -3, sub: -1, mul: -32766, div: 0, mod: 32766}, + itd16{a: 32767, b: -32768, add: -1, sub: -1, mul: -32768, div: 0, mod: 32767}, + itd16{a: 32767, b: -32767, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd16{a: 32767, b: -1, add: 32766, sub: -32768, mul: -32767, div: -32767, mod: 0}, + itd16{a: 32767, b: 0, add: 32767, sub: 32767, mul: 0}, + itd16{a: 32767, b: 1, add: -32768, sub: 32766, mul: 32767, div: 32767, mod: 0}, + itd16{a: 32767, b: 32766, add: -3, sub: 1, mul: -32766, div: 1, mod: 1}, + itd16{a: 32767, b: 32767, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, +} +var uint8_data []utd8 = []utd8{utd8{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + utd8{a: 0, b: 1, add: 1, sub: 255, mul: 0, div: 0, mod: 0}, + utd8{a: 0, b: 255, add: 255, sub: 1, mul: 0, div: 0, mod: 0}, + utd8{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + utd8{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + utd8{a: 1, b: 255, add: 0, sub: 2, mul: 255, div: 0, mod: 1}, + utd8{a: 255, b: 0, add: 255, sub: 255, mul: 0}, + utd8{a: 255, b: 1, add: 0, sub: 254, mul: 255, div: 255, mod: 0}, + utd8{a: 255, b: 255, add: 254, sub: 0, mul: 1, div: 1, mod: 0}, +} +var int8_data []itd8 = []itd8{itd8{a: -128, b: -128, add: 0, sub: 0, mul: 0, div: 1, mod: 0}, + itd8{a: -128, b: -127, add: 1, sub: -1, mul: -128, div: 1, mod: -1}, + itd8{a: -128, b: -1, add: 127, sub: -127, mul: -128, div: -128, mod: 0}, + itd8{a: -128, b: 0, add: -128, sub: -128, mul: 0}, + itd8{a: -128, b: 1, add: -127, sub: 127, mul: -128, div: -128, mod: 0}, + itd8{a: -128, b: 126, add: -2, sub: 2, mul: 0, div: -1, mod: -2}, + itd8{a: -128, b: 127, add: -1, sub: 1, mul: -128, div: -1, mod: -1}, + itd8{a: -127, b: -128, add: 1, sub: 1, mul: -128, div: 0, mod: -127}, + itd8{a: -127, b: -127, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd8{a: -127, b: -1, add: -128, sub: -126, mul: 127, div: 127, mod: 0}, + itd8{a: -127, b: 0, add: -127, sub: -127, mul: 0}, + itd8{a: -127, b: 1, add: -126, sub: -128, mul: -127, div: -127, mod: 0}, + itd8{a: -127, b: 126, add: -1, sub: 3, mul: 126, div: -1, mod: -1}, + itd8{a: -127, b: 127, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd8{a: -1, b: -128, add: 127, sub: 127, mul: -128, div: 0, mod: -1}, + itd8{a: -1, b: -127, add: -128, sub: 126, mul: 127, div: 0, mod: -1}, + itd8{a: -1, b: -1, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, + itd8{a: -1, b: 0, add: -1, sub: -1, mul: 0}, + itd8{a: -1, b: 1, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd8{a: -1, b: 126, add: 125, sub: -127, mul: -126, div: 0, mod: -1}, + itd8{a: -1, b: 127, add: 126, sub: -128, mul: -127, div: 0, mod: -1}, + itd8{a: 0, b: -128, add: -128, sub: -128, mul: 0, div: 0, mod: 0}, + itd8{a: 0, b: -127, add: -127, sub: 127, mul: 0, div: 0, mod: 0}, + itd8{a: 0, b: -1, add: -1, sub: 1, mul: 0, div: 0, mod: 0}, + itd8{a: 0, b: 0, add: 0, sub: 0, mul: 0}, + itd8{a: 0, b: 1, add: 1, sub: -1, mul: 0, div: 0, mod: 0}, + itd8{a: 0, b: 126, add: 126, sub: -126, mul: 0, div: 0, mod: 0}, + itd8{a: 0, b: 127, add: 127, sub: -127, mul: 0, div: 0, mod: 0}, + itd8{a: 1, b: -128, add: -127, sub: -127, mul: -128, div: 0, mod: 1}, + itd8{a: 1, b: -127, add: -126, sub: -128, mul: -127, div: 0, mod: 1}, + itd8{a: 1, b: -1, add: 0, sub: 2, mul: -1, div: -1, mod: 0}, + itd8{a: 1, b: 0, add: 1, sub: 1, mul: 0}, + itd8{a: 1, b: 1, add: 2, sub: 0, mul: 1, div: 1, mod: 0}, + itd8{a: 1, b: 126, add: 127, sub: -125, mul: 126, div: 0, mod: 1}, + itd8{a: 1, b: 127, add: -128, sub: -126, mul: 127, div: 0, mod: 1}, + itd8{a: 126, b: -128, add: -2, sub: -2, mul: 0, div: 0, mod: 126}, + itd8{a: 126, b: -127, add: -1, sub: -3, mul: 126, div: 0, mod: 126}, + itd8{a: 126, b: -1, add: 125, sub: 127, mul: -126, div: -126, mod: 0}, + itd8{a: 126, b: 0, add: 126, sub: 126, mul: 0}, + itd8{a: 126, b: 1, add: 127, sub: 125, mul: 126, div: 126, mod: 0}, + itd8{a: 126, b: 126, add: -4, sub: 0, mul: 4, div: 1, mod: 0}, + itd8{a: 126, b: 127, add: -3, sub: -1, mul: -126, div: 0, mod: 126}, + itd8{a: 127, b: -128, add: -1, sub: -1, mul: -128, div: 0, mod: 127}, + itd8{a: 127, b: -127, add: 0, sub: -2, mul: -1, div: -1, mod: 0}, + itd8{a: 127, b: -1, add: 126, sub: -128, mul: -127, div: -127, mod: 0}, + itd8{a: 127, b: 0, add: 127, sub: 127, mul: 0}, + itd8{a: 127, b: 1, add: -128, sub: 126, mul: 127, div: 127, mod: 0}, + itd8{a: 127, b: 126, add: -3, sub: 1, mul: -126, div: 1, mod: 1}, + itd8{a: 127, b: 127, add: -2, sub: 0, mul: 1, div: 1, mod: 0}, +} +var failed bool + +func main() { + + for _, v := range uint64_data { + if got := add_uint64_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_uint64 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_uint64_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_uint64 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_uint64_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_uint64 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_uint64_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_uint64 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_uint64_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_uint64 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range int64_data { + if got := add_int64_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_int64 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_int64_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_int64 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_int64_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_int64 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_int64_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_int64 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_int64_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_int64 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range uint32_data { + if got := add_uint32_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_uint32 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_uint32_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_uint32 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_uint32_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_uint32 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_uint32_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_uint32 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_uint32_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_uint32 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range int32_data { + if got := add_int32_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_int32 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_int32_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_int32 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_int32_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_int32 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_int32_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_int32 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_int32_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_int32 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range uint16_data { + if got := add_uint16_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_uint16 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_uint16_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_uint16 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_uint16_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_uint16 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_uint16_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_uint16 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_uint16_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_uint16 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range int16_data { + if got := add_int16_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_int16 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_int16_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_int16 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_int16_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_int16 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_int16_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_int16 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_int16_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_int16 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range uint8_data { + if got := add_uint8_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_uint8 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_uint8_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_uint8 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_uint8_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_uint8 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_uint8_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_uint8 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_uint8_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_uint8 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + for _, v := range int8_data { + if got := add_int8_ssa(v.a, v.b); got != v.add { + fmt.Printf("add_int8 %d+%d = %d, wanted %d\n", v.a, v.b, got, v.add) + failed = true + } + if got := sub_int8_ssa(v.a, v.b); got != v.sub { + fmt.Printf("sub_int8 %d-%d = %d, wanted %d\n", v.a, v.b, got, v.sub) + failed = true + } + if v.b != 0 { + if got := div_int8_ssa(v.a, v.b); got != v.div { + fmt.Printf("div_int8 %d/%d = %d, wanted %d\n", v.a, v.b, got, v.div) + failed = true + } + + } + if v.b != 0 { + if got := mod_int8_ssa(v.a, v.b); got != v.mod { + fmt.Printf("mod_int8 %d%%%d = %d, wanted %d\n", v.a, v.b, got, v.mod) + failed = true + } + + } + if got := mul_int8_ssa(v.a, v.b); got != v.mul { + fmt.Printf("mul_int8 %d*%d = %d, wanted %d\n", v.a, v.b, got, v.mul) + failed = true + } + } + if failed { + panic("tests failed") + } +} 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..782d2df8c8 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/arithConst_ssa.go @@ -0,0 +1,12671 @@ +package main + +import "fmt" + +//go:noinline +func add_uint64_0_ssa(a uint64) uint64 { + return a + 0 +} + +//go:noinline +func add_0_uint64_ssa(a uint64) uint64 { + return 0 + a +} + +//go:noinline +func add_uint64_1_ssa(a uint64) uint64 { + return a + 1 +} + +//go:noinline +func add_1_uint64_ssa(a uint64) uint64 { + return 1 + a +} + +//go:noinline +func add_uint64_4294967296_ssa(a uint64) uint64 { + return a + 4294967296 +} + +//go:noinline +func add_4294967296_uint64_ssa(a uint64) uint64 { + return 4294967296 + a +} + +//go:noinline +func add_uint64_18446744073709551615_ssa(a uint64) uint64 { + return a + 18446744073709551615 +} + +//go:noinline +func add_18446744073709551615_uint64_ssa(a uint64) uint64 { + return 18446744073709551615 + a +} + +//go:noinline +func sub_uint64_0_ssa(a uint64) uint64 { + return a - 0 +} + +//go:noinline +func sub_0_uint64_ssa(a uint64) uint64 { + return 0 - a +} + +//go:noinline +func sub_uint64_1_ssa(a uint64) uint64 { + return a - 1 +} + +//go:noinline +func sub_1_uint64_ssa(a uint64) uint64 { + return 1 - a +} + +//go:noinline +func sub_uint64_4294967296_ssa(a uint64) uint64 { + return a - 4294967296 +} + +//go:noinline +func sub_4294967296_uint64_ssa(a uint64) uint64 { + return 4294967296 - a +} + +//go:noinline +func sub_uint64_18446744073709551615_ssa(a uint64) uint64 { + return a - 18446744073709551615 +} + +//go:noinline +func sub_18446744073709551615_uint64_ssa(a uint64) uint64 { + return 18446744073709551615 - a +} + +//go:noinline +func div_0_uint64_ssa(a uint64) uint64 { + return 0 / a +} + +//go:noinline +func div_uint64_1_ssa(a uint64) uint64 { + return a / 1 +} + +//go:noinline +func div_1_uint64_ssa(a uint64) uint64 { + return 1 / a +} + +//go:noinline +func div_uint64_4294967296_ssa(a uint64) uint64 { + return a / 4294967296 +} + +//go:noinline +func div_4294967296_uint64_ssa(a uint64) uint64 { + return 4294967296 / a +} + +//go:noinline +func div_uint64_18446744073709551615_ssa(a uint64) uint64 { + return a / 18446744073709551615 +} + +//go:noinline +func div_18446744073709551615_uint64_ssa(a uint64) uint64 { + return 18446744073709551615 / a +} + +//go:noinline +func mul_uint64_0_ssa(a uint64) uint64 { + return a * 0 +} + +//go:noinline +func mul_0_uint64_ssa(a uint64) uint64 { + return 0 * a +} + +//go:noinline +func mul_uint64_1_ssa(a uint64) uint64 { + return a * 1 +} + +//go:noinline +func mul_1_uint64_ssa(a uint64) uint64 { + return 1 * a +} + +//go:noinline +func mul_uint64_4294967296_ssa(a uint64) uint64 { + return a * 4294967296 +} + +//go:noinline +func mul_4294967296_uint64_ssa(a uint64) uint64 { + return 4294967296 * a +} + +//go:noinline +func mul_uint64_18446744073709551615_ssa(a uint64) uint64 { + return a * 18446744073709551615 +} + +//go:noinline +func mul_18446744073709551615_uint64_ssa(a uint64) uint64 { + return 18446744073709551615 * a +} + +//go:noinline +func lsh_uint64_0_ssa(a uint64) uint64 { + return a << 0 +} + +//go:noinline +func lsh_0_uint64_ssa(a uint64) uint64 { + return 0 << a +} + +//go:noinline +func lsh_uint64_1_ssa(a uint64) uint64 { + return a << 1 +} + +//go:noinline +func lsh_1_uint64_ssa(a uint64) uint64 { + return 1 << a +} + +//go:noinline +func lsh_uint64_4294967296_ssa(a uint64) uint64 { + return a << 4294967296 +} + +//go:noinline +func lsh_4294967296_uint64_ssa(a uint64) uint64 { + return 4294967296 << a +} + +//go:noinline +func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 { + return a << 18446744073709551615 +} + +//go:noinline +func lsh_18446744073709551615_uint64_ssa(a uint64) uint64 { + return 18446744073709551615 << a +} + +//go:noinline +func rsh_uint64_0_ssa(a uint64) uint64 { + return a >> 0 +} + +//go:noinline +func rsh_0_uint64_ssa(a uint64) uint64 { + return 0 >> a +} + +//go:noinline +func rsh_uint64_1_ssa(a uint64) uint64 { + return a >> 1 +} + +//go:noinline +func rsh_1_uint64_ssa(a uint64) uint64 { + return 1 >> a +} + +//go:noinline +func rsh_uint64_4294967296_ssa(a uint64) uint64 { + return a >> 4294967296 +} + +//go:noinline +func rsh_4294967296_uint64_ssa(a uint64) uint64 { + return 4294967296 >> a +} + +//go:noinline +func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 { + return a >> 18446744073709551615 +} + +//go:noinline +func rsh_18446744073709551615_uint64_ssa(a uint64) uint64 { + return 18446744073709551615 >> a +} + +//go:noinline +func add_int64_Neg9223372036854775808_ssa(a int64) int64 { + return a + -9223372036854775808 +} + +//go:noinline +func add_Neg9223372036854775808_int64_ssa(a int64) int64 { + return -9223372036854775808 + a +} + +//go:noinline +func add_int64_Neg9223372036854775807_ssa(a int64) int64 { + return a + -9223372036854775807 +} + +//go:noinline +func add_Neg9223372036854775807_int64_ssa(a int64) int64 { + return -9223372036854775807 + a +} + +//go:noinline +func add_int64_Neg4294967296_ssa(a int64) int64 { + return a + -4294967296 +} + +//go:noinline +func add_Neg4294967296_int64_ssa(a int64) int64 { + return -4294967296 + a +} + +//go:noinline +func add_int64_Neg1_ssa(a int64) int64 { + return a + -1 +} + +//go:noinline +func add_Neg1_int64_ssa(a int64) int64 { + return -1 + a +} + +//go:noinline +func add_int64_0_ssa(a int64) int64 { + return a + 0 +} + +//go:noinline +func add_0_int64_ssa(a int64) int64 { + return 0 + a +} + +//go:noinline +func add_int64_1_ssa(a int64) int64 { + return a + 1 +} + +//go:noinline +func add_1_int64_ssa(a int64) int64 { + return 1 + a +} + +//go:noinline +func add_int64_4294967296_ssa(a int64) int64 { + return a + 4294967296 +} + +//go:noinline +func add_4294967296_int64_ssa(a int64) int64 { + return 4294967296 + a +} + +//go:noinline +func add_int64_9223372036854775806_ssa(a int64) int64 { + return a + 9223372036854775806 +} + +//go:noinline +func add_9223372036854775806_int64_ssa(a int64) int64 { + return 9223372036854775806 + a +} + +//go:noinline +func add_int64_9223372036854775807_ssa(a int64) int64 { + return a + 9223372036854775807 +} + +//go:noinline +func add_9223372036854775807_int64_ssa(a int64) int64 { + return 9223372036854775807 + a +} + +//go:noinline +func sub_int64_Neg9223372036854775808_ssa(a int64) int64 { + return a - -9223372036854775808 +} + +//go:noinline +func sub_Neg9223372036854775808_int64_ssa(a int64) int64 { + return -9223372036854775808 - a +} + +//go:noinline +func sub_int64_Neg9223372036854775807_ssa(a int64) int64 { + return a - -9223372036854775807 +} + +//go:noinline +func sub_Neg9223372036854775807_int64_ssa(a int64) int64 { + return -9223372036854775807 - a +} + +//go:noinline +func sub_int64_Neg4294967296_ssa(a int64) int64 { + return a - -4294967296 +} + +//go:noinline +func sub_Neg4294967296_int64_ssa(a int64) int64 { + return -4294967296 - a +} + +//go:noinline +func sub_int64_Neg1_ssa(a int64) int64 { + return a - -1 +} + +//go:noinline +func sub_Neg1_int64_ssa(a int64) int64 { + return -1 - a +} + +//go:noinline +func sub_int64_0_ssa(a int64) int64 { + return a - 0 +} + +//go:noinline +func sub_0_int64_ssa(a int64) int64 { + return 0 - a +} + +//go:noinline +func sub_int64_1_ssa(a int64) int64 { + return a - 1 +} + +//go:noinline +func sub_1_int64_ssa(a int64) int64 { + return 1 - a +} + +//go:noinline +func sub_int64_4294967296_ssa(a int64) int64 { + return a - 4294967296 +} + +//go:noinline +func sub_4294967296_int64_ssa(a int64) int64 { + return 4294967296 - a +} + +//go:noinline +func sub_int64_9223372036854775806_ssa(a int64) int64 { + return a - 9223372036854775806 +} + +//go:noinline +func sub_9223372036854775806_int64_ssa(a int64) int64 { + return 9223372036854775806 - a +} + +//go:noinline +func sub_int64_9223372036854775807_ssa(a int64) int64 { + return a - 9223372036854775807 +} + +//go:noinline +func sub_9223372036854775807_int64_ssa(a int64) int64 { + return 9223372036854775807 - a +} + +//go:noinline +func div_int64_Neg9223372036854775808_ssa(a int64) int64 { + return a / -9223372036854775808 +} + +//go:noinline +func div_Neg9223372036854775808_int64_ssa(a int64) int64 { + return -9223372036854775808 / a +} + +//go:noinline +func div_int64_Neg9223372036854775807_ssa(a int64) int64 { + return a / -9223372036854775807 +} + +//go:noinline +func div_Neg9223372036854775807_int64_ssa(a int64) int64 { + return -9223372036854775807 / a +} + +//go:noinline +func div_int64_Neg4294967296_ssa(a int64) int64 { + return a / -4294967296 +} + +//go:noinline +func div_Neg4294967296_int64_ssa(a int64) int64 { + return -4294967296 / a +} + +//go:noinline +func div_int64_Neg1_ssa(a int64) int64 { + return a / -1 +} + +//go:noinline +func div_Neg1_int64_ssa(a int64) int64 { + return -1 / a +} + +//go:noinline +func div_0_int64_ssa(a int64) int64 { + return 0 / a +} + +//go:noinline +func div_int64_1_ssa(a int64) int64 { + return a / 1 +} + +//go:noinline +func div_1_int64_ssa(a int64) int64 { + return 1 / a +} + +//go:noinline +func div_int64_4294967296_ssa(a int64) int64 { + return a / 4294967296 +} + +//go:noinline +func div_4294967296_int64_ssa(a int64) int64 { + return 4294967296 / a +} + +//go:noinline +func div_int64_9223372036854775806_ssa(a int64) int64 { + return a / 9223372036854775806 +} + +//go:noinline +func div_9223372036854775806_int64_ssa(a int64) int64 { + return 9223372036854775806 / a +} + +//go:noinline +func div_int64_9223372036854775807_ssa(a int64) int64 { + return a / 9223372036854775807 +} + +//go:noinline +func div_9223372036854775807_int64_ssa(a int64) int64 { + return 9223372036854775807 / a +} + +//go:noinline +func mul_int64_Neg9223372036854775808_ssa(a int64) int64 { + return a * -9223372036854775808 +} + +//go:noinline +func mul_Neg9223372036854775808_int64_ssa(a int64) int64 { + return -9223372036854775808 * a +} + +//go:noinline +func mul_int64_Neg9223372036854775807_ssa(a int64) int64 { + return a * -9223372036854775807 +} + +//go:noinline +func mul_Neg9223372036854775807_int64_ssa(a int64) int64 { + return -9223372036854775807 * a +} + +//go:noinline +func mul_int64_Neg4294967296_ssa(a int64) int64 { + return a * -4294967296 +} + +//go:noinline +func mul_Neg4294967296_int64_ssa(a int64) int64 { + return -4294967296 * a +} + +//go:noinline +func mul_int64_Neg1_ssa(a int64) int64 { + return a * -1 +} + +//go:noinline +func mul_Neg1_int64_ssa(a int64) int64 { + return -1 * a +} + +//go:noinline +func mul_int64_0_ssa(a int64) int64 { + return a * 0 +} + +//go:noinline +func mul_0_int64_ssa(a int64) int64 { + return 0 * a +} + +//go:noinline +func mul_int64_1_ssa(a int64) int64 { + return a * 1 +} + +//go:noinline +func mul_1_int64_ssa(a int64) int64 { + return 1 * a +} + +//go:noinline +func mul_int64_4294967296_ssa(a int64) int64 { + return a * 4294967296 +} + +//go:noinline +func mul_4294967296_int64_ssa(a int64) int64 { + return 4294967296 * a +} + +//go:noinline +func mul_int64_9223372036854775806_ssa(a int64) int64 { + return a * 9223372036854775806 +} + +//go:noinline +func mul_9223372036854775806_int64_ssa(a int64) int64 { + return 9223372036854775806 * a +} + +//go:noinline +func mul_int64_9223372036854775807_ssa(a int64) int64 { + return a * 9223372036854775807 +} + +//go:noinline +func mul_9223372036854775807_int64_ssa(a int64) int64 { + return 9223372036854775807 * a +} + +//go:noinline +func add_uint32_0_ssa(a uint32) uint32 { + return a + 0 +} + +//go:noinline +func add_0_uint32_ssa(a uint32) uint32 { + return 0 + a +} + +//go:noinline +func add_uint32_1_ssa(a uint32) uint32 { + return a + 1 +} + +//go:noinline +func add_1_uint32_ssa(a uint32) uint32 { + return 1 + a +} + +//go:noinline +func add_uint32_4294967295_ssa(a uint32) uint32 { + return a + 4294967295 +} + +//go:noinline +func add_4294967295_uint32_ssa(a uint32) uint32 { + return 4294967295 + a +} + +//go:noinline +func sub_uint32_0_ssa(a uint32) uint32 { + return a - 0 +} + +//go:noinline +func sub_0_uint32_ssa(a uint32) uint32 { + return 0 - a +} + +//go:noinline +func sub_uint32_1_ssa(a uint32) uint32 { + return a - 1 +} + +//go:noinline +func sub_1_uint32_ssa(a uint32) uint32 { + return 1 - a +} + +//go:noinline +func sub_uint32_4294967295_ssa(a uint32) uint32 { + return a - 4294967295 +} + +//go:noinline +func sub_4294967295_uint32_ssa(a uint32) uint32 { + return 4294967295 - a +} + +//go:noinline +func div_0_uint32_ssa(a uint32) uint32 { + return 0 / a +} + +//go:noinline +func div_uint32_1_ssa(a uint32) uint32 { + return a / 1 +} + +//go:noinline +func div_1_uint32_ssa(a uint32) uint32 { + return 1 / a +} + +//go:noinline +func div_uint32_4294967295_ssa(a uint32) uint32 { + return a / 4294967295 +} + +//go:noinline +func div_4294967295_uint32_ssa(a uint32) uint32 { + return 4294967295 / a +} + +//go:noinline +func mul_uint32_0_ssa(a uint32) uint32 { + return a * 0 +} + +//go:noinline +func mul_0_uint32_ssa(a uint32) uint32 { + return 0 * a +} + +//go:noinline +func mul_uint32_1_ssa(a uint32) uint32 { + return a * 1 +} + +//go:noinline +func mul_1_uint32_ssa(a uint32) uint32 { + return 1 * a +} + +//go:noinline +func mul_uint32_4294967295_ssa(a uint32) uint32 { + return a * 4294967295 +} + +//go:noinline +func mul_4294967295_uint32_ssa(a uint32) uint32 { + return 4294967295 * a +} + +//go:noinline +func lsh_uint32_0_ssa(a uint32) uint32 { + return a << 0 +} + +//go:noinline +func lsh_0_uint32_ssa(a uint32) uint32 { + return 0 << a +} + +//go:noinline +func lsh_uint32_1_ssa(a uint32) uint32 { + return a << 1 +} + +//go:noinline +func lsh_1_uint32_ssa(a uint32) uint32 { + return 1 << a +} + +//go:noinline +func lsh_uint32_4294967295_ssa(a uint32) uint32 { + return a << 4294967295 +} + +//go:noinline +func lsh_4294967295_uint32_ssa(a uint32) uint32 { + return 4294967295 << a +} + +//go:noinline +func rsh_uint32_0_ssa(a uint32) uint32 { + return a >> 0 +} + +//go:noinline +func rsh_0_uint32_ssa(a uint32) uint32 { + return 0 >> a +} + +//go:noinline +func rsh_uint32_1_ssa(a uint32) uint32 { + return a >> 1 +} + +//go:noinline +func rsh_1_uint32_ssa(a uint32) uint32 { + return 1 >> a +} + +//go:noinline +func rsh_uint32_4294967295_ssa(a uint32) uint32 { + return a >> 4294967295 +} + +//go:noinline +func rsh_4294967295_uint32_ssa(a uint32) uint32 { + return 4294967295 >> a +} + +//go:noinline +func add_int32_Neg2147483648_ssa(a int32) int32 { + return a + -2147483648 +} + +//go:noinline +func add_Neg2147483648_int32_ssa(a int32) int32 { + return -2147483648 + a +} + +//go:noinline +func add_int32_Neg2147483647_ssa(a int32) int32 { + return a + -2147483647 +} + +//go:noinline +func add_Neg2147483647_int32_ssa(a int32) int32 { + return -2147483647 + a +} + +//go:noinline +func add_int32_Neg1_ssa(a int32) int32 { + return a + -1 +} + +//go:noinline +func add_Neg1_int32_ssa(a int32) int32 { + return -1 + a +} + +//go:noinline +func add_int32_0_ssa(a int32) int32 { + return a + 0 +} + +//go:noinline +func add_0_int32_ssa(a int32) int32 { + return 0 + a +} + +//go:noinline +func add_int32_1_ssa(a int32) int32 { + return a + 1 +} + +//go:noinline +func add_1_int32_ssa(a int32) int32 { + return 1 + a +} + +//go:noinline +func add_int32_2147483647_ssa(a int32) int32 { + return a + 2147483647 +} + +//go:noinline +func add_2147483647_int32_ssa(a int32) int32 { + return 2147483647 + a +} + +//go:noinline +func sub_int32_Neg2147483648_ssa(a int32) int32 { + return a - -2147483648 +} + +//go:noinline +func sub_Neg2147483648_int32_ssa(a int32) int32 { + return -2147483648 - a +} + +//go:noinline +func sub_int32_Neg2147483647_ssa(a int32) int32 { + return a - -2147483647 +} + +//go:noinline +func sub_Neg2147483647_int32_ssa(a int32) int32 { + return -2147483647 - a +} + +//go:noinline +func sub_int32_Neg1_ssa(a int32) int32 { + return a - -1 +} + +//go:noinline +func sub_Neg1_int32_ssa(a int32) int32 { + return -1 - a +} + +//go:noinline +func sub_int32_0_ssa(a int32) int32 { + return a - 0 +} + +//go:noinline +func sub_0_int32_ssa(a int32) int32 { + return 0 - a +} + +//go:noinline +func sub_int32_1_ssa(a int32) int32 { + return a - 1 +} + +//go:noinline +func sub_1_int32_ssa(a int32) int32 { + return 1 - a +} + +//go:noinline +func sub_int32_2147483647_ssa(a int32) int32 { + return a - 2147483647 +} + +//go:noinline +func sub_2147483647_int32_ssa(a int32) int32 { + return 2147483647 - a +} + +//go:noinline +func div_int32_Neg2147483648_ssa(a int32) int32 { + return a / -2147483648 +} + +//go:noinline +func div_Neg2147483648_int32_ssa(a int32) int32 { + return -2147483648 / a +} + +//go:noinline +func div_int32_Neg2147483647_ssa(a int32) int32 { + return a / -2147483647 +} + +//go:noinline +func div_Neg2147483647_int32_ssa(a int32) int32 { + return -2147483647 / a +} + +//go:noinline +func div_int32_Neg1_ssa(a int32) int32 { + return a / -1 +} + +//go:noinline +func div_Neg1_int32_ssa(a int32) int32 { + return -1 / a +} + +//go:noinline +func div_0_int32_ssa(a int32) int32 { + return 0 / a +} + +//go:noinline +func div_int32_1_ssa(a int32) int32 { + return a / 1 +} + +//go:noinline +func div_1_int32_ssa(a int32) int32 { + return 1 / a +} + +//go:noinline +func div_int32_2147483647_ssa(a int32) int32 { + return a / 2147483647 +} + +//go:noinline +func div_2147483647_int32_ssa(a int32) int32 { + return 2147483647 / a +} + +//go:noinline +func mul_int32_Neg2147483648_ssa(a int32) int32 { + return a * -2147483648 +} + +//go:noinline +func mul_Neg2147483648_int32_ssa(a int32) int32 { + return -2147483648 * a +} + +//go:noinline +func mul_int32_Neg2147483647_ssa(a int32) int32 { + return a * -2147483647 +} + +//go:noinline +func mul_Neg2147483647_int32_ssa(a int32) int32 { + return -2147483647 * a +} + +//go:noinline +func mul_int32_Neg1_ssa(a int32) int32 { + return a * -1 +} + +//go:noinline +func mul_Neg1_int32_ssa(a int32) int32 { + return -1 * a +} + +//go:noinline +func mul_int32_0_ssa(a int32) int32 { + return a * 0 +} + +//go:noinline +func mul_0_int32_ssa(a int32) int32 { + return 0 * a +} + +//go:noinline +func mul_int32_1_ssa(a int32) int32 { + return a * 1 +} + +//go:noinline +func mul_1_int32_ssa(a int32) int32 { + return 1 * a +} + +//go:noinline +func mul_int32_2147483647_ssa(a int32) int32 { + return a * 2147483647 +} + +//go:noinline +func mul_2147483647_int32_ssa(a int32) int32 { + return 2147483647 * a +} + +//go:noinline +func add_uint16_0_ssa(a uint16) uint16 { + return a + 0 +} + +//go:noinline +func add_0_uint16_ssa(a uint16) uint16 { + return 0 + a +} + +//go:noinline +func add_uint16_1_ssa(a uint16) uint16 { + return a + 1 +} + +//go:noinline +func add_1_uint16_ssa(a uint16) uint16 { + return 1 + a +} + +//go:noinline +func add_uint16_65535_ssa(a uint16) uint16 { + return a + 65535 +} + +//go:noinline +func add_65535_uint16_ssa(a uint16) uint16 { + return 65535 + a +} + +//go:noinline +func sub_uint16_0_ssa(a uint16) uint16 { + return a - 0 +} + +//go:noinline +func sub_0_uint16_ssa(a uint16) uint16 { + return 0 - a +} + +//go:noinline +func sub_uint16_1_ssa(a uint16) uint16 { + return a - 1 +} + +//go:noinline +func sub_1_uint16_ssa(a uint16) uint16 { + return 1 - a +} + +//go:noinline +func sub_uint16_65535_ssa(a uint16) uint16 { + return a - 65535 +} + +//go:noinline +func sub_65535_uint16_ssa(a uint16) uint16 { + return 65535 - a +} + +//go:noinline +func div_0_uint16_ssa(a uint16) uint16 { + return 0 / a +} + +//go:noinline +func div_uint16_1_ssa(a uint16) uint16 { + return a / 1 +} + +//go:noinline +func div_1_uint16_ssa(a uint16) uint16 { + return 1 / a +} + +//go:noinline +func div_uint16_65535_ssa(a uint16) uint16 { + return a / 65535 +} + +//go:noinline +func div_65535_uint16_ssa(a uint16) uint16 { + return 65535 / a +} + +//go:noinline +func mul_uint16_0_ssa(a uint16) uint16 { + return a * 0 +} + +//go:noinline +func mul_0_uint16_ssa(a uint16) uint16 { + return 0 * a +} + +//go:noinline +func mul_uint16_1_ssa(a uint16) uint16 { + return a * 1 +} + +//go:noinline +func mul_1_uint16_ssa(a uint16) uint16 { + return 1 * a +} + +//go:noinline +func mul_uint16_65535_ssa(a uint16) uint16 { + return a * 65535 +} + +//go:noinline +func mul_65535_uint16_ssa(a uint16) uint16 { + return 65535 * a +} + +//go:noinline +func lsh_uint16_0_ssa(a uint16) uint16 { + return a << 0 +} + +//go:noinline +func lsh_0_uint16_ssa(a uint16) uint16 { + return 0 << a +} + +//go:noinline +func lsh_uint16_1_ssa(a uint16) uint16 { + return a << 1 +} + +//go:noinline +func lsh_1_uint16_ssa(a uint16) uint16 { + return 1 << a +} + +//go:noinline +func lsh_uint16_65535_ssa(a uint16) uint16 { + return a << 65535 +} + +//go:noinline +func lsh_65535_uint16_ssa(a uint16) uint16 { + return 65535 << a +} + +//go:noinline +func rsh_uint16_0_ssa(a uint16) uint16 { + return a >> 0 +} + +//go:noinline +func rsh_0_uint16_ssa(a uint16) uint16 { + return 0 >> a +} + +//go:noinline +func rsh_uint16_1_ssa(a uint16) uint16 { + return a >> 1 +} + +//go:noinline +func rsh_1_uint16_ssa(a uint16) uint16 { + return 1 >> a +} + +//go:noinline +func rsh_uint16_65535_ssa(a uint16) uint16 { + return a >> 65535 +} + +//go:noinline +func rsh_65535_uint16_ssa(a uint16) uint16 { + return 65535 >> a +} + +//go:noinline +func add_int16_Neg32768_ssa(a int16) int16 { + return a + -32768 +} + +//go:noinline +func add_Neg32768_int16_ssa(a int16) int16 { + return -32768 + a +} + +//go:noinline +func add_int16_Neg32767_ssa(a int16) int16 { + return a + -32767 +} + +//go:noinline +func add_Neg32767_int16_ssa(a int16) int16 { + return -32767 + a +} + +//go:noinline +func add_int16_Neg1_ssa(a int16) int16 { + return a + -1 +} + +//go:noinline +func add_Neg1_int16_ssa(a int16) int16 { + return -1 + a +} + +//go:noinline +func add_int16_0_ssa(a int16) int16 { + return a + 0 +} + +//go:noinline +func add_0_int16_ssa(a int16) int16 { + return 0 + a +} + +//go:noinline +func add_int16_1_ssa(a int16) int16 { + return a + 1 +} + +//go:noinline +func add_1_int16_ssa(a int16) int16 { + return 1 + a +} + +//go:noinline +func add_int16_32766_ssa(a int16) int16 { + return a + 32766 +} + +//go:noinline +func add_32766_int16_ssa(a int16) int16 { + return 32766 + a +} + +//go:noinline +func add_int16_32767_ssa(a int16) int16 { + return a + 32767 +} + +//go:noinline +func add_32767_int16_ssa(a int16) int16 { + return 32767 + a +} + +//go:noinline +func sub_int16_Neg32768_ssa(a int16) int16 { + return a - -32768 +} + +//go:noinline +func sub_Neg32768_int16_ssa(a int16) int16 { + return -32768 - a +} + +//go:noinline +func sub_int16_Neg32767_ssa(a int16) int16 { + return a - -32767 +} + +//go:noinline +func sub_Neg32767_int16_ssa(a int16) int16 { + return -32767 - a +} + +//go:noinline +func sub_int16_Neg1_ssa(a int16) int16 { + return a - -1 +} + +//go:noinline +func sub_Neg1_int16_ssa(a int16) int16 { + return -1 - a +} + +//go:noinline +func sub_int16_0_ssa(a int16) int16 { + return a - 0 +} + +//go:noinline +func sub_0_int16_ssa(a int16) int16 { + return 0 - a +} + +//go:noinline +func sub_int16_1_ssa(a int16) int16 { + return a - 1 +} + +//go:noinline +func sub_1_int16_ssa(a int16) int16 { + return 1 - a +} + +//go:noinline +func sub_int16_32766_ssa(a int16) int16 { + return a - 32766 +} + +//go:noinline +func sub_32766_int16_ssa(a int16) int16 { + return 32766 - a +} + +//go:noinline +func sub_int16_32767_ssa(a int16) int16 { + return a - 32767 +} + +//go:noinline +func sub_32767_int16_ssa(a int16) int16 { + return 32767 - a +} + +//go:noinline +func div_int16_Neg32768_ssa(a int16) int16 { + return a / -32768 +} + +//go:noinline +func div_Neg32768_int16_ssa(a int16) int16 { + return -32768 / a +} + +//go:noinline +func div_int16_Neg32767_ssa(a int16) int16 { + return a / -32767 +} + +//go:noinline +func div_Neg32767_int16_ssa(a int16) int16 { + return -32767 / a +} + +//go:noinline +func div_int16_Neg1_ssa(a int16) int16 { + return a / -1 +} + +//go:noinline +func div_Neg1_int16_ssa(a int16) int16 { + return -1 / a +} + +//go:noinline +func div_0_int16_ssa(a int16) int16 { + return 0 / a +} + +//go:noinline +func div_int16_1_ssa(a int16) int16 { + return a / 1 +} + +//go:noinline +func div_1_int16_ssa(a int16) int16 { + return 1 / a +} + +//go:noinline +func div_int16_32766_ssa(a int16) int16 { + return a / 32766 +} + +//go:noinline +func div_32766_int16_ssa(a int16) int16 { + return 32766 / a +} + +//go:noinline +func div_int16_32767_ssa(a int16) int16 { + return a / 32767 +} + +//go:noinline +func div_32767_int16_ssa(a int16) int16 { + return 32767 / a +} + +//go:noinline +func mul_int16_Neg32768_ssa(a int16) int16 { + return a * -32768 +} + +//go:noinline +func mul_Neg32768_int16_ssa(a int16) int16 { + return -32768 * a +} + +//go:noinline +func mul_int16_Neg32767_ssa(a int16) int16 { + return a * -32767 +} + +//go:noinline +func mul_Neg32767_int16_ssa(a int16) int16 { + return -32767 * a +} + +//go:noinline +func mul_int16_Neg1_ssa(a int16) int16 { + return a * -1 +} + +//go:noinline +func mul_Neg1_int16_ssa(a int16) int16 { + return -1 * a +} + +//go:noinline +func mul_int16_0_ssa(a int16) int16 { + return a * 0 +} + +//go:noinline +func mul_0_int16_ssa(a int16) int16 { + return 0 * a +} + +//go:noinline +func mul_int16_1_ssa(a int16) int16 { + return a * 1 +} + +//go:noinline +func mul_1_int16_ssa(a int16) int16 { + return 1 * a +} + +//go:noinline +func mul_int16_32766_ssa(a int16) int16 { + return a * 32766 +} + +//go:noinline +func mul_32766_int16_ssa(a int16) int16 { + return 32766 * a +} + +//go:noinline +func mul_int16_32767_ssa(a int16) int16 { + return a * 32767 +} + +//go:noinline +func mul_32767_int16_ssa(a int16) int16 { + return 32767 * a +} + +//go:noinline +func add_uint8_0_ssa(a uint8) uint8 { + return a + 0 +} + +//go:noinline +func add_0_uint8_ssa(a uint8) uint8 { + return 0 + a +} + +//go:noinline +func add_uint8_1_ssa(a uint8) uint8 { + return a + 1 +} + +//go:noinline +func add_1_uint8_ssa(a uint8) uint8 { + return 1 + a +} + +//go:noinline +func add_uint8_255_ssa(a uint8) uint8 { + return a + 255 +} + +//go:noinline +func add_255_uint8_ssa(a uint8) uint8 { + return 255 + a +} + +//go:noinline +func sub_uint8_0_ssa(a uint8) uint8 { + return a - 0 +} + +//go:noinline +func sub_0_uint8_ssa(a uint8) uint8 { + return 0 - a +} + +//go:noinline +func sub_uint8_1_ssa(a uint8) uint8 { + return a - 1 +} + +//go:noinline +func sub_1_uint8_ssa(a uint8) uint8 { + return 1 - a +} + +//go:noinline +func sub_uint8_255_ssa(a uint8) uint8 { + return a - 255 +} + +//go:noinline +func sub_255_uint8_ssa(a uint8) uint8 { + return 255 - a +} + +//go:noinline +func div_0_uint8_ssa(a uint8) uint8 { + return 0 / a +} + +//go:noinline +func div_uint8_1_ssa(a uint8) uint8 { + return a / 1 +} + +//go:noinline +func div_1_uint8_ssa(a uint8) uint8 { + return 1 / a +} + +//go:noinline +func div_uint8_255_ssa(a uint8) uint8 { + return a / 255 +} + +//go:noinline +func div_255_uint8_ssa(a uint8) uint8 { + return 255 / a +} + +//go:noinline +func mul_uint8_0_ssa(a uint8) uint8 { + return a * 0 +} + +//go:noinline +func mul_0_uint8_ssa(a uint8) uint8 { + return 0 * a +} + +//go:noinline +func mul_uint8_1_ssa(a uint8) uint8 { + return a * 1 +} + +//go:noinline +func mul_1_uint8_ssa(a uint8) uint8 { + return 1 * a +} + +//go:noinline +func mul_uint8_255_ssa(a uint8) uint8 { + return a * 255 +} + +//go:noinline +func mul_255_uint8_ssa(a uint8) uint8 { + return 255 * a +} + +//go:noinline +func lsh_uint8_0_ssa(a uint8) uint8 { + return a << 0 +} + +//go:noinline +func lsh_0_uint8_ssa(a uint8) uint8 { + return 0 << a +} + +//go:noinline +func lsh_uint8_1_ssa(a uint8) uint8 { + return a << 1 +} + +//go:noinline +func lsh_1_uint8_ssa(a uint8) uint8 { + return 1 << a +} + +//go:noinline +func lsh_uint8_255_ssa(a uint8) uint8 { + return a << 255 +} + +//go:noinline +func lsh_255_uint8_ssa(a uint8) uint8 { + return 255 << a +} + +//go:noinline +func rsh_uint8_0_ssa(a uint8) uint8 { + return a >> 0 +} + +//go:noinline +func rsh_0_uint8_ssa(a uint8) uint8 { + return 0 >> a +} + +//go:noinline +func rsh_uint8_1_ssa(a uint8) uint8 { + return a >> 1 +} + +//go:noinline +func rsh_1_uint8_ssa(a uint8) uint8 { + return 1 >> a +} + +//go:noinline +func rsh_uint8_255_ssa(a uint8) uint8 { + return a >> 255 +} + +//go:noinline +func rsh_255_uint8_ssa(a uint8) uint8 { + return 255 >> a +} + +//go:noinline +func add_int8_Neg128_ssa(a int8) int8 { + return a + -128 +} + +//go:noinline +func add_Neg128_int8_ssa(a int8) int8 { + return -128 + a +} + +//go:noinline +func add_int8_Neg127_ssa(a int8) int8 { + return a + -127 +} + +//go:noinline +func add_Neg127_int8_ssa(a int8) int8 { + return -127 + a +} + +//go:noinline +func add_int8_Neg1_ssa(a int8) int8 { + return a + -1 +} + +//go:noinline +func add_Neg1_int8_ssa(a int8) int8 { + return -1 + a +} + +//go:noinline +func add_int8_0_ssa(a int8) int8 { + return a + 0 +} + +//go:noinline +func add_0_int8_ssa(a int8) int8 { + return 0 + a +} + +//go:noinline +func add_int8_1_ssa(a int8) int8 { + return a + 1 +} + +//go:noinline +func add_1_int8_ssa(a int8) int8 { + return 1 + a +} + +//go:noinline +func add_int8_126_ssa(a int8) int8 { + return a + 126 +} + +//go:noinline +func add_126_int8_ssa(a int8) int8 { + return 126 + a +} + +//go:noinline +func add_int8_127_ssa(a int8) int8 { + return a + 127 +} + +//go:noinline +func add_127_int8_ssa(a int8) int8 { + return 127 + a +} + +//go:noinline +func sub_int8_Neg128_ssa(a int8) int8 { + return a - -128 +} + +//go:noinline +func sub_Neg128_int8_ssa(a int8) int8 { + return -128 - a +} + +//go:noinline +func sub_int8_Neg127_ssa(a int8) int8 { + return a - -127 +} + +//go:noinline +func sub_Neg127_int8_ssa(a int8) int8 { + return -127 - a +} + +//go:noinline +func sub_int8_Neg1_ssa(a int8) int8 { + return a - -1 +} + +//go:noinline +func sub_Neg1_int8_ssa(a int8) int8 { + return -1 - a +} + +//go:noinline +func sub_int8_0_ssa(a int8) int8 { + return a - 0 +} + +//go:noinline +func sub_0_int8_ssa(a int8) int8 { + return 0 - a +} + +//go:noinline +func sub_int8_1_ssa(a int8) int8 { + return a - 1 +} + +//go:noinline +func sub_1_int8_ssa(a int8) int8 { + return 1 - a +} + +//go:noinline +func sub_int8_126_ssa(a int8) int8 { + return a - 126 +} + +//go:noinline +func sub_126_int8_ssa(a int8) int8 { + return 126 - a +} + +//go:noinline +func sub_int8_127_ssa(a int8) int8 { + return a - 127 +} + +//go:noinline +func sub_127_int8_ssa(a int8) int8 { + return 127 - a +} + +//go:noinline +func div_int8_Neg128_ssa(a int8) int8 { + return a / -128 +} + +//go:noinline +func div_Neg128_int8_ssa(a int8) int8 { + return -128 / a +} + +//go:noinline +func div_int8_Neg127_ssa(a int8) int8 { + return a / -127 +} + +//go:noinline +func div_Neg127_int8_ssa(a int8) int8 { + return -127 / a +} + +//go:noinline +func div_int8_Neg1_ssa(a int8) int8 { + return a / -1 +} + +//go:noinline +func div_Neg1_int8_ssa(a int8) int8 { + return -1 / a +} + +//go:noinline +func div_0_int8_ssa(a int8) int8 { + return 0 / a +} + +//go:noinline +func div_int8_1_ssa(a int8) int8 { + return a / 1 +} + +//go:noinline +func div_1_int8_ssa(a int8) int8 { + return 1 / a +} + +//go:noinline +func div_int8_126_ssa(a int8) int8 { + return a / 126 +} + +//go:noinline +func div_126_int8_ssa(a int8) int8 { + return 126 / a +} + +//go:noinline +func div_int8_127_ssa(a int8) int8 { + return a / 127 +} + +//go:noinline +func div_127_int8_ssa(a int8) int8 { + return 127 / a +} + +//go:noinline +func mul_int8_Neg128_ssa(a int8) int8 { + return a * -128 +} + +//go:noinline +func mul_Neg128_int8_ssa(a int8) int8 { + return -128 * a +} + +//go:noinline +func mul_int8_Neg127_ssa(a int8) int8 { + return a * -127 +} + +//go:noinline +func mul_Neg127_int8_ssa(a int8) int8 { + return -127 * a +} + +//go:noinline +func mul_int8_Neg1_ssa(a int8) int8 { + return a * -1 +} + +//go:noinline +func mul_Neg1_int8_ssa(a int8) int8 { + return -1 * a +} + +//go:noinline +func mul_int8_0_ssa(a int8) int8 { + return a * 0 +} + +//go:noinline +func mul_0_int8_ssa(a int8) int8 { + return 0 * a +} + +//go:noinline +func mul_int8_1_ssa(a int8) int8 { + return a * 1 +} + +//go:noinline +func mul_1_int8_ssa(a int8) int8 { + return 1 * a +} + +//go:noinline +func mul_int8_126_ssa(a int8) int8 { + return a * 126 +} + +//go:noinline +func mul_126_int8_ssa(a int8) int8 { + return 126 * a +} + +//go:noinline +func mul_int8_127_ssa(a int8) int8 { + return a * 127 +} + +//go:noinline +func mul_127_int8_ssa(a int8) int8 { + return 127 * a +} + +var failed bool + +func main() { + + if got := add_0_uint64_ssa(0); got != 0 { + fmt.Printf("add_uint64 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint64_0_ssa(0); got != 0 { + fmt.Printf("add_uint64 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_uint64_ssa(1); got != 1 { + fmt.Printf("add_uint64 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint64_0_ssa(1); got != 1 { + fmt.Printf("add_uint64 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint64_ssa(4294967296); got != 4294967296 { + fmt.Printf("add_uint64 0+4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_uint64_0_ssa(4294967296); got != 4294967296 { + fmt.Printf("add_uint64 4294967296+0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_0_uint64_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("add_uint64 0+18446744073709551615 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := add_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("add_uint64 18446744073709551615+0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := add_1_uint64_ssa(0); got != 1 { + fmt.Printf("add_uint64 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint64_1_ssa(0); got != 1 { + fmt.Printf("add_uint64 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_uint64_ssa(1); got != 2 { + fmt.Printf("add_uint64 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_uint64_1_ssa(1); got != 2 { + fmt.Printf("add_uint64 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_uint64_ssa(4294967296); got != 4294967297 { + fmt.Printf("add_uint64 1+4294967296 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_uint64_1_ssa(4294967296); got != 4294967297 { + fmt.Printf("add_uint64 4294967296+1 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_1_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("add_uint64 1+18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint64_1_ssa(18446744073709551615); got != 0 { + fmt.Printf("add_uint64 18446744073709551615+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_4294967296_uint64_ssa(0); got != 4294967296 { + fmt.Printf("add_uint64 4294967296+0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_uint64_4294967296_ssa(0); got != 4294967296 { + fmt.Printf("add_uint64 0+4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_4294967296_uint64_ssa(1); got != 4294967297 { + fmt.Printf("add_uint64 4294967296+1 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_uint64_4294967296_ssa(1); got != 4294967297 { + fmt.Printf("add_uint64 1+4294967296 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_4294967296_uint64_ssa(4294967296); got != 8589934592 { + fmt.Printf("add_uint64 4294967296+4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := add_uint64_4294967296_ssa(4294967296); got != 8589934592 { + fmt.Printf("add_uint64 4294967296+4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := add_4294967296_uint64_ssa(18446744073709551615); got != 4294967295 { + fmt.Printf("add_uint64 4294967296+18446744073709551615 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_uint64_4294967296_ssa(18446744073709551615); got != 4294967295 { + fmt.Printf("add_uint64 18446744073709551615+4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { + fmt.Printf("add_uint64 18446744073709551615+0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := add_uint64_18446744073709551615_ssa(0); got != 18446744073709551615 { + fmt.Printf("add_uint64 0+18446744073709551615 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := add_18446744073709551615_uint64_ssa(1); got != 0 { + fmt.Printf("add_uint64 18446744073709551615+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint64_18446744073709551615_ssa(1); got != 0 { + fmt.Printf("add_uint64 1+18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := add_18446744073709551615_uint64_ssa(4294967296); got != 4294967295 { + fmt.Printf("add_uint64 18446744073709551615+4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_uint64_18446744073709551615_ssa(4294967296); got != 4294967295 { + fmt.Printf("add_uint64 4294967296+18446744073709551615 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_18446744073709551615_uint64_ssa(18446744073709551615); got != 18446744073709551614 { + fmt.Printf("add_uint64 18446744073709551615+18446744073709551615 = %d, wanted 18446744073709551614\n", got) + failed = true + } + + if got := add_uint64_18446744073709551615_ssa(18446744073709551615); got != 18446744073709551614 { + fmt.Printf("add_uint64 18446744073709551615+18446744073709551615 = %d, wanted 18446744073709551614\n", got) + failed = true + } + + if got := sub_0_uint64_ssa(0); got != 0 { + fmt.Printf("sub_uint64 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint64_0_ssa(0); got != 0 { + fmt.Printf("sub_uint64 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_uint64_ssa(1); got != 18446744073709551615 { + fmt.Printf("sub_uint64 0-1 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := sub_uint64_0_ssa(1); got != 1 { + fmt.Printf("sub_uint64 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_uint64_ssa(4294967296); got != 18446744069414584320 { + fmt.Printf("sub_uint64 0-4294967296 = %d, wanted 18446744069414584320\n", got) + failed = true + } + + if got := sub_uint64_0_ssa(4294967296); got != 4294967296 { + fmt.Printf("sub_uint64 4294967296-0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := sub_0_uint64_ssa(18446744073709551615); got != 1 { + fmt.Printf("sub_uint64 0-18446744073709551615 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("sub_uint64 18446744073709551615-0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := sub_1_uint64_ssa(0); got != 1 { + fmt.Printf("sub_uint64 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint64_1_ssa(0); got != 18446744073709551615 { + fmt.Printf("sub_uint64 0-1 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := sub_1_uint64_ssa(1); got != 0 { + fmt.Printf("sub_uint64 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint64_1_ssa(1); got != 0 { + fmt.Printf("sub_uint64 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_uint64_ssa(4294967296); got != 18446744069414584321 { + fmt.Printf("sub_uint64 1-4294967296 = %d, wanted 18446744069414584321\n", got) + failed = true + } + + if got := sub_uint64_1_ssa(4294967296); got != 4294967295 { + fmt.Printf("sub_uint64 4294967296-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_1_uint64_ssa(18446744073709551615); got != 2 { + fmt.Printf("sub_uint64 1-18446744073709551615 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_uint64_1_ssa(18446744073709551615); got != 18446744073709551614 { + fmt.Printf("sub_uint64 18446744073709551615-1 = %d, wanted 18446744073709551614\n", got) + failed = true + } + + if got := sub_4294967296_uint64_ssa(0); got != 4294967296 { + fmt.Printf("sub_uint64 4294967296-0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := sub_uint64_4294967296_ssa(0); got != 18446744069414584320 { + fmt.Printf("sub_uint64 0-4294967296 = %d, wanted 18446744069414584320\n", got) + failed = true + } + + if got := sub_4294967296_uint64_ssa(1); got != 4294967295 { + fmt.Printf("sub_uint64 4294967296-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_uint64_4294967296_ssa(1); got != 18446744069414584321 { + fmt.Printf("sub_uint64 1-4294967296 = %d, wanted 18446744069414584321\n", got) + failed = true + } + + if got := sub_4294967296_uint64_ssa(4294967296); got != 0 { + fmt.Printf("sub_uint64 4294967296-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint64_4294967296_ssa(4294967296); got != 0 { + fmt.Printf("sub_uint64 4294967296-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_4294967296_uint64_ssa(18446744073709551615); got != 4294967297 { + fmt.Printf("sub_uint64 4294967296-18446744073709551615 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := sub_uint64_4294967296_ssa(18446744073709551615); got != 18446744069414584319 { + fmt.Printf("sub_uint64 18446744073709551615-4294967296 = %d, wanted 18446744069414584319\n", got) + failed = true + } + + if got := sub_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { + fmt.Printf("sub_uint64 18446744073709551615-0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := sub_uint64_18446744073709551615_ssa(0); got != 1 { + fmt.Printf("sub_uint64 0-18446744073709551615 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_18446744073709551615_uint64_ssa(1); got != 18446744073709551614 { + fmt.Printf("sub_uint64 18446744073709551615-1 = %d, wanted 18446744073709551614\n", got) + failed = true + } + + if got := sub_uint64_18446744073709551615_ssa(1); got != 2 { + fmt.Printf("sub_uint64 1-18446744073709551615 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_18446744073709551615_uint64_ssa(4294967296); got != 18446744069414584319 { + fmt.Printf("sub_uint64 18446744073709551615-4294967296 = %d, wanted 18446744069414584319\n", got) + failed = true + } + + if got := sub_uint64_18446744073709551615_ssa(4294967296); got != 4294967297 { + fmt.Printf("sub_uint64 4294967296-18446744073709551615 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := sub_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("sub_uint64 18446744073709551615-18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { + fmt.Printf("sub_uint64 18446744073709551615-18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + 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 := mul_0_uint64_ssa(0); got != 0 { + fmt.Printf("mul_uint64 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_0_ssa(0); got != 0 { + fmt.Printf("mul_uint64 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint64_ssa(1); got != 0 { + fmt.Printf("mul_uint64 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_0_ssa(1); got != 0 { + fmt.Printf("mul_uint64 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint64_ssa(4294967296); got != 0 { + fmt.Printf("mul_uint64 0*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_0_ssa(4294967296); got != 0 { + fmt.Printf("mul_uint64 4294967296*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("mul_uint64 0*18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_0_ssa(18446744073709551615); got != 0 { + fmt.Printf("mul_uint64 18446744073709551615*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint64_ssa(0); got != 0 { + fmt.Printf("mul_uint64 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_1_ssa(0); got != 0 { + fmt.Printf("mul_uint64 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint64_ssa(1); got != 1 { + fmt.Printf("mul_uint64 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint64_1_ssa(1); got != 1 { + fmt.Printf("mul_uint64 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_uint64_ssa(4294967296); got != 4294967296 { + fmt.Printf("mul_uint64 1*4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_uint64_1_ssa(4294967296); got != 4294967296 { + fmt.Printf("mul_uint64 4294967296*1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_1_uint64_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("mul_uint64 1*18446744073709551615 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := mul_uint64_1_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("mul_uint64 18446744073709551615*1 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := mul_4294967296_uint64_ssa(0); got != 0 { + fmt.Printf("mul_uint64 4294967296*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_4294967296_ssa(0); got != 0 { + fmt.Printf("mul_uint64 0*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967296_uint64_ssa(1); got != 4294967296 { + fmt.Printf("mul_uint64 4294967296*1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_uint64_4294967296_ssa(1); got != 4294967296 { + fmt.Printf("mul_uint64 1*4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_4294967296_uint64_ssa(4294967296); got != 0 { + fmt.Printf("mul_uint64 4294967296*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_4294967296_ssa(4294967296); got != 0 { + fmt.Printf("mul_uint64 4294967296*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967296_uint64_ssa(18446744073709551615); got != 18446744069414584320 { + fmt.Printf("mul_uint64 4294967296*18446744073709551615 = %d, wanted 18446744069414584320\n", got) + failed = true + } + + if got := mul_uint64_4294967296_ssa(18446744073709551615); got != 18446744069414584320 { + fmt.Printf("mul_uint64 18446744073709551615*4294967296 = %d, wanted 18446744069414584320\n", got) + failed = true + } + + if got := mul_18446744073709551615_uint64_ssa(0); got != 0 { + fmt.Printf("mul_uint64 18446744073709551615*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint64_18446744073709551615_ssa(0); got != 0 { + fmt.Printf("mul_uint64 0*18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_18446744073709551615_uint64_ssa(1); got != 18446744073709551615 { + fmt.Printf("mul_uint64 18446744073709551615*1 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := mul_uint64_18446744073709551615_ssa(1); got != 18446744073709551615 { + fmt.Printf("mul_uint64 1*18446744073709551615 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := mul_18446744073709551615_uint64_ssa(4294967296); got != 18446744069414584320 { + fmt.Printf("mul_uint64 18446744073709551615*4294967296 = %d, wanted 18446744069414584320\n", got) + failed = true + } + + if got := mul_uint64_18446744073709551615_ssa(4294967296); got != 18446744069414584320 { + fmt.Printf("mul_uint64 4294967296*18446744073709551615 = %d, wanted 18446744069414584320\n", got) + failed = true + } + + if got := mul_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 { + fmt.Printf("mul_uint64 18446744073709551615*18446744073709551615 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint64_18446744073709551615_ssa(18446744073709551615); got != 1 { + fmt.Printf("mul_uint64 18446744073709551615*18446744073709551615 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint64_ssa(0); got != 0 { + fmt.Printf("lsh_uint64 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_0_ssa(0); got != 0 { + fmt.Printf("lsh_uint64 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_0_uint64_ssa(1); got != 0 { + fmt.Printf("lsh_uint64 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_0_ssa(1); got != 1 { + fmt.Printf("lsh_uint64 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint64_ssa(4294967296); got != 0 { + fmt.Printf("lsh_uint64 0<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_0_ssa(4294967296); got != 4294967296 { + fmt.Printf("lsh_uint64 4294967296<<0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := lsh_0_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("lsh_uint64 0<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("lsh_uint64 18446744073709551615<<0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := lsh_1_uint64_ssa(0); got != 1 { + fmt.Printf("lsh_uint64 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_uint64_1_ssa(0); got != 0 { + fmt.Printf("lsh_uint64 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_1_uint64_ssa(1); got != 2 { + fmt.Printf("lsh_uint64 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_uint64_1_ssa(1); got != 2 { + fmt.Printf("lsh_uint64 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_1_uint64_ssa(4294967296); got != 0 { + fmt.Printf("lsh_uint64 1<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_1_ssa(4294967296); got != 8589934592 { + fmt.Printf("lsh_uint64 4294967296<<1 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := lsh_1_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("lsh_uint64 1<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_1_ssa(18446744073709551615); got != 18446744073709551614 { + fmt.Printf("lsh_uint64 18446744073709551615<<1 = %d, wanted 18446744073709551614\n", got) + failed = true + } + + if got := lsh_4294967296_uint64_ssa(0); got != 4294967296 { + fmt.Printf("lsh_uint64 4294967296<<0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := lsh_uint64_4294967296_ssa(0); got != 0 { + fmt.Printf("lsh_uint64 0<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_4294967296_uint64_ssa(1); got != 8589934592 { + fmt.Printf("lsh_uint64 4294967296<<1 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := lsh_uint64_4294967296_ssa(1); got != 0 { + fmt.Printf("lsh_uint64 1<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_4294967296_uint64_ssa(4294967296); got != 0 { + fmt.Printf("lsh_uint64 4294967296<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_4294967296_ssa(4294967296); got != 0 { + fmt.Printf("lsh_uint64 4294967296<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_4294967296_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("lsh_uint64 4294967296<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_4294967296_ssa(18446744073709551615); got != 0 { + fmt.Printf("lsh_uint64 18446744073709551615<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { + fmt.Printf("lsh_uint64 18446744073709551615<<0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := lsh_uint64_18446744073709551615_ssa(0); got != 0 { + fmt.Printf("lsh_uint64 0<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_18446744073709551615_uint64_ssa(1); got != 18446744073709551614 { + fmt.Printf("lsh_uint64 18446744073709551615<<1 = %d, wanted 18446744073709551614\n", got) + failed = true + } + + if got := lsh_uint64_18446744073709551615_ssa(1); got != 0 { + fmt.Printf("lsh_uint64 1<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_18446744073709551615_uint64_ssa(4294967296); got != 0 { + fmt.Printf("lsh_uint64 18446744073709551615<<4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_18446744073709551615_ssa(4294967296); got != 0 { + fmt.Printf("lsh_uint64 4294967296<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("lsh_uint64 18446744073709551615<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { + fmt.Printf("lsh_uint64 18446744073709551615<<18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint64_ssa(0); got != 0 { + fmt.Printf("rsh_uint64 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_0_ssa(0); got != 0 { + fmt.Printf("rsh_uint64 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint64_ssa(1); got != 0 { + fmt.Printf("rsh_uint64 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_0_ssa(1); got != 1 { + fmt.Printf("rsh_uint64 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_0_uint64_ssa(4294967296); got != 0 { + fmt.Printf("rsh_uint64 0>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_0_ssa(4294967296); got != 4294967296 { + fmt.Printf("rsh_uint64 4294967296>>0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := rsh_0_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("rsh_uint64 0>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { + fmt.Printf("rsh_uint64 18446744073709551615>>0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := rsh_1_uint64_ssa(0); got != 1 { + fmt.Printf("rsh_uint64 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_uint64_1_ssa(0); got != 0 { + fmt.Printf("rsh_uint64 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint64_ssa(1); got != 0 { + fmt.Printf("rsh_uint64 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_1_ssa(1); got != 0 { + fmt.Printf("rsh_uint64 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint64_ssa(4294967296); got != 0 { + fmt.Printf("rsh_uint64 1>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_1_ssa(4294967296); got != 2147483648 { + fmt.Printf("rsh_uint64 4294967296>>1 = %d, wanted 2147483648\n", got) + failed = true + } + + if got := rsh_1_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("rsh_uint64 1>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_1_ssa(18446744073709551615); got != 9223372036854775807 { + fmt.Printf("rsh_uint64 18446744073709551615>>1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := rsh_4294967296_uint64_ssa(0); got != 4294967296 { + fmt.Printf("rsh_uint64 4294967296>>0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := rsh_uint64_4294967296_ssa(0); got != 0 { + fmt.Printf("rsh_uint64 0>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_4294967296_uint64_ssa(1); got != 2147483648 { + fmt.Printf("rsh_uint64 4294967296>>1 = %d, wanted 2147483648\n", got) + failed = true + } + + if got := rsh_uint64_4294967296_ssa(1); got != 0 { + fmt.Printf("rsh_uint64 1>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_4294967296_uint64_ssa(4294967296); got != 0 { + fmt.Printf("rsh_uint64 4294967296>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_4294967296_ssa(4294967296); got != 0 { + fmt.Printf("rsh_uint64 4294967296>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_4294967296_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("rsh_uint64 4294967296>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_4294967296_ssa(18446744073709551615); got != 0 { + fmt.Printf("rsh_uint64 18446744073709551615>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { + fmt.Printf("rsh_uint64 18446744073709551615>>0 = %d, wanted 18446744073709551615\n", got) + failed = true + } + + if got := rsh_uint64_18446744073709551615_ssa(0); got != 0 { + fmt.Printf("rsh_uint64 0>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_18446744073709551615_uint64_ssa(1); got != 9223372036854775807 { + fmt.Printf("rsh_uint64 18446744073709551615>>1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := rsh_uint64_18446744073709551615_ssa(1); got != 0 { + fmt.Printf("rsh_uint64 1>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_18446744073709551615_uint64_ssa(4294967296); got != 0 { + fmt.Printf("rsh_uint64 18446744073709551615>>4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_18446744073709551615_ssa(4294967296); got != 0 { + fmt.Printf("rsh_uint64 4294967296>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { + fmt.Printf("rsh_uint64 18446744073709551615>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { + fmt.Printf("rsh_uint64 18446744073709551615>>18446744073709551615 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("add_int64 -9223372036854775808+-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { + fmt.Printf("add_int64 -9223372036854775808+-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != 1 { + fmt.Printf("add_int64 -9223372036854775808+-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != 1 { + fmt.Printf("add_int64 -9223372036854775807+-9223372036854775808 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(-4294967296); got != 9223372032559808512 { + fmt.Printf("add_int64 -9223372036854775808+-4294967296 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(-4294967296); got != 9223372032559808512 { + fmt.Printf("add_int64 -4294967296+-9223372036854775808 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(-1); got != 9223372036854775807 { + fmt.Printf("add_int64 -9223372036854775808+-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(-1); got != 9223372036854775807 { + fmt.Printf("add_int64 -1+-9223372036854775808 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(0); got != -9223372036854775808 { + fmt.Printf("add_int64 -9223372036854775808+0 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(0); got != -9223372036854775808 { + fmt.Printf("add_int64 0+-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(1); got != -9223372036854775807 { + fmt.Printf("add_int64 -9223372036854775808+1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(1); got != -9223372036854775807 { + fmt.Printf("add_int64 1+-9223372036854775808 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(4294967296); got != -9223372032559808512 { + fmt.Printf("add_int64 -9223372036854775808+4294967296 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(4294967296); got != -9223372032559808512 { + fmt.Printf("add_int64 4294967296+-9223372036854775808 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(9223372036854775806); got != -2 { + fmt.Printf("add_int64 -9223372036854775808+9223372036854775806 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(9223372036854775806); got != -2 { + fmt.Printf("add_int64 9223372036854775806+-9223372036854775808 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -1 { + fmt.Printf("add_int64 -9223372036854775808+9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775808_ssa(9223372036854775807); got != -1 { + fmt.Printf("add_int64 9223372036854775807+-9223372036854775808 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != 1 { + fmt.Printf("add_int64 -9223372036854775807+-9223372036854775808 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != 1 { + fmt.Printf("add_int64 -9223372036854775808+-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 2 { + fmt.Printf("add_int64 -9223372036854775807+-9223372036854775807 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 2 { + fmt.Printf("add_int64 -9223372036854775807+-9223372036854775807 = %d, wanted 2\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(-4294967296); got != 9223372032559808513 { + fmt.Printf("add_int64 -9223372036854775807+-4294967296 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(-4294967296); got != 9223372032559808513 { + fmt.Printf("add_int64 -4294967296+-9223372036854775807 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(-1); got != -9223372036854775808 { + fmt.Printf("add_int64 -9223372036854775807+-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(-1); got != -9223372036854775808 { + fmt.Printf("add_int64 -1+-9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(0); got != -9223372036854775807 { + fmt.Printf("add_int64 -9223372036854775807+0 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(0); got != -9223372036854775807 { + fmt.Printf("add_int64 0+-9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775806 { + fmt.Printf("add_int64 -9223372036854775807+1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(1); got != -9223372036854775806 { + fmt.Printf("add_int64 1+-9223372036854775807 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(4294967296); got != -9223372032559808511 { + fmt.Printf("add_int64 -9223372036854775807+4294967296 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(4294967296); got != -9223372032559808511 { + fmt.Printf("add_int64 4294967296+-9223372036854775807 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(9223372036854775806); got != -1 { + fmt.Printf("add_int64 -9223372036854775807+9223372036854775806 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(9223372036854775806); got != -1 { + fmt.Printf("add_int64 9223372036854775806+-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg9223372036854775807_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("add_int64 -9223372036854775807+9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_Neg9223372036854775807_ssa(9223372036854775807); got != 0 { + fmt.Printf("add_int64 9223372036854775807+-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(-9223372036854775808); got != 9223372032559808512 { + fmt.Printf("add_int64 -4294967296+-9223372036854775808 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(-9223372036854775808); got != 9223372032559808512 { + fmt.Printf("add_int64 -9223372036854775808+-4294967296 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(-9223372036854775807); got != 9223372032559808513 { + fmt.Printf("add_int64 -4294967296+-9223372036854775807 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(-9223372036854775807); got != 9223372032559808513 { + fmt.Printf("add_int64 -9223372036854775807+-4294967296 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(-4294967296); got != -8589934592 { + fmt.Printf("add_int64 -4294967296+-4294967296 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(-4294967296); got != -8589934592 { + fmt.Printf("add_int64 -4294967296+-4294967296 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(-1); got != -4294967297 { + fmt.Printf("add_int64 -4294967296+-1 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(-1); got != -4294967297 { + fmt.Printf("add_int64 -1+-4294967296 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(0); got != -4294967296 { + fmt.Printf("add_int64 -4294967296+0 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(0); got != -4294967296 { + fmt.Printf("add_int64 0+-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(1); got != -4294967295 { + fmt.Printf("add_int64 -4294967296+1 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(1); got != -4294967295 { + fmt.Printf("add_int64 1+-4294967296 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(4294967296); got != 0 { + fmt.Printf("add_int64 -4294967296+4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(4294967296); got != 0 { + fmt.Printf("add_int64 4294967296+-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(9223372036854775806); got != 9223372032559808510 { + fmt.Printf("add_int64 -4294967296+9223372036854775806 = %d, wanted 9223372032559808510\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(9223372036854775806); got != 9223372032559808510 { + fmt.Printf("add_int64 9223372036854775806+-4294967296 = %d, wanted 9223372032559808510\n", got) + failed = true + } + + if got := add_Neg4294967296_int64_ssa(9223372036854775807); got != 9223372032559808511 { + fmt.Printf("add_int64 -4294967296+9223372036854775807 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := add_int64_Neg4294967296_ssa(9223372036854775807); got != 9223372032559808511 { + fmt.Printf("add_int64 9223372036854775807+-4294967296 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(-9223372036854775808); got != 9223372036854775807 { + fmt.Printf("add_int64 -1+-9223372036854775808 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(-9223372036854775808); got != 9223372036854775807 { + fmt.Printf("add_int64 -9223372036854775808+-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(-9223372036854775807); got != -9223372036854775808 { + fmt.Printf("add_int64 -1+-9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(-9223372036854775807); got != -9223372036854775808 { + fmt.Printf("add_int64 -9223372036854775807+-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(-4294967296); got != -4294967297 { + fmt.Printf("add_int64 -1+-4294967296 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(-4294967296); got != -4294967297 { + fmt.Printf("add_int64 -4294967296+-1 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(-1); got != -2 { + fmt.Printf("add_int64 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(-1); got != -2 { + fmt.Printf("add_int64 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(0); got != -1 { + fmt.Printf("add_int64 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(0); got != -1 { + fmt.Printf("add_int64 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(1); got != 0 { + fmt.Printf("add_int64 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(1); got != 0 { + fmt.Printf("add_int64 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(4294967296); got != 4294967295 { + fmt.Printf("add_int64 -1+4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(4294967296); got != 4294967295 { + fmt.Printf("add_int64 4294967296+-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(9223372036854775806); got != 9223372036854775805 { + fmt.Printf("add_int64 -1+9223372036854775806 = %d, wanted 9223372036854775805\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(9223372036854775806); got != 9223372036854775805 { + fmt.Printf("add_int64 9223372036854775806+-1 = %d, wanted 9223372036854775805\n", got) + failed = true + } + + if got := add_Neg1_int64_ssa(9223372036854775807); got != 9223372036854775806 { + fmt.Printf("add_int64 -1+9223372036854775807 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_int64_Neg1_ssa(9223372036854775807); got != 9223372036854775806 { + fmt.Printf("add_int64 9223372036854775807+-1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_0_int64_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("add_int64 0+-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_int64_0_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("add_int64 -9223372036854775808+0 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_0_int64_ssa(-9223372036854775807); got != -9223372036854775807 { + fmt.Printf("add_int64 0+-9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_int64_0_ssa(-9223372036854775807); got != -9223372036854775807 { + fmt.Printf("add_int64 -9223372036854775807+0 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_0_int64_ssa(-4294967296); got != -4294967296 { + fmt.Printf("add_int64 0+-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := add_int64_0_ssa(-4294967296); got != -4294967296 { + fmt.Printf("add_int64 -4294967296+0 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := add_0_int64_ssa(-1); got != -1 { + fmt.Printf("add_int64 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int64_0_ssa(-1); got != -1 { + fmt.Printf("add_int64 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_0_int64_ssa(0); got != 0 { + fmt.Printf("add_int64 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_0_ssa(0); got != 0 { + fmt.Printf("add_int64 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_int64_ssa(1); got != 1 { + fmt.Printf("add_int64 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int64_0_ssa(1); got != 1 { + fmt.Printf("add_int64 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_int64_ssa(4294967296); got != 4294967296 { + fmt.Printf("add_int64 0+4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_int64_0_ssa(4294967296); got != 4294967296 { + fmt.Printf("add_int64 4294967296+0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_0_int64_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("add_int64 0+9223372036854775806 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_int64_0_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("add_int64 9223372036854775806+0 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_0_int64_ssa(9223372036854775807); got != 9223372036854775807 { + fmt.Printf("add_int64 0+9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_int64_0_ssa(9223372036854775807); got != 9223372036854775807 { + fmt.Printf("add_int64 9223372036854775807+0 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_1_int64_ssa(-9223372036854775808); got != -9223372036854775807 { + fmt.Printf("add_int64 1+-9223372036854775808 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_int64_1_ssa(-9223372036854775808); got != -9223372036854775807 { + fmt.Printf("add_int64 -9223372036854775808+1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := add_1_int64_ssa(-9223372036854775807); got != -9223372036854775806 { + fmt.Printf("add_int64 1+-9223372036854775807 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := add_int64_1_ssa(-9223372036854775807); got != -9223372036854775806 { + fmt.Printf("add_int64 -9223372036854775807+1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := add_1_int64_ssa(-4294967296); got != -4294967295 { + fmt.Printf("add_int64 1+-4294967296 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := add_int64_1_ssa(-4294967296); got != -4294967295 { + fmt.Printf("add_int64 -4294967296+1 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := add_1_int64_ssa(-1); got != 0 { + fmt.Printf("add_int64 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_1_ssa(-1); got != 0 { + fmt.Printf("add_int64 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_1_int64_ssa(0); got != 1 { + fmt.Printf("add_int64 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int64_1_ssa(0); got != 1 { + fmt.Printf("add_int64 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_int64_ssa(1); got != 2 { + fmt.Printf("add_int64 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int64_1_ssa(1); got != 2 { + fmt.Printf("add_int64 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_int64_ssa(4294967296); got != 4294967297 { + fmt.Printf("add_int64 1+4294967296 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_int64_1_ssa(4294967296); got != 4294967297 { + fmt.Printf("add_int64 4294967296+1 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_1_int64_ssa(9223372036854775806); got != 9223372036854775807 { + fmt.Printf("add_int64 1+9223372036854775806 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_int64_1_ssa(9223372036854775806); got != 9223372036854775807 { + fmt.Printf("add_int64 9223372036854775806+1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_1_int64_ssa(9223372036854775807); got != -9223372036854775808 { + fmt.Printf("add_int64 1+9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_int64_1_ssa(9223372036854775807); got != -9223372036854775808 { + fmt.Printf("add_int64 9223372036854775807+1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(-9223372036854775808); got != -9223372032559808512 { + fmt.Printf("add_int64 4294967296+-9223372036854775808 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(-9223372036854775808); got != -9223372032559808512 { + fmt.Printf("add_int64 -9223372036854775808+4294967296 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(-9223372036854775807); got != -9223372032559808511 { + fmt.Printf("add_int64 4294967296+-9223372036854775807 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(-9223372036854775807); got != -9223372032559808511 { + fmt.Printf("add_int64 -9223372036854775807+4294967296 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(-4294967296); got != 0 { + fmt.Printf("add_int64 4294967296+-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(-4294967296); got != 0 { + fmt.Printf("add_int64 -4294967296+4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(-1); got != 4294967295 { + fmt.Printf("add_int64 4294967296+-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(-1); got != 4294967295 { + fmt.Printf("add_int64 -1+4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(0); got != 4294967296 { + fmt.Printf("add_int64 4294967296+0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(0); got != 4294967296 { + fmt.Printf("add_int64 0+4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(1); got != 4294967297 { + fmt.Printf("add_int64 4294967296+1 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(1); got != 4294967297 { + fmt.Printf("add_int64 1+4294967296 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(4294967296); got != 8589934592 { + fmt.Printf("add_int64 4294967296+4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(4294967296); got != 8589934592 { + fmt.Printf("add_int64 4294967296+4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(9223372036854775806); got != -9223372032559808514 { + fmt.Printf("add_int64 4294967296+9223372036854775806 = %d, wanted -9223372032559808514\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(9223372036854775806); got != -9223372032559808514 { + fmt.Printf("add_int64 9223372036854775806+4294967296 = %d, wanted -9223372032559808514\n", got) + failed = true + } + + if got := add_4294967296_int64_ssa(9223372036854775807); got != -9223372032559808513 { + fmt.Printf("add_int64 4294967296+9223372036854775807 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := add_int64_4294967296_ssa(9223372036854775807); got != -9223372032559808513 { + fmt.Printf("add_int64 9223372036854775807+4294967296 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(-9223372036854775808); got != -2 { + fmt.Printf("add_int64 9223372036854775806+-9223372036854775808 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(-9223372036854775808); got != -2 { + fmt.Printf("add_int64 -9223372036854775808+9223372036854775806 = %d, wanted -2\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(-9223372036854775807); got != -1 { + fmt.Printf("add_int64 9223372036854775806+-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(-9223372036854775807); got != -1 { + fmt.Printf("add_int64 -9223372036854775807+9223372036854775806 = %d, wanted -1\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(-4294967296); got != 9223372032559808510 { + fmt.Printf("add_int64 9223372036854775806+-4294967296 = %d, wanted 9223372032559808510\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(-4294967296); got != 9223372032559808510 { + fmt.Printf("add_int64 -4294967296+9223372036854775806 = %d, wanted 9223372032559808510\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(-1); got != 9223372036854775805 { + fmt.Printf("add_int64 9223372036854775806+-1 = %d, wanted 9223372036854775805\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(-1); got != 9223372036854775805 { + fmt.Printf("add_int64 -1+9223372036854775806 = %d, wanted 9223372036854775805\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(0); got != 9223372036854775806 { + fmt.Printf("add_int64 9223372036854775806+0 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(0); got != 9223372036854775806 { + fmt.Printf("add_int64 0+9223372036854775806 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(1); got != 9223372036854775807 { + fmt.Printf("add_int64 9223372036854775806+1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(1); got != 9223372036854775807 { + fmt.Printf("add_int64 1+9223372036854775806 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(4294967296); got != -9223372032559808514 { + fmt.Printf("add_int64 9223372036854775806+4294967296 = %d, wanted -9223372032559808514\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(4294967296); got != -9223372032559808514 { + fmt.Printf("add_int64 4294967296+9223372036854775806 = %d, wanted -9223372032559808514\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(9223372036854775806); got != -4 { + fmt.Printf("add_int64 9223372036854775806+9223372036854775806 = %d, wanted -4\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(9223372036854775806); got != -4 { + fmt.Printf("add_int64 9223372036854775806+9223372036854775806 = %d, wanted -4\n", got) + failed = true + } + + if got := add_9223372036854775806_int64_ssa(9223372036854775807); got != -3 { + fmt.Printf("add_int64 9223372036854775806+9223372036854775807 = %d, wanted -3\n", got) + failed = true + } + + if got := add_int64_9223372036854775806_ssa(9223372036854775807); got != -3 { + fmt.Printf("add_int64 9223372036854775807+9223372036854775806 = %d, wanted -3\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(-9223372036854775808); got != -1 { + fmt.Printf("add_int64 9223372036854775807+-9223372036854775808 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(-9223372036854775808); got != -1 { + fmt.Printf("add_int64 -9223372036854775808+9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("add_int64 9223372036854775807+-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(-9223372036854775807); got != 0 { + fmt.Printf("add_int64 -9223372036854775807+9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(-4294967296); got != 9223372032559808511 { + fmt.Printf("add_int64 9223372036854775807+-4294967296 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(-4294967296); got != 9223372032559808511 { + fmt.Printf("add_int64 -4294967296+9223372036854775807 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(-1); got != 9223372036854775806 { + fmt.Printf("add_int64 9223372036854775807+-1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(-1); got != 9223372036854775806 { + fmt.Printf("add_int64 -1+9223372036854775807 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(0); got != 9223372036854775807 { + fmt.Printf("add_int64 9223372036854775807+0 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(0); got != 9223372036854775807 { + fmt.Printf("add_int64 0+9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(1); got != -9223372036854775808 { + fmt.Printf("add_int64 9223372036854775807+1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(1); got != -9223372036854775808 { + fmt.Printf("add_int64 1+9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(4294967296); got != -9223372032559808513 { + fmt.Printf("add_int64 9223372036854775807+4294967296 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(4294967296); got != -9223372032559808513 { + fmt.Printf("add_int64 4294967296+9223372036854775807 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(9223372036854775806); got != -3 { + fmt.Printf("add_int64 9223372036854775807+9223372036854775806 = %d, wanted -3\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(9223372036854775806); got != -3 { + fmt.Printf("add_int64 9223372036854775806+9223372036854775807 = %d, wanted -3\n", got) + failed = true + } + + if got := add_9223372036854775807_int64_ssa(9223372036854775807); got != -2 { + fmt.Printf("add_int64 9223372036854775807+9223372036854775807 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int64_9223372036854775807_ssa(9223372036854775807); got != -2 { + fmt.Printf("add_int64 9223372036854775807+9223372036854775807 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("sub_int64 -9223372036854775808--9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { + fmt.Printf("sub_int64 -9223372036854775808--9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != -1 { + fmt.Printf("sub_int64 -9223372036854775808--9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != 1 { + fmt.Printf("sub_int64 -9223372036854775807--9223372036854775808 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(-4294967296); got != -9223372032559808512 { + fmt.Printf("sub_int64 -9223372036854775808--4294967296 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(-4294967296); got != 9223372032559808512 { + fmt.Printf("sub_int64 -4294967296--9223372036854775808 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(-1); got != -9223372036854775807 { + fmt.Printf("sub_int64 -9223372036854775808--1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(-1); got != 9223372036854775807 { + fmt.Printf("sub_int64 -1--9223372036854775808 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(0); got != -9223372036854775808 { + fmt.Printf("sub_int64 -9223372036854775808-0 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(0); got != -9223372036854775808 { + fmt.Printf("sub_int64 0--9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(1); got != 9223372036854775807 { + fmt.Printf("sub_int64 -9223372036854775808-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(1); got != -9223372036854775807 { + fmt.Printf("sub_int64 1--9223372036854775808 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(4294967296); got != 9223372032559808512 { + fmt.Printf("sub_int64 -9223372036854775808-4294967296 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(4294967296); got != -9223372032559808512 { + fmt.Printf("sub_int64 4294967296--9223372036854775808 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(9223372036854775806); got != 2 { + fmt.Printf("sub_int64 -9223372036854775808-9223372036854775806 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(9223372036854775806); got != -2 { + fmt.Printf("sub_int64 9223372036854775806--9223372036854775808 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg9223372036854775808_int64_ssa(9223372036854775807); got != 1 { + fmt.Printf("sub_int64 -9223372036854775808-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775808_ssa(9223372036854775807); got != -1 { + fmt.Printf("sub_int64 9223372036854775807--9223372036854775808 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != 1 { + fmt.Printf("sub_int64 -9223372036854775807--9223372036854775808 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != -1 { + fmt.Printf("sub_int64 -9223372036854775808--9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("sub_int64 -9223372036854775807--9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 0 { + fmt.Printf("sub_int64 -9223372036854775807--9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(-4294967296); got != -9223372032559808511 { + fmt.Printf("sub_int64 -9223372036854775807--4294967296 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(-4294967296); got != 9223372032559808511 { + fmt.Printf("sub_int64 -4294967296--9223372036854775807 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(-1); got != -9223372036854775806 { + fmt.Printf("sub_int64 -9223372036854775807--1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(-1); got != 9223372036854775806 { + fmt.Printf("sub_int64 -1--9223372036854775807 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(0); got != -9223372036854775807 { + fmt.Printf("sub_int64 -9223372036854775807-0 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(0); got != 9223372036854775807 { + fmt.Printf("sub_int64 0--9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775808 { + fmt.Printf("sub_int64 -9223372036854775807-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(1); got != -9223372036854775808 { + fmt.Printf("sub_int64 1--9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(4294967296); got != 9223372032559808513 { + fmt.Printf("sub_int64 -9223372036854775807-4294967296 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(4294967296); got != -9223372032559808513 { + fmt.Printf("sub_int64 4294967296--9223372036854775807 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(9223372036854775806); got != 3 { + fmt.Printf("sub_int64 -9223372036854775807-9223372036854775806 = %d, wanted 3\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(9223372036854775806); got != -3 { + fmt.Printf("sub_int64 9223372036854775806--9223372036854775807 = %d, wanted -3\n", got) + failed = true + } + + if got := sub_Neg9223372036854775807_int64_ssa(9223372036854775807); got != 2 { + fmt.Printf("sub_int64 -9223372036854775807-9223372036854775807 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int64_Neg9223372036854775807_ssa(9223372036854775807); got != -2 { + fmt.Printf("sub_int64 9223372036854775807--9223372036854775807 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(-9223372036854775808); got != 9223372032559808512 { + fmt.Printf("sub_int64 -4294967296--9223372036854775808 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(-9223372036854775808); got != -9223372032559808512 { + fmt.Printf("sub_int64 -9223372036854775808--4294967296 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(-9223372036854775807); got != 9223372032559808511 { + fmt.Printf("sub_int64 -4294967296--9223372036854775807 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(-9223372036854775807); got != -9223372032559808511 { + fmt.Printf("sub_int64 -9223372036854775807--4294967296 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(-4294967296); got != 0 { + fmt.Printf("sub_int64 -4294967296--4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(-4294967296); got != 0 { + fmt.Printf("sub_int64 -4294967296--4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(-1); got != -4294967295 { + fmt.Printf("sub_int64 -4294967296--1 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(-1); got != 4294967295 { + fmt.Printf("sub_int64 -1--4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(0); got != -4294967296 { + fmt.Printf("sub_int64 -4294967296-0 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(0); got != 4294967296 { + fmt.Printf("sub_int64 0--4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(1); got != -4294967297 { + fmt.Printf("sub_int64 -4294967296-1 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(1); got != 4294967297 { + fmt.Printf("sub_int64 1--4294967296 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(4294967296); got != -8589934592 { + fmt.Printf("sub_int64 -4294967296-4294967296 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(4294967296); got != 8589934592 { + fmt.Printf("sub_int64 4294967296--4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(9223372036854775806); got != 9223372032559808514 { + fmt.Printf("sub_int64 -4294967296-9223372036854775806 = %d, wanted 9223372032559808514\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(9223372036854775806); got != -9223372032559808514 { + fmt.Printf("sub_int64 9223372036854775806--4294967296 = %d, wanted -9223372032559808514\n", got) + failed = true + } + + if got := sub_Neg4294967296_int64_ssa(9223372036854775807); got != 9223372032559808513 { + fmt.Printf("sub_int64 -4294967296-9223372036854775807 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := sub_int64_Neg4294967296_ssa(9223372036854775807); got != -9223372032559808513 { + fmt.Printf("sub_int64 9223372036854775807--4294967296 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(-9223372036854775808); got != 9223372036854775807 { + fmt.Printf("sub_int64 -1--9223372036854775808 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(-9223372036854775808); got != -9223372036854775807 { + fmt.Printf("sub_int64 -9223372036854775808--1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(-9223372036854775807); got != 9223372036854775806 { + fmt.Printf("sub_int64 -1--9223372036854775807 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(-9223372036854775807); got != -9223372036854775806 { + fmt.Printf("sub_int64 -9223372036854775807--1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(-4294967296); got != 4294967295 { + fmt.Printf("sub_int64 -1--4294967296 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(-4294967296); got != -4294967295 { + fmt.Printf("sub_int64 -4294967296--1 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(-1); got != 0 { + fmt.Printf("sub_int64 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(-1); got != 0 { + fmt.Printf("sub_int64 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(0); got != -1 { + fmt.Printf("sub_int64 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(0); got != 1 { + fmt.Printf("sub_int64 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(1); got != -2 { + fmt.Printf("sub_int64 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(1); got != 2 { + fmt.Printf("sub_int64 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(4294967296); got != -4294967297 { + fmt.Printf("sub_int64 -1-4294967296 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(4294967296); got != 4294967297 { + fmt.Printf("sub_int64 4294967296--1 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(9223372036854775806); got != -9223372036854775807 { + fmt.Printf("sub_int64 -1-9223372036854775806 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(9223372036854775806); got != 9223372036854775807 { + fmt.Printf("sub_int64 9223372036854775806--1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_Neg1_int64_ssa(9223372036854775807); got != -9223372036854775808 { + fmt.Printf("sub_int64 -1-9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_int64_Neg1_ssa(9223372036854775807); got != -9223372036854775808 { + fmt.Printf("sub_int64 9223372036854775807--1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_0_int64_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("sub_int64 0--9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_int64_0_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("sub_int64 -9223372036854775808-0 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_0_int64_ssa(-9223372036854775807); got != 9223372036854775807 { + fmt.Printf("sub_int64 0--9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_0_ssa(-9223372036854775807); got != -9223372036854775807 { + fmt.Printf("sub_int64 -9223372036854775807-0 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_0_int64_ssa(-4294967296); got != 4294967296 { + fmt.Printf("sub_int64 0--4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := sub_int64_0_ssa(-4294967296); got != -4294967296 { + fmt.Printf("sub_int64 -4294967296-0 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := sub_0_int64_ssa(-1); got != 1 { + fmt.Printf("sub_int64 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int64_0_ssa(-1); got != -1 { + fmt.Printf("sub_int64 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_0_int64_ssa(0); got != 0 { + fmt.Printf("sub_int64 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_0_ssa(0); got != 0 { + fmt.Printf("sub_int64 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_int64_ssa(1); got != -1 { + fmt.Printf("sub_int64 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int64_0_ssa(1); got != 1 { + fmt.Printf("sub_int64 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_int64_ssa(4294967296); got != -4294967296 { + fmt.Printf("sub_int64 0-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := sub_int64_0_ssa(4294967296); got != 4294967296 { + fmt.Printf("sub_int64 4294967296-0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := sub_0_int64_ssa(9223372036854775806); got != -9223372036854775806 { + fmt.Printf("sub_int64 0-9223372036854775806 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := sub_int64_0_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("sub_int64 9223372036854775806-0 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := sub_0_int64_ssa(9223372036854775807); got != -9223372036854775807 { + fmt.Printf("sub_int64 0-9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_0_ssa(9223372036854775807); got != 9223372036854775807 { + fmt.Printf("sub_int64 9223372036854775807-0 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_1_int64_ssa(-9223372036854775808); got != -9223372036854775807 { + fmt.Printf("sub_int64 1--9223372036854775808 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_1_ssa(-9223372036854775808); got != 9223372036854775807 { + fmt.Printf("sub_int64 -9223372036854775808-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_1_int64_ssa(-9223372036854775807); got != -9223372036854775808 { + fmt.Printf("sub_int64 1--9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_int64_1_ssa(-9223372036854775807); got != -9223372036854775808 { + fmt.Printf("sub_int64 -9223372036854775807-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_1_int64_ssa(-4294967296); got != 4294967297 { + fmt.Printf("sub_int64 1--4294967296 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := sub_int64_1_ssa(-4294967296); got != -4294967297 { + fmt.Printf("sub_int64 -4294967296-1 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := sub_1_int64_ssa(-1); got != 2 { + fmt.Printf("sub_int64 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int64_1_ssa(-1); got != -2 { + fmt.Printf("sub_int64 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_1_int64_ssa(0); got != 1 { + fmt.Printf("sub_int64 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int64_1_ssa(0); got != -1 { + fmt.Printf("sub_int64 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_1_int64_ssa(1); got != 0 { + fmt.Printf("sub_int64 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_1_ssa(1); got != 0 { + fmt.Printf("sub_int64 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_int64_ssa(4294967296); got != -4294967295 { + fmt.Printf("sub_int64 1-4294967296 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := sub_int64_1_ssa(4294967296); got != 4294967295 { + fmt.Printf("sub_int64 4294967296-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_1_int64_ssa(9223372036854775806); got != -9223372036854775805 { + fmt.Printf("sub_int64 1-9223372036854775806 = %d, wanted -9223372036854775805\n", got) + failed = true + } + + if got := sub_int64_1_ssa(9223372036854775806); got != 9223372036854775805 { + fmt.Printf("sub_int64 9223372036854775806-1 = %d, wanted 9223372036854775805\n", got) + failed = true + } + + if got := sub_1_int64_ssa(9223372036854775807); got != -9223372036854775806 { + fmt.Printf("sub_int64 1-9223372036854775807 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := sub_int64_1_ssa(9223372036854775807); got != 9223372036854775806 { + fmt.Printf("sub_int64 9223372036854775807-1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(-9223372036854775808); got != -9223372032559808512 { + fmt.Printf("sub_int64 4294967296--9223372036854775808 = %d, wanted -9223372032559808512\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(-9223372036854775808); got != 9223372032559808512 { + fmt.Printf("sub_int64 -9223372036854775808-4294967296 = %d, wanted 9223372032559808512\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(-9223372036854775807); got != -9223372032559808513 { + fmt.Printf("sub_int64 4294967296--9223372036854775807 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(-9223372036854775807); got != 9223372032559808513 { + fmt.Printf("sub_int64 -9223372036854775807-4294967296 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(-4294967296); got != 8589934592 { + fmt.Printf("sub_int64 4294967296--4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(-4294967296); got != -8589934592 { + fmt.Printf("sub_int64 -4294967296-4294967296 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(-1); got != 4294967297 { + fmt.Printf("sub_int64 4294967296--1 = %d, wanted 4294967297\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(-1); got != -4294967297 { + fmt.Printf("sub_int64 -1-4294967296 = %d, wanted -4294967297\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(0); got != 4294967296 { + fmt.Printf("sub_int64 4294967296-0 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(0); got != -4294967296 { + fmt.Printf("sub_int64 0-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(1); got != 4294967295 { + fmt.Printf("sub_int64 4294967296-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(1); got != -4294967295 { + fmt.Printf("sub_int64 1-4294967296 = %d, wanted -4294967295\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(4294967296); got != 0 { + fmt.Printf("sub_int64 4294967296-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(4294967296); got != 0 { + fmt.Printf("sub_int64 4294967296-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(9223372036854775806); got != -9223372032559808510 { + fmt.Printf("sub_int64 4294967296-9223372036854775806 = %d, wanted -9223372032559808510\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(9223372036854775806); got != 9223372032559808510 { + fmt.Printf("sub_int64 9223372036854775806-4294967296 = %d, wanted 9223372032559808510\n", got) + failed = true + } + + if got := sub_4294967296_int64_ssa(9223372036854775807); got != -9223372032559808511 { + fmt.Printf("sub_int64 4294967296-9223372036854775807 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := sub_int64_4294967296_ssa(9223372036854775807); got != 9223372032559808511 { + fmt.Printf("sub_int64 9223372036854775807-4294967296 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(-9223372036854775808); got != -2 { + fmt.Printf("sub_int64 9223372036854775806--9223372036854775808 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(-9223372036854775808); got != 2 { + fmt.Printf("sub_int64 -9223372036854775808-9223372036854775806 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(-9223372036854775807); got != -3 { + fmt.Printf("sub_int64 9223372036854775806--9223372036854775807 = %d, wanted -3\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(-9223372036854775807); got != 3 { + fmt.Printf("sub_int64 -9223372036854775807-9223372036854775806 = %d, wanted 3\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(-4294967296); got != -9223372032559808514 { + fmt.Printf("sub_int64 9223372036854775806--4294967296 = %d, wanted -9223372032559808514\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(-4294967296); got != 9223372032559808514 { + fmt.Printf("sub_int64 -4294967296-9223372036854775806 = %d, wanted 9223372032559808514\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(-1); got != 9223372036854775807 { + fmt.Printf("sub_int64 9223372036854775806--1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(-1); got != -9223372036854775807 { + fmt.Printf("sub_int64 -1-9223372036854775806 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(0); got != 9223372036854775806 { + fmt.Printf("sub_int64 9223372036854775806-0 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(0); got != -9223372036854775806 { + fmt.Printf("sub_int64 0-9223372036854775806 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(1); got != 9223372036854775805 { + fmt.Printf("sub_int64 9223372036854775806-1 = %d, wanted 9223372036854775805\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(1); got != -9223372036854775805 { + fmt.Printf("sub_int64 1-9223372036854775806 = %d, wanted -9223372036854775805\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(4294967296); got != 9223372032559808510 { + fmt.Printf("sub_int64 9223372036854775806-4294967296 = %d, wanted 9223372032559808510\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(4294967296); got != -9223372032559808510 { + fmt.Printf("sub_int64 4294967296-9223372036854775806 = %d, wanted -9223372032559808510\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("sub_int64 9223372036854775806-9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(9223372036854775806); got != 0 { + fmt.Printf("sub_int64 9223372036854775806-9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_9223372036854775806_int64_ssa(9223372036854775807); got != -1 { + fmt.Printf("sub_int64 9223372036854775806-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int64_9223372036854775806_ssa(9223372036854775807); got != 1 { + fmt.Printf("sub_int64 9223372036854775807-9223372036854775806 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(-9223372036854775808); got != -1 { + fmt.Printf("sub_int64 9223372036854775807--9223372036854775808 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(-9223372036854775808); got != 1 { + fmt.Printf("sub_int64 -9223372036854775808-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(-9223372036854775807); got != -2 { + fmt.Printf("sub_int64 9223372036854775807--9223372036854775807 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(-9223372036854775807); got != 2 { + fmt.Printf("sub_int64 -9223372036854775807-9223372036854775807 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(-4294967296); got != -9223372032559808513 { + fmt.Printf("sub_int64 9223372036854775807--4294967296 = %d, wanted -9223372032559808513\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(-4294967296); got != 9223372032559808513 { + fmt.Printf("sub_int64 -4294967296-9223372036854775807 = %d, wanted 9223372032559808513\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(-1); got != -9223372036854775808 { + fmt.Printf("sub_int64 9223372036854775807--1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(-1); got != -9223372036854775808 { + fmt.Printf("sub_int64 -1-9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(0); got != 9223372036854775807 { + fmt.Printf("sub_int64 9223372036854775807-0 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(0); got != -9223372036854775807 { + fmt.Printf("sub_int64 0-9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(1); got != 9223372036854775806 { + fmt.Printf("sub_int64 9223372036854775807-1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(1); got != -9223372036854775806 { + fmt.Printf("sub_int64 1-9223372036854775807 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(4294967296); got != 9223372032559808511 { + fmt.Printf("sub_int64 9223372036854775807-4294967296 = %d, wanted 9223372032559808511\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(4294967296); got != -9223372032559808511 { + fmt.Printf("sub_int64 4294967296-9223372036854775807 = %d, wanted -9223372032559808511\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(9223372036854775806); got != 1 { + fmt.Printf("sub_int64 9223372036854775807-9223372036854775806 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(9223372036854775806); got != -1 { + fmt.Printf("sub_int64 9223372036854775806-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_9223372036854775807_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("sub_int64 9223372036854775807-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int64_9223372036854775807_ssa(9223372036854775807); got != 0 { + fmt.Printf("sub_int64 9223372036854775807-9223372036854775807 = %d, wanted 0\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 := mul_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*-9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775807*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 -4294967296*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(-1); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(-1); got != -9223372036854775808 { + fmt.Printf("mul_int64 -1*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(1); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(1); got != -9223372036854775808 { + fmt.Printf("mul_int64 1*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 4294967296*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(9223372036854775806); got != 0 { + fmt.Printf("mul_int64 9223372036854775806*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775808_ssa(9223372036854775807); got != -9223372036854775808 { + fmt.Printf("mul_int64 9223372036854775807*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775807*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*-9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 1 { + fmt.Printf("mul_int64 -9223372036854775807*-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 1 { + fmt.Printf("mul_int64 -9223372036854775807*-9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(-4294967296); got != -4294967296 { + fmt.Printf("mul_int64 -9223372036854775807*-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(-4294967296); got != -4294967296 { + fmt.Printf("mul_int64 -4294967296*-9223372036854775807 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(-1); got != 9223372036854775807 { + fmt.Printf("mul_int64 -9223372036854775807*-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(-1); got != 9223372036854775807 { + fmt.Printf("mul_int64 -1*-9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 -9223372036854775807*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775807 { + fmt.Printf("mul_int64 -9223372036854775807*1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(1); got != -9223372036854775807 { + fmt.Printf("mul_int64 1*-9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(4294967296); got != 4294967296 { + fmt.Printf("mul_int64 -9223372036854775807*4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(4294967296); got != 4294967296 { + fmt.Printf("mul_int64 4294967296*-9223372036854775807 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("mul_int64 -9223372036854775807*9223372036854775806 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*-9223372036854775807 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_Neg9223372036854775807_int64_ssa(9223372036854775807); got != -1 { + fmt.Printf("mul_int64 -9223372036854775807*9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int64_Neg9223372036854775807_ssa(9223372036854775807); got != -1 { + fmt.Printf("mul_int64 9223372036854775807*-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -4294967296*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(-9223372036854775807); got != -4294967296 { + fmt.Printf("mul_int64 -4294967296*-9223372036854775807 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(-9223372036854775807); got != -4294967296 { + fmt.Printf("mul_int64 -9223372036854775807*-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 -4294967296*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 -4294967296*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(-1); got != 4294967296 { + fmt.Printf("mul_int64 -4294967296*-1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(-1); got != 4294967296 { + fmt.Printf("mul_int64 -1*-4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 -4294967296*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(1); got != -4294967296 { + fmt.Printf("mul_int64 -4294967296*1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(1); got != -4294967296 { + fmt.Printf("mul_int64 1*-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 -4294967296*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 4294967296*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(9223372036854775806); got != 8589934592 { + fmt.Printf("mul_int64 -4294967296*9223372036854775806 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(9223372036854775806); got != 8589934592 { + fmt.Printf("mul_int64 9223372036854775806*-4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := mul_Neg4294967296_int64_ssa(9223372036854775807); got != 4294967296 { + fmt.Printf("mul_int64 -4294967296*9223372036854775807 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg4294967296_ssa(9223372036854775807); got != 4294967296 { + fmt.Printf("mul_int64 9223372036854775807*-4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 -1*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*-1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(-9223372036854775807); got != 9223372036854775807 { + fmt.Printf("mul_int64 -1*-9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(-9223372036854775807); got != 9223372036854775807 { + fmt.Printf("mul_int64 -9223372036854775807*-1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(-4294967296); got != 4294967296 { + fmt.Printf("mul_int64 -1*-4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(-4294967296); got != 4294967296 { + fmt.Printf("mul_int64 -4294967296*-1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(-1); got != 1 { + fmt.Printf("mul_int64 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(-1); got != 1 { + fmt.Printf("mul_int64 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(1); got != -1 { + fmt.Printf("mul_int64 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(1); got != -1 { + fmt.Printf("mul_int64 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(4294967296); got != -4294967296 { + fmt.Printf("mul_int64 -1*4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(4294967296); got != -4294967296 { + fmt.Printf("mul_int64 4294967296*-1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(9223372036854775806); got != -9223372036854775806 { + fmt.Printf("mul_int64 -1*9223372036854775806 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(9223372036854775806); got != -9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*-1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_Neg1_int64_ssa(9223372036854775807); got != -9223372036854775807 { + fmt.Printf("mul_int64 -1*9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_Neg1_ssa(9223372036854775807); got != -9223372036854775807 { + fmt.Printf("mul_int64 9223372036854775807*-1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_0_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 0*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(-9223372036854775807); got != 0 { + fmt.Printf("mul_int64 0*-9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(-9223372036854775807); got != 0 { + fmt.Printf("mul_int64 -9223372036854775807*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 0*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 -4294967296*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(-1); got != 0 { + fmt.Printf("mul_int64 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(-1); got != 0 { + fmt.Printf("mul_int64 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(1); got != 0 { + fmt.Printf("mul_int64 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(1); got != 0 { + fmt.Printf("mul_int64 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 0*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 4294967296*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(9223372036854775806); got != 0 { + fmt.Printf("mul_int64 0*9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(9223372036854775806); got != 0 { + fmt.Printf("mul_int64 9223372036854775806*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int64_ssa(9223372036854775807); got != 0 { + fmt.Printf("mul_int64 0*9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_0_ssa(9223372036854775807); got != 0 { + fmt.Printf("mul_int64 9223372036854775807*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int64_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 1*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_1_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*1 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_1_int64_ssa(-9223372036854775807); got != -9223372036854775807 { + fmt.Printf("mul_int64 1*-9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_1_ssa(-9223372036854775807); got != -9223372036854775807 { + fmt.Printf("mul_int64 -9223372036854775807*1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_1_int64_ssa(-4294967296); got != -4294967296 { + fmt.Printf("mul_int64 1*-4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_1_ssa(-4294967296); got != -4294967296 { + fmt.Printf("mul_int64 -4294967296*1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_1_int64_ssa(-1); got != -1 { + fmt.Printf("mul_int64 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int64_1_ssa(-1); got != -1 { + fmt.Printf("mul_int64 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_1_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_1_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int64_ssa(1); got != 1 { + fmt.Printf("mul_int64 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int64_1_ssa(1); got != 1 { + fmt.Printf("mul_int64 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_int64_ssa(4294967296); got != 4294967296 { + fmt.Printf("mul_int64 1*4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_1_ssa(4294967296); got != 4294967296 { + fmt.Printf("mul_int64 4294967296*1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_1_int64_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("mul_int64 1*9223372036854775806 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_1_ssa(9223372036854775806); got != 9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_1_int64_ssa(9223372036854775807); got != 9223372036854775807 { + fmt.Printf("mul_int64 1*9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_1_ssa(9223372036854775807); got != 9223372036854775807 { + fmt.Printf("mul_int64 9223372036854775807*1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 4294967296*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(-9223372036854775807); got != 4294967296 { + fmt.Printf("mul_int64 4294967296*-9223372036854775807 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(-9223372036854775807); got != 4294967296 { + fmt.Printf("mul_int64 -9223372036854775807*4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 4294967296*-4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(-4294967296); got != 0 { + fmt.Printf("mul_int64 -4294967296*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(-1); got != -4294967296 { + fmt.Printf("mul_int64 4294967296*-1 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(-1); got != -4294967296 { + fmt.Printf("mul_int64 -1*4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 4294967296*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(1); got != 4294967296 { + fmt.Printf("mul_int64 4294967296*1 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(1); got != 4294967296 { + fmt.Printf("mul_int64 1*4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 4294967296*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(4294967296); got != 0 { + fmt.Printf("mul_int64 4294967296*4294967296 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(9223372036854775806); got != -8589934592 { + fmt.Printf("mul_int64 4294967296*9223372036854775806 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(9223372036854775806); got != -8589934592 { + fmt.Printf("mul_int64 9223372036854775806*4294967296 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := mul_4294967296_int64_ssa(9223372036854775807); got != -4294967296 { + fmt.Printf("mul_int64 4294967296*9223372036854775807 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_4294967296_ssa(9223372036854775807); got != -4294967296 { + fmt.Printf("mul_int64 9223372036854775807*4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 9223372036854775806*-9223372036854775808 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(-9223372036854775808); got != 0 { + fmt.Printf("mul_int64 -9223372036854775808*9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(-9223372036854775807); got != 9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*-9223372036854775807 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(-9223372036854775807); got != 9223372036854775806 { + fmt.Printf("mul_int64 -9223372036854775807*9223372036854775806 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(-4294967296); got != 8589934592 { + fmt.Printf("mul_int64 9223372036854775806*-4294967296 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(-4294967296); got != 8589934592 { + fmt.Printf("mul_int64 -4294967296*9223372036854775806 = %d, wanted 8589934592\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(-1); got != -9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*-1 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(-1); got != -9223372036854775806 { + fmt.Printf("mul_int64 -1*9223372036854775806 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 9223372036854775806*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*9223372036854775806 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(1); got != 9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*1 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(1); got != 9223372036854775806 { + fmt.Printf("mul_int64 1*9223372036854775806 = %d, wanted 9223372036854775806\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(4294967296); got != -8589934592 { + fmt.Printf("mul_int64 9223372036854775806*4294967296 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(4294967296); got != -8589934592 { + fmt.Printf("mul_int64 4294967296*9223372036854775806 = %d, wanted -8589934592\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(9223372036854775806); got != 4 { + fmt.Printf("mul_int64 9223372036854775806*9223372036854775806 = %d, wanted 4\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(9223372036854775806); got != 4 { + fmt.Printf("mul_int64 9223372036854775806*9223372036854775806 = %d, wanted 4\n", got) + failed = true + } + + if got := mul_9223372036854775806_int64_ssa(9223372036854775807); got != -9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*9223372036854775807 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_9223372036854775806_ssa(9223372036854775807); got != -9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775807*9223372036854775806 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 9223372036854775807*-9223372036854775808 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(-9223372036854775808); got != -9223372036854775808 { + fmt.Printf("mul_int64 -9223372036854775808*9223372036854775807 = %d, wanted -9223372036854775808\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(-9223372036854775807); got != -1 { + fmt.Printf("mul_int64 9223372036854775807*-9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(-9223372036854775807); got != -1 { + fmt.Printf("mul_int64 -9223372036854775807*9223372036854775807 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(-4294967296); got != 4294967296 { + fmt.Printf("mul_int64 9223372036854775807*-4294967296 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(-4294967296); got != 4294967296 { + fmt.Printf("mul_int64 -4294967296*9223372036854775807 = %d, wanted 4294967296\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(-1); got != -9223372036854775807 { + fmt.Printf("mul_int64 9223372036854775807*-1 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(-1); got != -9223372036854775807 { + fmt.Printf("mul_int64 -1*9223372036854775807 = %d, wanted -9223372036854775807\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(0); got != 0 { + fmt.Printf("mul_int64 9223372036854775807*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(0); got != 0 { + fmt.Printf("mul_int64 0*9223372036854775807 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(1); got != 9223372036854775807 { + fmt.Printf("mul_int64 9223372036854775807*1 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(1); got != 9223372036854775807 { + fmt.Printf("mul_int64 1*9223372036854775807 = %d, wanted 9223372036854775807\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(4294967296); got != -4294967296 { + fmt.Printf("mul_int64 9223372036854775807*4294967296 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(4294967296); got != -4294967296 { + fmt.Printf("mul_int64 4294967296*9223372036854775807 = %d, wanted -4294967296\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(9223372036854775806); got != -9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775807*9223372036854775806 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(9223372036854775806); got != -9223372036854775806 { + fmt.Printf("mul_int64 9223372036854775806*9223372036854775807 = %d, wanted -9223372036854775806\n", got) + failed = true + } + + if got := mul_9223372036854775807_int64_ssa(9223372036854775807); got != 1 { + fmt.Printf("mul_int64 9223372036854775807*9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int64_9223372036854775807_ssa(9223372036854775807); got != 1 { + fmt.Printf("mul_int64 9223372036854775807*9223372036854775807 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint32_ssa(0); got != 0 { + fmt.Printf("add_uint32 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint32_0_ssa(0); got != 0 { + fmt.Printf("add_uint32 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_uint32_ssa(1); got != 1 { + fmt.Printf("add_uint32 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint32_0_ssa(1); got != 1 { + fmt.Printf("add_uint32 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint32_ssa(4294967295); got != 4294967295 { + fmt.Printf("add_uint32 0+4294967295 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_uint32_0_ssa(4294967295); got != 4294967295 { + fmt.Printf("add_uint32 4294967295+0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_1_uint32_ssa(0); got != 1 { + fmt.Printf("add_uint32 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint32_1_ssa(0); got != 1 { + fmt.Printf("add_uint32 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_uint32_ssa(1); got != 2 { + fmt.Printf("add_uint32 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_uint32_1_ssa(1); got != 2 { + fmt.Printf("add_uint32 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_uint32_ssa(4294967295); got != 0 { + fmt.Printf("add_uint32 1+4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint32_1_ssa(4294967295); got != 0 { + fmt.Printf("add_uint32 4294967295+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_4294967295_uint32_ssa(0); got != 4294967295 { + fmt.Printf("add_uint32 4294967295+0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_uint32_4294967295_ssa(0); got != 4294967295 { + fmt.Printf("add_uint32 0+4294967295 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := add_4294967295_uint32_ssa(1); got != 0 { + fmt.Printf("add_uint32 4294967295+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint32_4294967295_ssa(1); got != 0 { + fmt.Printf("add_uint32 1+4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := add_4294967295_uint32_ssa(4294967295); got != 4294967294 { + fmt.Printf("add_uint32 4294967295+4294967295 = %d, wanted 4294967294\n", got) + failed = true + } + + if got := add_uint32_4294967295_ssa(4294967295); got != 4294967294 { + fmt.Printf("add_uint32 4294967295+4294967295 = %d, wanted 4294967294\n", got) + failed = true + } + + if got := sub_0_uint32_ssa(0); got != 0 { + fmt.Printf("sub_uint32 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint32_0_ssa(0); got != 0 { + fmt.Printf("sub_uint32 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_uint32_ssa(1); got != 4294967295 { + fmt.Printf("sub_uint32 0-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_uint32_0_ssa(1); got != 1 { + fmt.Printf("sub_uint32 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_uint32_ssa(4294967295); got != 1 { + fmt.Printf("sub_uint32 0-4294967295 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint32_0_ssa(4294967295); got != 4294967295 { + fmt.Printf("sub_uint32 4294967295-0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_1_uint32_ssa(0); got != 1 { + fmt.Printf("sub_uint32 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint32_1_ssa(0); got != 4294967295 { + fmt.Printf("sub_uint32 0-1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_1_uint32_ssa(1); got != 0 { + fmt.Printf("sub_uint32 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint32_1_ssa(1); got != 0 { + fmt.Printf("sub_uint32 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_uint32_ssa(4294967295); got != 2 { + fmt.Printf("sub_uint32 1-4294967295 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_uint32_1_ssa(4294967295); got != 4294967294 { + fmt.Printf("sub_uint32 4294967295-1 = %d, wanted 4294967294\n", got) + failed = true + } + + if got := sub_4294967295_uint32_ssa(0); got != 4294967295 { + fmt.Printf("sub_uint32 4294967295-0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := sub_uint32_4294967295_ssa(0); got != 1 { + fmt.Printf("sub_uint32 0-4294967295 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_4294967295_uint32_ssa(1); got != 4294967294 { + fmt.Printf("sub_uint32 4294967295-1 = %d, wanted 4294967294\n", got) + failed = true + } + + if got := sub_uint32_4294967295_ssa(1); got != 2 { + fmt.Printf("sub_uint32 1-4294967295 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_4294967295_uint32_ssa(4294967295); got != 0 { + fmt.Printf("sub_uint32 4294967295-4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint32_4294967295_ssa(4294967295); got != 0 { + fmt.Printf("sub_uint32 4294967295-4294967295 = %d, wanted 0\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 := mul_0_uint32_ssa(0); got != 0 { + fmt.Printf("mul_uint32 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint32_0_ssa(0); got != 0 { + fmt.Printf("mul_uint32 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint32_ssa(1); got != 0 { + fmt.Printf("mul_uint32 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint32_0_ssa(1); got != 0 { + fmt.Printf("mul_uint32 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint32_ssa(4294967295); got != 0 { + fmt.Printf("mul_uint32 0*4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint32_0_ssa(4294967295); got != 0 { + fmt.Printf("mul_uint32 4294967295*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint32_ssa(0); got != 0 { + fmt.Printf("mul_uint32 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint32_1_ssa(0); got != 0 { + fmt.Printf("mul_uint32 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint32_ssa(1); got != 1 { + fmt.Printf("mul_uint32 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint32_1_ssa(1); got != 1 { + fmt.Printf("mul_uint32 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_uint32_ssa(4294967295); got != 4294967295 { + fmt.Printf("mul_uint32 1*4294967295 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := mul_uint32_1_ssa(4294967295); got != 4294967295 { + fmt.Printf("mul_uint32 4294967295*1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := mul_4294967295_uint32_ssa(0); got != 0 { + fmt.Printf("mul_uint32 4294967295*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint32_4294967295_ssa(0); got != 0 { + fmt.Printf("mul_uint32 0*4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_4294967295_uint32_ssa(1); got != 4294967295 { + fmt.Printf("mul_uint32 4294967295*1 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := mul_uint32_4294967295_ssa(1); got != 4294967295 { + fmt.Printf("mul_uint32 1*4294967295 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := mul_4294967295_uint32_ssa(4294967295); got != 1 { + fmt.Printf("mul_uint32 4294967295*4294967295 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint32_4294967295_ssa(4294967295); got != 1 { + fmt.Printf("mul_uint32 4294967295*4294967295 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint32_ssa(0); got != 0 { + fmt.Printf("lsh_uint32 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint32_0_ssa(0); got != 0 { + fmt.Printf("lsh_uint32 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_0_uint32_ssa(1); got != 0 { + fmt.Printf("lsh_uint32 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint32_0_ssa(1); got != 1 { + fmt.Printf("lsh_uint32 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint32_ssa(4294967295); got != 0 { + fmt.Printf("lsh_uint32 0<<4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint32_0_ssa(4294967295); got != 4294967295 { + fmt.Printf("lsh_uint32 4294967295<<0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := lsh_1_uint32_ssa(0); got != 1 { + fmt.Printf("lsh_uint32 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_uint32_1_ssa(0); got != 0 { + fmt.Printf("lsh_uint32 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_1_uint32_ssa(1); got != 2 { + fmt.Printf("lsh_uint32 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_uint32_1_ssa(1); got != 2 { + fmt.Printf("lsh_uint32 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_1_uint32_ssa(4294967295); got != 0 { + fmt.Printf("lsh_uint32 1<<4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint32_1_ssa(4294967295); got != 4294967294 { + fmt.Printf("lsh_uint32 4294967295<<1 = %d, wanted 4294967294\n", got) + failed = true + } + + if got := lsh_4294967295_uint32_ssa(0); got != 4294967295 { + fmt.Printf("lsh_uint32 4294967295<<0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := lsh_uint32_4294967295_ssa(0); got != 0 { + fmt.Printf("lsh_uint32 0<<4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_4294967295_uint32_ssa(1); got != 4294967294 { + fmt.Printf("lsh_uint32 4294967295<<1 = %d, wanted 4294967294\n", got) + failed = true + } + + if got := lsh_uint32_4294967295_ssa(1); got != 0 { + fmt.Printf("lsh_uint32 1<<4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_4294967295_uint32_ssa(4294967295); got != 0 { + fmt.Printf("lsh_uint32 4294967295<<4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint32_4294967295_ssa(4294967295); got != 0 { + fmt.Printf("lsh_uint32 4294967295<<4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint32_ssa(0); got != 0 { + fmt.Printf("rsh_uint32 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint32_0_ssa(0); got != 0 { + fmt.Printf("rsh_uint32 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint32_ssa(1); got != 0 { + fmt.Printf("rsh_uint32 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint32_0_ssa(1); got != 1 { + fmt.Printf("rsh_uint32 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_0_uint32_ssa(4294967295); got != 0 { + fmt.Printf("rsh_uint32 0>>4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint32_0_ssa(4294967295); got != 4294967295 { + fmt.Printf("rsh_uint32 4294967295>>0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := rsh_1_uint32_ssa(0); got != 1 { + fmt.Printf("rsh_uint32 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_uint32_1_ssa(0); got != 0 { + fmt.Printf("rsh_uint32 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint32_ssa(1); got != 0 { + fmt.Printf("rsh_uint32 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint32_1_ssa(1); got != 0 { + fmt.Printf("rsh_uint32 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint32_ssa(4294967295); got != 0 { + fmt.Printf("rsh_uint32 1>>4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint32_1_ssa(4294967295); got != 2147483647 { + fmt.Printf("rsh_uint32 4294967295>>1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := rsh_4294967295_uint32_ssa(0); got != 4294967295 { + fmt.Printf("rsh_uint32 4294967295>>0 = %d, wanted 4294967295\n", got) + failed = true + } + + if got := rsh_uint32_4294967295_ssa(0); got != 0 { + fmt.Printf("rsh_uint32 0>>4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_4294967295_uint32_ssa(1); got != 2147483647 { + fmt.Printf("rsh_uint32 4294967295>>1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := rsh_uint32_4294967295_ssa(1); got != 0 { + fmt.Printf("rsh_uint32 1>>4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_4294967295_uint32_ssa(4294967295); got != 0 { + fmt.Printf("rsh_uint32 4294967295>>4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint32_4294967295_ssa(4294967295); got != 0 { + fmt.Printf("rsh_uint32 4294967295>>4294967295 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg2147483648_int32_ssa(-2147483648); got != 0 { + fmt.Printf("add_int32 -2147483648+-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int32_Neg2147483648_ssa(-2147483648); got != 0 { + fmt.Printf("add_int32 -2147483648+-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg2147483648_int32_ssa(-2147483647); got != 1 { + fmt.Printf("add_int32 -2147483648+-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int32_Neg2147483648_ssa(-2147483647); got != 1 { + fmt.Printf("add_int32 -2147483647+-2147483648 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg2147483648_int32_ssa(-1); got != 2147483647 { + fmt.Printf("add_int32 -2147483648+-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_int32_Neg2147483648_ssa(-1); got != 2147483647 { + fmt.Printf("add_int32 -1+-2147483648 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_Neg2147483648_int32_ssa(0); got != -2147483648 { + fmt.Printf("add_int32 -2147483648+0 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_int32_Neg2147483648_ssa(0); got != -2147483648 { + fmt.Printf("add_int32 0+-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_Neg2147483648_int32_ssa(1); got != -2147483647 { + fmt.Printf("add_int32 -2147483648+1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_int32_Neg2147483648_ssa(1); got != -2147483647 { + fmt.Printf("add_int32 1+-2147483648 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_Neg2147483648_int32_ssa(2147483647); got != -1 { + fmt.Printf("add_int32 -2147483648+2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int32_Neg2147483648_ssa(2147483647); got != -1 { + fmt.Printf("add_int32 2147483647+-2147483648 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg2147483647_int32_ssa(-2147483648); got != 1 { + fmt.Printf("add_int32 -2147483647+-2147483648 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int32_Neg2147483647_ssa(-2147483648); got != 1 { + fmt.Printf("add_int32 -2147483648+-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg2147483647_int32_ssa(-2147483647); got != 2 { + fmt.Printf("add_int32 -2147483647+-2147483647 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int32_Neg2147483647_ssa(-2147483647); got != 2 { + fmt.Printf("add_int32 -2147483647+-2147483647 = %d, wanted 2\n", got) + failed = true + } + + if got := add_Neg2147483647_int32_ssa(-1); got != -2147483648 { + fmt.Printf("add_int32 -2147483647+-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_int32_Neg2147483647_ssa(-1); got != -2147483648 { + fmt.Printf("add_int32 -1+-2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_Neg2147483647_int32_ssa(0); got != -2147483647 { + fmt.Printf("add_int32 -2147483647+0 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_int32_Neg2147483647_ssa(0); got != -2147483647 { + fmt.Printf("add_int32 0+-2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_Neg2147483647_int32_ssa(1); got != -2147483646 { + fmt.Printf("add_int32 -2147483647+1 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := add_int32_Neg2147483647_ssa(1); got != -2147483646 { + fmt.Printf("add_int32 1+-2147483647 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := add_Neg2147483647_int32_ssa(2147483647); got != 0 { + fmt.Printf("add_int32 -2147483647+2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int32_Neg2147483647_ssa(2147483647); got != 0 { + fmt.Printf("add_int32 2147483647+-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int32_ssa(-2147483648); got != 2147483647 { + fmt.Printf("add_int32 -1+-2147483648 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_int32_Neg1_ssa(-2147483648); got != 2147483647 { + fmt.Printf("add_int32 -2147483648+-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_Neg1_int32_ssa(-2147483647); got != -2147483648 { + fmt.Printf("add_int32 -1+-2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_int32_Neg1_ssa(-2147483647); got != -2147483648 { + fmt.Printf("add_int32 -2147483647+-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_Neg1_int32_ssa(-1); got != -2 { + fmt.Printf("add_int32 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int32_Neg1_ssa(-1); got != -2 { + fmt.Printf("add_int32 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg1_int32_ssa(0); got != -1 { + fmt.Printf("add_int32 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int32_Neg1_ssa(0); got != -1 { + fmt.Printf("add_int32 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg1_int32_ssa(1); got != 0 { + fmt.Printf("add_int32 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int32_Neg1_ssa(1); got != 0 { + fmt.Printf("add_int32 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int32_ssa(2147483647); got != 2147483646 { + fmt.Printf("add_int32 -1+2147483647 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := add_int32_Neg1_ssa(2147483647); got != 2147483646 { + fmt.Printf("add_int32 2147483647+-1 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := add_0_int32_ssa(-2147483648); got != -2147483648 { + fmt.Printf("add_int32 0+-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_int32_0_ssa(-2147483648); got != -2147483648 { + fmt.Printf("add_int32 -2147483648+0 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_0_int32_ssa(-2147483647); got != -2147483647 { + fmt.Printf("add_int32 0+-2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_int32_0_ssa(-2147483647); got != -2147483647 { + fmt.Printf("add_int32 -2147483647+0 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_0_int32_ssa(-1); got != -1 { + fmt.Printf("add_int32 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int32_0_ssa(-1); got != -1 { + fmt.Printf("add_int32 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_0_int32_ssa(0); got != 0 { + fmt.Printf("add_int32 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int32_0_ssa(0); got != 0 { + fmt.Printf("add_int32 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_int32_ssa(1); got != 1 { + fmt.Printf("add_int32 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int32_0_ssa(1); got != 1 { + fmt.Printf("add_int32 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_int32_ssa(2147483647); got != 2147483647 { + fmt.Printf("add_int32 0+2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_int32_0_ssa(2147483647); got != 2147483647 { + fmt.Printf("add_int32 2147483647+0 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_1_int32_ssa(-2147483648); got != -2147483647 { + fmt.Printf("add_int32 1+-2147483648 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_int32_1_ssa(-2147483648); got != -2147483647 { + fmt.Printf("add_int32 -2147483648+1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := add_1_int32_ssa(-2147483647); got != -2147483646 { + fmt.Printf("add_int32 1+-2147483647 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := add_int32_1_ssa(-2147483647); got != -2147483646 { + fmt.Printf("add_int32 -2147483647+1 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := add_1_int32_ssa(-1); got != 0 { + fmt.Printf("add_int32 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int32_1_ssa(-1); got != 0 { + fmt.Printf("add_int32 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_1_int32_ssa(0); got != 1 { + fmt.Printf("add_int32 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int32_1_ssa(0); got != 1 { + fmt.Printf("add_int32 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_int32_ssa(1); got != 2 { + fmt.Printf("add_int32 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int32_1_ssa(1); got != 2 { + fmt.Printf("add_int32 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_int32_ssa(2147483647); got != -2147483648 { + fmt.Printf("add_int32 1+2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_int32_1_ssa(2147483647); got != -2147483648 { + fmt.Printf("add_int32 2147483647+1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_2147483647_int32_ssa(-2147483648); got != -1 { + fmt.Printf("add_int32 2147483647+-2147483648 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int32_2147483647_ssa(-2147483648); got != -1 { + fmt.Printf("add_int32 -2147483648+2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := add_2147483647_int32_ssa(-2147483647); got != 0 { + fmt.Printf("add_int32 2147483647+-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int32_2147483647_ssa(-2147483647); got != 0 { + fmt.Printf("add_int32 -2147483647+2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := add_2147483647_int32_ssa(-1); got != 2147483646 { + fmt.Printf("add_int32 2147483647+-1 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := add_int32_2147483647_ssa(-1); got != 2147483646 { + fmt.Printf("add_int32 -1+2147483647 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := add_2147483647_int32_ssa(0); got != 2147483647 { + fmt.Printf("add_int32 2147483647+0 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_int32_2147483647_ssa(0); got != 2147483647 { + fmt.Printf("add_int32 0+2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := add_2147483647_int32_ssa(1); got != -2147483648 { + fmt.Printf("add_int32 2147483647+1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_int32_2147483647_ssa(1); got != -2147483648 { + fmt.Printf("add_int32 1+2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := add_2147483647_int32_ssa(2147483647); got != -2 { + fmt.Printf("add_int32 2147483647+2147483647 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int32_2147483647_ssa(2147483647); got != -2 { + fmt.Printf("add_int32 2147483647+2147483647 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg2147483648_int32_ssa(-2147483648); got != 0 { + fmt.Printf("sub_int32 -2147483648--2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int32_Neg2147483648_ssa(-2147483648); got != 0 { + fmt.Printf("sub_int32 -2147483648--2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg2147483648_int32_ssa(-2147483647); got != -1 { + fmt.Printf("sub_int32 -2147483648--2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int32_Neg2147483648_ssa(-2147483647); got != 1 { + fmt.Printf("sub_int32 -2147483647--2147483648 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg2147483648_int32_ssa(-1); got != -2147483647 { + fmt.Printf("sub_int32 -2147483648--1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_int32_Neg2147483648_ssa(-1); got != 2147483647 { + fmt.Printf("sub_int32 -1--2147483648 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_Neg2147483648_int32_ssa(0); got != -2147483648 { + fmt.Printf("sub_int32 -2147483648-0 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_int32_Neg2147483648_ssa(0); got != -2147483648 { + fmt.Printf("sub_int32 0--2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_Neg2147483648_int32_ssa(1); got != 2147483647 { + fmt.Printf("sub_int32 -2147483648-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_int32_Neg2147483648_ssa(1); got != -2147483647 { + fmt.Printf("sub_int32 1--2147483648 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_Neg2147483648_int32_ssa(2147483647); got != 1 { + fmt.Printf("sub_int32 -2147483648-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int32_Neg2147483648_ssa(2147483647); got != -1 { + fmt.Printf("sub_int32 2147483647--2147483648 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg2147483647_int32_ssa(-2147483648); got != 1 { + fmt.Printf("sub_int32 -2147483647--2147483648 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int32_Neg2147483647_ssa(-2147483648); got != -1 { + fmt.Printf("sub_int32 -2147483648--2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg2147483647_int32_ssa(-2147483647); got != 0 { + fmt.Printf("sub_int32 -2147483647--2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int32_Neg2147483647_ssa(-2147483647); got != 0 { + fmt.Printf("sub_int32 -2147483647--2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg2147483647_int32_ssa(-1); got != -2147483646 { + fmt.Printf("sub_int32 -2147483647--1 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := sub_int32_Neg2147483647_ssa(-1); got != 2147483646 { + fmt.Printf("sub_int32 -1--2147483647 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := sub_Neg2147483647_int32_ssa(0); got != -2147483647 { + fmt.Printf("sub_int32 -2147483647-0 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_int32_Neg2147483647_ssa(0); got != 2147483647 { + fmt.Printf("sub_int32 0--2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_Neg2147483647_int32_ssa(1); got != -2147483648 { + fmt.Printf("sub_int32 -2147483647-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_int32_Neg2147483647_ssa(1); got != -2147483648 { + fmt.Printf("sub_int32 1--2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_Neg2147483647_int32_ssa(2147483647); got != 2 { + fmt.Printf("sub_int32 -2147483647-2147483647 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int32_Neg2147483647_ssa(2147483647); got != -2 { + fmt.Printf("sub_int32 2147483647--2147483647 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg1_int32_ssa(-2147483648); got != 2147483647 { + fmt.Printf("sub_int32 -1--2147483648 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_int32_Neg1_ssa(-2147483648); got != -2147483647 { + fmt.Printf("sub_int32 -2147483648--1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_Neg1_int32_ssa(-2147483647); got != 2147483646 { + fmt.Printf("sub_int32 -1--2147483647 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := sub_int32_Neg1_ssa(-2147483647); got != -2147483646 { + fmt.Printf("sub_int32 -2147483647--1 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := sub_Neg1_int32_ssa(-1); got != 0 { + fmt.Printf("sub_int32 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int32_Neg1_ssa(-1); got != 0 { + fmt.Printf("sub_int32 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg1_int32_ssa(0); got != -1 { + fmt.Printf("sub_int32 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int32_Neg1_ssa(0); got != 1 { + fmt.Printf("sub_int32 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg1_int32_ssa(1); got != -2 { + fmt.Printf("sub_int32 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int32_Neg1_ssa(1); got != 2 { + fmt.Printf("sub_int32 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_Neg1_int32_ssa(2147483647); got != -2147483648 { + fmt.Printf("sub_int32 -1-2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_int32_Neg1_ssa(2147483647); got != -2147483648 { + fmt.Printf("sub_int32 2147483647--1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_0_int32_ssa(-2147483648); got != -2147483648 { + fmt.Printf("sub_int32 0--2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_int32_0_ssa(-2147483648); got != -2147483648 { + fmt.Printf("sub_int32 -2147483648-0 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_0_int32_ssa(-2147483647); got != 2147483647 { + fmt.Printf("sub_int32 0--2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_int32_0_ssa(-2147483647); got != -2147483647 { + fmt.Printf("sub_int32 -2147483647-0 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_0_int32_ssa(-1); got != 1 { + fmt.Printf("sub_int32 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int32_0_ssa(-1); got != -1 { + fmt.Printf("sub_int32 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_0_int32_ssa(0); got != 0 { + fmt.Printf("sub_int32 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int32_0_ssa(0); got != 0 { + fmt.Printf("sub_int32 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_int32_ssa(1); got != -1 { + fmt.Printf("sub_int32 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int32_0_ssa(1); got != 1 { + fmt.Printf("sub_int32 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_int32_ssa(2147483647); got != -2147483647 { + fmt.Printf("sub_int32 0-2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_int32_0_ssa(2147483647); got != 2147483647 { + fmt.Printf("sub_int32 2147483647-0 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_1_int32_ssa(-2147483648); got != -2147483647 { + fmt.Printf("sub_int32 1--2147483648 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_int32_1_ssa(-2147483648); got != 2147483647 { + fmt.Printf("sub_int32 -2147483648-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_1_int32_ssa(-2147483647); got != -2147483648 { + fmt.Printf("sub_int32 1--2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_int32_1_ssa(-2147483647); got != -2147483648 { + fmt.Printf("sub_int32 -2147483647-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_1_int32_ssa(-1); got != 2 { + fmt.Printf("sub_int32 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int32_1_ssa(-1); got != -2 { + fmt.Printf("sub_int32 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_1_int32_ssa(0); got != 1 { + fmt.Printf("sub_int32 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int32_1_ssa(0); got != -1 { + fmt.Printf("sub_int32 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_1_int32_ssa(1); got != 0 { + fmt.Printf("sub_int32 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int32_1_ssa(1); got != 0 { + fmt.Printf("sub_int32 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_int32_ssa(2147483647); got != -2147483646 { + fmt.Printf("sub_int32 1-2147483647 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := sub_int32_1_ssa(2147483647); got != 2147483646 { + fmt.Printf("sub_int32 2147483647-1 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := sub_2147483647_int32_ssa(-2147483648); got != -1 { + fmt.Printf("sub_int32 2147483647--2147483648 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int32_2147483647_ssa(-2147483648); got != 1 { + fmt.Printf("sub_int32 -2147483648-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_2147483647_int32_ssa(-2147483647); got != -2 { + fmt.Printf("sub_int32 2147483647--2147483647 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int32_2147483647_ssa(-2147483647); got != 2 { + fmt.Printf("sub_int32 -2147483647-2147483647 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_2147483647_int32_ssa(-1); got != -2147483648 { + fmt.Printf("sub_int32 2147483647--1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_int32_2147483647_ssa(-1); got != -2147483648 { + fmt.Printf("sub_int32 -1-2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := sub_2147483647_int32_ssa(0); got != 2147483647 { + fmt.Printf("sub_int32 2147483647-0 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := sub_int32_2147483647_ssa(0); got != -2147483647 { + fmt.Printf("sub_int32 0-2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := sub_2147483647_int32_ssa(1); got != 2147483646 { + fmt.Printf("sub_int32 2147483647-1 = %d, wanted 2147483646\n", got) + failed = true + } + + if got := sub_int32_2147483647_ssa(1); got != -2147483646 { + fmt.Printf("sub_int32 1-2147483647 = %d, wanted -2147483646\n", got) + failed = true + } + + if got := sub_2147483647_int32_ssa(2147483647); got != 0 { + fmt.Printf("sub_int32 2147483647-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int32_2147483647_ssa(2147483647); got != 0 { + fmt.Printf("sub_int32 2147483647-2147483647 = %d, wanted 0\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 := mul_Neg2147483648_int32_ssa(-2147483648); got != 0 { + fmt.Printf("mul_int32 -2147483648*-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_Neg2147483648_ssa(-2147483648); got != 0 { + fmt.Printf("mul_int32 -2147483648*-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg2147483648_int32_ssa(-2147483647); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*-2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_Neg2147483648_ssa(-2147483647); got != -2147483648 { + fmt.Printf("mul_int32 -2147483647*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_Neg2147483648_int32_ssa(-1); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_Neg2147483648_ssa(-1); got != -2147483648 { + fmt.Printf("mul_int32 -1*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_Neg2147483648_int32_ssa(0); got != 0 { + fmt.Printf("mul_int32 -2147483648*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_Neg2147483648_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg2147483648_int32_ssa(1); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_Neg2147483648_ssa(1); got != -2147483648 { + fmt.Printf("mul_int32 1*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_Neg2147483648_int32_ssa(2147483647); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_Neg2147483648_ssa(2147483647); got != -2147483648 { + fmt.Printf("mul_int32 2147483647*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_Neg2147483647_int32_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 -2147483647*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_Neg2147483647_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*-2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_Neg2147483647_int32_ssa(-2147483647); got != 1 { + fmt.Printf("mul_int32 -2147483647*-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int32_Neg2147483647_ssa(-2147483647); got != 1 { + fmt.Printf("mul_int32 -2147483647*-2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg2147483647_int32_ssa(-1); got != 2147483647 { + fmt.Printf("mul_int32 -2147483647*-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_int32_Neg2147483647_ssa(-1); got != 2147483647 { + fmt.Printf("mul_int32 -1*-2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_Neg2147483647_int32_ssa(0); got != 0 { + fmt.Printf("mul_int32 -2147483647*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_Neg2147483647_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg2147483647_int32_ssa(1); got != -2147483647 { + fmt.Printf("mul_int32 -2147483647*1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_int32_Neg2147483647_ssa(1); got != -2147483647 { + fmt.Printf("mul_int32 1*-2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_Neg2147483647_int32_ssa(2147483647); got != -1 { + fmt.Printf("mul_int32 -2147483647*2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int32_Neg2147483647_ssa(2147483647); got != -1 { + fmt.Printf("mul_int32 2147483647*-2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int32_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 -1*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_Neg1_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*-1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_Neg1_int32_ssa(-2147483647); got != 2147483647 { + fmt.Printf("mul_int32 -1*-2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_int32_Neg1_ssa(-2147483647); got != 2147483647 { + fmt.Printf("mul_int32 -2147483647*-1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_Neg1_int32_ssa(-1); got != 1 { + fmt.Printf("mul_int32 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int32_Neg1_ssa(-1); got != 1 { + fmt.Printf("mul_int32 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg1_int32_ssa(0); got != 0 { + fmt.Printf("mul_int32 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_Neg1_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg1_int32_ssa(1); got != -1 { + fmt.Printf("mul_int32 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int32_Neg1_ssa(1); got != -1 { + fmt.Printf("mul_int32 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int32_ssa(2147483647); got != -2147483647 { + fmt.Printf("mul_int32 -1*2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_int32_Neg1_ssa(2147483647); got != -2147483647 { + fmt.Printf("mul_int32 2147483647*-1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_0_int32_ssa(-2147483648); got != 0 { + fmt.Printf("mul_int32 0*-2147483648 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_0_ssa(-2147483648); got != 0 { + fmt.Printf("mul_int32 -2147483648*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int32_ssa(-2147483647); got != 0 { + fmt.Printf("mul_int32 0*-2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_0_ssa(-2147483647); got != 0 { + fmt.Printf("mul_int32 -2147483647*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int32_ssa(-1); got != 0 { + fmt.Printf("mul_int32 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_0_ssa(-1); got != 0 { + fmt.Printf("mul_int32 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int32_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_0_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int32_ssa(1); got != 0 { + fmt.Printf("mul_int32 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_0_ssa(1); got != 0 { + fmt.Printf("mul_int32 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int32_ssa(2147483647); got != 0 { + fmt.Printf("mul_int32 0*2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_0_ssa(2147483647); got != 0 { + fmt.Printf("mul_int32 2147483647*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int32_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 1*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_1_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*1 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_1_int32_ssa(-2147483647); got != -2147483647 { + fmt.Printf("mul_int32 1*-2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_int32_1_ssa(-2147483647); got != -2147483647 { + fmt.Printf("mul_int32 -2147483647*1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_1_int32_ssa(-1); got != -1 { + fmt.Printf("mul_int32 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int32_1_ssa(-1); got != -1 { + fmt.Printf("mul_int32 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_1_int32_ssa(0); got != 0 { + fmt.Printf("mul_int32 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_1_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int32_ssa(1); got != 1 { + fmt.Printf("mul_int32 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int32_1_ssa(1); got != 1 { + fmt.Printf("mul_int32 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_int32_ssa(2147483647); got != 2147483647 { + fmt.Printf("mul_int32 1*2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_int32_1_ssa(2147483647); got != 2147483647 { + fmt.Printf("mul_int32 2147483647*1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_2147483647_int32_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 2147483647*-2147483648 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_int32_2147483647_ssa(-2147483648); got != -2147483648 { + fmt.Printf("mul_int32 -2147483648*2147483647 = %d, wanted -2147483648\n", got) + failed = true + } + + if got := mul_2147483647_int32_ssa(-2147483647); got != -1 { + fmt.Printf("mul_int32 2147483647*-2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int32_2147483647_ssa(-2147483647); got != -1 { + fmt.Printf("mul_int32 -2147483647*2147483647 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_2147483647_int32_ssa(-1); got != -2147483647 { + fmt.Printf("mul_int32 2147483647*-1 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_int32_2147483647_ssa(-1); got != -2147483647 { + fmt.Printf("mul_int32 -1*2147483647 = %d, wanted -2147483647\n", got) + failed = true + } + + if got := mul_2147483647_int32_ssa(0); got != 0 { + fmt.Printf("mul_int32 2147483647*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int32_2147483647_ssa(0); got != 0 { + fmt.Printf("mul_int32 0*2147483647 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_2147483647_int32_ssa(1); got != 2147483647 { + fmt.Printf("mul_int32 2147483647*1 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_int32_2147483647_ssa(1); got != 2147483647 { + fmt.Printf("mul_int32 1*2147483647 = %d, wanted 2147483647\n", got) + failed = true + } + + if got := mul_2147483647_int32_ssa(2147483647); got != 1 { + fmt.Printf("mul_int32 2147483647*2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int32_2147483647_ssa(2147483647); got != 1 { + fmt.Printf("mul_int32 2147483647*2147483647 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint16_ssa(0); got != 0 { + fmt.Printf("add_uint16 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint16_0_ssa(0); got != 0 { + fmt.Printf("add_uint16 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_uint16_ssa(1); got != 1 { + fmt.Printf("add_uint16 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint16_0_ssa(1); got != 1 { + fmt.Printf("add_uint16 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint16_ssa(65535); got != 65535 { + fmt.Printf("add_uint16 0+65535 = %d, wanted 65535\n", got) + failed = true + } + + if got := add_uint16_0_ssa(65535); got != 65535 { + fmt.Printf("add_uint16 65535+0 = %d, wanted 65535\n", got) + failed = true + } + + if got := add_1_uint16_ssa(0); got != 1 { + fmt.Printf("add_uint16 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint16_1_ssa(0); got != 1 { + fmt.Printf("add_uint16 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_uint16_ssa(1); got != 2 { + fmt.Printf("add_uint16 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_uint16_1_ssa(1); got != 2 { + fmt.Printf("add_uint16 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_uint16_ssa(65535); got != 0 { + fmt.Printf("add_uint16 1+65535 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint16_1_ssa(65535); got != 0 { + fmt.Printf("add_uint16 65535+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_65535_uint16_ssa(0); got != 65535 { + fmt.Printf("add_uint16 65535+0 = %d, wanted 65535\n", got) + failed = true + } + + if got := add_uint16_65535_ssa(0); got != 65535 { + fmt.Printf("add_uint16 0+65535 = %d, wanted 65535\n", got) + failed = true + } + + if got := add_65535_uint16_ssa(1); got != 0 { + fmt.Printf("add_uint16 65535+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint16_65535_ssa(1); got != 0 { + fmt.Printf("add_uint16 1+65535 = %d, wanted 0\n", got) + failed = true + } + + if got := add_65535_uint16_ssa(65535); got != 65534 { + fmt.Printf("add_uint16 65535+65535 = %d, wanted 65534\n", got) + failed = true + } + + if got := add_uint16_65535_ssa(65535); got != 65534 { + fmt.Printf("add_uint16 65535+65535 = %d, wanted 65534\n", got) + failed = true + } + + if got := sub_0_uint16_ssa(0); got != 0 { + fmt.Printf("sub_uint16 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint16_0_ssa(0); got != 0 { + fmt.Printf("sub_uint16 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_uint16_ssa(1); got != 65535 { + fmt.Printf("sub_uint16 0-1 = %d, wanted 65535\n", got) + failed = true + } + + if got := sub_uint16_0_ssa(1); got != 1 { + fmt.Printf("sub_uint16 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_uint16_ssa(65535); got != 1 { + fmt.Printf("sub_uint16 0-65535 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint16_0_ssa(65535); got != 65535 { + fmt.Printf("sub_uint16 65535-0 = %d, wanted 65535\n", got) + failed = true + } + + if got := sub_1_uint16_ssa(0); got != 1 { + fmt.Printf("sub_uint16 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint16_1_ssa(0); got != 65535 { + fmt.Printf("sub_uint16 0-1 = %d, wanted 65535\n", got) + failed = true + } + + if got := sub_1_uint16_ssa(1); got != 0 { + fmt.Printf("sub_uint16 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint16_1_ssa(1); got != 0 { + fmt.Printf("sub_uint16 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_uint16_ssa(65535); got != 2 { + fmt.Printf("sub_uint16 1-65535 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_uint16_1_ssa(65535); got != 65534 { + fmt.Printf("sub_uint16 65535-1 = %d, wanted 65534\n", got) + failed = true + } + + if got := sub_65535_uint16_ssa(0); got != 65535 { + fmt.Printf("sub_uint16 65535-0 = %d, wanted 65535\n", got) + failed = true + } + + if got := sub_uint16_65535_ssa(0); got != 1 { + fmt.Printf("sub_uint16 0-65535 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_65535_uint16_ssa(1); got != 65534 { + fmt.Printf("sub_uint16 65535-1 = %d, wanted 65534\n", got) + failed = true + } + + if got := sub_uint16_65535_ssa(1); got != 2 { + fmt.Printf("sub_uint16 1-65535 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_65535_uint16_ssa(65535); got != 0 { + fmt.Printf("sub_uint16 65535-65535 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint16_65535_ssa(65535); got != 0 { + fmt.Printf("sub_uint16 65535-65535 = %d, wanted 0\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 := mul_0_uint16_ssa(0); got != 0 { + fmt.Printf("mul_uint16 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint16_0_ssa(0); got != 0 { + fmt.Printf("mul_uint16 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint16_ssa(1); got != 0 { + fmt.Printf("mul_uint16 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint16_0_ssa(1); got != 0 { + fmt.Printf("mul_uint16 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint16_ssa(65535); got != 0 { + fmt.Printf("mul_uint16 0*65535 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint16_0_ssa(65535); got != 0 { + fmt.Printf("mul_uint16 65535*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint16_ssa(0); got != 0 { + fmt.Printf("mul_uint16 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint16_1_ssa(0); got != 0 { + fmt.Printf("mul_uint16 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint16_ssa(1); got != 1 { + fmt.Printf("mul_uint16 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint16_1_ssa(1); got != 1 { + fmt.Printf("mul_uint16 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_uint16_ssa(65535); got != 65535 { + fmt.Printf("mul_uint16 1*65535 = %d, wanted 65535\n", got) + failed = true + } + + if got := mul_uint16_1_ssa(65535); got != 65535 { + fmt.Printf("mul_uint16 65535*1 = %d, wanted 65535\n", got) + failed = true + } + + if got := mul_65535_uint16_ssa(0); got != 0 { + fmt.Printf("mul_uint16 65535*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint16_65535_ssa(0); got != 0 { + fmt.Printf("mul_uint16 0*65535 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_65535_uint16_ssa(1); got != 65535 { + fmt.Printf("mul_uint16 65535*1 = %d, wanted 65535\n", got) + failed = true + } + + if got := mul_uint16_65535_ssa(1); got != 65535 { + fmt.Printf("mul_uint16 1*65535 = %d, wanted 65535\n", got) + failed = true + } + + if got := mul_65535_uint16_ssa(65535); got != 1 { + fmt.Printf("mul_uint16 65535*65535 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint16_65535_ssa(65535); got != 1 { + fmt.Printf("mul_uint16 65535*65535 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint16_ssa(0); got != 0 { + fmt.Printf("lsh_uint16 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint16_0_ssa(0); got != 0 { + fmt.Printf("lsh_uint16 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_0_uint16_ssa(1); got != 0 { + fmt.Printf("lsh_uint16 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint16_0_ssa(1); got != 1 { + fmt.Printf("lsh_uint16 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint16_ssa(65535); got != 0 { + fmt.Printf("lsh_uint16 0<<65535 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint16_0_ssa(65535); got != 65535 { + fmt.Printf("lsh_uint16 65535<<0 = %d, wanted 65535\n", got) + failed = true + } + + if got := lsh_1_uint16_ssa(0); got != 1 { + fmt.Printf("lsh_uint16 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_uint16_1_ssa(0); got != 0 { + fmt.Printf("lsh_uint16 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_1_uint16_ssa(1); got != 2 { + fmt.Printf("lsh_uint16 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_uint16_1_ssa(1); got != 2 { + fmt.Printf("lsh_uint16 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_1_uint16_ssa(65535); got != 0 { + fmt.Printf("lsh_uint16 1<<65535 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint16_1_ssa(65535); got != 65534 { + fmt.Printf("lsh_uint16 65535<<1 = %d, wanted 65534\n", got) + failed = true + } + + if got := lsh_65535_uint16_ssa(0); got != 65535 { + fmt.Printf("lsh_uint16 65535<<0 = %d, wanted 65535\n", got) + failed = true + } + + if got := lsh_uint16_65535_ssa(0); got != 0 { + fmt.Printf("lsh_uint16 0<<65535 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_65535_uint16_ssa(1); got != 65534 { + fmt.Printf("lsh_uint16 65535<<1 = %d, wanted 65534\n", got) + failed = true + } + + if got := lsh_uint16_65535_ssa(1); got != 0 { + fmt.Printf("lsh_uint16 1<<65535 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_65535_uint16_ssa(65535); got != 0 { + fmt.Printf("lsh_uint16 65535<<65535 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint16_65535_ssa(65535); got != 0 { + fmt.Printf("lsh_uint16 65535<<65535 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint16_ssa(0); got != 0 { + fmt.Printf("rsh_uint16 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint16_0_ssa(0); got != 0 { + fmt.Printf("rsh_uint16 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint16_ssa(1); got != 0 { + fmt.Printf("rsh_uint16 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint16_0_ssa(1); got != 1 { + fmt.Printf("rsh_uint16 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_0_uint16_ssa(65535); got != 0 { + fmt.Printf("rsh_uint16 0>>65535 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint16_0_ssa(65535); got != 65535 { + fmt.Printf("rsh_uint16 65535>>0 = %d, wanted 65535\n", got) + failed = true + } + + if got := rsh_1_uint16_ssa(0); got != 1 { + fmt.Printf("rsh_uint16 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_uint16_1_ssa(0); got != 0 { + fmt.Printf("rsh_uint16 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint16_ssa(1); got != 0 { + fmt.Printf("rsh_uint16 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint16_1_ssa(1); got != 0 { + fmt.Printf("rsh_uint16 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint16_ssa(65535); got != 0 { + fmt.Printf("rsh_uint16 1>>65535 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint16_1_ssa(65535); got != 32767 { + fmt.Printf("rsh_uint16 65535>>1 = %d, wanted 32767\n", got) + failed = true + } + + if got := rsh_65535_uint16_ssa(0); got != 65535 { + fmt.Printf("rsh_uint16 65535>>0 = %d, wanted 65535\n", got) + failed = true + } + + if got := rsh_uint16_65535_ssa(0); got != 0 { + fmt.Printf("rsh_uint16 0>>65535 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_65535_uint16_ssa(1); got != 32767 { + fmt.Printf("rsh_uint16 65535>>1 = %d, wanted 32767\n", got) + failed = true + } + + if got := rsh_uint16_65535_ssa(1); got != 0 { + fmt.Printf("rsh_uint16 1>>65535 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_65535_uint16_ssa(65535); got != 0 { + fmt.Printf("rsh_uint16 65535>>65535 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint16_65535_ssa(65535); got != 0 { + fmt.Printf("rsh_uint16 65535>>65535 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(-32768); got != 0 { + fmt.Printf("add_int16 -32768+-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(-32768); got != 0 { + fmt.Printf("add_int16 -32768+-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(-32767); got != 1 { + fmt.Printf("add_int16 -32768+-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(-32767); got != 1 { + fmt.Printf("add_int16 -32767+-32768 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(-1); got != 32767 { + fmt.Printf("add_int16 -32768+-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(-1); got != 32767 { + fmt.Printf("add_int16 -1+-32768 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(0); got != -32768 { + fmt.Printf("add_int16 -32768+0 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(0); got != -32768 { + fmt.Printf("add_int16 0+-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(1); got != -32767 { + fmt.Printf("add_int16 -32768+1 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(1); got != -32767 { + fmt.Printf("add_int16 1+-32768 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(32766); got != -2 { + fmt.Printf("add_int16 -32768+32766 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(32766); got != -2 { + fmt.Printf("add_int16 32766+-32768 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg32768_int16_ssa(32767); got != -1 { + fmt.Printf("add_int16 -32768+32767 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int16_Neg32768_ssa(32767); got != -1 { + fmt.Printf("add_int16 32767+-32768 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(-32768); got != 1 { + fmt.Printf("add_int16 -32767+-32768 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(-32768); got != 1 { + fmt.Printf("add_int16 -32768+-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(-32767); got != 2 { + fmt.Printf("add_int16 -32767+-32767 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(-32767); got != 2 { + fmt.Printf("add_int16 -32767+-32767 = %d, wanted 2\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(-1); got != -32768 { + fmt.Printf("add_int16 -32767+-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(-1); got != -32768 { + fmt.Printf("add_int16 -1+-32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(0); got != -32767 { + fmt.Printf("add_int16 -32767+0 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(0); got != -32767 { + fmt.Printf("add_int16 0+-32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(1); got != -32766 { + fmt.Printf("add_int16 -32767+1 = %d, wanted -32766\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(1); got != -32766 { + fmt.Printf("add_int16 1+-32767 = %d, wanted -32766\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(32766); got != -1 { + fmt.Printf("add_int16 -32767+32766 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(32766); got != -1 { + fmt.Printf("add_int16 32766+-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg32767_int16_ssa(32767); got != 0 { + fmt.Printf("add_int16 -32767+32767 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int16_Neg32767_ssa(32767); got != 0 { + fmt.Printf("add_int16 32767+-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(-32768); got != 32767 { + fmt.Printf("add_int16 -1+-32768 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(-32768); got != 32767 { + fmt.Printf("add_int16 -32768+-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(-32767); got != -32768 { + fmt.Printf("add_int16 -1+-32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(-32767); got != -32768 { + fmt.Printf("add_int16 -32767+-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(-1); got != -2 { + fmt.Printf("add_int16 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(-1); got != -2 { + fmt.Printf("add_int16 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(0); got != -1 { + fmt.Printf("add_int16 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(0); got != -1 { + fmt.Printf("add_int16 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(1); got != 0 { + fmt.Printf("add_int16 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(1); got != 0 { + fmt.Printf("add_int16 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(32766); got != 32765 { + fmt.Printf("add_int16 -1+32766 = %d, wanted 32765\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(32766); got != 32765 { + fmt.Printf("add_int16 32766+-1 = %d, wanted 32765\n", got) + failed = true + } + + if got := add_Neg1_int16_ssa(32767); got != 32766 { + fmt.Printf("add_int16 -1+32767 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_int16_Neg1_ssa(32767); got != 32766 { + fmt.Printf("add_int16 32767+-1 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_0_int16_ssa(-32768); got != -32768 { + fmt.Printf("add_int16 0+-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_int16_0_ssa(-32768); got != -32768 { + fmt.Printf("add_int16 -32768+0 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_0_int16_ssa(-32767); got != -32767 { + fmt.Printf("add_int16 0+-32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_int16_0_ssa(-32767); got != -32767 { + fmt.Printf("add_int16 -32767+0 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_0_int16_ssa(-1); got != -1 { + fmt.Printf("add_int16 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int16_0_ssa(-1); got != -1 { + fmt.Printf("add_int16 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_0_int16_ssa(0); got != 0 { + fmt.Printf("add_int16 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int16_0_ssa(0); got != 0 { + fmt.Printf("add_int16 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_int16_ssa(1); got != 1 { + fmt.Printf("add_int16 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int16_0_ssa(1); got != 1 { + fmt.Printf("add_int16 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_int16_ssa(32766); got != 32766 { + fmt.Printf("add_int16 0+32766 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_int16_0_ssa(32766); got != 32766 { + fmt.Printf("add_int16 32766+0 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_0_int16_ssa(32767); got != 32767 { + fmt.Printf("add_int16 0+32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_int16_0_ssa(32767); got != 32767 { + fmt.Printf("add_int16 32767+0 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_1_int16_ssa(-32768); got != -32767 { + fmt.Printf("add_int16 1+-32768 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_int16_1_ssa(-32768); got != -32767 { + fmt.Printf("add_int16 -32768+1 = %d, wanted -32767\n", got) + failed = true + } + + if got := add_1_int16_ssa(-32767); got != -32766 { + fmt.Printf("add_int16 1+-32767 = %d, wanted -32766\n", got) + failed = true + } + + if got := add_int16_1_ssa(-32767); got != -32766 { + fmt.Printf("add_int16 -32767+1 = %d, wanted -32766\n", got) + failed = true + } + + if got := add_1_int16_ssa(-1); got != 0 { + fmt.Printf("add_int16 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int16_1_ssa(-1); got != 0 { + fmt.Printf("add_int16 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_1_int16_ssa(0); got != 1 { + fmt.Printf("add_int16 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int16_1_ssa(0); got != 1 { + fmt.Printf("add_int16 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_int16_ssa(1); got != 2 { + fmt.Printf("add_int16 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int16_1_ssa(1); got != 2 { + fmt.Printf("add_int16 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_int16_ssa(32766); got != 32767 { + fmt.Printf("add_int16 1+32766 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_int16_1_ssa(32766); got != 32767 { + fmt.Printf("add_int16 32766+1 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_1_int16_ssa(32767); got != -32768 { + fmt.Printf("add_int16 1+32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_int16_1_ssa(32767); got != -32768 { + fmt.Printf("add_int16 32767+1 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_32766_int16_ssa(-32768); got != -2 { + fmt.Printf("add_int16 32766+-32768 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int16_32766_ssa(-32768); got != -2 { + fmt.Printf("add_int16 -32768+32766 = %d, wanted -2\n", got) + failed = true + } + + if got := add_32766_int16_ssa(-32767); got != -1 { + fmt.Printf("add_int16 32766+-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int16_32766_ssa(-32767); got != -1 { + fmt.Printf("add_int16 -32767+32766 = %d, wanted -1\n", got) + failed = true + } + + if got := add_32766_int16_ssa(-1); got != 32765 { + fmt.Printf("add_int16 32766+-1 = %d, wanted 32765\n", got) + failed = true + } + + if got := add_int16_32766_ssa(-1); got != 32765 { + fmt.Printf("add_int16 -1+32766 = %d, wanted 32765\n", got) + failed = true + } + + if got := add_32766_int16_ssa(0); got != 32766 { + fmt.Printf("add_int16 32766+0 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_int16_32766_ssa(0); got != 32766 { + fmt.Printf("add_int16 0+32766 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_32766_int16_ssa(1); got != 32767 { + fmt.Printf("add_int16 32766+1 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_int16_32766_ssa(1); got != 32767 { + fmt.Printf("add_int16 1+32766 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_32766_int16_ssa(32766); got != -4 { + fmt.Printf("add_int16 32766+32766 = %d, wanted -4\n", got) + failed = true + } + + if got := add_int16_32766_ssa(32766); got != -4 { + fmt.Printf("add_int16 32766+32766 = %d, wanted -4\n", got) + failed = true + } + + if got := add_32766_int16_ssa(32767); got != -3 { + fmt.Printf("add_int16 32766+32767 = %d, wanted -3\n", got) + failed = true + } + + if got := add_int16_32766_ssa(32767); got != -3 { + fmt.Printf("add_int16 32767+32766 = %d, wanted -3\n", got) + failed = true + } + + if got := add_32767_int16_ssa(-32768); got != -1 { + fmt.Printf("add_int16 32767+-32768 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int16_32767_ssa(-32768); got != -1 { + fmt.Printf("add_int16 -32768+32767 = %d, wanted -1\n", got) + failed = true + } + + if got := add_32767_int16_ssa(-32767); got != 0 { + fmt.Printf("add_int16 32767+-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int16_32767_ssa(-32767); got != 0 { + fmt.Printf("add_int16 -32767+32767 = %d, wanted 0\n", got) + failed = true + } + + if got := add_32767_int16_ssa(-1); got != 32766 { + fmt.Printf("add_int16 32767+-1 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_int16_32767_ssa(-1); got != 32766 { + fmt.Printf("add_int16 -1+32767 = %d, wanted 32766\n", got) + failed = true + } + + if got := add_32767_int16_ssa(0); got != 32767 { + fmt.Printf("add_int16 32767+0 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_int16_32767_ssa(0); got != 32767 { + fmt.Printf("add_int16 0+32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := add_32767_int16_ssa(1); got != -32768 { + fmt.Printf("add_int16 32767+1 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_int16_32767_ssa(1); got != -32768 { + fmt.Printf("add_int16 1+32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := add_32767_int16_ssa(32766); got != -3 { + fmt.Printf("add_int16 32767+32766 = %d, wanted -3\n", got) + failed = true + } + + if got := add_int16_32767_ssa(32766); got != -3 { + fmt.Printf("add_int16 32766+32767 = %d, wanted -3\n", got) + failed = true + } + + if got := add_32767_int16_ssa(32767); got != -2 { + fmt.Printf("add_int16 32767+32767 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int16_32767_ssa(32767); got != -2 { + fmt.Printf("add_int16 32767+32767 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(-32768); got != 0 { + fmt.Printf("sub_int16 -32768--32768 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(-32768); got != 0 { + fmt.Printf("sub_int16 -32768--32768 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(-32767); got != -1 { + fmt.Printf("sub_int16 -32768--32767 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(-32767); got != 1 { + fmt.Printf("sub_int16 -32767--32768 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(-1); got != -32767 { + fmt.Printf("sub_int16 -32768--1 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(-1); got != 32767 { + fmt.Printf("sub_int16 -1--32768 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(0); got != -32768 { + fmt.Printf("sub_int16 -32768-0 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(0); got != -32768 { + fmt.Printf("sub_int16 0--32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(1); got != 32767 { + fmt.Printf("sub_int16 -32768-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(1); got != -32767 { + fmt.Printf("sub_int16 1--32768 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(32766); got != 2 { + fmt.Printf("sub_int16 -32768-32766 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(32766); got != -2 { + fmt.Printf("sub_int16 32766--32768 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg32768_int16_ssa(32767); got != 1 { + fmt.Printf("sub_int16 -32768-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int16_Neg32768_ssa(32767); got != -1 { + fmt.Printf("sub_int16 32767--32768 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(-32768); got != 1 { + fmt.Printf("sub_int16 -32767--32768 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(-32768); got != -1 { + fmt.Printf("sub_int16 -32768--32767 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(-32767); got != 0 { + fmt.Printf("sub_int16 -32767--32767 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(-32767); got != 0 { + fmt.Printf("sub_int16 -32767--32767 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(-1); got != -32766 { + fmt.Printf("sub_int16 -32767--1 = %d, wanted -32766\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(-1); got != 32766 { + fmt.Printf("sub_int16 -1--32767 = %d, wanted 32766\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(0); got != -32767 { + fmt.Printf("sub_int16 -32767-0 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(0); got != 32767 { + fmt.Printf("sub_int16 0--32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(1); got != -32768 { + fmt.Printf("sub_int16 -32767-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(1); got != -32768 { + fmt.Printf("sub_int16 1--32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(32766); got != 3 { + fmt.Printf("sub_int16 -32767-32766 = %d, wanted 3\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(32766); got != -3 { + fmt.Printf("sub_int16 32766--32767 = %d, wanted -3\n", got) + failed = true + } + + if got := sub_Neg32767_int16_ssa(32767); got != 2 { + fmt.Printf("sub_int16 -32767-32767 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int16_Neg32767_ssa(32767); got != -2 { + fmt.Printf("sub_int16 32767--32767 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(-32768); got != 32767 { + fmt.Printf("sub_int16 -1--32768 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(-32768); got != -32767 { + fmt.Printf("sub_int16 -32768--1 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(-32767); got != 32766 { + fmt.Printf("sub_int16 -1--32767 = %d, wanted 32766\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(-32767); got != -32766 { + fmt.Printf("sub_int16 -32767--1 = %d, wanted -32766\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(-1); got != 0 { + fmt.Printf("sub_int16 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(-1); got != 0 { + fmt.Printf("sub_int16 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(0); got != -1 { + fmt.Printf("sub_int16 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(0); got != 1 { + fmt.Printf("sub_int16 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(1); got != -2 { + fmt.Printf("sub_int16 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(1); got != 2 { + fmt.Printf("sub_int16 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(32766); got != -32767 { + fmt.Printf("sub_int16 -1-32766 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(32766); got != 32767 { + fmt.Printf("sub_int16 32766--1 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_Neg1_int16_ssa(32767); got != -32768 { + fmt.Printf("sub_int16 -1-32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_int16_Neg1_ssa(32767); got != -32768 { + fmt.Printf("sub_int16 32767--1 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_0_int16_ssa(-32768); got != -32768 { + fmt.Printf("sub_int16 0--32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_int16_0_ssa(-32768); got != -32768 { + fmt.Printf("sub_int16 -32768-0 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_0_int16_ssa(-32767); got != 32767 { + fmt.Printf("sub_int16 0--32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_int16_0_ssa(-32767); got != -32767 { + fmt.Printf("sub_int16 -32767-0 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_0_int16_ssa(-1); got != 1 { + fmt.Printf("sub_int16 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int16_0_ssa(-1); got != -1 { + fmt.Printf("sub_int16 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_0_int16_ssa(0); got != 0 { + fmt.Printf("sub_int16 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_0_ssa(0); got != 0 { + fmt.Printf("sub_int16 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_int16_ssa(1); got != -1 { + fmt.Printf("sub_int16 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int16_0_ssa(1); got != 1 { + fmt.Printf("sub_int16 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_int16_ssa(32766); got != -32766 { + fmt.Printf("sub_int16 0-32766 = %d, wanted -32766\n", got) + failed = true + } + + if got := sub_int16_0_ssa(32766); got != 32766 { + fmt.Printf("sub_int16 32766-0 = %d, wanted 32766\n", got) + failed = true + } + + if got := sub_0_int16_ssa(32767); got != -32767 { + fmt.Printf("sub_int16 0-32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_int16_0_ssa(32767); got != 32767 { + fmt.Printf("sub_int16 32767-0 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_1_int16_ssa(-32768); got != -32767 { + fmt.Printf("sub_int16 1--32768 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_int16_1_ssa(-32768); got != 32767 { + fmt.Printf("sub_int16 -32768-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_1_int16_ssa(-32767); got != -32768 { + fmt.Printf("sub_int16 1--32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_int16_1_ssa(-32767); got != -32768 { + fmt.Printf("sub_int16 -32767-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_1_int16_ssa(-1); got != 2 { + fmt.Printf("sub_int16 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int16_1_ssa(-1); got != -2 { + fmt.Printf("sub_int16 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_1_int16_ssa(0); got != 1 { + fmt.Printf("sub_int16 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int16_1_ssa(0); got != -1 { + fmt.Printf("sub_int16 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_1_int16_ssa(1); got != 0 { + fmt.Printf("sub_int16 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_1_ssa(1); got != 0 { + fmt.Printf("sub_int16 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_int16_ssa(32766); got != -32765 { + fmt.Printf("sub_int16 1-32766 = %d, wanted -32765\n", got) + failed = true + } + + if got := sub_int16_1_ssa(32766); got != 32765 { + fmt.Printf("sub_int16 32766-1 = %d, wanted 32765\n", got) + failed = true + } + + if got := sub_1_int16_ssa(32767); got != -32766 { + fmt.Printf("sub_int16 1-32767 = %d, wanted -32766\n", got) + failed = true + } + + if got := sub_int16_1_ssa(32767); got != 32766 { + fmt.Printf("sub_int16 32767-1 = %d, wanted 32766\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(-32768); got != -2 { + fmt.Printf("sub_int16 32766--32768 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(-32768); got != 2 { + fmt.Printf("sub_int16 -32768-32766 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(-32767); got != -3 { + fmt.Printf("sub_int16 32766--32767 = %d, wanted -3\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(-32767); got != 3 { + fmt.Printf("sub_int16 -32767-32766 = %d, wanted 3\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(-1); got != 32767 { + fmt.Printf("sub_int16 32766--1 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(-1); got != -32767 { + fmt.Printf("sub_int16 -1-32766 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(0); got != 32766 { + fmt.Printf("sub_int16 32766-0 = %d, wanted 32766\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(0); got != -32766 { + fmt.Printf("sub_int16 0-32766 = %d, wanted -32766\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(1); got != 32765 { + fmt.Printf("sub_int16 32766-1 = %d, wanted 32765\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(1); got != -32765 { + fmt.Printf("sub_int16 1-32766 = %d, wanted -32765\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(32766); got != 0 { + fmt.Printf("sub_int16 32766-32766 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(32766); got != 0 { + fmt.Printf("sub_int16 32766-32766 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_32766_int16_ssa(32767); got != -1 { + fmt.Printf("sub_int16 32766-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int16_32766_ssa(32767); got != 1 { + fmt.Printf("sub_int16 32767-32766 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(-32768); got != -1 { + fmt.Printf("sub_int16 32767--32768 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(-32768); got != 1 { + fmt.Printf("sub_int16 -32768-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(-32767); got != -2 { + fmt.Printf("sub_int16 32767--32767 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(-32767); got != 2 { + fmt.Printf("sub_int16 -32767-32767 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(-1); got != -32768 { + fmt.Printf("sub_int16 32767--1 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(-1); got != -32768 { + fmt.Printf("sub_int16 -1-32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(0); got != 32767 { + fmt.Printf("sub_int16 32767-0 = %d, wanted 32767\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(0); got != -32767 { + fmt.Printf("sub_int16 0-32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(1); got != 32766 { + fmt.Printf("sub_int16 32767-1 = %d, wanted 32766\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(1); got != -32766 { + fmt.Printf("sub_int16 1-32767 = %d, wanted -32766\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(32766); got != 1 { + fmt.Printf("sub_int16 32767-32766 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(32766); got != -1 { + fmt.Printf("sub_int16 32766-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_32767_int16_ssa(32767); got != 0 { + fmt.Printf("sub_int16 32767-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int16_32767_ssa(32767); got != 0 { + fmt.Printf("sub_int16 32767-32767 = %d, wanted 0\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 := mul_Neg32768_int16_ssa(-32768); got != 0 { + fmt.Printf("mul_int16 -32768*-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(-32768); got != 0 { + fmt.Printf("mul_int16 -32768*-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg32768_int16_ssa(-32767); got != -32768 { + fmt.Printf("mul_int16 -32768*-32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(-32767); got != -32768 { + fmt.Printf("mul_int16 -32767*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_Neg32768_int16_ssa(-1); got != -32768 { + fmt.Printf("mul_int16 -32768*-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(-1); got != -32768 { + fmt.Printf("mul_int16 -1*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_Neg32768_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 -32768*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg32768_int16_ssa(1); got != -32768 { + fmt.Printf("mul_int16 -32768*1 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(1); got != -32768 { + fmt.Printf("mul_int16 1*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_Neg32768_int16_ssa(32766); got != 0 { + fmt.Printf("mul_int16 -32768*32766 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(32766); got != 0 { + fmt.Printf("mul_int16 32766*-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg32768_int16_ssa(32767); got != -32768 { + fmt.Printf("mul_int16 -32768*32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_Neg32768_ssa(32767); got != -32768 { + fmt.Printf("mul_int16 32767*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 -32767*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 -32768*-32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(-32767); got != 1 { + fmt.Printf("mul_int16 -32767*-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(-32767); got != 1 { + fmt.Printf("mul_int16 -32767*-32767 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(-1); got != 32767 { + fmt.Printf("mul_int16 -32767*-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(-1); got != 32767 { + fmt.Printf("mul_int16 -1*-32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 -32767*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(1); got != -32767 { + fmt.Printf("mul_int16 -32767*1 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(1); got != -32767 { + fmt.Printf("mul_int16 1*-32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(32766); got != 32766 { + fmt.Printf("mul_int16 -32767*32766 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(32766); got != 32766 { + fmt.Printf("mul_int16 32766*-32767 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_Neg32767_int16_ssa(32767); got != -1 { + fmt.Printf("mul_int16 -32767*32767 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int16_Neg32767_ssa(32767); got != -1 { + fmt.Printf("mul_int16 32767*-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 -1*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 -32768*-1 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(-32767); got != 32767 { + fmt.Printf("mul_int16 -1*-32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(-32767); got != 32767 { + fmt.Printf("mul_int16 -32767*-1 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(-1); got != 1 { + fmt.Printf("mul_int16 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(-1); got != 1 { + fmt.Printf("mul_int16 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(1); got != -1 { + fmt.Printf("mul_int16 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(1); got != -1 { + fmt.Printf("mul_int16 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(32766); got != -32766 { + fmt.Printf("mul_int16 -1*32766 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(32766); got != -32766 { + fmt.Printf("mul_int16 32766*-1 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_Neg1_int16_ssa(32767); got != -32767 { + fmt.Printf("mul_int16 -1*32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_int16_Neg1_ssa(32767); got != -32767 { + fmt.Printf("mul_int16 32767*-1 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_0_int16_ssa(-32768); got != 0 { + fmt.Printf("mul_int16 0*-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(-32768); got != 0 { + fmt.Printf("mul_int16 -32768*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int16_ssa(-32767); got != 0 { + fmt.Printf("mul_int16 0*-32767 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(-32767); got != 0 { + fmt.Printf("mul_int16 -32767*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int16_ssa(-1); got != 0 { + fmt.Printf("mul_int16 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(-1); got != 0 { + fmt.Printf("mul_int16 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int16_ssa(1); got != 0 { + fmt.Printf("mul_int16 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(1); got != 0 { + fmt.Printf("mul_int16 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int16_ssa(32766); got != 0 { + fmt.Printf("mul_int16 0*32766 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(32766); got != 0 { + fmt.Printf("mul_int16 32766*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int16_ssa(32767); got != 0 { + fmt.Printf("mul_int16 0*32767 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_0_ssa(32767); got != 0 { + fmt.Printf("mul_int16 32767*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int16_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 1*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_1_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 -32768*1 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_1_int16_ssa(-32767); got != -32767 { + fmt.Printf("mul_int16 1*-32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_int16_1_ssa(-32767); got != -32767 { + fmt.Printf("mul_int16 -32767*1 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_1_int16_ssa(-1); got != -1 { + fmt.Printf("mul_int16 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int16_1_ssa(-1); got != -1 { + fmt.Printf("mul_int16 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_1_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_1_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int16_ssa(1); got != 1 { + fmt.Printf("mul_int16 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int16_1_ssa(1); got != 1 { + fmt.Printf("mul_int16 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_int16_ssa(32766); got != 32766 { + fmt.Printf("mul_int16 1*32766 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_int16_1_ssa(32766); got != 32766 { + fmt.Printf("mul_int16 32766*1 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_1_int16_ssa(32767); got != 32767 { + fmt.Printf("mul_int16 1*32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_int16_1_ssa(32767); got != 32767 { + fmt.Printf("mul_int16 32767*1 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(-32768); got != 0 { + fmt.Printf("mul_int16 32766*-32768 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(-32768); got != 0 { + fmt.Printf("mul_int16 -32768*32766 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(-32767); got != 32766 { + fmt.Printf("mul_int16 32766*-32767 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(-32767); got != 32766 { + fmt.Printf("mul_int16 -32767*32766 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(-1); got != -32766 { + fmt.Printf("mul_int16 32766*-1 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(-1); got != -32766 { + fmt.Printf("mul_int16 -1*32766 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 32766*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*32766 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(1); got != 32766 { + fmt.Printf("mul_int16 32766*1 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(1); got != 32766 { + fmt.Printf("mul_int16 1*32766 = %d, wanted 32766\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(32766); got != 4 { + fmt.Printf("mul_int16 32766*32766 = %d, wanted 4\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(32766); got != 4 { + fmt.Printf("mul_int16 32766*32766 = %d, wanted 4\n", got) + failed = true + } + + if got := mul_32766_int16_ssa(32767); got != -32766 { + fmt.Printf("mul_int16 32766*32767 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_int16_32766_ssa(32767); got != -32766 { + fmt.Printf("mul_int16 32767*32766 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 32767*-32768 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(-32768); got != -32768 { + fmt.Printf("mul_int16 -32768*32767 = %d, wanted -32768\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(-32767); got != -1 { + fmt.Printf("mul_int16 32767*-32767 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(-32767); got != -1 { + fmt.Printf("mul_int16 -32767*32767 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(-1); got != -32767 { + fmt.Printf("mul_int16 32767*-1 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(-1); got != -32767 { + fmt.Printf("mul_int16 -1*32767 = %d, wanted -32767\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(0); got != 0 { + fmt.Printf("mul_int16 32767*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(0); got != 0 { + fmt.Printf("mul_int16 0*32767 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(1); got != 32767 { + fmt.Printf("mul_int16 32767*1 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(1); got != 32767 { + fmt.Printf("mul_int16 1*32767 = %d, wanted 32767\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(32766); got != -32766 { + fmt.Printf("mul_int16 32767*32766 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(32766); got != -32766 { + fmt.Printf("mul_int16 32766*32767 = %d, wanted -32766\n", got) + failed = true + } + + if got := mul_32767_int16_ssa(32767); got != 1 { + fmt.Printf("mul_int16 32767*32767 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int16_32767_ssa(32767); got != 1 { + fmt.Printf("mul_int16 32767*32767 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint8_ssa(0); got != 0 { + fmt.Printf("add_uint8 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint8_0_ssa(0); got != 0 { + fmt.Printf("add_uint8 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_uint8_ssa(1); got != 1 { + fmt.Printf("add_uint8 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint8_0_ssa(1); got != 1 { + fmt.Printf("add_uint8 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_uint8_ssa(255); got != 255 { + fmt.Printf("add_uint8 0+255 = %d, wanted 255\n", got) + failed = true + } + + if got := add_uint8_0_ssa(255); got != 255 { + fmt.Printf("add_uint8 255+0 = %d, wanted 255\n", got) + failed = true + } + + if got := add_1_uint8_ssa(0); got != 1 { + fmt.Printf("add_uint8 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_uint8_1_ssa(0); got != 1 { + fmt.Printf("add_uint8 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_uint8_ssa(1); got != 2 { + fmt.Printf("add_uint8 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_uint8_1_ssa(1); got != 2 { + fmt.Printf("add_uint8 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_uint8_ssa(255); got != 0 { + fmt.Printf("add_uint8 1+255 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint8_1_ssa(255); got != 0 { + fmt.Printf("add_uint8 255+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_255_uint8_ssa(0); got != 255 { + fmt.Printf("add_uint8 255+0 = %d, wanted 255\n", got) + failed = true + } + + if got := add_uint8_255_ssa(0); got != 255 { + fmt.Printf("add_uint8 0+255 = %d, wanted 255\n", got) + failed = true + } + + if got := add_255_uint8_ssa(1); got != 0 { + fmt.Printf("add_uint8 255+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_uint8_255_ssa(1); got != 0 { + fmt.Printf("add_uint8 1+255 = %d, wanted 0\n", got) + failed = true + } + + if got := add_255_uint8_ssa(255); got != 254 { + fmt.Printf("add_uint8 255+255 = %d, wanted 254\n", got) + failed = true + } + + if got := add_uint8_255_ssa(255); got != 254 { + fmt.Printf("add_uint8 255+255 = %d, wanted 254\n", got) + failed = true + } + + if got := sub_0_uint8_ssa(0); got != 0 { + fmt.Printf("sub_uint8 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint8_0_ssa(0); got != 0 { + fmt.Printf("sub_uint8 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_uint8_ssa(1); got != 255 { + fmt.Printf("sub_uint8 0-1 = %d, wanted 255\n", got) + failed = true + } + + if got := sub_uint8_0_ssa(1); got != 1 { + fmt.Printf("sub_uint8 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_uint8_ssa(255); got != 1 { + fmt.Printf("sub_uint8 0-255 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint8_0_ssa(255); got != 255 { + fmt.Printf("sub_uint8 255-0 = %d, wanted 255\n", got) + failed = true + } + + if got := sub_1_uint8_ssa(0); got != 1 { + fmt.Printf("sub_uint8 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_uint8_1_ssa(0); got != 255 { + fmt.Printf("sub_uint8 0-1 = %d, wanted 255\n", got) + failed = true + } + + if got := sub_1_uint8_ssa(1); got != 0 { + fmt.Printf("sub_uint8 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint8_1_ssa(1); got != 0 { + fmt.Printf("sub_uint8 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_uint8_ssa(255); got != 2 { + fmt.Printf("sub_uint8 1-255 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_uint8_1_ssa(255); got != 254 { + fmt.Printf("sub_uint8 255-1 = %d, wanted 254\n", got) + failed = true + } + + if got := sub_255_uint8_ssa(0); got != 255 { + fmt.Printf("sub_uint8 255-0 = %d, wanted 255\n", got) + failed = true + } + + if got := sub_uint8_255_ssa(0); got != 1 { + fmt.Printf("sub_uint8 0-255 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_255_uint8_ssa(1); got != 254 { + fmt.Printf("sub_uint8 255-1 = %d, wanted 254\n", got) + failed = true + } + + if got := sub_uint8_255_ssa(1); got != 2 { + fmt.Printf("sub_uint8 1-255 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_255_uint8_ssa(255); got != 0 { + fmt.Printf("sub_uint8 255-255 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_uint8_255_ssa(255); got != 0 { + fmt.Printf("sub_uint8 255-255 = %d, wanted 0\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("div_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("div_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 := mul_0_uint8_ssa(0); got != 0 { + fmt.Printf("mul_uint8 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint8_0_ssa(0); got != 0 { + fmt.Printf("mul_uint8 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint8_ssa(1); got != 0 { + fmt.Printf("mul_uint8 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint8_0_ssa(1); got != 0 { + fmt.Printf("mul_uint8 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_uint8_ssa(255); got != 0 { + fmt.Printf("mul_uint8 0*255 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint8_0_ssa(255); got != 0 { + fmt.Printf("mul_uint8 255*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint8_ssa(0); got != 0 { + fmt.Printf("mul_uint8 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint8_1_ssa(0); got != 0 { + fmt.Printf("mul_uint8 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_uint8_ssa(1); got != 1 { + fmt.Printf("mul_uint8 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint8_1_ssa(1); got != 1 { + fmt.Printf("mul_uint8 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_uint8_ssa(255); got != 255 { + fmt.Printf("mul_uint8 1*255 = %d, wanted 255\n", got) + failed = true + } + + if got := mul_uint8_1_ssa(255); got != 255 { + fmt.Printf("mul_uint8 255*1 = %d, wanted 255\n", got) + failed = true + } + + if got := mul_255_uint8_ssa(0); got != 0 { + fmt.Printf("mul_uint8 255*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_uint8_255_ssa(0); got != 0 { + fmt.Printf("mul_uint8 0*255 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_255_uint8_ssa(1); got != 255 { + fmt.Printf("mul_uint8 255*1 = %d, wanted 255\n", got) + failed = true + } + + if got := mul_uint8_255_ssa(1); got != 255 { + fmt.Printf("mul_uint8 1*255 = %d, wanted 255\n", got) + failed = true + } + + if got := mul_255_uint8_ssa(255); got != 1 { + fmt.Printf("mul_uint8 255*255 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_uint8_255_ssa(255); got != 1 { + fmt.Printf("mul_uint8 255*255 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint8_ssa(0); got != 0 { + fmt.Printf("lsh_uint8 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint8_0_ssa(0); got != 0 { + fmt.Printf("lsh_uint8 0<<0 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_0_uint8_ssa(1); got != 0 { + fmt.Printf("lsh_uint8 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint8_0_ssa(1); got != 1 { + fmt.Printf("lsh_uint8 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_0_uint8_ssa(255); got != 0 { + fmt.Printf("lsh_uint8 0<<255 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint8_0_ssa(255); got != 255 { + fmt.Printf("lsh_uint8 255<<0 = %d, wanted 255\n", got) + failed = true + } + + if got := lsh_1_uint8_ssa(0); got != 1 { + fmt.Printf("lsh_uint8 1<<0 = %d, wanted 1\n", got) + failed = true + } + + if got := lsh_uint8_1_ssa(0); got != 0 { + fmt.Printf("lsh_uint8 0<<1 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_1_uint8_ssa(1); got != 2 { + fmt.Printf("lsh_uint8 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_uint8_1_ssa(1); got != 2 { + fmt.Printf("lsh_uint8 1<<1 = %d, wanted 2\n", got) + failed = true + } + + if got := lsh_1_uint8_ssa(255); got != 0 { + fmt.Printf("lsh_uint8 1<<255 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint8_1_ssa(255); got != 254 { + fmt.Printf("lsh_uint8 255<<1 = %d, wanted 254\n", got) + failed = true + } + + if got := lsh_255_uint8_ssa(0); got != 255 { + fmt.Printf("lsh_uint8 255<<0 = %d, wanted 255\n", got) + failed = true + } + + if got := lsh_uint8_255_ssa(0); got != 0 { + fmt.Printf("lsh_uint8 0<<255 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_255_uint8_ssa(1); got != 254 { + fmt.Printf("lsh_uint8 255<<1 = %d, wanted 254\n", got) + failed = true + } + + if got := lsh_uint8_255_ssa(1); got != 0 { + fmt.Printf("lsh_uint8 1<<255 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_255_uint8_ssa(255); got != 0 { + fmt.Printf("lsh_uint8 255<<255 = %d, wanted 0\n", got) + failed = true + } + + if got := lsh_uint8_255_ssa(255); got != 0 { + fmt.Printf("lsh_uint8 255<<255 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint8_ssa(0); got != 0 { + fmt.Printf("rsh_uint8 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint8_0_ssa(0); got != 0 { + fmt.Printf("rsh_uint8 0>>0 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_0_uint8_ssa(1); got != 0 { + fmt.Printf("rsh_uint8 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint8_0_ssa(1); got != 1 { + fmt.Printf("rsh_uint8 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_0_uint8_ssa(255); got != 0 { + fmt.Printf("rsh_uint8 0>>255 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint8_0_ssa(255); got != 255 { + fmt.Printf("rsh_uint8 255>>0 = %d, wanted 255\n", got) + failed = true + } + + if got := rsh_1_uint8_ssa(0); got != 1 { + fmt.Printf("rsh_uint8 1>>0 = %d, wanted 1\n", got) + failed = true + } + + if got := rsh_uint8_1_ssa(0); got != 0 { + fmt.Printf("rsh_uint8 0>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint8_ssa(1); got != 0 { + fmt.Printf("rsh_uint8 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint8_1_ssa(1); got != 0 { + fmt.Printf("rsh_uint8 1>>1 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_1_uint8_ssa(255); got != 0 { + fmt.Printf("rsh_uint8 1>>255 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint8_1_ssa(255); got != 127 { + fmt.Printf("rsh_uint8 255>>1 = %d, wanted 127\n", got) + failed = true + } + + if got := rsh_255_uint8_ssa(0); got != 255 { + fmt.Printf("rsh_uint8 255>>0 = %d, wanted 255\n", got) + failed = true + } + + if got := rsh_uint8_255_ssa(0); got != 0 { + fmt.Printf("rsh_uint8 0>>255 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_255_uint8_ssa(1); got != 127 { + fmt.Printf("rsh_uint8 255>>1 = %d, wanted 127\n", got) + failed = true + } + + if got := rsh_uint8_255_ssa(1); got != 0 { + fmt.Printf("rsh_uint8 1>>255 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_255_uint8_ssa(255); got != 0 { + fmt.Printf("rsh_uint8 255>>255 = %d, wanted 0\n", got) + failed = true + } + + if got := rsh_uint8_255_ssa(255); got != 0 { + fmt.Printf("rsh_uint8 255>>255 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(-128); got != 0 { + fmt.Printf("add_int8 -128+-128 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(-128); got != 0 { + fmt.Printf("add_int8 -128+-128 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(-127); got != 1 { + fmt.Printf("add_int8 -128+-127 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(-127); got != 1 { + fmt.Printf("add_int8 -127+-128 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(-1); got != 127 { + fmt.Printf("add_int8 -128+-1 = %d, wanted 127\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(-1); got != 127 { + fmt.Printf("add_int8 -1+-128 = %d, wanted 127\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(0); got != -128 { + fmt.Printf("add_int8 -128+0 = %d, wanted -128\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(0); got != -128 { + fmt.Printf("add_int8 0+-128 = %d, wanted -128\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(1); got != -127 { + fmt.Printf("add_int8 -128+1 = %d, wanted -127\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(1); got != -127 { + fmt.Printf("add_int8 1+-128 = %d, wanted -127\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(126); got != -2 { + fmt.Printf("add_int8 -128+126 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(126); got != -2 { + fmt.Printf("add_int8 126+-128 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg128_int8_ssa(127); got != -1 { + fmt.Printf("add_int8 -128+127 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int8_Neg128_ssa(127); got != -1 { + fmt.Printf("add_int8 127+-128 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(-128); got != 1 { + fmt.Printf("add_int8 -127+-128 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(-128); got != 1 { + fmt.Printf("add_int8 -128+-127 = %d, wanted 1\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(-127); got != 2 { + fmt.Printf("add_int8 -127+-127 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(-127); got != 2 { + fmt.Printf("add_int8 -127+-127 = %d, wanted 2\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(-1); got != -128 { + fmt.Printf("add_int8 -127+-1 = %d, wanted -128\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(-1); got != -128 { + fmt.Printf("add_int8 -1+-127 = %d, wanted -128\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(0); got != -127 { + fmt.Printf("add_int8 -127+0 = %d, wanted -127\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(0); got != -127 { + fmt.Printf("add_int8 0+-127 = %d, wanted -127\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(1); got != -126 { + fmt.Printf("add_int8 -127+1 = %d, wanted -126\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(1); got != -126 { + fmt.Printf("add_int8 1+-127 = %d, wanted -126\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(126); got != -1 { + fmt.Printf("add_int8 -127+126 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(126); got != -1 { + fmt.Printf("add_int8 126+-127 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg127_int8_ssa(127); got != 0 { + fmt.Printf("add_int8 -127+127 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int8_Neg127_ssa(127); got != 0 { + fmt.Printf("add_int8 127+-127 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(-128); got != 127 { + fmt.Printf("add_int8 -1+-128 = %d, wanted 127\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(-128); got != 127 { + fmt.Printf("add_int8 -128+-1 = %d, wanted 127\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(-127); got != -128 { + fmt.Printf("add_int8 -1+-127 = %d, wanted -128\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(-127); got != -128 { + fmt.Printf("add_int8 -127+-1 = %d, wanted -128\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(-1); got != -2 { + fmt.Printf("add_int8 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(-1); got != -2 { + fmt.Printf("add_int8 -1+-1 = %d, wanted -2\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(0); got != -1 { + fmt.Printf("add_int8 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(0); got != -1 { + fmt.Printf("add_int8 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(1); got != 0 { + fmt.Printf("add_int8 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(1); got != 0 { + fmt.Printf("add_int8 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(126); got != 125 { + fmt.Printf("add_int8 -1+126 = %d, wanted 125\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(126); got != 125 { + fmt.Printf("add_int8 126+-1 = %d, wanted 125\n", got) + failed = true + } + + if got := add_Neg1_int8_ssa(127); got != 126 { + fmt.Printf("add_int8 -1+127 = %d, wanted 126\n", got) + failed = true + } + + if got := add_int8_Neg1_ssa(127); got != 126 { + fmt.Printf("add_int8 127+-1 = %d, wanted 126\n", got) + failed = true + } + + if got := add_0_int8_ssa(-128); got != -128 { + fmt.Printf("add_int8 0+-128 = %d, wanted -128\n", got) + failed = true + } + + if got := add_int8_0_ssa(-128); got != -128 { + fmt.Printf("add_int8 -128+0 = %d, wanted -128\n", got) + failed = true + } + + if got := add_0_int8_ssa(-127); got != -127 { + fmt.Printf("add_int8 0+-127 = %d, wanted -127\n", got) + failed = true + } + + if got := add_int8_0_ssa(-127); got != -127 { + fmt.Printf("add_int8 -127+0 = %d, wanted -127\n", got) + failed = true + } + + if got := add_0_int8_ssa(-1); got != -1 { + fmt.Printf("add_int8 0+-1 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int8_0_ssa(-1); got != -1 { + fmt.Printf("add_int8 -1+0 = %d, wanted -1\n", got) + failed = true + } + + if got := add_0_int8_ssa(0); got != 0 { + fmt.Printf("add_int8 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int8_0_ssa(0); got != 0 { + fmt.Printf("add_int8 0+0 = %d, wanted 0\n", got) + failed = true + } + + if got := add_0_int8_ssa(1); got != 1 { + fmt.Printf("add_int8 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int8_0_ssa(1); got != 1 { + fmt.Printf("add_int8 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_0_int8_ssa(126); got != 126 { + fmt.Printf("add_int8 0+126 = %d, wanted 126\n", got) + failed = true + } + + if got := add_int8_0_ssa(126); got != 126 { + fmt.Printf("add_int8 126+0 = %d, wanted 126\n", got) + failed = true + } + + if got := add_0_int8_ssa(127); got != 127 { + fmt.Printf("add_int8 0+127 = %d, wanted 127\n", got) + failed = true + } + + if got := add_int8_0_ssa(127); got != 127 { + fmt.Printf("add_int8 127+0 = %d, wanted 127\n", got) + failed = true + } + + if got := add_1_int8_ssa(-128); got != -127 { + fmt.Printf("add_int8 1+-128 = %d, wanted -127\n", got) + failed = true + } + + if got := add_int8_1_ssa(-128); got != -127 { + fmt.Printf("add_int8 -128+1 = %d, wanted -127\n", got) + failed = true + } + + if got := add_1_int8_ssa(-127); got != -126 { + fmt.Printf("add_int8 1+-127 = %d, wanted -126\n", got) + failed = true + } + + if got := add_int8_1_ssa(-127); got != -126 { + fmt.Printf("add_int8 -127+1 = %d, wanted -126\n", got) + failed = true + } + + if got := add_1_int8_ssa(-1); got != 0 { + fmt.Printf("add_int8 1+-1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int8_1_ssa(-1); got != 0 { + fmt.Printf("add_int8 -1+1 = %d, wanted 0\n", got) + failed = true + } + + if got := add_1_int8_ssa(0); got != 1 { + fmt.Printf("add_int8 1+0 = %d, wanted 1\n", got) + failed = true + } + + if got := add_int8_1_ssa(0); got != 1 { + fmt.Printf("add_int8 0+1 = %d, wanted 1\n", got) + failed = true + } + + if got := add_1_int8_ssa(1); got != 2 { + fmt.Printf("add_int8 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_int8_1_ssa(1); got != 2 { + fmt.Printf("add_int8 1+1 = %d, wanted 2\n", got) + failed = true + } + + if got := add_1_int8_ssa(126); got != 127 { + fmt.Printf("add_int8 1+126 = %d, wanted 127\n", got) + failed = true + } + + if got := add_int8_1_ssa(126); got != 127 { + fmt.Printf("add_int8 126+1 = %d, wanted 127\n", got) + failed = true + } + + if got := add_1_int8_ssa(127); got != -128 { + fmt.Printf("add_int8 1+127 = %d, wanted -128\n", got) + failed = true + } + + if got := add_int8_1_ssa(127); got != -128 { + fmt.Printf("add_int8 127+1 = %d, wanted -128\n", got) + failed = true + } + + if got := add_126_int8_ssa(-128); got != -2 { + fmt.Printf("add_int8 126+-128 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int8_126_ssa(-128); got != -2 { + fmt.Printf("add_int8 -128+126 = %d, wanted -2\n", got) + failed = true + } + + if got := add_126_int8_ssa(-127); got != -1 { + fmt.Printf("add_int8 126+-127 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int8_126_ssa(-127); got != -1 { + fmt.Printf("add_int8 -127+126 = %d, wanted -1\n", got) + failed = true + } + + if got := add_126_int8_ssa(-1); got != 125 { + fmt.Printf("add_int8 126+-1 = %d, wanted 125\n", got) + failed = true + } + + if got := add_int8_126_ssa(-1); got != 125 { + fmt.Printf("add_int8 -1+126 = %d, wanted 125\n", got) + failed = true + } + + if got := add_126_int8_ssa(0); got != 126 { + fmt.Printf("add_int8 126+0 = %d, wanted 126\n", got) + failed = true + } + + if got := add_int8_126_ssa(0); got != 126 { + fmt.Printf("add_int8 0+126 = %d, wanted 126\n", got) + failed = true + } + + if got := add_126_int8_ssa(1); got != 127 { + fmt.Printf("add_int8 126+1 = %d, wanted 127\n", got) + failed = true + } + + if got := add_int8_126_ssa(1); got != 127 { + fmt.Printf("add_int8 1+126 = %d, wanted 127\n", got) + failed = true + } + + if got := add_126_int8_ssa(126); got != -4 { + fmt.Printf("add_int8 126+126 = %d, wanted -4\n", got) + failed = true + } + + if got := add_int8_126_ssa(126); got != -4 { + fmt.Printf("add_int8 126+126 = %d, wanted -4\n", got) + failed = true + } + + if got := add_126_int8_ssa(127); got != -3 { + fmt.Printf("add_int8 126+127 = %d, wanted -3\n", got) + failed = true + } + + if got := add_int8_126_ssa(127); got != -3 { + fmt.Printf("add_int8 127+126 = %d, wanted -3\n", got) + failed = true + } + + if got := add_127_int8_ssa(-128); got != -1 { + fmt.Printf("add_int8 127+-128 = %d, wanted -1\n", got) + failed = true + } + + if got := add_int8_127_ssa(-128); got != -1 { + fmt.Printf("add_int8 -128+127 = %d, wanted -1\n", got) + failed = true + } + + if got := add_127_int8_ssa(-127); got != 0 { + fmt.Printf("add_int8 127+-127 = %d, wanted 0\n", got) + failed = true + } + + if got := add_int8_127_ssa(-127); got != 0 { + fmt.Printf("add_int8 -127+127 = %d, wanted 0\n", got) + failed = true + } + + if got := add_127_int8_ssa(-1); got != 126 { + fmt.Printf("add_int8 127+-1 = %d, wanted 126\n", got) + failed = true + } + + if got := add_int8_127_ssa(-1); got != 126 { + fmt.Printf("add_int8 -1+127 = %d, wanted 126\n", got) + failed = true + } + + if got := add_127_int8_ssa(0); got != 127 { + fmt.Printf("add_int8 127+0 = %d, wanted 127\n", got) + failed = true + } + + if got := add_int8_127_ssa(0); got != 127 { + fmt.Printf("add_int8 0+127 = %d, wanted 127\n", got) + failed = true + } + + if got := add_127_int8_ssa(1); got != -128 { + fmt.Printf("add_int8 127+1 = %d, wanted -128\n", got) + failed = true + } + + if got := add_int8_127_ssa(1); got != -128 { + fmt.Printf("add_int8 1+127 = %d, wanted -128\n", got) + failed = true + } + + if got := add_127_int8_ssa(126); got != -3 { + fmt.Printf("add_int8 127+126 = %d, wanted -3\n", got) + failed = true + } + + if got := add_int8_127_ssa(126); got != -3 { + fmt.Printf("add_int8 126+127 = %d, wanted -3\n", got) + failed = true + } + + if got := add_127_int8_ssa(127); got != -2 { + fmt.Printf("add_int8 127+127 = %d, wanted -2\n", got) + failed = true + } + + if got := add_int8_127_ssa(127); got != -2 { + fmt.Printf("add_int8 127+127 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(-128); got != 0 { + fmt.Printf("sub_int8 -128--128 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(-128); got != 0 { + fmt.Printf("sub_int8 -128--128 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(-127); got != -1 { + fmt.Printf("sub_int8 -128--127 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(-127); got != 1 { + fmt.Printf("sub_int8 -127--128 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(-1); got != -127 { + fmt.Printf("sub_int8 -128--1 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(-1); got != 127 { + fmt.Printf("sub_int8 -1--128 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(0); got != -128 { + fmt.Printf("sub_int8 -128-0 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(0); got != -128 { + fmt.Printf("sub_int8 0--128 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(1); got != 127 { + fmt.Printf("sub_int8 -128-1 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(1); got != -127 { + fmt.Printf("sub_int8 1--128 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(126); got != 2 { + fmt.Printf("sub_int8 -128-126 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(126); got != -2 { + fmt.Printf("sub_int8 126--128 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg128_int8_ssa(127); got != 1 { + fmt.Printf("sub_int8 -128-127 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int8_Neg128_ssa(127); got != -1 { + fmt.Printf("sub_int8 127--128 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(-128); got != 1 { + fmt.Printf("sub_int8 -127--128 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(-128); got != -1 { + fmt.Printf("sub_int8 -128--127 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(-127); got != 0 { + fmt.Printf("sub_int8 -127--127 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(-127); got != 0 { + fmt.Printf("sub_int8 -127--127 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(-1); got != -126 { + fmt.Printf("sub_int8 -127--1 = %d, wanted -126\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(-1); got != 126 { + fmt.Printf("sub_int8 -1--127 = %d, wanted 126\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(0); got != -127 { + fmt.Printf("sub_int8 -127-0 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(0); got != 127 { + fmt.Printf("sub_int8 0--127 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(1); got != -128 { + fmt.Printf("sub_int8 -127-1 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(1); got != -128 { + fmt.Printf("sub_int8 1--127 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(126); got != 3 { + fmt.Printf("sub_int8 -127-126 = %d, wanted 3\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(126); got != -3 { + fmt.Printf("sub_int8 126--127 = %d, wanted -3\n", got) + failed = true + } + + if got := sub_Neg127_int8_ssa(127); got != 2 { + fmt.Printf("sub_int8 -127-127 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int8_Neg127_ssa(127); got != -2 { + fmt.Printf("sub_int8 127--127 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(-128); got != 127 { + fmt.Printf("sub_int8 -1--128 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(-128); got != -127 { + fmt.Printf("sub_int8 -128--1 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(-127); got != 126 { + fmt.Printf("sub_int8 -1--127 = %d, wanted 126\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(-127); got != -126 { + fmt.Printf("sub_int8 -127--1 = %d, wanted -126\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(-1); got != 0 { + fmt.Printf("sub_int8 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(-1); got != 0 { + fmt.Printf("sub_int8 -1--1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(0); got != -1 { + fmt.Printf("sub_int8 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(0); got != 1 { + fmt.Printf("sub_int8 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(1); got != -2 { + fmt.Printf("sub_int8 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(1); got != 2 { + fmt.Printf("sub_int8 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(126); got != -127 { + fmt.Printf("sub_int8 -1-126 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(126); got != 127 { + fmt.Printf("sub_int8 126--1 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_Neg1_int8_ssa(127); got != -128 { + fmt.Printf("sub_int8 -1-127 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_int8_Neg1_ssa(127); got != -128 { + fmt.Printf("sub_int8 127--1 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_0_int8_ssa(-128); got != -128 { + fmt.Printf("sub_int8 0--128 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_int8_0_ssa(-128); got != -128 { + fmt.Printf("sub_int8 -128-0 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_0_int8_ssa(-127); got != 127 { + fmt.Printf("sub_int8 0--127 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_int8_0_ssa(-127); got != -127 { + fmt.Printf("sub_int8 -127-0 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_0_int8_ssa(-1); got != 1 { + fmt.Printf("sub_int8 0--1 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int8_0_ssa(-1); got != -1 { + fmt.Printf("sub_int8 -1-0 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_0_int8_ssa(0); got != 0 { + fmt.Printf("sub_int8 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_0_ssa(0); got != 0 { + fmt.Printf("sub_int8 0-0 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_0_int8_ssa(1); got != -1 { + fmt.Printf("sub_int8 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int8_0_ssa(1); got != 1 { + fmt.Printf("sub_int8 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_0_int8_ssa(126); got != -126 { + fmt.Printf("sub_int8 0-126 = %d, wanted -126\n", got) + failed = true + } + + if got := sub_int8_0_ssa(126); got != 126 { + fmt.Printf("sub_int8 126-0 = %d, wanted 126\n", got) + failed = true + } + + if got := sub_0_int8_ssa(127); got != -127 { + fmt.Printf("sub_int8 0-127 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_int8_0_ssa(127); got != 127 { + fmt.Printf("sub_int8 127-0 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_1_int8_ssa(-128); got != -127 { + fmt.Printf("sub_int8 1--128 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_int8_1_ssa(-128); got != 127 { + fmt.Printf("sub_int8 -128-1 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_1_int8_ssa(-127); got != -128 { + fmt.Printf("sub_int8 1--127 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_int8_1_ssa(-127); got != -128 { + fmt.Printf("sub_int8 -127-1 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_1_int8_ssa(-1); got != 2 { + fmt.Printf("sub_int8 1--1 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_int8_1_ssa(-1); got != -2 { + fmt.Printf("sub_int8 -1-1 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_1_int8_ssa(0); got != 1 { + fmt.Printf("sub_int8 1-0 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int8_1_ssa(0); got != -1 { + fmt.Printf("sub_int8 0-1 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_1_int8_ssa(1); got != 0 { + fmt.Printf("sub_int8 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_1_ssa(1); got != 0 { + fmt.Printf("sub_int8 1-1 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_1_int8_ssa(126); got != -125 { + fmt.Printf("sub_int8 1-126 = %d, wanted -125\n", got) + failed = true + } + + if got := sub_int8_1_ssa(126); got != 125 { + fmt.Printf("sub_int8 126-1 = %d, wanted 125\n", got) + failed = true + } + + if got := sub_1_int8_ssa(127); got != -126 { + fmt.Printf("sub_int8 1-127 = %d, wanted -126\n", got) + failed = true + } + + if got := sub_int8_1_ssa(127); got != 126 { + fmt.Printf("sub_int8 127-1 = %d, wanted 126\n", got) + failed = true + } + + if got := sub_126_int8_ssa(-128); got != -2 { + fmt.Printf("sub_int8 126--128 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int8_126_ssa(-128); got != 2 { + fmt.Printf("sub_int8 -128-126 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_126_int8_ssa(-127); got != -3 { + fmt.Printf("sub_int8 126--127 = %d, wanted -3\n", got) + failed = true + } + + if got := sub_int8_126_ssa(-127); got != 3 { + fmt.Printf("sub_int8 -127-126 = %d, wanted 3\n", got) + failed = true + } + + if got := sub_126_int8_ssa(-1); got != 127 { + fmt.Printf("sub_int8 126--1 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_int8_126_ssa(-1); got != -127 { + fmt.Printf("sub_int8 -1-126 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_126_int8_ssa(0); got != 126 { + fmt.Printf("sub_int8 126-0 = %d, wanted 126\n", got) + failed = true + } + + if got := sub_int8_126_ssa(0); got != -126 { + fmt.Printf("sub_int8 0-126 = %d, wanted -126\n", got) + failed = true + } + + if got := sub_126_int8_ssa(1); got != 125 { + fmt.Printf("sub_int8 126-1 = %d, wanted 125\n", got) + failed = true + } + + if got := sub_int8_126_ssa(1); got != -125 { + fmt.Printf("sub_int8 1-126 = %d, wanted -125\n", got) + failed = true + } + + if got := sub_126_int8_ssa(126); got != 0 { + fmt.Printf("sub_int8 126-126 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_126_ssa(126); got != 0 { + fmt.Printf("sub_int8 126-126 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_126_int8_ssa(127); got != -1 { + fmt.Printf("sub_int8 126-127 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int8_126_ssa(127); got != 1 { + fmt.Printf("sub_int8 127-126 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_127_int8_ssa(-128); got != -1 { + fmt.Printf("sub_int8 127--128 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_int8_127_ssa(-128); got != 1 { + fmt.Printf("sub_int8 -128-127 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_127_int8_ssa(-127); got != -2 { + fmt.Printf("sub_int8 127--127 = %d, wanted -2\n", got) + failed = true + } + + if got := sub_int8_127_ssa(-127); got != 2 { + fmt.Printf("sub_int8 -127-127 = %d, wanted 2\n", got) + failed = true + } + + if got := sub_127_int8_ssa(-1); got != -128 { + fmt.Printf("sub_int8 127--1 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_int8_127_ssa(-1); got != -128 { + fmt.Printf("sub_int8 -1-127 = %d, wanted -128\n", got) + failed = true + } + + if got := sub_127_int8_ssa(0); got != 127 { + fmt.Printf("sub_int8 127-0 = %d, wanted 127\n", got) + failed = true + } + + if got := sub_int8_127_ssa(0); got != -127 { + fmt.Printf("sub_int8 0-127 = %d, wanted -127\n", got) + failed = true + } + + if got := sub_127_int8_ssa(1); got != 126 { + fmt.Printf("sub_int8 127-1 = %d, wanted 126\n", got) + failed = true + } + + if got := sub_int8_127_ssa(1); got != -126 { + fmt.Printf("sub_int8 1-127 = %d, wanted -126\n", got) + failed = true + } + + if got := sub_127_int8_ssa(126); got != 1 { + fmt.Printf("sub_int8 127-126 = %d, wanted 1\n", got) + failed = true + } + + if got := sub_int8_127_ssa(126); got != -1 { + fmt.Printf("sub_int8 126-127 = %d, wanted -1\n", got) + failed = true + } + + if got := sub_127_int8_ssa(127); got != 0 { + fmt.Printf("sub_int8 127-127 = %d, wanted 0\n", got) + failed = true + } + + if got := sub_int8_127_ssa(127); got != 0 { + fmt.Printf("sub_int8 127-127 = %d, wanted 0\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 got := mul_Neg128_int8_ssa(-128); got != 0 { + fmt.Printf("mul_int8 -128*-128 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(-128); got != 0 { + fmt.Printf("mul_int8 -128*-128 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg128_int8_ssa(-127); got != -128 { + fmt.Printf("mul_int8 -128*-127 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(-127); got != -128 { + fmt.Printf("mul_int8 -127*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_Neg128_int8_ssa(-1); got != -128 { + fmt.Printf("mul_int8 -128*-1 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(-1); got != -128 { + fmt.Printf("mul_int8 -1*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_Neg128_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 -128*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*-128 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg128_int8_ssa(1); got != -128 { + fmt.Printf("mul_int8 -128*1 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(1); got != -128 { + fmt.Printf("mul_int8 1*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_Neg128_int8_ssa(126); got != 0 { + fmt.Printf("mul_int8 -128*126 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(126); got != 0 { + fmt.Printf("mul_int8 126*-128 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg128_int8_ssa(127); got != -128 { + fmt.Printf("mul_int8 -128*127 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_Neg128_ssa(127); got != -128 { + fmt.Printf("mul_int8 127*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(-128); got != -128 { + fmt.Printf("mul_int8 -127*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(-128); got != -128 { + fmt.Printf("mul_int8 -128*-127 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(-127); got != 1 { + fmt.Printf("mul_int8 -127*-127 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(-127); got != 1 { + fmt.Printf("mul_int8 -127*-127 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(-1); got != 127 { + fmt.Printf("mul_int8 -127*-1 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(-1); got != 127 { + fmt.Printf("mul_int8 -1*-127 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 -127*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*-127 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(1); got != -127 { + fmt.Printf("mul_int8 -127*1 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(1); got != -127 { + fmt.Printf("mul_int8 1*-127 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(126); got != 126 { + fmt.Printf("mul_int8 -127*126 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(126); got != 126 { + fmt.Printf("mul_int8 126*-127 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_Neg127_int8_ssa(127); got != -1 { + fmt.Printf("mul_int8 -127*127 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int8_Neg127_ssa(127); got != -1 { + fmt.Printf("mul_int8 127*-127 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(-128); got != -128 { + fmt.Printf("mul_int8 -1*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(-128); got != -128 { + fmt.Printf("mul_int8 -128*-1 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(-127); got != 127 { + fmt.Printf("mul_int8 -1*-127 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(-127); got != 127 { + fmt.Printf("mul_int8 -127*-1 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(-1); got != 1 { + fmt.Printf("mul_int8 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(-1); got != 1 { + fmt.Printf("mul_int8 -1*-1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(1); got != -1 { + fmt.Printf("mul_int8 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(1); got != -1 { + fmt.Printf("mul_int8 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(126); got != -126 { + fmt.Printf("mul_int8 -1*126 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(126); got != -126 { + fmt.Printf("mul_int8 126*-1 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_Neg1_int8_ssa(127); got != -127 { + fmt.Printf("mul_int8 -1*127 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_int8_Neg1_ssa(127); got != -127 { + fmt.Printf("mul_int8 127*-1 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_0_int8_ssa(-128); got != 0 { + fmt.Printf("mul_int8 0*-128 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(-128); got != 0 { + fmt.Printf("mul_int8 -128*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int8_ssa(-127); got != 0 { + fmt.Printf("mul_int8 0*-127 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(-127); got != 0 { + fmt.Printf("mul_int8 -127*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int8_ssa(-1); got != 0 { + fmt.Printf("mul_int8 0*-1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(-1); got != 0 { + fmt.Printf("mul_int8 -1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int8_ssa(1); got != 0 { + fmt.Printf("mul_int8 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(1); got != 0 { + fmt.Printf("mul_int8 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int8_ssa(126); got != 0 { + fmt.Printf("mul_int8 0*126 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(126); got != 0 { + fmt.Printf("mul_int8 126*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_0_int8_ssa(127); got != 0 { + fmt.Printf("mul_int8 0*127 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_0_ssa(127); got != 0 { + fmt.Printf("mul_int8 127*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int8_ssa(-128); got != -128 { + fmt.Printf("mul_int8 1*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_1_ssa(-128); got != -128 { + fmt.Printf("mul_int8 -128*1 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_1_int8_ssa(-127); got != -127 { + fmt.Printf("mul_int8 1*-127 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_int8_1_ssa(-127); got != -127 { + fmt.Printf("mul_int8 -127*1 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_1_int8_ssa(-1); got != -1 { + fmt.Printf("mul_int8 1*-1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int8_1_ssa(-1); got != -1 { + fmt.Printf("mul_int8 -1*1 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_1_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 1*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_1_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*1 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_1_int8_ssa(1); got != 1 { + fmt.Printf("mul_int8 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int8_1_ssa(1); got != 1 { + fmt.Printf("mul_int8 1*1 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_1_int8_ssa(126); got != 126 { + fmt.Printf("mul_int8 1*126 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_int8_1_ssa(126); got != 126 { + fmt.Printf("mul_int8 126*1 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_1_int8_ssa(127); got != 127 { + fmt.Printf("mul_int8 1*127 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_int8_1_ssa(127); got != 127 { + fmt.Printf("mul_int8 127*1 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_126_int8_ssa(-128); got != 0 { + fmt.Printf("mul_int8 126*-128 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_126_ssa(-128); got != 0 { + fmt.Printf("mul_int8 -128*126 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_126_int8_ssa(-127); got != 126 { + fmt.Printf("mul_int8 126*-127 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_int8_126_ssa(-127); got != 126 { + fmt.Printf("mul_int8 -127*126 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_126_int8_ssa(-1); got != -126 { + fmt.Printf("mul_int8 126*-1 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_int8_126_ssa(-1); got != -126 { + fmt.Printf("mul_int8 -1*126 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_126_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 126*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_126_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*126 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_126_int8_ssa(1); got != 126 { + fmt.Printf("mul_int8 126*1 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_int8_126_ssa(1); got != 126 { + fmt.Printf("mul_int8 1*126 = %d, wanted 126\n", got) + failed = true + } + + if got := mul_126_int8_ssa(126); got != 4 { + fmt.Printf("mul_int8 126*126 = %d, wanted 4\n", got) + failed = true + } + + if got := mul_int8_126_ssa(126); got != 4 { + fmt.Printf("mul_int8 126*126 = %d, wanted 4\n", got) + failed = true + } + + if got := mul_126_int8_ssa(127); got != -126 { + fmt.Printf("mul_int8 126*127 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_int8_126_ssa(127); got != -126 { + fmt.Printf("mul_int8 127*126 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_127_int8_ssa(-128); got != -128 { + fmt.Printf("mul_int8 127*-128 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_int8_127_ssa(-128); got != -128 { + fmt.Printf("mul_int8 -128*127 = %d, wanted -128\n", got) + failed = true + } + + if got := mul_127_int8_ssa(-127); got != -1 { + fmt.Printf("mul_int8 127*-127 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_int8_127_ssa(-127); got != -1 { + fmt.Printf("mul_int8 -127*127 = %d, wanted -1\n", got) + failed = true + } + + if got := mul_127_int8_ssa(-1); got != -127 { + fmt.Printf("mul_int8 127*-1 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_int8_127_ssa(-1); got != -127 { + fmt.Printf("mul_int8 -1*127 = %d, wanted -127\n", got) + failed = true + } + + if got := mul_127_int8_ssa(0); got != 0 { + fmt.Printf("mul_int8 127*0 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_int8_127_ssa(0); got != 0 { + fmt.Printf("mul_int8 0*127 = %d, wanted 0\n", got) + failed = true + } + + if got := mul_127_int8_ssa(1); got != 127 { + fmt.Printf("mul_int8 127*1 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_int8_127_ssa(1); got != 127 { + fmt.Printf("mul_int8 1*127 = %d, wanted 127\n", got) + failed = true + } + + if got := mul_127_int8_ssa(126); got != -126 { + fmt.Printf("mul_int8 127*126 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_int8_127_ssa(126); got != -126 { + fmt.Printf("mul_int8 126*127 = %d, wanted -126\n", got) + failed = true + } + + if got := mul_127_int8_ssa(127); got != 1 { + fmt.Printf("mul_int8 127*127 = %d, wanted 1\n", got) + failed = true + } + + if got := mul_int8_127_ssa(127); got != 1 { + fmt.Printf("mul_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 new file mode 100644 index 0000000000..f4bea0ed11 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/arith_ssa.go @@ -0,0 +1,438 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests arithmetic expressions + +package main + +import "fmt" + +const ( + y = 0x0fffFFFF +) + +//go:noinline +func invalidAdd_ssa(x uint32) uint32 { + return x + y + y + y + y + y + y + y + y + y + y + y + y + y + y + y + y + y +} + +//go:noinline +func invalidSub_ssa(x uint32) uint32 { + return x - y - y - y - y - y - y - y - y - y - y - y - y - y - y - y - y - y +} + +//go:noinline +func invalidMul_ssa(x uint32) uint32 { + return x * y * y * y * y * y * y * y * y * y * y * y * y * y * y * y * y * y +} + +// testLargeConst tests a situation where larger than 32 bit consts were passed to ADDL +// causing an invalid instruction error. +func testLargeConst() { + if want, got := uint32(268435440), invalidAdd_ssa(1); want != got { + println("testLargeConst add failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(4026531858), invalidSub_ssa(1); want != got { + println("testLargeConst sub failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(268435455), invalidMul_ssa(1); want != got { + println("testLargeConst mul failed, wanted", want, "got", got) + failed = true + } +} + +// testArithRshConst ensures that "const >> const" right shifts correctly perform +// sign extension on the lhs constant +func testArithRshConst() { + wantu := uint64(0x4000000000000000) + if got := arithRshuConst_ssa(); got != wantu { + println("arithRshuConst failed, wanted", wantu, "got", got) + failed = true + } + + wants := int64(-0x4000000000000000) + if got := arithRshConst_ssa(); got != wants { + println("arithRshuConst failed, wanted", wants, "got", got) + failed = true + } +} + +//go:noinline +func arithRshuConst_ssa() uint64 { + y := uint64(0x8000000000000001) + z := uint64(1) + return uint64(y >> z) +} + +//go:noinline +func arithRshConst_ssa() int64 { + y := int64(-0x8000000000000000) + z := uint64(1) + return int64(y >> z) +} + +//go:noinline +func arithConstShift_ssa(x int64) int64 { + return x >> 100 +} + +// testArithConstShift tests that right shift by large constants preserve +// the sign of the input. +func testArithConstShift() { + want := int64(-1) + if got := arithConstShift_ssa(-1); want != got { + println("arithConstShift_ssa(-1) failed, wanted", want, "got", got) + failed = true + } + want = 0 + if got := arithConstShift_ssa(1); want != got { + println("arithConstShift_ssa(1) failed, wanted", want, "got", got) + failed = true + } +} + +// overflowConstShift_ssa verifes that constant folding for shift +// doesn't wrap (i.e. x << MAX_INT << 1 doesn't get folded to x << 0). +//go:noinline +func overflowConstShift64_ssa(x int64) int64 { + return x << uint64(0xffffffffffffffff) << uint64(1) +} + +//go:noinline +func overflowConstShift32_ssa(x int64) int32 { + return int32(x) << uint32(0xffffffff) << uint32(1) +} + +//go:noinline +func overflowConstShift16_ssa(x int64) int16 { + return int16(x) << uint16(0xffff) << uint16(1) +} + +//go:noinline +func overflowConstShift8_ssa(x int64) int8 { + return int8(x) << uint8(0xff) << uint8(1) +} + +func testOverflowConstShift() { + want := int64(0) + for x := int64(-127); x < int64(127); x++ { + got := overflowConstShift64_ssa(x) + if want != got { + fmt.Printf("overflowShift64 failed, wanted %d got %d\n", want, got) + } + got = int64(overflowConstShift32_ssa(x)) + if want != got { + fmt.Printf("overflowShift32 failed, wanted %d got %d\n", want, got) + } + got = int64(overflowConstShift16_ssa(x)) + if want != got { + fmt.Printf("overflowShift16 failed, wanted %d got %d\n", want, got) + } + got = int64(overflowConstShift8_ssa(x)) + if want != got { + fmt.Printf("overflowShift8 failed, wanted %d got %d\n", want, got) + } + } +} + +// test64BitConstMult tests that rewrite rules don't fold 64 bit constants +// into multiply instructions. +func test64BitConstMult() { + want := int64(103079215109) + if got := test64BitConstMult_ssa(1, 2); want != got { + println("test64BitConstMult failed, wanted", want, "got", got) + failed = true + } +} + +//go:noinline +func test64BitConstMult_ssa(a, b int64) int64 { + return 34359738369*a + b*34359738370 +} + +// test64BitConstAdd tests that rewrite rules don't fold 64 bit constants +// into add instructions. +func test64BitConstAdd() { + want := int64(3567671782835376650) + if got := test64BitConstAdd_ssa(1, 2); want != got { + println("test64BitConstAdd failed, wanted", want, "got", got) + failed = true + } +} + +//go:noinline +func test64BitConstAdd_ssa(a, b int64) int64 { + return a + 575815584948629622 + b + 2991856197886747025 +} + +// testRegallocCVSpill tests that regalloc spills a value whose last use is the +// current value. +func testRegallocCVSpill() { + want := int8(-9) + if got := testRegallocCVSpill_ssa(1, 2, 3, 4); want != got { + println("testRegallocCVSpill failed, wanted", want, "got", got) + failed = true + } +} + +//go:noinline +func testRegallocCVSpill_ssa(a, b, c, d int8) int8 { + return a + -32 + b + 63*c*-87*d +} + +func testBitwiseLogic() { + a, b := uint32(57623283), uint32(1314713839) + if want, got := uint32(38551779), testBitwiseAnd_ssa(a, b); want != got { + println("testBitwiseAnd failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(1333785343), testBitwiseOr_ssa(a, b); want != got { + println("testBitwiseOr failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(1295233564), testBitwiseXor_ssa(a, b); want != got { + println("testBitwiseXor failed, wanted", want, "got", got) + failed = true + } + if want, got := int32(832), testBitwiseLsh_ssa(13, 4, 2); want != got { + println("testBitwiseLsh failed, wanted", want, "got", got) + failed = true + } + if want, got := int32(0), testBitwiseLsh_ssa(13, 25, 15); want != got { + println("testBitwiseLsh failed, wanted", want, "got", got) + failed = true + } + if want, got := int32(0), testBitwiseLsh_ssa(-13, 25, 15); want != got { + println("testBitwiseLsh failed, wanted", want, "got", got) + failed = true + } + if want, got := int32(-13), testBitwiseRsh_ssa(-832, 4, 2); want != got { + println("testBitwiseRsh failed, wanted", want, "got", got) + failed = true + } + if want, got := int32(0), testBitwiseRsh_ssa(13, 25, 15); want != got { + println("testBitwiseRsh failed, wanted", want, "got", got) + failed = true + } + if want, got := int32(-1), testBitwiseRsh_ssa(-13, 25, 15); want != got { + println("testBitwiseRsh failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(0x3ffffff), testBitwiseRshU_ssa(0xffffffff, 4, 2); want != got { + println("testBitwiseRshU failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(0), testBitwiseRshU_ssa(13, 25, 15); want != got { + println("testBitwiseRshU failed, wanted", want, "got", got) + failed = true + } + if want, got := uint32(0), testBitwiseRshU_ssa(0x8aaaaaaa, 25, 15); want != got { + println("testBitwiseRshU failed, wanted", want, "got", got) + failed = true + } +} + +//go:noinline +func testBitwiseAnd_ssa(a, b uint32) uint32 { + return a & b +} + +//go:noinline +func testBitwiseOr_ssa(a, b uint32) uint32 { + return a | b +} + +//go:noinline +func testBitwiseXor_ssa(a, b uint32) uint32 { + return a ^ b +} + +//go:noinline +func testBitwiseLsh_ssa(a int32, b, c uint32) int32 { + return a << b << c +} + +//go:noinline +func testBitwiseRsh_ssa(a int32, b, c uint32) int32 { + return a >> b >> c +} + +//go:noinline +func testBitwiseRshU_ssa(a uint32, b, c uint32) uint32 { + return a >> b >> c +} + +//go:noinline +func testShiftCX_ssa() int { + v1 := uint8(3) + v4 := (v1 * v1) ^ v1 | v1 - v1 - v1&v1 ^ uint8(3+2) + v1*1>>0 - v1 | 1 | v1<<(2*3|0-0*0^1) + v5 := v4>>(3-0-uint(3)) | v1 | v1 + v1 ^ v4<<(0+1|3&1)<<(uint64(1)<<0*2*0<<0) ^ v1 + v6 := v5 ^ (v1+v1)*v1 | v1 | v1*v1>>(v1&v1)>>(uint(1)<<0*uint(3)>>1)*v1<<2*v1<<v1 - v1>>2 | (v4 - v1) ^ v1 + v1 ^ v1>>1 | v1 + v1 - v1 ^ v1 + v7 := v6 & v5 << 0 + v1++ + v11 := 2&1 ^ 0 + 3 | int(0^0)<<1>>(1*0*3) ^ 0*0 ^ 3&0*3&3 ^ 3*3 ^ 1 ^ int(2)<<(2*3) + 2 | 2 | 2 ^ 2 + 1 | 3 | 0 ^ int(1)>>1 ^ 2 // int + v7-- + return int(uint64(2*1)<<(3-2)<<uint(3>>v7)-2)&v11 | v11 - int(2)<<0>>(2-1)*(v11*0&v11<<1<<(uint8(2)+v4)) +} + +func testShiftCX() { + want := 141 + if got := testShiftCX_ssa(); want != got { + println("testShiftCX failed, wanted", want, "got", got) + failed = true + } +} + +// testSubqToNegq ensures that the SUBQ -> NEGQ translation works correctly. +func testSubqToNegq() { + want := int64(-318294940372190156) + if got := testSubqToNegq_ssa(1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); want != got { + println("testSubqToNegq failed, wanted", want, "got", got) + failed = true + } +} + +//go:noinline +func testSubqToNegq_ssa(a, b, c, d, e, f, g, h, i, j, k int64) int64 { + return a + 8207351403619448057 - b - 1779494519303207690 + c*8810076340510052032*d - 4465874067674546219 - e*4361839741470334295 - f + 8688847565426072650*g*8065564729145417479 +} + +func testOcom() { + want1, want2 := int32(0x55555555), int32(-0x55555556) + if got1, got2 := testOcom_ssa(0x55555555, 0x55555555); want1 != got1 || want2 != got2 { + println("testSubqToNegq failed, wanted", want1, "and", want2, + "got", got1, "and", got2) + failed = true + } +} + +//go:noinline +func testOcom_ssa(a, b int32) (int32, int32) { + return ^^^^a, ^^^^^b +} + +func lrot1_ssa(w uint8, x uint16, y uint32, z uint64) (a uint8, b uint16, c uint32, d uint64) { + a = (w << 5) | (w >> 3) + b = (x << 13) | (x >> 3) + c = (y << 29) | (y >> 3) + d = (z << 61) | (z >> 3) + return +} + +//go:noinline +func lrot2_ssa(w, n uint32) uint32 { + // Want to be sure that a "rotate by 32" which + // is really 0 | (w >> 0) == w + // is correctly compiled. + return (w << n) | (w >> (32 - n)) +} + +//go:noinline +func lrot3_ssa(w uint32) uint32 { + // Want to be sure that a "rotate by 32" which + // is really 0 | (w >> 0) == w + // is correctly compiled. + return (w << 32) | (w >> (32 - 32)) +} + +func testLrot() { + wantA, wantB, wantC, wantD := uint8(0xe1), uint16(0xe001), + uint32(0xe0000001), uint64(0xe000000000000001) + a, b, c, d := lrot1_ssa(0xf, 0xf, 0xf, 0xf) + if a != wantA || b != wantB || c != wantC || d != wantD { + println("lrot1_ssa(0xf, 0xf, 0xf, 0xf)=", + wantA, wantB, wantC, wantD, ", got", a, b, c, d) + failed = true + } + x := lrot2_ssa(0xb0000001, 32) + wantX := uint32(0xb0000001) + if x != wantX { + println("lrot2_ssa(0xb0000001, 32)=", + wantX, ", got", x) + failed = true + } + x = lrot3_ssa(0xb0000001) + if x != wantX { + println("lrot3_ssa(0xb0000001)=", + wantX, ", got", x) + failed = true + } + +} + +//go:noinline +func sub1_ssa() uint64 { + v1 := uint64(3) // uint64 + return v1*v1 - (v1&v1)&v1 +} +func sub2_ssa() uint8 { + switch { + } + v1 := uint8(0) + v3 := v1 + v1 + v1 ^ v1 | 3 + v1 ^ v1 | v1 ^ v1 + v1-- // dev.ssa doesn't see this one + return v1 ^ v1*v1 - v3 +} + +func testSubConst() { + x1 := sub1_ssa() + want1 := uint64(6) + if x1 != want1 { + println("sub1_ssa()=", want1, ", got", x1) + failed = true + } + x2 := sub2_ssa() + want2 := uint8(251) + if x2 != want2 { + println("sub2_ssa()=", want2, ", got", x2) + failed = true + } +} + +//go:noinline +func orPhi_ssa(a bool, x int) int { + v := 0 + if a { + v = -1 + } else { + v = -1 + } + return x | v +} + +func testOrPhi() { + if want, got := -1, orPhi_ssa(true, 4); got != want { + println("orPhi_ssa(true, 4)=", got, " want ", want) + } + if want, got := -1, orPhi_ssa(false, 0); got != want { + println("orPhi_ssa(false, 0)=", got, " want ", want) + } +} + +var failed = false + +func main() { + + test64BitConstMult() + test64BitConstAdd() + testRegallocCVSpill() + testSubqToNegq() + testBitwiseLogic() + testOcom() + testLrot() + testShiftCX() + testSubConst() + testOverflowConstShift() + testArithConstShift() + testArithRshConst() + testLargeConst() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/array_ssa.go b/src/cmd/compile/internal/gc/testdata/array_ssa.go new file mode 100644 index 0000000000..0334339d43 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/array_ssa.go @@ -0,0 +1,142 @@ +package main + +var failed = false + +//go:noinline +func testSliceLenCap12_ssa(a [10]int, i, j int) (int, int) { + b := a[i:j] + return len(b), cap(b) +} + +//go:noinline +func testSliceLenCap1_ssa(a [10]int, i, j int) (int, int) { + b := a[i:] + return len(b), cap(b) +} + +//go:noinline +func testSliceLenCap2_ssa(a [10]int, i, j int) (int, int) { + b := a[:j] + return len(b), cap(b) +} + +func testSliceLenCap() { + a := [10]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} + tests := [...]struct { + fn func(a [10]int, i, j int) (int, int) + i, j int // slice range + l, c int // len, cap + }{ + // -1 means the value is not used. + {testSliceLenCap12_ssa, 0, 0, 0, 10}, + {testSliceLenCap12_ssa, 0, 1, 1, 10}, + {testSliceLenCap12_ssa, 0, 10, 10, 10}, + {testSliceLenCap12_ssa, 10, 10, 0, 0}, + {testSliceLenCap12_ssa, 0, 5, 5, 10}, + {testSliceLenCap12_ssa, 5, 5, 0, 5}, + {testSliceLenCap12_ssa, 5, 10, 5, 5}, + {testSliceLenCap1_ssa, 0, -1, 0, 10}, + {testSliceLenCap1_ssa, 5, -1, 5, 5}, + {testSliceLenCap1_ssa, 10, -1, 0, 0}, + {testSliceLenCap2_ssa, -1, 0, 0, 10}, + {testSliceLenCap2_ssa, -1, 5, 5, 10}, + {testSliceLenCap2_ssa, -1, 10, 10, 10}, + } + + for i, t := range tests { + if l, c := t.fn(a, t.i, t.j); l != t.l && c != t.c { + println("#", i, " len(a[", t.i, ":", t.j, "]), cap(a[", t.i, ":", t.j, "]) =", l, c, + ", want", t.l, t.c) + failed = true + } + } +} + +//go:noinline +func testSliceGetElement_ssa(a [10]int, i, j, p int) int { + return a[i:j][p] +} + +func testSliceGetElement() { + a := [10]int{0, 10, 20, 30, 40, 50, 60, 70, 80, 90} + tests := [...]struct { + i, j, p int + want int // a[i:j][p] + }{ + {0, 10, 2, 20}, + {0, 5, 4, 40}, + {5, 10, 3, 80}, + {1, 9, 7, 80}, + } + + for i, t := range tests { + if got := testSliceGetElement_ssa(a, t.i, t.j, t.p); got != t.want { + println("#", i, " a[", t.i, ":", t.j, "][", t.p, "] = ", got, " wanted ", t.want) + failed = true + } + } +} + +//go:noinline +func testSliceSetElement_ssa(a *[10]int, i, j, p, x int) { + (*a)[i:j][p] = x +} + +func testSliceSetElement() { + a := [10]int{0, 10, 20, 30, 40, 50, 60, 70, 80, 90} + tests := [...]struct { + i, j, p int + want int // a[i:j][p] + }{ + {0, 10, 2, 17}, + {0, 5, 4, 11}, + {5, 10, 3, 28}, + {1, 9, 7, 99}, + } + + for i, t := range tests { + testSliceSetElement_ssa(&a, t.i, t.j, t.p, t.want) + if got := a[t.i+t.p]; got != t.want { + println("#", i, " a[", t.i, ":", t.j, "][", t.p, "] = ", got, " wanted ", t.want) + failed = true + } + } +} + +func testSlicePanic1() { + defer func() { + if r := recover(); r != nil { + println("paniced as expected") + } + }() + + a := [10]int{0, 10, 20, 30, 40, 50, 60, 70, 80, 90} + testSliceLenCap12_ssa(a, 3, 12) + println("expected to panic, but didn't") + failed = true +} + +func testSlicePanic2() { + defer func() { + if r := recover(); r != nil { + println("paniced as expected") + } + }() + + a := [10]int{0, 10, 20, 30, 40, 50, 60, 70, 80, 90} + testSliceGetElement_ssa(a, 3, 7, 4) + println("expected to panic, but didn't") + failed = true +} + +func main() { + testSliceLenCap() + testSliceGetElement() + testSliceSetElement() + testSlicePanic1() + testSlicePanic2() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/assert_ssa.go b/src/cmd/compile/internal/gc/testdata/assert_ssa.go new file mode 100644 index 0000000000..d64d4fc35a --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/assert_ssa.go @@ -0,0 +1,147 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests type assertion expressions and statements + +package main + +import ( + "fmt" + "runtime" +) + +type ( + S struct{} + T struct{} + + I interface { + F() + } +) + +var ( + s *S + t *T +) + +func (s *S) F() {} +func (t *T) F() {} + +func e2t_ssa(e interface{}) *T { + return e.(*T) +} + +func i2t_ssa(i I) *T { + return i.(*T) +} + +func testAssertE2TOk() { + if got := e2t_ssa(t); got != t { + fmt.Printf("e2t_ssa(t)=%v want %v", got, t) + failed = true + } +} + +func testAssertE2TPanic() { + var got *T + defer func() { + if got != nil { + fmt.Printf("e2t_ssa(s)=%v want nil", got) + failed = true + } + e := recover() + err, ok := e.(*runtime.TypeAssertionError) + if !ok { + fmt.Printf("e2t_ssa(s) panic type %T", e) + failed = true + } + want := "interface conversion: interface {} is *main.S, not *main.T" + if err.Error() != want { + fmt.Printf("e2t_ssa(s) wrong error, want '%s', got '%s'\n", want, err.Error()) + failed = true + } + }() + got = e2t_ssa(s) + fmt.Printf("e2t_ssa(s) should panic") + failed = true +} + +func testAssertI2TOk() { + if got := i2t_ssa(t); got != t { + fmt.Printf("i2t_ssa(t)=%v want %v", got, t) + failed = true + } +} + +func testAssertI2TPanic() { + var got *T + defer func() { + if got != nil { + fmt.Printf("i2t_ssa(s)=%v want nil", got) + failed = true + } + e := recover() + err, ok := e.(*runtime.TypeAssertionError) + if !ok { + fmt.Printf("i2t_ssa(s) panic type %T", e) + failed = true + } + want := "interface conversion: main.I is *main.S, not *main.T" + if err.Error() != want { + fmt.Printf("i2t_ssa(s) wrong error, want '%s', got '%s'\n", want, err.Error()) + failed = true + } + }() + got = i2t_ssa(s) + fmt.Printf("i2t_ssa(s) should panic") + failed = true +} + +func e2t2_ssa(e interface{}) (*T, bool) { + t, ok := e.(*T) + return t, ok +} + +func i2t2_ssa(i I) (*T, bool) { + t, ok := i.(*T) + return t, ok +} + +func testAssertE2T2() { + if got, ok := e2t2_ssa(t); !ok || got != t { + fmt.Printf("e2t2_ssa(t)=(%v, %v) want (%v, %v)", got, ok, t, true) + failed = true + } + if got, ok := e2t2_ssa(s); ok || got != nil { + fmt.Printf("e2t2_ssa(s)=(%v, %v) want (%v, %v)", got, ok, nil, false) + failed = true + } +} + +func testAssertI2T2() { + if got, ok := i2t2_ssa(t); !ok || got != t { + fmt.Printf("i2t2_ssa(t)=(%v, %v) want (%v, %v)", got, ok, t, true) + failed = true + } + if got, ok := i2t2_ssa(s); ok || got != nil { + fmt.Printf("i2t2_ssa(s)=(%v, %v) want (%v, %v)", got, ok, nil, false) + failed = true + } +} + +var failed = false + +func main() { + testAssertE2TOk() + testAssertE2TPanic() + testAssertI2TOk() + testAssertI2TPanic() + testAssertE2T2() + testAssertI2T2() + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/break_ssa.go b/src/cmd/compile/internal/gc/testdata/break_ssa.go new file mode 100644 index 0000000000..855ef70049 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/break_ssa.go @@ -0,0 +1,255 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests continue and break. + +package main + +func continuePlain_ssa() int { + var n int + for i := 0; i < 10; i++ { + if i == 6 { + continue + } + n = i + } + return n +} + +func continueLabeled_ssa() int { + var n int +Next: + for i := 0; i < 10; i++ { + if i == 6 { + continue Next + } + n = i + } + return n +} + +func continuePlainInner_ssa() int { + var n int + for j := 0; j < 30; j += 10 { + for i := 0; i < 10; i++ { + if i == 6 { + continue + } + n = i + } + n += j + } + return n +} + +func continueLabeledInner_ssa() int { + var n int + for j := 0; j < 30; j += 10 { + Next: + for i := 0; i < 10; i++ { + if i == 6 { + continue Next + } + n = i + } + n += j + } + return n +} + +func continueLabeledOuter_ssa() int { + var n int +Next: + for j := 0; j < 30; j += 10 { + for i := 0; i < 10; i++ { + if i == 6 { + continue Next + } + n = i + } + n += j + } + return n +} + +func breakPlain_ssa() int { + var n int + for i := 0; i < 10; i++ { + if i == 6 { + break + } + n = i + } + return n +} + +func breakLabeled_ssa() int { + var n int +Next: + for i := 0; i < 10; i++ { + if i == 6 { + break Next + } + n = i + } + return n +} + +func breakPlainInner_ssa() int { + var n int + for j := 0; j < 30; j += 10 { + for i := 0; i < 10; i++ { + if i == 6 { + break + } + n = i + } + n += j + } + return n +} + +func breakLabeledInner_ssa() int { + var n int + for j := 0; j < 30; j += 10 { + Next: + for i := 0; i < 10; i++ { + if i == 6 { + break Next + } + n = i + } + n += j + } + return n +} + +func breakLabeledOuter_ssa() int { + var n int +Next: + for j := 0; j < 30; j += 10 { + for i := 0; i < 10; i++ { + if i == 6 { + break Next + } + n = i + } + n += j + } + return n +} + +var g, h int // globals to ensure optimizations don't collapse our switch statements + +func switchPlain_ssa() int { + var n int + switch g { + case 0: + n = 1 + break + n = 2 + } + return n +} + +func switchLabeled_ssa() int { + var n int +Done: + switch g { + case 0: + n = 1 + break Done + n = 2 + } + return n +} + +func switchPlainInner_ssa() int { + var n int + switch g { + case 0: + n = 1 + switch h { + case 0: + n += 10 + break + } + n = 2 + } + return n +} + +func switchLabeledInner_ssa() int { + var n int + switch g { + case 0: + n = 1 + Done: + switch h { + case 0: + n += 10 + break Done + } + n = 2 + } + return n +} + +func switchLabeledOuter_ssa() int { + var n int +Done: + switch g { + case 0: + n = 1 + switch h { + case 0: + n += 10 + break Done + } + n = 2 + } + return n +} + +func main() { + tests := [...]struct { + name string + fn func() int + want int + }{ + {"continuePlain_ssa", continuePlain_ssa, 9}, + {"continueLabeled_ssa", continueLabeled_ssa, 9}, + {"continuePlainInner_ssa", continuePlainInner_ssa, 29}, + {"continueLabeledInner_ssa", continueLabeledInner_ssa, 29}, + {"continueLabeledOuter_ssa", continueLabeledOuter_ssa, 5}, + + {"breakPlain_ssa", breakPlain_ssa, 5}, + {"breakLabeled_ssa", breakLabeled_ssa, 5}, + {"breakPlainInner_ssa", breakPlainInner_ssa, 25}, + {"breakLabeledInner_ssa", breakLabeledInner_ssa, 25}, + {"breakLabeledOuter_ssa", breakLabeledOuter_ssa, 5}, + + {"switchPlain_ssa", switchPlain_ssa, 1}, + {"switchLabeled_ssa", switchLabeled_ssa, 1}, + {"switchPlainInner_ssa", switchPlainInner_ssa, 2}, + {"switchLabeledInner_ssa", switchLabeledInner_ssa, 2}, + {"switchLabeledOuter_ssa", switchLabeledOuter_ssa, 11}, + + // no select tests; they're identical to switch + } + + var failed bool + for _, test := range tests { + if got := test.fn(); test.fn() != test.want { + print(test.name, "()=", got, ", want ", test.want, "\n") + failed = true + } + } + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/chan_ssa.go b/src/cmd/compile/internal/gc/testdata/chan_ssa.go new file mode 100644 index 0000000000..0766fcda5b --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/chan_ssa.go @@ -0,0 +1,73 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// chan_ssa.go tests chan operations. +package main + +import "fmt" + +var failed = false + +//go:noinline +func lenChan_ssa(v chan int) int { + return len(v) +} + +//go:noinline +func capChan_ssa(v chan int) int { + return cap(v) +} + +func testLenChan() { + + v := make(chan int, 10) + v <- 1 + v <- 1 + v <- 1 + + if want, got := 3, lenChan_ssa(v); got != want { + fmt.Printf("expected len(chan) = %d, got %d", want, got) + failed = true + } +} + +func testLenNilChan() { + + var v chan int + if want, got := 0, lenChan_ssa(v); got != want { + fmt.Printf("expected len(nil) = %d, got %d", want, got) + failed = true + } +} + +func testCapChan() { + + v := make(chan int, 25) + + if want, got := 25, capChan_ssa(v); got != want { + fmt.Printf("expected cap(chan) = %d, got %d", want, got) + failed = true + } +} + +func testCapNilChan() { + + var v chan int + if want, got := 0, capChan_ssa(v); got != want { + fmt.Printf("expected cap(nil) = %d, got %d", want, got) + failed = true + } +} + +func main() { + testLenChan() + testLenNilChan() + + testCapChan() + testCapNilChan() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/closure_ssa.go b/src/cmd/compile/internal/gc/testdata/closure_ssa.go new file mode 100644 index 0000000000..70181bc24b --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/closure_ssa.go @@ -0,0 +1,38 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// map_ssa.go tests map operations. +package main + +import "fmt" + +var failed = false + +//go:noinline +func testCFunc_ssa() int { + a := 0 + b := func() { + switch { + } + a++ + } + b() + b() + return a +} + +func testCFunc() { + if want, got := 2, testCFunc_ssa(); got != want { + fmt.Printf("expected %d, got %d", want, got) + failed = true + } +} + +func main() { + testCFunc() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/cmp_ssa.go b/src/cmd/compile/internal/gc/testdata/cmp_ssa.go new file mode 100644 index 0000000000..ba420f2e4e --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/cmp_ssa.go @@ -0,0 +1,48 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// cmp_ssa.go tests compare simplification operations. +package main + +import "fmt" + +var failed = false + +//go:noinline +func eq_ssa(a int64) bool { + return 4+a == 10 +} + +//go:noinline +func neq_ssa(a int64) bool { + return 10 != a+4 +} + +func testCmp() { + if wanted, got := true, eq_ssa(6); wanted != got { + fmt.Printf("eq_ssa: expected %v, got %v\n", wanted, got) + failed = true + } + if wanted, got := false, eq_ssa(7); wanted != got { + fmt.Printf("eq_ssa: expected %v, got %v\n", wanted, got) + failed = true + } + + if wanted, got := false, neq_ssa(6); wanted != got { + fmt.Printf("neq_ssa: expected %v, got %v\n", wanted, got) + failed = true + } + if wanted, got := true, neq_ssa(7); wanted != got { + fmt.Printf("neq_ssa: expected %v, got %v\n", wanted, got) + failed = true + } +} + +func main() { + testCmp() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/compound_ssa.go b/src/cmd/compile/internal/gc/testdata/compound_ssa.go new file mode 100644 index 0000000000..b0e4962f5e --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/compound_ssa.go @@ -0,0 +1,145 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Test compound objects + +package main + +import "fmt" + +func string_ssa(a, b string, x bool) string { + s := "" + if x { + s = a + } else { + s = b + } + return s +} + +func testString() { + a := "foo" + b := "barz" + if want, got := a, string_ssa(a, b, true); got != want { + fmt.Printf("string_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } + if want, got := b, string_ssa(a, b, false); got != want { + fmt.Printf("string_ssa(%v, %v, false) = %v, want %v\n", a, b, got, want) + failed = true + } +} + +func complex64_ssa(a, b complex64, x bool) complex64 { + switch { + } + var c complex64 + if x { + c = a + } else { + c = b + } + return c +} + +func complex128_ssa(a, b complex128, x bool) complex128 { + switch { + } + var c complex128 + if x { + c = a + } else { + c = b + } + return c +} + +func testComplex64() { + var a complex64 = 1 + 2i + var b complex64 = 3 + 4i + + if want, got := a, complex64_ssa(a, b, true); got != want { + fmt.Printf("complex64_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } + if want, got := b, complex64_ssa(a, b, false); got != want { + fmt.Printf("complex64_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } +} + +func testComplex128() { + var a complex128 = 1 + 2i + var b complex128 = 3 + 4i + + if want, got := a, complex128_ssa(a, b, true); got != want { + fmt.Printf("complex128_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } + if want, got := b, complex128_ssa(a, b, false); got != want { + fmt.Printf("complex128_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } +} + +func slice_ssa(a, b []byte, x bool) []byte { + var s []byte + if x { + s = a + } else { + s = b + } + return s +} + +func testSlice() { + a := []byte{3, 4, 5} + b := []byte{7, 8, 9} + if want, got := byte(3), slice_ssa(a, b, true)[0]; got != want { + fmt.Printf("slice_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } + if want, got := byte(7), slice_ssa(a, b, false)[0]; got != want { + fmt.Printf("slice_ssa(%v, %v, false) = %v, want %v\n", a, b, got, want) + failed = true + } +} + +func interface_ssa(a, b interface{}, x bool) interface{} { + var s interface{} + if x { + s = a + } else { + s = b + } + return s +} + +func testInterface() { + a := interface{}(3) + b := interface{}(4) + if want, got := 3, interface_ssa(a, b, true).(int); got != want { + fmt.Printf("interface_ssa(%v, %v, true) = %v, want %v\n", a, b, got, want) + failed = true + } + if want, got := 4, interface_ssa(a, b, false).(int); got != want { + fmt.Printf("interface_ssa(%v, %v, false) = %v, want %v\n", a, b, got, want) + failed = true + } +} + +var failed = false + +func main() { + testString() + testSlice() + testInterface() + testComplex64() + testComplex128() + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/copy_ssa.go b/src/cmd/compile/internal/gc/testdata/copy_ssa.go new file mode 100644 index 0000000000..44f0223a43 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/copy_ssa.go @@ -0,0 +1,726 @@ +// run +// autogenerated from gen/copyGen.go - do not edit! +package main + +import "fmt" + +type T1 struct { + pre [8]byte + mid [1]byte + post [8]byte +} + +func t1copy_ssa(y, x *[1]byte) { + switch { + } + *y = *x +} +func testCopy1() { + a := T1{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1]byte{0}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1]byte{100} + t1copy_ssa(&a.mid, &x) + want := T1{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1]byte{100}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T2 struct { + pre [8]byte + mid [2]byte + post [8]byte +} + +func t2copy_ssa(y, x *[2]byte) { + switch { + } + *y = *x +} +func testCopy2() { + a := T2{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [2]byte{0, 1}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [2]byte{100, 101} + t2copy_ssa(&a.mid, &x) + want := T2{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [2]byte{100, 101}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t2copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T3 struct { + pre [8]byte + mid [3]byte + post [8]byte +} + +func t3copy_ssa(y, x *[3]byte) { + switch { + } + *y = *x +} +func testCopy3() { + a := T3{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [3]byte{0, 1, 2}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [3]byte{100, 101, 102} + t3copy_ssa(&a.mid, &x) + want := T3{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [3]byte{100, 101, 102}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t3copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T4 struct { + pre [8]byte + mid [4]byte + post [8]byte +} + +func t4copy_ssa(y, x *[4]byte) { + switch { + } + *y = *x +} +func testCopy4() { + a := T4{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [4]byte{0, 1, 2, 3}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [4]byte{100, 101, 102, 103} + t4copy_ssa(&a.mid, &x) + want := T4{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [4]byte{100, 101, 102, 103}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t4copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T5 struct { + pre [8]byte + mid [5]byte + post [8]byte +} + +func t5copy_ssa(y, x *[5]byte) { + switch { + } + *y = *x +} +func testCopy5() { + a := T5{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [5]byte{0, 1, 2, 3, 4}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [5]byte{100, 101, 102, 103, 104} + t5copy_ssa(&a.mid, &x) + want := T5{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [5]byte{100, 101, 102, 103, 104}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t5copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T6 struct { + pre [8]byte + mid [6]byte + post [8]byte +} + +func t6copy_ssa(y, x *[6]byte) { + switch { + } + *y = *x +} +func testCopy6() { + a := T6{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [6]byte{0, 1, 2, 3, 4, 5}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [6]byte{100, 101, 102, 103, 104, 105} + t6copy_ssa(&a.mid, &x) + want := T6{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [6]byte{100, 101, 102, 103, 104, 105}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t6copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T7 struct { + pre [8]byte + mid [7]byte + post [8]byte +} + +func t7copy_ssa(y, x *[7]byte) { + switch { + } + *y = *x +} +func testCopy7() { + a := T7{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [7]byte{0, 1, 2, 3, 4, 5, 6}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [7]byte{100, 101, 102, 103, 104, 105, 106} + t7copy_ssa(&a.mid, &x) + want := T7{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [7]byte{100, 101, 102, 103, 104, 105, 106}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t7copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T8 struct { + pre [8]byte + mid [8]byte + post [8]byte +} + +func t8copy_ssa(y, x *[8]byte) { + switch { + } + *y = *x +} +func testCopy8() { + a := T8{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [8]byte{0, 1, 2, 3, 4, 5, 6, 7}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [8]byte{100, 101, 102, 103, 104, 105, 106, 107} + t8copy_ssa(&a.mid, &x) + want := T8{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [8]byte{100, 101, 102, 103, 104, 105, 106, 107}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t8copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T9 struct { + pre [8]byte + mid [9]byte + post [8]byte +} + +func t9copy_ssa(y, x *[9]byte) { + switch { + } + *y = *x +} +func testCopy9() { + a := T9{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [9]byte{0, 1, 2, 3, 4, 5, 6, 7, 8}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [9]byte{100, 101, 102, 103, 104, 105, 106, 107, 108} + t9copy_ssa(&a.mid, &x) + want := T9{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [9]byte{100, 101, 102, 103, 104, 105, 106, 107, 108}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t9copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T10 struct { + pre [8]byte + mid [10]byte + post [8]byte +} + +func t10copy_ssa(y, x *[10]byte) { + switch { + } + *y = *x +} +func testCopy10() { + a := T10{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [10]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [10]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109} + t10copy_ssa(&a.mid, &x) + want := T10{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [10]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t10copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T15 struct { + pre [8]byte + mid [15]byte + post [8]byte +} + +func t15copy_ssa(y, x *[15]byte) { + switch { + } + *y = *x +} +func testCopy15() { + a := T15{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [15]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [15]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114} + t15copy_ssa(&a.mid, &x) + want := T15{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [15]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t15copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T16 struct { + pre [8]byte + mid [16]byte + post [8]byte +} + +func t16copy_ssa(y, x *[16]byte) { + switch { + } + *y = *x +} +func testCopy16() { + a := T16{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [16]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [16]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115} + t16copy_ssa(&a.mid, &x) + want := T16{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [16]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t16copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T17 struct { + pre [8]byte + mid [17]byte + post [8]byte +} + +func t17copy_ssa(y, x *[17]byte) { + switch { + } + *y = *x +} +func testCopy17() { + a := T17{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [17]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [17]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116} + t17copy_ssa(&a.mid, &x) + want := T17{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [17]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t17copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T23 struct { + pre [8]byte + mid [23]byte + post [8]byte +} + +func t23copy_ssa(y, x *[23]byte) { + switch { + } + *y = *x +} +func testCopy23() { + a := T23{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [23]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [23]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122} + t23copy_ssa(&a.mid, &x) + want := T23{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [23]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t23copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T24 struct { + pre [8]byte + mid [24]byte + post [8]byte +} + +func t24copy_ssa(y, x *[24]byte) { + switch { + } + *y = *x +} +func testCopy24() { + a := T24{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [24]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [24]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123} + t24copy_ssa(&a.mid, &x) + want := T24{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [24]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t24copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T25 struct { + pre [8]byte + mid [25]byte + post [8]byte +} + +func t25copy_ssa(y, x *[25]byte) { + switch { + } + *y = *x +} +func testCopy25() { + a := T25{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [25]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [25]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124} + t25copy_ssa(&a.mid, &x) + want := T25{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [25]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t25copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T31 struct { + pre [8]byte + mid [31]byte + post [8]byte +} + +func t31copy_ssa(y, x *[31]byte) { + switch { + } + *y = *x +} +func testCopy31() { + a := T31{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [31]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [31]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130} + t31copy_ssa(&a.mid, &x) + want := T31{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [31]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t31copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T32 struct { + pre [8]byte + mid [32]byte + post [8]byte +} + +func t32copy_ssa(y, x *[32]byte) { + switch { + } + *y = *x +} +func testCopy32() { + a := T32{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [32]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [32]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131} + t32copy_ssa(&a.mid, &x) + want := T32{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [32]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t32copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T33 struct { + pre [8]byte + mid [33]byte + post [8]byte +} + +func t33copy_ssa(y, x *[33]byte) { + switch { + } + *y = *x +} +func testCopy33() { + a := T33{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [33]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [33]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132} + t33copy_ssa(&a.mid, &x) + want := T33{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [33]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t33copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T63 struct { + pre [8]byte + mid [63]byte + post [8]byte +} + +func t63copy_ssa(y, x *[63]byte) { + switch { + } + *y = *x +} +func testCopy63() { + a := T63{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [63]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [63]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162} + t63copy_ssa(&a.mid, &x) + want := T63{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [63]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t63copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T64 struct { + pre [8]byte + mid [64]byte + post [8]byte +} + +func t64copy_ssa(y, x *[64]byte) { + switch { + } + *y = *x +} +func testCopy64() { + a := T64{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [64]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [64]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163} + t64copy_ssa(&a.mid, &x) + want := T64{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [64]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t64copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T65 struct { + pre [8]byte + mid [65]byte + post [8]byte +} + +func t65copy_ssa(y, x *[65]byte) { + switch { + } + *y = *x +} +func testCopy65() { + a := T65{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [65]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [65]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164} + t65copy_ssa(&a.mid, &x) + want := T65{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [65]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t65copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1023 struct { + pre [8]byte + mid [1023]byte + post [8]byte +} + +func t1023copy_ssa(y, x *[1023]byte) { + switch { + } + *y = *x +} +func testCopy1023() { + a := T1023{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1023]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1023]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122} + t1023copy_ssa(&a.mid, &x) + want := T1023{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1023]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1023copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1024 struct { + pre [8]byte + mid [1024]byte + post [8]byte +} + +func t1024copy_ssa(y, x *[1024]byte) { + switch { + } + *y = *x +} +func testCopy1024() { + a := T1024{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1024]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1024]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123} + t1024copy_ssa(&a.mid, &x) + want := T1024{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1024]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1024copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1025 struct { + pre [8]byte + mid [1025]byte + post [8]byte +} + +func t1025copy_ssa(y, x *[1025]byte) { + switch { + } + *y = *x +} +func testCopy1025() { + a := T1025{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1025]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1025]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124} + t1025copy_ssa(&a.mid, &x) + want := T1025{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1025]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1025copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1031 struct { + pre [8]byte + mid [1031]byte + post [8]byte +} + +func t1031copy_ssa(y, x *[1031]byte) { + switch { + } + *y = *x +} +func testCopy1031() { + a := T1031{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1031]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1031]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130} + t1031copy_ssa(&a.mid, &x) + want := T1031{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1031]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1031copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1032 struct { + pre [8]byte + mid [1032]byte + post [8]byte +} + +func t1032copy_ssa(y, x *[1032]byte) { + switch { + } + *y = *x +} +func testCopy1032() { + a := T1032{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1032]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1032]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131} + t1032copy_ssa(&a.mid, &x) + want := T1032{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1032]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1032copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1033 struct { + pre [8]byte + mid [1033]byte + post [8]byte +} + +func t1033copy_ssa(y, x *[1033]byte) { + switch { + } + *y = *x +} +func testCopy1033() { + a := T1033{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1033]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1033]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132} + t1033copy_ssa(&a.mid, &x) + want := T1033{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1033]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1033copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1039 struct { + pre [8]byte + mid [1039]byte + post [8]byte +} + +func t1039copy_ssa(y, x *[1039]byte) { + switch { + } + *y = *x +} +func testCopy1039() { + a := T1039{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1039]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1039]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138} + t1039copy_ssa(&a.mid, &x) + want := T1039{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1039]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1039copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1040 struct { + pre [8]byte + mid [1040]byte + post [8]byte +} + +func t1040copy_ssa(y, x *[1040]byte) { + switch { + } + *y = *x +} +func testCopy1040() { + a := T1040{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1040]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1040]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139} + t1040copy_ssa(&a.mid, &x) + want := T1040{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1040]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1040copy got=%v, want %v\n", a, want) + failed = true + } +} + +type T1041 struct { + pre [8]byte + mid [1041]byte + post [8]byte +} + +func t1041copy_ssa(y, x *[1041]byte) { + switch { + } + *y = *x +} +func testCopy1041() { + a := T1041{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1041]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + x := [1041]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140} + t1041copy_ssa(&a.mid, &x) + want := T1041{[8]byte{201, 202, 203, 204, 205, 206, 207, 208}, [1041]byte{100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140}, [8]byte{211, 212, 213, 214, 215, 216, 217, 218}} + if a != want { + fmt.Printf("t1041copy got=%v, want %v\n", a, want) + failed = true + } +} + +var failed bool + +func main() { + testCopy1() + testCopy2() + testCopy3() + testCopy4() + testCopy5() + testCopy6() + testCopy7() + testCopy8() + testCopy9() + testCopy10() + testCopy15() + testCopy16() + testCopy17() + testCopy23() + testCopy24() + testCopy25() + testCopy31() + testCopy32() + testCopy33() + testCopy63() + testCopy64() + testCopy65() + testCopy1023() + testCopy1024() + testCopy1025() + testCopy1031() + testCopy1032() + testCopy1033() + testCopy1039() + testCopy1040() + testCopy1041() + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/ctl_ssa.go b/src/cmd/compile/internal/gc/testdata/ctl_ssa.go new file mode 100644 index 0000000000..09880ef94f --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/ctl_ssa.go @@ -0,0 +1,161 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Test control flow + +package main + +// nor_ssa calculates NOR(a, b). +// It is implemented in a way that generates +// phi control values. +func nor_ssa(a, b bool) bool { + var c bool + if a { + c = true + } + if b { + c = true + } + if c { + return false + } + return true +} + +func testPhiControl() { + tests := [...][3]bool{ // a, b, want + {false, false, true}, + {true, false, false}, + {false, true, false}, + {true, true, false}, + } + for _, test := range tests { + a, b := test[0], test[1] + got := nor_ssa(a, b) + want := test[2] + if want != got { + print("nor(", a, ", ", b, ")=", want, " got ", got, "\n") + failed = true + } + } +} + +func emptyRange_ssa(b []byte) bool { + for _, x := range b { + _ = x + } + return true +} + +func testEmptyRange() { + if !emptyRange_ssa([]byte{}) { + println("emptyRange_ssa([]byte{})=false, want true") + failed = true + } +} + +func switch_ssa(a int) int { + ret := 0 + switch a { + case 5: + ret += 5 + case 4: + ret += 4 + case 3: + ret += 3 + case 2: + ret += 2 + case 1: + ret += 1 + } + return ret + +} + +func fallthrough_ssa(a int) int { + ret := 0 + switch a { + case 5: + ret++ + fallthrough + case 4: + ret++ + fallthrough + case 3: + ret++ + fallthrough + case 2: + ret++ + fallthrough + case 1: + ret++ + } + return ret + +} + +func testFallthrough() { + for i := 0; i < 6; i++ { + if got := fallthrough_ssa(i); got != i { + println("fallthrough_ssa(i) =", got, "wanted", i) + failed = true + } + } +} + +func testSwitch() { + for i := 0; i < 6; i++ { + if got := switch_ssa(i); got != i { + println("switch_ssa(i) =", got, "wanted", i) + failed = true + } + } +} + +type junk struct { + step int +} + +// flagOverwrite_ssa is intended to reproduce an issue seen where a XOR +// was scheduled between a compare and branch, clearing flags. +func flagOverwrite_ssa(s *junk, c int) int { + switch { + } + if '0' <= c && c <= '9' { + s.step = 0 + return 1 + } + if c == 'e' || c == 'E' { + s.step = 0 + return 2 + } + s.step = 0 + return 3 +} + +func testFlagOverwrite() { + j := junk{} + if got := flagOverwrite_ssa(&j, ' '); got != 3 { + println("flagOverwrite_ssa =", got, "wanted 3") + failed = true + } +} + +var failed = false + +func main() { + testPhiControl() + testEmptyRange() + + testSwitch() + testFallthrough() + + testFlagOverwrite() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/deferNoReturn_ssa.go b/src/cmd/compile/internal/gc/testdata/deferNoReturn_ssa.go new file mode 100644 index 0000000000..7578dd56f2 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/deferNoReturn_ssa.go @@ -0,0 +1,17 @@ +// compile + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Test that a defer in a function with no return +// statement will compile correctly. + +package foo + +func deferNoReturn_ssa() { + defer func() { println("returned") }() + for { + println("loop") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/fp_ssa.go b/src/cmd/compile/internal/gc/testdata/fp_ssa.go new file mode 100644 index 0000000000..cfbdcda251 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/fp_ssa.go @@ -0,0 +1,1741 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests floating point arithmetic expressions + +package main + +import "fmt" + +// manysub_ssa is designed to tickle bugs that depend on register +// pressure or unfriendly operand ordering in registers (and at +// least once it succeeded in this). +func manysub_ssa(a, b, c, d float64) (aa, ab, ac, ad, ba, bb, bc, bd, ca, cb, cc, cd, da, db, dc, dd float64) { + switch { + } + aa = a + 11.0 - a + ab = a - b + ac = a - c + ad = a - d + ba = b - a + bb = b + 22.0 - b + bc = b - c + bd = b - d + ca = c - a + cb = c - b + cc = c + 33.0 - c + cd = c - d + da = d - a + db = d - b + dc = d - c + dd = d + 44.0 - d + return +} + +// fpspill_ssa attempts to trigger a bug where phis with floating point values +// were stored in non-fp registers causing an error in doasm. +func fpspill_ssa(a int) float64 { + switch { + } + + ret := -1.0 + switch a { + case 0: + ret = 1.0 + case 1: + ret = 1.1 + case 2: + ret = 1.2 + case 3: + ret = 1.3 + case 4: + ret = 1.4 + case 5: + ret = 1.5 + case 6: + ret = 1.6 + case 7: + ret = 1.7 + case 8: + ret = 1.8 + case 9: + ret = 1.9 + case 10: + ret = 1.10 + case 11: + ret = 1.11 + case 12: + ret = 1.12 + case 13: + ret = 1.13 + case 14: + ret = 1.14 + case 15: + ret = 1.15 + case 16: + ret = 1.16 + } + return ret +} + +func add64_ssa(a, b float64) float64 { + switch { + } + return a + b +} + +func mul64_ssa(a, b float64) float64 { + switch { + } + return a * b +} + +func sub64_ssa(a, b float64) float64 { + switch { + } + return a - b +} + +func div64_ssa(a, b float64) float64 { + switch { + } + return a / b +} + +func neg64_ssa(a, b float64) float64 { + switch { + } + return -a + -1*b +} + +func add32_ssa(a, b float32) float32 { + switch { + } + return a + b +} + +func mul32_ssa(a, b float32) float32 { + switch { + } + return a * b +} + +func sub32_ssa(a, b float32) float32 { + switch { + } + return a - b +} +func div32_ssa(a, b float32) float32 { + switch { + } + return a / b +} + +func neg32_ssa(a, b float32) float32 { + switch { + } + return -a + -1*b +} + +func conv2Float64_ssa(a int8, b uint8, c int16, d uint16, + e int32, f uint32, g int64, h uint64, i float32) (aa, bb, cc, dd, ee, ff, gg, hh, ii float64) { + switch { + } + aa = float64(a) + bb = float64(b) + cc = float64(c) + hh = float64(h) + dd = float64(d) + ee = float64(e) + ff = float64(f) + gg = float64(g) + ii = float64(i) + return +} + +func conv2Float32_ssa(a int8, b uint8, c int16, d uint16, + e int32, f uint32, g int64, h uint64, i float64) (aa, bb, cc, dd, ee, ff, gg, hh, ii float32) { + switch { + } + aa = float32(a) + bb = float32(b) + cc = float32(c) + dd = float32(d) + ee = float32(e) + ff = float32(f) + gg = float32(g) + hh = float32(h) + ii = float32(i) + return +} + +func integer2floatConversions() int { + fails := 0 + { + a, b, c, d, e, f, g, h, i := conv2Float64_ssa(0, 0, 0, 0, 0, 0, 0, 0, 0) + fails += expectAll64("zero64", 0, a, b, c, d, e, f, g, h, i) + } + { + a, b, c, d, e, f, g, h, i := conv2Float64_ssa(1, 1, 1, 1, 1, 1, 1, 1, 1) + fails += expectAll64("one64", 1, a, b, c, d, e, f, g, h, i) + } + { + a, b, c, d, e, f, g, h, i := conv2Float32_ssa(0, 0, 0, 0, 0, 0, 0, 0, 0) + fails += expectAll32("zero32", 0, a, b, c, d, e, f, g, h, i) + } + { + a, b, c, d, e, f, g, h, i := conv2Float32_ssa(1, 1, 1, 1, 1, 1, 1, 1, 1) + fails += expectAll32("one32", 1, a, b, c, d, e, f, g, h, i) + } + { + // Check maximum values + a, b, c, d, e, f, g, h, i := conv2Float64_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823E38) + fails += expect64("a", a, 127) + fails += expect64("b", b, 255) + fails += expect64("c", c, 32767) + fails += expect64("d", d, 65535) + fails += expect64("e", e, float64(int32(0x7fffffff))) + fails += expect64("f", f, float64(uint32(0xffffffff))) + fails += expect64("g", g, float64(int64(0x7fffffffffffffff))) + fails += expect64("h", h, float64(uint64(0xffffffffffffffff))) + fails += expect64("i", i, float64(float32(3.402823E38))) + } + { + // Check minimum values (and tweaks for unsigned) + a, b, c, d, e, f, g, h, i := conv2Float64_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5E-45) + fails += expect64("a", a, -128) + fails += expect64("b", b, 254) + fails += expect64("c", c, -32768) + fails += expect64("d", d, 65534) + fails += expect64("e", e, float64(^int32(0x7fffffff))) + fails += expect64("f", f, float64(uint32(0xfffffffe))) + fails += expect64("g", g, float64(^int64(0x7fffffffffffffff))) + fails += expect64("h", h, float64(uint64(0xfffffffffffff401))) + fails += expect64("i", i, float64(float32(1.5E-45))) + } + { + // Check maximum values + a, b, c, d, e, f, g, h, i := conv2Float32_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823E38) + fails += expect32("a", a, 127) + fails += expect32("b", b, 255) + fails += expect32("c", c, 32767) + fails += expect32("d", d, 65535) + fails += expect32("e", e, float32(int32(0x7fffffff))) + fails += expect32("f", f, float32(uint32(0xffffffff))) + fails += expect32("g", g, float32(int64(0x7fffffffffffffff))) + fails += expect32("h", h, float32(uint64(0xffffffffffffffff))) + fails += expect32("i", i, float32(float64(3.402823E38))) + } + { + // Check minimum values (and tweaks for unsigned) + a, b, c, d, e, f, g, h, i := conv2Float32_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5E-45) + fails += expect32("a", a, -128) + fails += expect32("b", b, 254) + fails += expect32("c", c, -32768) + fails += expect32("d", d, 65534) + fails += expect32("e", e, float32(^int32(0x7fffffff))) + fails += expect32("f", f, float32(uint32(0xfffffffe))) + fails += expect32("g", g, float32(^int64(0x7fffffffffffffff))) + fails += expect32("h", h, float32(uint64(0xfffffffffffff401))) + fails += expect32("i", i, float32(float64(1.5E-45))) + } + return fails +} + +const ( + aa = 0x1000000000000000 + ab = 0x100000000000000 + ac = 0x10000000000000 + ad = 0x1000000000000 + ba = 0x100000000000 + bb = 0x10000000000 + bc = 0x1000000000 + bd = 0x100000000 + ca = 0x10000000 + cb = 0x1000000 + cc = 0x100000 + cd = 0x10000 + da = 0x1000 + db = 0x100 + dc = 0x10 + dd = 0x1 +) + +func compares64_ssa(a, b, c, d float64) (lt, le, eq, ne, ge, gt uint64) { + + switch { + } + + if a < a { + lt += aa + } + if a < b { + lt += ab + } + if a < c { + lt += ac + } + if a < d { + lt += ad + } + + if b < a { + lt += ba + } + if b < b { + lt += bb + } + if b < c { + lt += bc + } + if b < d { + lt += bd + } + + if c < a { + lt += ca + } + if c < b { + lt += cb + } + if c < c { + lt += cc + } + if c < d { + lt += cd + } + + if d < a { + lt += da + } + if d < b { + lt += db + } + if d < c { + lt += dc + } + if d < d { + lt += dd + } + + if a <= a { + le += aa + } + if a <= b { + le += ab + } + if a <= c { + le += ac + } + if a <= d { + le += ad + } + + if b <= a { + le += ba + } + if b <= b { + le += bb + } + if b <= c { + le += bc + } + if b <= d { + le += bd + } + + if c <= a { + le += ca + } + if c <= b { + le += cb + } + if c <= c { + le += cc + } + if c <= d { + le += cd + } + + if d <= a { + le += da + } + if d <= b { + le += db + } + if d <= c { + le += dc + } + if d <= d { + le += dd + } + + if a == a { + eq += aa + } + if a == b { + eq += ab + } + if a == c { + eq += ac + } + if a == d { + eq += ad + } + + if b == a { + eq += ba + } + if b == b { + eq += bb + } + if b == c { + eq += bc + } + if b == d { + eq += bd + } + + if c == a { + eq += ca + } + if c == b { + eq += cb + } + if c == c { + eq += cc + } + if c == d { + eq += cd + } + + if d == a { + eq += da + } + if d == b { + eq += db + } + if d == c { + eq += dc + } + if d == d { + eq += dd + } + + if a != a { + ne += aa + } + if a != b { + ne += ab + } + if a != c { + ne += ac + } + if a != d { + ne += ad + } + + if b != a { + ne += ba + } + if b != b { + ne += bb + } + if b != c { + ne += bc + } + if b != d { + ne += bd + } + + if c != a { + ne += ca + } + if c != b { + ne += cb + } + if c != c { + ne += cc + } + if c != d { + ne += cd + } + + if d != a { + ne += da + } + if d != b { + ne += db + } + if d != c { + ne += dc + } + if d != d { + ne += dd + } + + if a >= a { + ge += aa + } + if a >= b { + ge += ab + } + if a >= c { + ge += ac + } + if a >= d { + ge += ad + } + + if b >= a { + ge += ba + } + if b >= b { + ge += bb + } + if b >= c { + ge += bc + } + if b >= d { + ge += bd + } + + if c >= a { + ge += ca + } + if c >= b { + ge += cb + } + if c >= c { + ge += cc + } + if c >= d { + ge += cd + } + + if d >= a { + ge += da + } + if d >= b { + ge += db + } + if d >= c { + ge += dc + } + if d >= d { + ge += dd + } + + if a > a { + gt += aa + } + if a > b { + gt += ab + } + if a > c { + gt += ac + } + if a > d { + gt += ad + } + + if b > a { + gt += ba + } + if b > b { + gt += bb + } + if b > c { + gt += bc + } + if b > d { + gt += bd + } + + if c > a { + gt += ca + } + if c > b { + gt += cb + } + if c > c { + gt += cc + } + if c > d { + gt += cd + } + + if d > a { + gt += da + } + if d > b { + gt += db + } + if d > c { + gt += dc + } + if d > d { + gt += dd + } + + return +} + +func compares32_ssa(a, b, c, d float32) (lt, le, eq, ne, ge, gt uint64) { + + switch { + } + + if a < a { + lt += aa + } + if a < b { + lt += ab + } + if a < c { + lt += ac + } + if a < d { + lt += ad + } + + if b < a { + lt += ba + } + if b < b { + lt += bb + } + if b < c { + lt += bc + } + if b < d { + lt += bd + } + + if c < a { + lt += ca + } + if c < b { + lt += cb + } + if c < c { + lt += cc + } + if c < d { + lt += cd + } + + if d < a { + lt += da + } + if d < b { + lt += db + } + if d < c { + lt += dc + } + if d < d { + lt += dd + } + + if a <= a { + le += aa + } + if a <= b { + le += ab + } + if a <= c { + le += ac + } + if a <= d { + le += ad + } + + if b <= a { + le += ba + } + if b <= b { + le += bb + } + if b <= c { + le += bc + } + if b <= d { + le += bd + } + + if c <= a { + le += ca + } + if c <= b { + le += cb + } + if c <= c { + le += cc + } + if c <= d { + le += cd + } + + if d <= a { + le += da + } + if d <= b { + le += db + } + if d <= c { + le += dc + } + if d <= d { + le += dd + } + + if a == a { + eq += aa + } + if a == b { + eq += ab + } + if a == c { + eq += ac + } + if a == d { + eq += ad + } + + if b == a { + eq += ba + } + if b == b { + eq += bb + } + if b == c { + eq += bc + } + if b == d { + eq += bd + } + + if c == a { + eq += ca + } + if c == b { + eq += cb + } + if c == c { + eq += cc + } + if c == d { + eq += cd + } + + if d == a { + eq += da + } + if d == b { + eq += db + } + if d == c { + eq += dc + } + if d == d { + eq += dd + } + + if a != a { + ne += aa + } + if a != b { + ne += ab + } + if a != c { + ne += ac + } + if a != d { + ne += ad + } + + if b != a { + ne += ba + } + if b != b { + ne += bb + } + if b != c { + ne += bc + } + if b != d { + ne += bd + } + + if c != a { + ne += ca + } + if c != b { + ne += cb + } + if c != c { + ne += cc + } + if c != d { + ne += cd + } + + if d != a { + ne += da + } + if d != b { + ne += db + } + if d != c { + ne += dc + } + if d != d { + ne += dd + } + + if a >= a { + ge += aa + } + if a >= b { + ge += ab + } + if a >= c { + ge += ac + } + if a >= d { + ge += ad + } + + if b >= a { + ge += ba + } + if b >= b { + ge += bb + } + if b >= c { + ge += bc + } + if b >= d { + ge += bd + } + + if c >= a { + ge += ca + } + if c >= b { + ge += cb + } + if c >= c { + ge += cc + } + if c >= d { + ge += cd + } + + if d >= a { + ge += da + } + if d >= b { + ge += db + } + if d >= c { + ge += dc + } + if d >= d { + ge += dd + } + + if a > a { + gt += aa + } + if a > b { + gt += ab + } + if a > c { + gt += ac + } + if a > d { + gt += ad + } + + if b > a { + gt += ba + } + if b > b { + gt += bb + } + if b > c { + gt += bc + } + if b > d { + gt += bd + } + + if c > a { + gt += ca + } + if c > b { + gt += cb + } + if c > c { + gt += cc + } + if c > d { + gt += cd + } + + if d > a { + gt += da + } + if d > b { + gt += db + } + if d > c { + gt += dc + } + if d > d { + gt += dd + } + + return +} + +func le64_ssa(x, y float64) bool { + switch { + } + return x <= y +} +func ge64_ssa(x, y float64) bool { + switch { + } + return x >= y +} +func lt64_ssa(x, y float64) bool { + switch { + } + return x < y +} +func gt64_ssa(x, y float64) bool { + switch { + } + return x > y +} +func eq64_ssa(x, y float64) bool { + switch { + } + return x == y +} +func ne64_ssa(x, y float64) bool { + switch { + } + return x != y +} + +func eqbr64_ssa(x, y float64) float64 { + switch { + } + if x == y { + return 17 + } + return 42 +} +func nebr64_ssa(x, y float64) float64 { + switch { + } + if x != y { + return 17 + } + return 42 +} +func gebr64_ssa(x, y float64) float64 { + switch { + } + if x >= y { + return 17 + } + return 42 +} +func lebr64_ssa(x, y float64) float64 { + switch { + } + if x <= y { + return 17 + } + return 42 +} +func ltbr64_ssa(x, y float64) float64 { + switch { + } + if x < y { + return 17 + } + return 42 +} +func gtbr64_ssa(x, y float64) float64 { + switch { + } + if x > y { + return 17 + } + return 42 +} + +func le32_ssa(x, y float32) bool { + switch { + } + return x <= y +} +func ge32_ssa(x, y float32) bool { + switch { + } + return x >= y +} +func lt32_ssa(x, y float32) bool { + switch { + } + return x < y +} +func gt32_ssa(x, y float32) bool { + switch { + } + return x > y +} +func eq32_ssa(x, y float32) bool { + switch { + } + return x == y +} +func ne32_ssa(x, y float32) bool { + switch { + } + return x != y +} + +func eqbr32_ssa(x, y float32) float32 { + switch { + } + if x == y { + return 17 + } + return 42 +} +func nebr32_ssa(x, y float32) float32 { + switch { + } + if x != y { + return 17 + } + return 42 +} +func gebr32_ssa(x, y float32) float32 { + switch { + } + if x >= y { + return 17 + } + return 42 +} +func lebr32_ssa(x, y float32) float32 { + switch { + } + if x <= y { + return 17 + } + return 42 +} +func ltbr32_ssa(x, y float32) float32 { + switch { + } + if x < y { + return 17 + } + return 42 +} +func gtbr32_ssa(x, y float32) float32 { + switch { + } + if x > y { + return 17 + } + return 42 +} + +func F32toU8_ssa(x float32) uint8 { + switch { + } + return uint8(x) +} + +func F32toI8_ssa(x float32) int8 { + switch { + } + return int8(x) +} + +func F32toU16_ssa(x float32) uint16 { + switch { + } + return uint16(x) +} + +func F32toI16_ssa(x float32) int16 { + switch { + } + return int16(x) +} + +func F32toU32_ssa(x float32) uint32 { + switch { + } + return uint32(x) +} + +func F32toI32_ssa(x float32) int32 { + switch { + } + return int32(x) +} + +func F32toU64_ssa(x float32) uint64 { + switch { + } + return uint64(x) +} + +func F32toI64_ssa(x float32) int64 { + switch { + } + return int64(x) +} + +func F64toU8_ssa(x float64) uint8 { + switch { + } + return uint8(x) +} + +func F64toI8_ssa(x float64) int8 { + switch { + } + return int8(x) +} + +func F64toU16_ssa(x float64) uint16 { + switch { + } + return uint16(x) +} + +func F64toI16_ssa(x float64) int16 { + switch { + } + return int16(x) +} + +func F64toU32_ssa(x float64) uint32 { + switch { + } + return uint32(x) +} + +func F64toI32_ssa(x float64) int32 { + switch { + } + return int32(x) +} + +func F64toU64_ssa(x float64) uint64 { + switch { + } + return uint64(x) +} + +func F64toI64_ssa(x float64) int64 { + switch { + } + return int64(x) +} + +func floatsToInts(x float64, expected int64) int { + y := float32(x) + fails := 0 + fails += expectInt64("F64toI8", int64(F64toI8_ssa(x)), expected) + fails += expectInt64("F64toI16", int64(F64toI16_ssa(x)), expected) + fails += expectInt64("F64toI32", int64(F64toI32_ssa(x)), expected) + fails += expectInt64("F64toI64", int64(F64toI64_ssa(x)), expected) + fails += expectInt64("F32toI8", int64(F32toI8_ssa(y)), expected) + fails += expectInt64("F32toI16", int64(F32toI16_ssa(y)), expected) + fails += expectInt64("F32toI32", int64(F32toI32_ssa(y)), expected) + fails += expectInt64("F32toI64", int64(F32toI64_ssa(y)), expected) + return fails +} + +func floatsToUints(x float64, expected uint64) int { + y := float32(x) + fails := 0 + fails += expectUint64("F64toU8", uint64(F64toU8_ssa(x)), expected) + fails += expectUint64("F64toU16", uint64(F64toU16_ssa(x)), expected) + fails += expectUint64("F64toU32", uint64(F64toU32_ssa(x)), expected) + fails += expectUint64("F64toU64", uint64(F64toU64_ssa(x)), expected) + fails += expectUint64("F32toU8", uint64(F32toU8_ssa(y)), expected) + fails += expectUint64("F32toU16", uint64(F32toU16_ssa(y)), expected) + fails += expectUint64("F32toU32", uint64(F32toU32_ssa(y)), expected) + fails += expectUint64("F32toU64", uint64(F32toU64_ssa(y)), expected) + return fails +} + +func floatingToIntegerConversionsTest() int { + fails := 0 + fails += floatsToInts(0.0, 0) + fails += floatsToInts(0.5, 0) + fails += floatsToInts(0.9, 0) + fails += floatsToInts(1.0, 1) + fails += floatsToInts(1.5, 1) + fails += floatsToInts(127.0, 127) + fails += floatsToInts(-1.0, -1) + fails += floatsToInts(-128.0, -128) + + fails += floatsToUints(0.0, 0) + fails += floatsToUints(1.0, 1) + fails += floatsToUints(255.0, 255) + + for j := uint(0); j < 24; j++ { + // Avoid hard cases in the construction + // of the test inputs. + v := int64(1<<62) | int64(1<<(62-j)) + w := uint64(v) + f := float32(v) + d := float64(v) + fails += expectUint64("2**62...", F32toU64_ssa(f), w) + fails += expectUint64("2**62...", F64toU64_ssa(d), w) + fails += expectInt64("2**62...", F32toI64_ssa(f), v) + fails += expectInt64("2**62...", F64toI64_ssa(d), v) + fails += expectInt64("2**62...", F32toI64_ssa(-f), -v) + fails += expectInt64("2**62...", F64toI64_ssa(-d), -v) + w += w + f += f + d += d + fails += expectUint64("2**63...", F32toU64_ssa(f), w) + fails += expectUint64("2**63...", F64toU64_ssa(d), w) + } + + for j := uint(0); j < 16; j++ { + // Avoid hard cases in the construction + // of the test inputs. + v := int32(1<<30) | int32(1<<(30-j)) + w := uint32(v) + f := float32(v) + d := float64(v) + fails += expectUint32("2**30...", F32toU32_ssa(f), w) + fails += expectUint32("2**30...", F64toU32_ssa(d), w) + fails += expectInt32("2**30...", F32toI32_ssa(f), v) + fails += expectInt32("2**30...", F64toI32_ssa(d), v) + fails += expectInt32("2**30...", F32toI32_ssa(-f), -v) + fails += expectInt32("2**30...", F64toI32_ssa(-d), -v) + w += w + f += f + d += d + fails += expectUint32("2**31...", F32toU32_ssa(f), w) + fails += expectUint32("2**31...", F64toU32_ssa(d), w) + } + + for j := uint(0); j < 15; j++ { + // Avoid hard cases in the construction + // of the test inputs. + v := int16(1<<14) | int16(1<<(14-j)) + w := uint16(v) + f := float32(v) + d := float64(v) + fails += expectUint16("2**14...", F32toU16_ssa(f), w) + fails += expectUint16("2**14...", F64toU16_ssa(d), w) + fails += expectInt16("2**14...", F32toI16_ssa(f), v) + fails += expectInt16("2**14...", F64toI16_ssa(d), v) + fails += expectInt16("2**14...", F32toI16_ssa(-f), -v) + fails += expectInt16("2**14...", F64toI16_ssa(-d), -v) + w += w + f += f + d += d + fails += expectUint16("2**15...", F32toU16_ssa(f), w) + fails += expectUint16("2**15...", F64toU16_ssa(d), w) + } + + fails += expectInt32("-2147483648", F32toI32_ssa(-2147483648), -2147483648) + + fails += expectInt32("-2147483648", F64toI32_ssa(-2147483648), -2147483648) + fails += expectInt32("-2147483647", F64toI32_ssa(-2147483647), -2147483647) + fails += expectUint32("4294967295", F64toU32_ssa(4294967295), 4294967295) + + fails += expectInt16("-32768", F64toI16_ssa(-32768), -32768) + fails += expectInt16("-32768", F32toI16_ssa(-32768), -32768) + + // NB more of a pain to do these for 32-bit because of lost bits in Float32 mantissa + fails += expectInt16("32767", F64toI16_ssa(32767), 32767) + fails += expectInt16("32767", F32toI16_ssa(32767), 32767) + fails += expectUint16("32767", F64toU16_ssa(32767), 32767) + fails += expectUint16("32767", F32toU16_ssa(32767), 32767) + fails += expectUint16("65535", F64toU16_ssa(65535), 65535) + fails += expectUint16("65535", F32toU16_ssa(65535), 65535) + + return fails +} + +func fail64(s string, f func(a, b float64) float64, a, b, e float64) int { + d := f(a, b) + if d != e { + fmt.Printf("For (float64) %v %v %v, expected %v, got %v\n", a, s, b, e, d) + return 1 + } + return 0 +} + +func fail64bool(s string, f func(a, b float64) bool, a, b float64, e bool) int { + d := f(a, b) + if d != e { + fmt.Printf("For (float64) %v %v %v, expected %v, got %v\n", a, s, b, e, d) + return 1 + } + return 0 +} + +func fail32(s string, f func(a, b float32) float32, a, b, e float32) int { + d := f(a, b) + if d != e { + fmt.Printf("For (float32) %v %v %v, expected %v, got %v\n", a, s, b, e, d) + return 1 + } + return 0 +} + +func fail32bool(s string, f func(a, b float32) bool, a, b float32, e bool) int { + d := f(a, b) + if d != e { + fmt.Printf("For (float32) %v %v %v, expected %v, got %v\n", a, s, b, e, d) + return 1 + } + return 0 +} + +func expect64(s string, x, expected float64) int { + if x != expected { + println("F64 Expected", expected, "for", s, ", got", x) + return 1 + } + return 0 +} + +func expect32(s string, x, expected float32) int { + if x != expected { + println("F32 Expected", expected, "for", s, ", got", x) + return 1 + } + return 0 +} + +func expectUint64(s string, x, expected uint64) int { + if x != expected { + fmt.Printf("U64 Expected 0x%016x for %s, got 0x%016x\n", expected, s, x) + return 1 + } + return 0 +} + +func expectInt64(s string, x, expected int64) int { + if x != expected { + fmt.Printf("%s: Expected 0x%016x, got 0x%016x\n", s, expected, x) + return 1 + } + return 0 +} + +func expectUint32(s string, x, expected uint32) int { + if x != expected { + fmt.Printf("U32 %s: Expected 0x%08x, got 0x%08x\n", s, expected, x) + return 1 + } + return 0 +} + +func expectInt32(s string, x, expected int32) int { + if x != expected { + fmt.Printf("I32 %s: Expected 0x%08x, got 0x%08x\n", s, expected, x) + return 1 + } + return 0 +} + +func expectUint16(s string, x, expected uint16) int { + if x != expected { + fmt.Printf("U16 %s: Expected 0x%04x, got 0x%04x\n", s, expected, x) + return 1 + } + return 0 +} + +func expectInt16(s string, x, expected int16) int { + if x != expected { + fmt.Printf("I16 %s: Expected 0x%04x, got 0x%04x\n", s, expected, x) + return 1 + } + return 0 +} + +func expectAll64(s string, expected, a, b, c, d, e, f, g, h, i float64) int { + fails := 0 + fails += expect64(s+":a", a, expected) + fails += expect64(s+":b", b, expected) + fails += expect64(s+":c", c, expected) + fails += expect64(s+":d", d, expected) + fails += expect64(s+":e", e, expected) + fails += expect64(s+":f", f, expected) + fails += expect64(s+":g", g, expected) + return fails +} + +func expectAll32(s string, expected, a, b, c, d, e, f, g, h, i float32) int { + fails := 0 + fails += expect32(s+":a", a, expected) + fails += expect32(s+":b", b, expected) + fails += expect32(s+":c", c, expected) + fails += expect32(s+":d", d, expected) + fails += expect32(s+":e", e, expected) + fails += expect32(s+":f", f, expected) + fails += expect32(s+":g", g, expected) + return fails +} + +var ev64 [2]float64 = [2]float64{42.0, 17.0} +var ev32 [2]float32 = [2]float32{42.0, 17.0} + +func cmpOpTest(s string, + f func(a, b float64) bool, + g func(a, b float64) float64, + ff func(a, b float32) bool, + gg func(a, b float32) float32, + zero, one, inf, nan float64, result uint) int { + fails := 0 + fails += fail64bool(s, f, zero, zero, result>>16&1 == 1) + fails += fail64bool(s, f, zero, one, result>>12&1 == 1) + fails += fail64bool(s, f, zero, inf, result>>8&1 == 1) + fails += fail64bool(s, f, zero, nan, result>>4&1 == 1) + fails += fail64bool(s, f, nan, nan, result&1 == 1) + + fails += fail64(s, g, zero, zero, ev64[result>>16&1]) + fails += fail64(s, g, zero, one, ev64[result>>12&1]) + fails += fail64(s, g, zero, inf, ev64[result>>8&1]) + fails += fail64(s, g, zero, nan, ev64[result>>4&1]) + fails += fail64(s, g, nan, nan, ev64[result>>0&1]) + + { + zero := float32(zero) + one := float32(one) + inf := float32(inf) + nan := float32(nan) + fails += fail32bool(s, ff, zero, zero, (result>>16)&1 == 1) + fails += fail32bool(s, ff, zero, one, (result>>12)&1 == 1) + fails += fail32bool(s, ff, zero, inf, (result>>8)&1 == 1) + fails += fail32bool(s, ff, zero, nan, (result>>4)&1 == 1) + fails += fail32bool(s, ff, nan, nan, result&1 == 1) + + fails += fail32(s, gg, zero, zero, ev32[(result>>16)&1]) + fails += fail32(s, gg, zero, one, ev32[(result>>12)&1]) + fails += fail32(s, gg, zero, inf, ev32[(result>>8)&1]) + fails += fail32(s, gg, zero, nan, ev32[(result>>4)&1]) + fails += fail32(s, gg, nan, nan, ev32[(result>>0)&1]) + } + + return fails +} + +func expectCx128(s string, x, expected complex128) int { + if x != expected { + println("Cx 128 Expected", expected, "for", s, ", got", x) + return 1 + } + return 0 +} + +func expectCx64(s string, x, expected complex64) int { + if x != expected { + println("Cx 64 Expected", expected, "for", s, ", got", x) + return 1 + } + return 0 +} + +//go:noinline +func cx128sum_ssa(a, b complex128) complex128 { + return a + b +} + +//go:noinline +func cx128diff_ssa(a, b complex128) complex128 { + return a - b +} + +//go:noinline +func cx128prod_ssa(a, b complex128) complex128 { + return a * b +} + +//go:noinline +func cx128quot_ssa(a, b complex128) complex128 { + return a / b +} + +//go:noinline +func cx128neg_ssa(a complex128) complex128 { + return -a +} + +//go:noinline +func cx128real_ssa(a complex128) float64 { + return real(a) +} + +//go:noinline +func cx128imag_ssa(a complex128) float64 { + return imag(a) +} + +//go:noinline +func cx128cnst_ssa(a complex128) complex128 { + b := 2 + 3i + return a * b +} + +//go:noinline +func cx64sum_ssa(a, b complex64) complex64 { + return a + b +} + +//go:noinline +func cx64diff_ssa(a, b complex64) complex64 { + return a - b +} + +//go:noinline +func cx64prod_ssa(a, b complex64) complex64 { + return a * b +} + +//go:noinline +func cx64quot_ssa(a, b complex64) complex64 { + return a / b +} + +//go:noinline +func cx64neg_ssa(a complex64) complex64 { + return -a +} + +//go:noinline +func cx64real_ssa(a complex64) float32 { + return real(a) +} + +//go:noinline +func cx64imag_ssa(a complex64) float32 { + return imag(a) +} + +//go:noinline +func cx128eq_ssa(a, b complex128) bool { + return a == b +} + +//go:noinline +func cx128ne_ssa(a, b complex128) bool { + return a != b +} + +//go:noinline +func cx64eq_ssa(a, b complex64) bool { + return a == b +} + +//go:noinline +func cx64ne_ssa(a, b complex64) bool { + return a != b +} + +func expectTrue(s string, b bool) int { + if !b { + println("expected true for", s, ", got false") + return 1 + } + return 0 +} +func expectFalse(s string, b bool) int { + if b { + println("expected false for", s, ", got true") + return 1 + } + return 0 +} + +func complexTest128() int { + fails := 0 + var a complex128 = 1 + 2i + var b complex128 = 3 + 6i + sum := cx128sum_ssa(b, a) + diff := cx128diff_ssa(b, a) + prod := cx128prod_ssa(b, a) + quot := cx128quot_ssa(b, a) + neg := cx128neg_ssa(a) + r := cx128real_ssa(a) + i := cx128imag_ssa(a) + cnst := cx128cnst_ssa(a) + c1 := cx128eq_ssa(a, a) + c2 := cx128eq_ssa(a, b) + c3 := cx128ne_ssa(a, a) + c4 := cx128ne_ssa(a, b) + + fails += expectCx128("sum", sum, 4+8i) + fails += expectCx128("diff", diff, 2+4i) + fails += expectCx128("prod", prod, -9+12i) + fails += expectCx128("quot", quot, 3+0i) + fails += expectCx128("neg", neg, -1-2i) + fails += expect64("real", r, 1) + fails += expect64("imag", i, 2) + fails += expectCx128("cnst", cnst, -4+7i) + fails += expectTrue(fmt.Sprintf("%v==%v", a, a), c1) + fails += expectFalse(fmt.Sprintf("%v==%v", a, b), c2) + fails += expectFalse(fmt.Sprintf("%v!=%v", a, a), c3) + fails += expectTrue(fmt.Sprintf("%v!=%v", a, b), c4) + + return fails +} + +func complexTest64() int { + fails := 0 + var a complex64 = 1 + 2i + var b complex64 = 3 + 6i + sum := cx64sum_ssa(b, a) + diff := cx64diff_ssa(b, a) + prod := cx64prod_ssa(b, a) + quot := cx64quot_ssa(b, a) + neg := cx64neg_ssa(a) + r := cx64real_ssa(a) + i := cx64imag_ssa(a) + c1 := cx64eq_ssa(a, a) + c2 := cx64eq_ssa(a, b) + c3 := cx64ne_ssa(a, a) + c4 := cx64ne_ssa(a, b) + + fails += expectCx64("sum", sum, 4+8i) + fails += expectCx64("diff", diff, 2+4i) + fails += expectCx64("prod", prod, -9+12i) + fails += expectCx64("quot", quot, 3+0i) + fails += expectCx64("neg", neg, -1-2i) + fails += expect32("real", r, 1) + fails += expect32("imag", i, 2) + fails += expectTrue(fmt.Sprintf("%v==%v", a, a), c1) + fails += expectFalse(fmt.Sprintf("%v==%v", a, b), c2) + fails += expectFalse(fmt.Sprintf("%v!=%v", a, a), c3) + fails += expectTrue(fmt.Sprintf("%v!=%v", a, b), c4) + + return fails +} + +func main() { + + a := 3.0 + b := 4.0 + + c := float32(3.0) + d := float32(4.0) + + tiny := float32(1.5E-45) // smallest f32 denorm = 2**(-149) + dtiny := float64(tiny) // well within range of f64 + + fails := 0 + fails += fail64("+", add64_ssa, a, b, 7.0) + fails += fail64("*", mul64_ssa, a, b, 12.0) + fails += fail64("-", sub64_ssa, a, b, -1.0) + fails += fail64("/", div64_ssa, a, b, 0.75) + fails += fail64("neg", neg64_ssa, a, b, -7) + + fails += fail32("+", add32_ssa, c, d, 7.0) + fails += fail32("*", mul32_ssa, c, d, 12.0) + fails += fail32("-", sub32_ssa, c, d, -1.0) + fails += fail32("/", div32_ssa, c, d, 0.75) + fails += fail32("neg", neg32_ssa, c, d, -7) + + // denorm-squared should underflow to zero. + fails += fail32("*", mul32_ssa, tiny, tiny, 0) + + // but should not underflow in float and in fact is exactly representable. + fails += fail64("*", mul64_ssa, dtiny, dtiny, 1.9636373861190906e-90) + + // Intended to create register pressure which forces + // asymmetric op into different code paths. + aa, ab, ac, ad, ba, bb, bc, bd, ca, cb, cc, cd, da, db, dc, dd := manysub_ssa(1000.0, 100.0, 10.0, 1.0) + + fails += expect64("aa", aa, 11.0) + fails += expect64("ab", ab, 900.0) + fails += expect64("ac", ac, 990.0) + fails += expect64("ad", ad, 999.0) + + fails += expect64("ba", ba, -900.0) + fails += expect64("bb", bb, 22.0) + fails += expect64("bc", bc, 90.0) + fails += expect64("bd", bd, 99.0) + + fails += expect64("ca", ca, -990.0) + fails += expect64("cb", cb, -90.0) + fails += expect64("cc", cc, 33.0) + fails += expect64("cd", cd, 9.0) + + fails += expect64("da", da, -999.0) + fails += expect64("db", db, -99.0) + fails += expect64("dc", dc, -9.0) + fails += expect64("dd", dd, 44.0) + + fails += integer2floatConversions() + + var zero64 float64 = 0.0 + var one64 float64 = 1.0 + var inf64 float64 = 1.0 / zero64 + var nan64 float64 = sub64_ssa(inf64, inf64) + + fails += cmpOpTest("!=", ne64_ssa, nebr64_ssa, ne32_ssa, nebr32_ssa, zero64, one64, inf64, nan64, 0x01111) + fails += cmpOpTest("==", eq64_ssa, eqbr64_ssa, eq32_ssa, eqbr32_ssa, zero64, one64, inf64, nan64, 0x10000) + fails += cmpOpTest("<=", le64_ssa, lebr64_ssa, le32_ssa, lebr32_ssa, zero64, one64, inf64, nan64, 0x11100) + fails += cmpOpTest("<", lt64_ssa, ltbr64_ssa, lt32_ssa, ltbr32_ssa, zero64, one64, inf64, nan64, 0x01100) + fails += cmpOpTest(">", gt64_ssa, gtbr64_ssa, gt32_ssa, gtbr32_ssa, zero64, one64, inf64, nan64, 0x00000) + fails += cmpOpTest(">=", ge64_ssa, gebr64_ssa, ge32_ssa, gebr32_ssa, zero64, one64, inf64, nan64, 0x10000) + + { + lt, le, eq, ne, ge, gt := compares64_ssa(0.0, 1.0, inf64, nan64) + fails += expectUint64("lt", lt, 0x0110001000000000) + fails += expectUint64("le", le, 0x1110011000100000) + fails += expectUint64("eq", eq, 0x1000010000100000) + fails += expectUint64("ne", ne, 0x0111101111011111) + fails += expectUint64("ge", ge, 0x1000110011100000) + fails += expectUint64("gt", gt, 0x0000100011000000) + // fmt.Printf("lt=0x%016x, le=0x%016x, eq=0x%016x, ne=0x%016x, ge=0x%016x, gt=0x%016x\n", + // lt, le, eq, ne, ge, gt) + } + { + lt, le, eq, ne, ge, gt := compares32_ssa(0.0, 1.0, float32(inf64), float32(nan64)) + fails += expectUint64("lt", lt, 0x0110001000000000) + fails += expectUint64("le", le, 0x1110011000100000) + fails += expectUint64("eq", eq, 0x1000010000100000) + fails += expectUint64("ne", ne, 0x0111101111011111) + fails += expectUint64("ge", ge, 0x1000110011100000) + fails += expectUint64("gt", gt, 0x0000100011000000) + } + + fails += floatingToIntegerConversionsTest() + fails += complexTest128() + fails += complexTest64() + + if fails > 0 { + fmt.Printf("Saw %v failures\n", fails) + panic("Failed.") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/gen/arithBoundaryGen.go b/src/cmd/compile/internal/gc/testdata/gen/arithBoundaryGen.go new file mode 100644 index 0000000000..7c7d721a23 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/gen/arithBoundaryGen.go @@ -0,0 +1,214 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This program generates a test to verify that the standard arithmetic +// operators properly handle some special cases. The test file should be +// generated with a known working version of go. +// launch with `go run arithBoundaryGen.go` a file called arithBoundary_ssa.go +// will be written into the parent directory containing the tests + +package main + +import ( + "bytes" + "fmt" + "go/format" + "io/ioutil" + "log" + "text/template" +) + +// used for interpolation in a text template +type tmplData struct { + Name, Stype, Symbol string +} + +// used to work around an issue with the mod symbol being +// interpreted as part of a format string +func (s tmplData) SymFirst() string { + return string(s.Symbol[0]) +} + +// ucast casts an unsigned int to the size in s +func ucast(i uint64, s sizedTestData) uint64 { + switch s.name { + case "uint32": + return uint64(uint32(i)) + case "uint16": + return uint64(uint16(i)) + case "uint8": + return uint64(uint8(i)) + } + return i +} + +// icast casts a signed int to the size in s +func icast(i int64, s sizedTestData) int64 { + switch s.name { + case "int32": + return int64(int32(i)) + case "int16": + return int64(int16(i)) + case "int8": + return int64(int8(i)) + } + return i +} + +type sizedTestData struct { + name string + sn string + u []uint64 + i []int64 +} + +// values to generate tests. these should include the smallest and largest values, along +// with any other values that might cause issues. we generate n^2 tests for each size to +// cover all cases. +var szs = []sizedTestData{ + sizedTestData{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}}, + sizedTestData{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF, + -4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}}, + + sizedTestData{name: "uint32", sn: "32", u: []uint64{0, 1, 4294967295}}, + sizedTestData{name: "int32", sn: "32", i: []int64{-0x80000000, -0x7FFFFFFF, -1, 0, + 1, 0x7FFFFFFF}}, + + sizedTestData{name: "uint16", sn: "16", u: []uint64{0, 1, 65535}}, + sizedTestData{name: "int16", sn: "16", i: []int64{-32768, -32767, -1, 0, 1, 32766, 32767}}, + + sizedTestData{name: "uint8", sn: "8", u: []uint64{0, 1, 255}}, + sizedTestData{name: "int8", sn: "8", i: []int64{-128, -127, -1, 0, 1, 126, 127}}, +} + +type op struct { + name, symbol string +} + +// ops that we will be generating tests for +var ops = []op{op{"add", "+"}, op{"sub", "-"}, op{"div", "/"}, op{"mod", "%%"}, op{"mul", "*"}} + +func main() { + + w := new(bytes.Buffer) + fmt.Fprintf(w, "package main;\n") + fmt.Fprintf(w, "import \"fmt\"\n") + + for _, sz := range []int{64, 32, 16, 8} { + fmt.Fprintf(w, "type utd%d struct {\n", sz) + fmt.Fprintf(w, " a,b uint%d\n", sz) + fmt.Fprintf(w, " add,sub,mul,div,mod uint%d\n", sz) + fmt.Fprintf(w, "}\n") + + fmt.Fprintf(w, "type itd%d struct {\n", sz) + fmt.Fprintf(w, " a,b int%d\n", sz) + fmt.Fprintf(w, " add,sub,mul,div,mod int%d\n", sz) + fmt.Fprintf(w, "}\n") + } + + // the function being tested + testFunc, err := template.New("testFunc").Parse( + `//go:noinline + func {{.Name}}_{{.Stype}}_ssa(a, b {{.Stype}}) {{.Stype}} { + return a {{.SymFirst}} b +} +`) + if err != nil { + panic(err) + } + + // generate our functions to be tested + for _, s := range szs { + for _, o := range ops { + fd := tmplData{o.name, s.name, o.symbol} + err = testFunc.Execute(w, fd) + if err != nil { + panic(err) + } + } + } + + // generate the test data + for _, s := range szs { + if len(s.u) > 0 { + fmt.Fprintf(w, "var %s_data []utd%s = []utd%s{", s.name, s.sn, s.sn) + for _, i := range s.u { + for _, j := range s.u { + fmt.Fprintf(w, "utd%s{a: %d, b: %d, add: %d, sub: %d, mul: %d", s.sn, i, j, ucast(i+j, s), ucast(i-j, s), ucast(i*j, s)) + if j != 0 { + fmt.Fprintf(w, ", div: %d, mod: %d", ucast(i/j, s), ucast(i%j, s)) + } + fmt.Fprint(w, "},\n") + } + } + fmt.Fprintf(w, "}\n") + } else { + // TODO: clean up this duplication + fmt.Fprintf(w, "var %s_data []itd%s = []itd%s{", s.name, s.sn, s.sn) + for _, i := range s.i { + for _, j := range s.i { + fmt.Fprintf(w, "itd%s{a: %d, b: %d, add: %d, sub: %d, mul: %d", s.sn, i, j, icast(i+j, s), icast(i-j, s), icast(i*j, s)) + if j != 0 { + fmt.Fprintf(w, ", div: %d, mod: %d", icast(i/j, s), icast(i%j, s)) + } + fmt.Fprint(w, "},\n") + } + } + fmt.Fprintf(w, "}\n") + } + } + + fmt.Fprintf(w, "var failed bool\n\n") + fmt.Fprintf(w, "func main() {\n\n") + + verify, err := template.New("tst").Parse( + `if got := {{.Name}}_{{.Stype}}_ssa(v.a, v.b); got != v.{{.Name}} { + fmt.Printf("{{.Name}}_{{.Stype}} %d{{.Symbol}}%d = %d, wanted %d\n",v.a,v.b,got,v.{{.Name}}) + failed = true +} +`) + + for _, s := range szs { + fmt.Fprintf(w, "for _, v := range %s_data {\n", s.name) + + for _, o := range ops { + // avoid generating tests that divide by zero + if o.name == "div" || o.name == "mod" { + fmt.Fprint(w, "if v.b != 0 {") + } + + err = verify.Execute(w, tmplData{o.name, s.name, o.symbol}) + + if o.name == "div" || o.name == "mod" { + fmt.Fprint(w, "\n}\n") + } + + if err != nil { + panic(err) + } + + } + fmt.Fprint(w, " }\n") + } + + fmt.Fprintf(w, `if failed { + panic("tests failed") + } +`) + fmt.Fprintf(w, "}\n") + + // gofmt result + b := w.Bytes() + src, err := format.Source(b) + if err != nil { + fmt.Printf("%s\n", b) + panic(err) + } + + // write to file + err = ioutil.WriteFile("../arithBoundary_ssa.go", src, 0666) + if err != nil { + log.Fatalf("can't write output: %v\n", err) + } +} diff --git a/src/cmd/compile/internal/gc/testdata/gen/arithConstGen.go b/src/cmd/compile/internal/gc/testdata/gen/arithConstGen.go new file mode 100644 index 0000000000..34e54ad08a --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/gen/arithConstGen.go @@ -0,0 +1,294 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This program generates a test to verify that the standard arithmetic +// operators properly handle const cases. The test file should be +// generated with a known working version of go. +// launch with `go run arithConstGen.go` a file called arithConst_ssa.go +// will be written into the parent directory containing the tests + +package main + +import ( + "bytes" + "fmt" + "go/format" + "io/ioutil" + "log" + "strings" + "text/template" +) + +type op struct { + name, symbol string +} +type szD struct { + name string + sn string + u []uint64 + i []int64 +} + +var szs []szD = []szD{ + szD{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}}, + szD{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF, + -4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}}, + + szD{name: "uint32", sn: "32", u: []uint64{0, 1, 4294967295}}, + szD{name: "int32", sn: "32", i: []int64{-0x80000000, -0x7FFFFFFF, -1, 0, + 1, 0x7FFFFFFF}}, + + szD{name: "uint16", sn: "16", u: []uint64{0, 1, 65535}}, + szD{name: "int16", sn: "16", i: []int64{-32768, -32767, -1, 0, 1, 32766, 32767}}, + + szD{name: "uint8", sn: "8", u: []uint64{0, 1, 255}}, + szD{name: "int8", sn: "8", i: []int64{-128, -127, -1, 0, 1, 126, 127}}, +} + +var ops []op = []op{op{"add", "+"}, op{"sub", "-"}, op{"div", "/"}, op{"mul", "*"}, + op{"lsh", "<<"}, op{"rsh", ">>"}} + +// compute the result of i op j, cast as type t. +func ansU(i, j uint64, t, op string) string { + var ans uint64 + switch op { + case "+": + ans = i + j + case "-": + ans = i - j + case "*": + ans = i * j + case "/": + if j != 0 { + ans = i / j + } + case "<<": + ans = i << j + case ">>": + ans = i >> j + } + switch t { + case "uint32": + ans = uint64(uint32(ans)) + case "uint16": + ans = uint64(uint16(ans)) + case "uint8": + ans = uint64(uint8(ans)) + } + return fmt.Sprintf("%d", ans) +} + +// compute the result of i op j, cast as type t. +func ansS(i, j int64, t, op string) string { + var ans int64 + switch op { + case "+": + ans = i + j + case "-": + ans = i - j + case "*": + ans = i * j + case "/": + if j != 0 { + ans = i / j + } + case "<<": + ans = i << uint64(j) + case ">>": + ans = i >> uint64(j) + } + switch t { + case "int32": + ans = int64(int32(ans)) + case "int16": + ans = int64(int16(ans)) + case "int8": + ans = int64(int8(ans)) + } + return fmt.Sprintf("%d", ans) +} + +func main() { + + w := new(bytes.Buffer) + + fmt.Fprintf(w, "package main;\n") + fmt.Fprintf(w, "import \"fmt\"\n") + + fncCnst1, err := template.New("fnc").Parse( + `//go:noinline + func {{.Name}}_{{.Type_}}_{{.FNumber}}_ssa(a {{.Type_}}) {{.Type_}} { + return a {{.Symbol}} {{.Number}} +} +`) + if err != nil { + panic(err) + } + fncCnst2, err := template.New("fnc").Parse( + `//go:noinline + func {{.Name}}_{{.FNumber}}_{{.Type_}}_ssa(a {{.Type_}}) {{.Type_}} { + return {{.Number}} {{.Symbol}} a +} + +`) + if err != nil { + panic(err) + } + + type fncData struct { + Name, Type_, Symbol, FNumber, Number string + } + + for _, s := range szs { + for _, o := range ops { + fd := fncData{o.name, s.name, o.symbol, "", ""} + + // unsigned test cases + if len(s.u) > 0 { + for _, i := range s.u { + fd.Number = fmt.Sprintf("%d", i) + fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1) + + // avoid division by zero + if o.name != "div" || i != 0 { + fncCnst1.Execute(w, fd) + } + + fncCnst2.Execute(w, fd) + } + } + + // signed test cases + if len(s.i) > 0 { + // don't generate tests for shifts by signed integers + if o.name == "lsh" || o.name == "rsh" { + continue + } + for _, i := range s.i { + fd.Number = fmt.Sprintf("%d", i) + fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1) + + // avoid division by zero + if o.name != "div" || i != 0 { + fncCnst1.Execute(w, fd) + } + fncCnst2.Execute(w, fd) + } + } + } + } + + fmt.Fprintf(w, "var failed bool\n\n") + fmt.Fprintf(w, "func main() {\n\n") + + vrf1, _ := template.New("vrf1").Parse(` + if got := {{.Name}}_{{.FNumber}}_{{.Type_}}_ssa({{.Input}}); got != {{.Ans}} { + fmt.Printf("{{.Name}}_{{.Type_}} {{.Number}}{{.Symbol}}{{.Input}} = %d, wanted {{.Ans}}\n",got) + failed = true + } +`) + + vrf2, _ := template.New("vrf2").Parse(` + if got := {{.Name}}_{{.Type_}}_{{.FNumber}}_ssa({{.Input}}); got != {{.Ans}} { + fmt.Printf("{{.Name}}_{{.Type_}} {{.Input}}{{.Symbol}}{{.Number}} = %d, wanted {{.Ans}}\n",got) + failed = true + } +`) + + type cfncData struct { + Name, Type_, Symbol, FNumber, Number string + Ans, Input string + } + for _, s := range szs { + if len(s.u) > 0 { + for _, o := range ops { + fd := cfncData{o.name, s.name, o.symbol, "", "", "", ""} + for _, i := range s.u { + fd.Number = fmt.Sprintf("%d", i) + fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1) + + // unsigned + for _, j := range s.u { + + if o.name != "div" || j != 0 { + fd.Ans = ansU(i, j, s.name, o.symbol) + fd.Input = fmt.Sprintf("%d", j) + err = vrf1.Execute(w, fd) + if err != nil { + panic(err) + } + } + + if o.name != "div" || i != 0 { + fd.Ans = ansU(j, i, s.name, o.symbol) + fd.Input = fmt.Sprintf("%d", j) + err = vrf2.Execute(w, fd) + if err != nil { + panic(err) + } + } + + } + } + + } + } + + // signed + if len(s.i) > 0 { + for _, o := range ops { + // don't generate tests for shifts by signed integers + if o.name == "lsh" || o.name == "rsh" { + continue + } + fd := cfncData{o.name, s.name, o.symbol, "", "", "", ""} + for _, i := range s.i { + fd.Number = fmt.Sprintf("%d", i) + fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1) + for _, j := range s.i { + if o.name != "div" || j != 0 { + fd.Ans = ansS(i, j, s.name, o.symbol) + fd.Input = fmt.Sprintf("%d", j) + err = vrf1.Execute(w, fd) + if err != nil { + panic(err) + } + } + + if o.name != "div" || i != 0 { + fd.Ans = ansS(j, i, s.name, o.symbol) + fd.Input = fmt.Sprintf("%d", j) + err = vrf2.Execute(w, fd) + if err != nil { + panic(err) + } + } + + } + } + + } + } + } + + fmt.Fprintf(w, `if failed { + panic("tests failed") + } +`) + fmt.Fprintf(w, "}\n") + + // gofmt result + b := w.Bytes() + src, err := format.Source(b) + if err != nil { + fmt.Printf("%s\n", b) + panic(err) + } + + // write to file + err = ioutil.WriteFile("../arithConst_ssa.go", src, 0666) + if err != nil { + log.Fatalf("can't write output: %v\n", err) + } +} diff --git a/src/cmd/compile/internal/gc/testdata/gen/copyGen.go b/src/cmd/compile/internal/gc/testdata/gen/copyGen.go new file mode 100644 index 0000000000..a699fac6c0 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/gen/copyGen.go @@ -0,0 +1,93 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "bytes" + "fmt" + "go/format" + "io/ioutil" + "log" +) + +// This program generates tests to verify that copying operations +// copy the data they are supposed to and clobber no adjacent values. + +// run as `go run copyGen.go`. A file called copy_ssa.go +// will be written into the parent directory containing the tests. + +var sizes = [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 23, 24, 25, 31, 32, 33, 63, 64, 65, 1023, 1024, 1025, 1024 + 7, 1024 + 8, 1024 + 9, 1024 + 15, 1024 + 16, 1024 + 17} + +func main() { + w := new(bytes.Buffer) + fmt.Fprintf(w, "// run\n") + fmt.Fprintf(w, "// autogenerated from gen/copyGen.go - do not edit!\n") + fmt.Fprintf(w, "package main\n") + fmt.Fprintf(w, "import \"fmt\"\n") + + for _, s := range sizes { + // type for test + fmt.Fprintf(w, "type T%d struct {\n", s) + fmt.Fprintf(w, " pre [8]byte\n") + fmt.Fprintf(w, " mid [%d]byte\n", s) + fmt.Fprintf(w, " post [8]byte\n") + fmt.Fprintf(w, "}\n") + + // function being tested + fmt.Fprintf(w, "func t%dcopy_ssa(y, x *[%d]byte) {\n", s, s) + fmt.Fprintf(w, " switch{}\n") + fmt.Fprintf(w, " *y = *x\n") + fmt.Fprintf(w, "}\n") + + // testing harness + fmt.Fprintf(w, "func testCopy%d() {\n", s) + fmt.Fprintf(w, " a := T%d{[8]byte{201, 202, 203, 204, 205, 206, 207, 208},[%d]byte{", s, s) + for i := 0; i < s; i++ { + fmt.Fprintf(w, "%d,", i%100) + } + fmt.Fprintf(w, "},[8]byte{211, 212, 213, 214, 215, 216, 217, 218}}\n") + fmt.Fprintf(w, " x := [%d]byte{", s) + for i := 0; i < s; i++ { + fmt.Fprintf(w, "%d,", 100+i%100) + } + fmt.Fprintf(w, "}\n") + fmt.Fprintf(w, " t%dcopy_ssa(&a.mid, &x)\n", s) + fmt.Fprintf(w, " want := T%d{[8]byte{201, 202, 203, 204, 205, 206, 207, 208},[%d]byte{", s, s) + for i := 0; i < s; i++ { + fmt.Fprintf(w, "%d,", 100+i%100) + } + fmt.Fprintf(w, "},[8]byte{211, 212, 213, 214, 215, 216, 217, 218}}\n") + fmt.Fprintf(w, " if a != want {\n") + fmt.Fprintf(w, " fmt.Printf(\"t%dcopy got=%%v, want %%v\\n\", a, want)\n", s) + fmt.Fprintf(w, " failed=true\n") + fmt.Fprintf(w, " }\n") + fmt.Fprintf(w, "}\n") + } + + // boilerplate at end + fmt.Fprintf(w, "var failed bool\n") + fmt.Fprintf(w, "func main() {\n") + for _, s := range sizes { + fmt.Fprintf(w, " testCopy%d()\n", s) + } + fmt.Fprintf(w, " if failed {\n") + fmt.Fprintf(w, " panic(\"failed\")\n") + fmt.Fprintf(w, " }\n") + fmt.Fprintf(w, "}\n") + + // gofmt result + b := w.Bytes() + src, err := format.Source(b) + if err != nil { + fmt.Printf("%s\n", b) + panic(err) + } + + // write to file + err = ioutil.WriteFile("../copy_ssa.go", src, 0666) + if err != nil { + log.Fatalf("can't write output: %v\n", err) + } +} diff --git a/src/cmd/compile/internal/gc/testdata/gen/zeroGen.go b/src/cmd/compile/internal/gc/testdata/gen/zeroGen.go new file mode 100644 index 0000000000..90e8029f3f --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/gen/zeroGen.go @@ -0,0 +1,88 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "bytes" + "fmt" + "go/format" + "io/ioutil" + "log" +) + +// This program generates tests to verify that zeroing operations +// zero the data they are supposed to and clobber no adjacent values. + +// run as `go run zeroGen.go`. A file called zero_ssa.go +// will be written into the parent directory containing the tests. + +var sizes = [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 23, 24, 25, 31, 32, 33, 63, 64, 65, 1023, 1024, 1025} + +func main() { + w := new(bytes.Buffer) + fmt.Fprintf(w, "// run\n") + fmt.Fprintf(w, "// autogenerated from gen/zeroGen.go - do not edit!\n") + fmt.Fprintf(w, "package main\n") + fmt.Fprintf(w, "import \"fmt\"\n") + + for _, s := range sizes { + // type for test + fmt.Fprintf(w, "type T%d struct {\n", s) + fmt.Fprintf(w, " pre [8]byte\n") + fmt.Fprintf(w, " mid [%d]byte\n", s) + fmt.Fprintf(w, " post [8]byte\n") + fmt.Fprintf(w, "}\n") + + // function being tested + fmt.Fprintf(w, "func zero%d_ssa(x *[%d]byte) {\n", s, s) + fmt.Fprintf(w, " switch{}\n") + fmt.Fprintf(w, " *x = [%d]byte{}\n", s) + fmt.Fprintf(w, "}\n") + + // testing harness + fmt.Fprintf(w, "func testZero%d() {\n", s) + fmt.Fprintf(w, " a := T%d{[8]byte{255,255,255,255,255,255,255,255},[%d]byte{", s, s) + for i := 0; i < s; i++ { + fmt.Fprintf(w, "255,") + } + fmt.Fprintf(w, "},[8]byte{255,255,255,255,255,255,255,255}}\n") + fmt.Fprintf(w, " zero%d_ssa(&a.mid)\n", s) + fmt.Fprintf(w, " want := T%d{[8]byte{255,255,255,255,255,255,255,255},[%d]byte{", s, s) + for i := 0; i < s; i++ { + fmt.Fprintf(w, "0,") + } + fmt.Fprintf(w, "},[8]byte{255,255,255,255,255,255,255,255}}\n") + fmt.Fprintf(w, " if a != want {\n") + fmt.Fprintf(w, " fmt.Printf(\"zero%d got=%%v, want %%v\\n\", a, want)\n", s) + fmt.Fprintf(w, " failed=true\n") + fmt.Fprintf(w, " }\n") + fmt.Fprintf(w, "}\n") + } + + // boilerplate at end + fmt.Fprintf(w, "var failed bool\n") + fmt.Fprintf(w, "func main() {\n") + for _, s := range sizes { + fmt.Fprintf(w, " testZero%d()\n", s) + } + fmt.Fprintf(w, " if failed {\n") + fmt.Fprintf(w, " panic(\"failed\")\n") + fmt.Fprintf(w, " }\n") + fmt.Fprintf(w, "}\n") + + // gofmt result + b := w.Bytes() + src, err := format.Source(b) + if err != nil { + fmt.Printf("%s\n", b) + panic(err) + } + + // write to file + err = ioutil.WriteFile("../zero_ssa.go", src, 0666) + if err != nil { + log.Fatalf("can't write output: %v\n", err) + } +} diff --git a/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go b/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go new file mode 100644 index 0000000000..e0b0b4dfab --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go @@ -0,0 +1,117 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests load/store ordering + +package main + +import "fmt" + +// testLoadStoreOrder tests for reordering of stores/loads. +func testLoadStoreOrder() { + z := uint32(1000) + if testLoadStoreOrder_ssa(&z, 100) == 0 { + println("testLoadStoreOrder failed") + failed = true + } +} +func testLoadStoreOrder_ssa(z *uint32, prec uint) int { + switch { + } + old := *z // load + *z = uint32(prec) // store + if *z < old { // load + return 1 + } + return 0 +} + +func testStoreSize() { + a := [4]uint16{11, 22, 33, 44} + testStoreSize_ssa(&a[0], &a[2], 77) + want := [4]uint16{77, 22, 33, 44} + if a != want { + fmt.Println("testStoreSize failed. want =", want, ", got =", a) + failed = true + } +} +func testStoreSize_ssa(p *uint16, q *uint16, v uint32) { + switch { + } + // Test to make sure that (Store ptr (Trunc32to16 val) mem) + // does not end up as a 32-bit store. It must stay a 16 bit store + // even when Trunc32to16 is rewritten to be a nop. + // To ensure that we get rewrite the Trunc32to16 before + // we rewrite the Store, we force the truncate into an + // earlier basic block by using it on both branches. + w := uint16(v) + if p != nil { + *p = w + } else { + *q = w + } +} + +var failed = false + +func testExtStore_ssa(p *byte, b bool) int { + switch { + } + x := *p + *p = 7 + if b { + return int(x) + } + return 0 +} + +func testExtStore() { + const start = 8 + var b byte = start + if got := testExtStore_ssa(&b, true); got != start { + fmt.Println("testExtStore failed. want =", start, ", got =", got) + failed = true + } +} + +var b int + +// testDeadStorePanic_ssa ensures that we don't optimize away stores +// that could be read by after recover(). Modeled after fixedbugs/issue1304. +func testDeadStorePanic_ssa(a int) (r int) { + switch { + } + defer func() { + recover() + r = a + }() + a = 2 // store + b := a - a // optimized to zero + c := 4 + a = c / b // store, but panics + a = 3 // store + r = a + return +} + +func testDeadStorePanic() { + if want, got := 2, testDeadStorePanic_ssa(1); want != got { + fmt.Println("testDeadStorePanic failed. want =", want, ", got =", got) + failed = true + } +} + +func main() { + + testLoadStoreOrder() + testStoreSize() + testExtStore() + testDeadStorePanic() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/map_ssa.go b/src/cmd/compile/internal/gc/testdata/map_ssa.go new file mode 100644 index 0000000000..4a466003c7 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/map_ssa.go @@ -0,0 +1,45 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// map_ssa.go tests map operations. +package main + +import "fmt" + +var failed = false + +//go:noinline +func lenMap_ssa(v map[int]int) int { + return len(v) +} + +func testLenMap() { + + v := make(map[int]int) + v[0] = 0 + v[1] = 0 + v[2] = 0 + + if want, got := 3, lenMap_ssa(v); got != want { + fmt.Printf("expected len(map) = %d, got %d", want, got) + failed = true + } +} + +func testLenNilMap() { + + var v map[int]int + if want, got := 0, lenMap_ssa(v); got != want { + fmt.Printf("expected len(nil) = %d, got %d", want, got) + failed = true + } +} +func main() { + testLenMap() + testLenNilMap() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/phi_ssa.go b/src/cmd/compile/internal/gc/testdata/phi_ssa.go new file mode 100644 index 0000000000..e855070fc3 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/phi_ssa.go @@ -0,0 +1,103 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +// Test to make sure spills of cast-shortened values +// don't end up spilling the pre-shortened size instead +// of the post-shortened size. + +import ( + "fmt" + "runtime" +) + +// unfoldable true +var true_ = true + +var data1 [26]int32 +var data2 [26]int64 + +func init() { + for i := 0; i < 26; i++ { + // If we spill all 8 bytes of this datum, the 1 in the high-order 4 bytes + // will overwrite some other variable in the stack frame. + data2[i] = 0x100000000 + } +} + +func foo() int32 { + var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z int32 + if true_ { + a = data1[0] + b = data1[1] + c = data1[2] + d = data1[3] + e = data1[4] + f = data1[5] + g = data1[6] + h = data1[7] + i = data1[8] + j = data1[9] + k = data1[10] + l = data1[11] + m = data1[12] + n = data1[13] + o = data1[14] + p = data1[15] + q = data1[16] + r = data1[17] + s = data1[18] + t = data1[19] + u = data1[20] + v = data1[21] + w = data1[22] + x = data1[23] + y = data1[24] + z = data1[25] + } else { + a = int32(data2[0]) + b = int32(data2[1]) + c = int32(data2[2]) + d = int32(data2[3]) + e = int32(data2[4]) + f = int32(data2[5]) + g = int32(data2[6]) + h = int32(data2[7]) + i = int32(data2[8]) + j = int32(data2[9]) + k = int32(data2[10]) + l = int32(data2[11]) + m = int32(data2[12]) + n = int32(data2[13]) + o = int32(data2[14]) + p = int32(data2[15]) + q = int32(data2[16]) + r = int32(data2[17]) + s = int32(data2[18]) + t = int32(data2[19]) + u = int32(data2[20]) + v = int32(data2[21]) + w = int32(data2[22]) + x = int32(data2[23]) + y = int32(data2[24]) + z = int32(data2[25]) + } + // Lots of phis of the form phi(int32,int64) of type int32 happen here. + // Some will be stack phis. For those stack phis, make sure the spill + // of the second argument uses the phi's width (4 bytes), not its width + // (8 bytes). Otherwise, a random stack slot gets clobbered. + + runtime.Gosched() + return a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v + w + x + y + z +} + +func main() { + want := int32(0) + got := foo() + if got != want { + fmt.Printf("want %d, got %d\n", want, got) + panic("bad") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/regalloc_ssa.go b/src/cmd/compile/internal/gc/testdata/regalloc_ssa.go new file mode 100644 index 0000000000..f752692952 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/regalloc_ssa.go @@ -0,0 +1,57 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests phi implementation + +package main + +func phiOverwrite_ssa() int { + var n int + for i := 0; i < 10; i++ { + if i == 6 { + break + } + n = i + } + return n +} + +func phiOverwrite() { + want := 5 + got := phiOverwrite_ssa() + if got != want { + println("phiOverwrite_ssa()=", want, ", got", got) + failed = true + } +} + +func phiOverwriteBig_ssa() int { + var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z int + a = 1 + for idx := 0; idx < 26; idx++ { + a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z = b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a + } + return a*1 + b*2 + c*3 + d*4 + e*5 + f*6 + g*7 + h*8 + i*9 + j*10 + k*11 + l*12 + m*13 + n*14 + o*15 + p*16 + q*17 + r*18 + s*19 + t*20 + u*21 + v*22 + w*23 + x*24 + y*25 + z*26 +} + +func phiOverwriteBig() { + want := 1 + got := phiOverwriteBig_ssa() + if got != want { + println("phiOverwriteBig_ssa()=", want, ", got", got) + failed = true + } +} + +var failed = false + +func main() { + phiOverwrite() + phiOverwriteBig() + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/short_ssa.go b/src/cmd/compile/internal/gc/testdata/short_ssa.go new file mode 100644 index 0000000000..fcec1baf09 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/short_ssa.go @@ -0,0 +1,60 @@ +// run + +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Tests short circuiting. + +package main + +func and_ssa(arg1, arg2 bool) bool { + return arg1 && rightCall(arg2) +} + +func or_ssa(arg1, arg2 bool) bool { + return arg1 || rightCall(arg2) +} + +var rightCalled bool + +//go:noinline +func rightCall(v bool) bool { + rightCalled = true + return v + panic("unreached") +} + +func testAnd(arg1, arg2, wantRes bool) { testShortCircuit("AND", arg1, arg2, and_ssa, arg1, wantRes) } +func testOr(arg1, arg2, wantRes bool) { testShortCircuit("OR", arg1, arg2, or_ssa, !arg1, wantRes) } + +func testShortCircuit(opName string, arg1, arg2 bool, fn func(bool, bool) bool, wantRightCall, wantRes bool) { + rightCalled = false + got := fn(arg1, arg2) + if rightCalled != wantRightCall { + println("failed for", arg1, opName, arg2, "; rightCalled=", rightCalled, "want=", wantRightCall) + failed = true + } + if wantRes != got { + println("failed for", arg1, opName, arg2, "; res=", got, "want=", wantRes) + failed = true + } +} + +var failed = false + +func main() { + testAnd(false, false, false) + testAnd(false, true, false) + testAnd(true, false, false) + testAnd(true, true, true) + + testOr(false, false, false) + testOr(false, true, true) + testOr(true, false, true) + testOr(true, true, true) + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/string_ssa.go b/src/cmd/compile/internal/gc/testdata/string_ssa.go new file mode 100644 index 0000000000..a949fbcefb --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/string_ssa.go @@ -0,0 +1,161 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// string_ssa.go tests string operations. +package main + +var failed = false + +//go:noinline +func testStringSlice1_ssa(a string, i, j int) string { + return a[i:] +} + +//go:noinline +func testStringSlice2_ssa(a string, i, j int) string { + return a[:j] +} + +//go:noinline +func testStringSlice12_ssa(a string, i, j int) string { + return a[i:j] +} + +func testStringSlice() { + tests := [...]struct { + fn func(string, int, int) string + s string + low, high int + want string + }{ + // -1 means the value is not used. + {testStringSlice1_ssa, "foobar", 0, -1, "foobar"}, + {testStringSlice1_ssa, "foobar", 3, -1, "bar"}, + {testStringSlice1_ssa, "foobar", 6, -1, ""}, + {testStringSlice2_ssa, "foobar", -1, 0, ""}, + {testStringSlice2_ssa, "foobar", -1, 3, "foo"}, + {testStringSlice2_ssa, "foobar", -1, 6, "foobar"}, + {testStringSlice12_ssa, "foobar", 0, 6, "foobar"}, + {testStringSlice12_ssa, "foobar", 0, 0, ""}, + {testStringSlice12_ssa, "foobar", 6, 6, ""}, + {testStringSlice12_ssa, "foobar", 1, 5, "ooba"}, + {testStringSlice12_ssa, "foobar", 3, 3, ""}, + {testStringSlice12_ssa, "", 0, 0, ""}, + } + + for i, t := range tests { + if got := t.fn(t.s, t.low, t.high); t.want != got { + println("#", i, " ", t.s, "[", t.low, ":", t.high, "] = ", got, " want ", t.want) + failed = true + } + } +} + +type prefix struct { + prefix string +} + +func (p *prefix) slice_ssa() { + p.prefix = p.prefix[:3] +} + +func testStructSlice() { + switch { + } + p := &prefix{"prefix"} + p.slice_ssa() + if "pre" != p.prefix { + println("wrong field slice: wanted %s got %s", "pre", p.prefix) + failed = true + } +} + +func testStringSlicePanic() { + defer func() { + if r := recover(); r != nil { + println("paniced as expected") + } + }() + + str := "foobar" + println("got ", testStringSlice12_ssa(str, 3, 9)) + println("expected to panic, but didn't") + failed = true +} + +const _Accuracy_name = "BelowExactAbove" + +var _Accuracy_index = [...]uint8{0, 5, 10, 15} + +//go:noinline +func testSmallIndexType_ssa(i int) string { + return _Accuracy_name[_Accuracy_index[i]:_Accuracy_index[i+1]] +} + +func testSmallIndexType() { + tests := []struct { + i int + want string + }{ + {0, "Below"}, + {1, "Exact"}, + {2, "Above"}, + } + + for i, t := range tests { + if got := testSmallIndexType_ssa(t.i); got != t.want { + println("#", i, "got ", got, ", wanted", t.want) + failed = true + } + } +} + +//go:noinline +func testStringElem_ssa(s string, i int) byte { + return s[i] +} + +func testStringElem() { + tests := []struct { + s string + i int + n byte + }{ + {"foobar", 3, 98}, + {"foobar", 0, 102}, + {"foobar", 5, 114}, + } + for _, t := range tests { + if got := testStringElem_ssa(t.s, t.i); got != t.n { + print("testStringElem \"", t.s, "\"[", t.i, "]=", got, ", wanted ", t.n, "\n") + failed = true + } + } +} + +//go:noinline +func testStringElemConst_ssa(i int) byte { + s := "foobar" + return s[i] +} + +func testStringElemConst() { + if got := testStringElemConst_ssa(3); got != 98 { + println("testStringElemConst=", got, ", wanted 98") + failed = true + } +} + +func main() { + testStringSlice() + testStringSlicePanic() + testStructSlice() + testSmallIndexType() + testStringElem() + testStringElemConst() + + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/testdata/unsafe_ssa.go b/src/cmd/compile/internal/gc/testdata/unsafe_ssa.go new file mode 100644 index 0000000000..d074eb1d5e --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/unsafe_ssa.go @@ -0,0 +1,148 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "fmt" + "runtime" + "unsafe" +) + +// global pointer slot +var a *[8]uint + +// unfoldable true +var b = true + +// Test to make sure that a pointer value which is alive +// across a call is retained, even when there are matching +// conversions to/from uintptr around the call. +// We arrange things very carefully to have to/from +// conversions on either side of the call which cannot be +// combined with any other conversions. +func f_ssa() *[8]uint { + // Make x a uintptr pointing to where a points. + var x uintptr + if b { + x = uintptr(unsafe.Pointer(a)) + } else { + x = 0 + } + // Clobber the global pointer. The only live ref + // to the allocated object is now x. + a = nil + + // Convert to pointer so it should hold + // the object live across GC call. + p := unsafe.Pointer(x) + + // Call gc. + runtime.GC() + + // Convert back to uintptr. + y := uintptr(p) + + // Mess with y so that the subsequent cast + // to unsafe.Pointer can't be combined with the + // uintptr cast above. + var z uintptr + if b { + z = y + } else { + z = 0 + } + return (*[8]uint)(unsafe.Pointer(z)) +} + +// g_ssa is the same as f_ssa, but with a bit of pointer +// arithmetic for added insanity. +func g_ssa() *[7]uint { + // Make x a uintptr pointing to where a points. + var x uintptr + if b { + x = uintptr(unsafe.Pointer(a)) + } else { + x = 0 + } + // Clobber the global pointer. The only live ref + // to the allocated object is now x. + a = nil + + // Offset x by one int. + x += unsafe.Sizeof(int(0)) + + // Convert to pointer so it should hold + // the object live across GC call. + p := unsafe.Pointer(x) + + // Call gc. + runtime.GC() + + // Convert back to uintptr. + y := uintptr(p) + + // Mess with y so that the subsequent cast + // to unsafe.Pointer can't be combined with the + // uintptr cast above. + var z uintptr + if b { + z = y + } else { + z = 0 + } + return (*[7]uint)(unsafe.Pointer(z)) +} + +func testf() { + a = new([8]uint) + for i := 0; i < 8; i++ { + a[i] = 0xabcd + } + c := f_ssa() + for i := 0; i < 8; i++ { + if c[i] != 0xabcd { + fmt.Printf("%d:%x\n", i, c[i]) + panic("bad c") + } + } +} + +func testg() { + a = new([8]uint) + for i := 0; i < 8; i++ { + a[i] = 0xabcd + } + c := g_ssa() + for i := 0; i < 7; i++ { + if c[i] != 0xabcd { + fmt.Printf("%d:%x\n", i, c[i]) + panic("bad c") + } + } +} + +func alias_ssa(ui64 *uint64, ui32 *uint32) uint32 { + *ui32 = 0xffffffff + *ui64 = 0 // store + ret := *ui32 // load from same address, should be zero + *ui64 = 0xffffffffffffffff // store + return ret +} +func testdse() { + x := int64(-1) + // construct two pointers that alias one another + ui64 := (*uint64)(unsafe.Pointer(&x)) + ui32 := (*uint32)(unsafe.Pointer(&x)) + if want, got := uint32(0), alias_ssa(ui64, ui32); got != want { + fmt.Printf("alias_ssa: wanted %d, got %d\n", want, got) + panic("alias_ssa") + } +} + +func main() { + testf() + testg() + testdse() +} diff --git a/src/cmd/compile/internal/gc/testdata/zero_ssa.go b/src/cmd/compile/internal/gc/testdata/zero_ssa.go new file mode 100644 index 0000000000..0ec883b7f4 --- /dev/null +++ b/src/cmd/compile/internal/gc/testdata/zero_ssa.go @@ -0,0 +1,563 @@ +// run +// autogenerated from gen/zeroGen.go - do not edit! +package main + +import "fmt" + +type T1 struct { + pre [8]byte + mid [1]byte + post [8]byte +} + +func zero1_ssa(x *[1]byte) { + switch { + } + *x = [1]byte{} +} +func testZero1() { + a := T1{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1]byte{255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero1_ssa(&a.mid) + want := T1{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1]byte{0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero1 got=%v, want %v\n", a, want) + failed = true + } +} + +type T2 struct { + pre [8]byte + mid [2]byte + post [8]byte +} + +func zero2_ssa(x *[2]byte) { + switch { + } + *x = [2]byte{} +} +func testZero2() { + a := T2{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [2]byte{255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero2_ssa(&a.mid) + want := T2{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [2]byte{0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero2 got=%v, want %v\n", a, want) + failed = true + } +} + +type T3 struct { + pre [8]byte + mid [3]byte + post [8]byte +} + +func zero3_ssa(x *[3]byte) { + switch { + } + *x = [3]byte{} +} +func testZero3() { + a := T3{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [3]byte{255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero3_ssa(&a.mid) + want := T3{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [3]byte{0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero3 got=%v, want %v\n", a, want) + failed = true + } +} + +type T4 struct { + pre [8]byte + mid [4]byte + post [8]byte +} + +func zero4_ssa(x *[4]byte) { + switch { + } + *x = [4]byte{} +} +func testZero4() { + a := T4{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [4]byte{255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero4_ssa(&a.mid) + want := T4{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [4]byte{0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero4 got=%v, want %v\n", a, want) + failed = true + } +} + +type T5 struct { + pre [8]byte + mid [5]byte + post [8]byte +} + +func zero5_ssa(x *[5]byte) { + switch { + } + *x = [5]byte{} +} +func testZero5() { + a := T5{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [5]byte{255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero5_ssa(&a.mid) + want := T5{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [5]byte{0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero5 got=%v, want %v\n", a, want) + failed = true + } +} + +type T6 struct { + pre [8]byte + mid [6]byte + post [8]byte +} + +func zero6_ssa(x *[6]byte) { + switch { + } + *x = [6]byte{} +} +func testZero6() { + a := T6{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [6]byte{255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero6_ssa(&a.mid) + want := T6{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [6]byte{0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero6 got=%v, want %v\n", a, want) + failed = true + } +} + +type T7 struct { + pre [8]byte + mid [7]byte + post [8]byte +} + +func zero7_ssa(x *[7]byte) { + switch { + } + *x = [7]byte{} +} +func testZero7() { + a := T7{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [7]byte{255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero7_ssa(&a.mid) + want := T7{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [7]byte{0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero7 got=%v, want %v\n", a, want) + failed = true + } +} + +type T8 struct { + pre [8]byte + mid [8]byte + post [8]byte +} + +func zero8_ssa(x *[8]byte) { + switch { + } + *x = [8]byte{} +} +func testZero8() { + a := T8{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero8_ssa(&a.mid) + want := T8{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero8 got=%v, want %v\n", a, want) + failed = true + } +} + +type T9 struct { + pre [8]byte + mid [9]byte + post [8]byte +} + +func zero9_ssa(x *[9]byte) { + switch { + } + *x = [9]byte{} +} +func testZero9() { + a := T9{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [9]byte{255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero9_ssa(&a.mid) + want := T9{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [9]byte{0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero9 got=%v, want %v\n", a, want) + failed = true + } +} + +type T10 struct { + pre [8]byte + mid [10]byte + post [8]byte +} + +func zero10_ssa(x *[10]byte) { + switch { + } + *x = [10]byte{} +} +func testZero10() { + a := T10{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [10]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero10_ssa(&a.mid) + want := T10{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [10]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero10 got=%v, want %v\n", a, want) + failed = true + } +} + +type T15 struct { + pre [8]byte + mid [15]byte + post [8]byte +} + +func zero15_ssa(x *[15]byte) { + switch { + } + *x = [15]byte{} +} +func testZero15() { + a := T15{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [15]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero15_ssa(&a.mid) + want := T15{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [15]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero15 got=%v, want %v\n", a, want) + failed = true + } +} + +type T16 struct { + pre [8]byte + mid [16]byte + post [8]byte +} + +func zero16_ssa(x *[16]byte) { + switch { + } + *x = [16]byte{} +} +func testZero16() { + a := T16{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [16]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero16_ssa(&a.mid) + want := T16{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero16 got=%v, want %v\n", a, want) + failed = true + } +} + +type T17 struct { + pre [8]byte + mid [17]byte + post [8]byte +} + +func zero17_ssa(x *[17]byte) { + switch { + } + *x = [17]byte{} +} +func testZero17() { + a := T17{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [17]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero17_ssa(&a.mid) + want := T17{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [17]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero17 got=%v, want %v\n", a, want) + failed = true + } +} + +type T23 struct { + pre [8]byte + mid [23]byte + post [8]byte +} + +func zero23_ssa(x *[23]byte) { + switch { + } + *x = [23]byte{} +} +func testZero23() { + a := T23{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [23]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero23_ssa(&a.mid) + want := T23{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [23]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero23 got=%v, want %v\n", a, want) + failed = true + } +} + +type T24 struct { + pre [8]byte + mid [24]byte + post [8]byte +} + +func zero24_ssa(x *[24]byte) { + switch { + } + *x = [24]byte{} +} +func testZero24() { + a := T24{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [24]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero24_ssa(&a.mid) + want := T24{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [24]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero24 got=%v, want %v\n", a, want) + failed = true + } +} + +type T25 struct { + pre [8]byte + mid [25]byte + post [8]byte +} + +func zero25_ssa(x *[25]byte) { + switch { + } + *x = [25]byte{} +} +func testZero25() { + a := T25{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [25]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero25_ssa(&a.mid) + want := T25{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [25]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero25 got=%v, want %v\n", a, want) + failed = true + } +} + +type T31 struct { + pre [8]byte + mid [31]byte + post [8]byte +} + +func zero31_ssa(x *[31]byte) { + switch { + } + *x = [31]byte{} +} +func testZero31() { + a := T31{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [31]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero31_ssa(&a.mid) + want := T31{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [31]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero31 got=%v, want %v\n", a, want) + failed = true + } +} + +type T32 struct { + pre [8]byte + mid [32]byte + post [8]byte +} + +func zero32_ssa(x *[32]byte) { + switch { + } + *x = [32]byte{} +} +func testZero32() { + a := T32{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [32]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero32_ssa(&a.mid) + want := T32{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero32 got=%v, want %v\n", a, want) + failed = true + } +} + +type T33 struct { + pre [8]byte + mid [33]byte + post [8]byte +} + +func zero33_ssa(x *[33]byte) { + switch { + } + *x = [33]byte{} +} +func testZero33() { + a := T33{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [33]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero33_ssa(&a.mid) + want := T33{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [33]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero33 got=%v, want %v\n", a, want) + failed = true + } +} + +type T63 struct { + pre [8]byte + mid [63]byte + post [8]byte +} + +func zero63_ssa(x *[63]byte) { + switch { + } + *x = [63]byte{} +} +func testZero63() { + a := T63{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [63]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero63_ssa(&a.mid) + want := T63{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [63]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero63 got=%v, want %v\n", a, want) + failed = true + } +} + +type T64 struct { + pre [8]byte + mid [64]byte + post [8]byte +} + +func zero64_ssa(x *[64]byte) { + switch { + } + *x = [64]byte{} +} +func testZero64() { + a := T64{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [64]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero64_ssa(&a.mid) + want := T64{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [64]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero64 got=%v, want %v\n", a, want) + failed = true + } +} + +type T65 struct { + pre [8]byte + mid [65]byte + post [8]byte +} + +func zero65_ssa(x *[65]byte) { + switch { + } + *x = [65]byte{} +} +func testZero65() { + a := T65{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [65]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero65_ssa(&a.mid) + want := T65{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [65]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero65 got=%v, want %v\n", a, want) + failed = true + } +} + +type T1023 struct { + pre [8]byte + mid [1023]byte + post [8]byte +} + +func zero1023_ssa(x *[1023]byte) { + switch { + } + *x = [1023]byte{} +} +func testZero1023() { + a := T1023{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1023]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero1023_ssa(&a.mid) + want := T1023{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1023]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero1023 got=%v, want %v\n", a, want) + failed = true + } +} + +type T1024 struct { + pre [8]byte + mid [1024]byte + post [8]byte +} + +func zero1024_ssa(x *[1024]byte) { + switch { + } + *x = [1024]byte{} +} +func testZero1024() { + a := T1024{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1024]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero1024_ssa(&a.mid) + want := T1024{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1024]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero1024 got=%v, want %v\n", a, want) + failed = true + } +} + +type T1025 struct { + pre [8]byte + mid [1025]byte + post [8]byte +} + +func zero1025_ssa(x *[1025]byte) { + switch { + } + *x = [1025]byte{} +} +func testZero1025() { + a := T1025{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1025]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + zero1025_ssa(&a.mid) + want := T1025{[8]byte{255, 255, 255, 255, 255, 255, 255, 255}, [1025]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, [8]byte{255, 255, 255, 255, 255, 255, 255, 255}} + if a != want { + fmt.Printf("zero1025 got=%v, want %v\n", a, want) + failed = true + } +} + +var failed bool + +func main() { + testZero1() + testZero2() + testZero3() + testZero4() + testZero5() + testZero6() + testZero7() + testZero8() + testZero9() + testZero10() + testZero15() + testZero16() + testZero17() + testZero23() + testZero24() + testZero25() + testZero31() + testZero32() + testZero33() + testZero63() + testZero64() + testZero65() + testZero1023() + testZero1024() + testZero1025() + if failed { + panic("failed") + } +} diff --git a/src/cmd/compile/internal/gc/type.go b/src/cmd/compile/internal/gc/type.go new file mode 100644 index 0000000000..f09094ce23 --- /dev/null +++ b/src/cmd/compile/internal/gc/type.go @@ -0,0 +1,388 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file provides methods that let us export a Type as an ../ssa:Type. +// We don't export this package's Type directly because it would lead +// to an import cycle with this package and ../ssa. +// TODO: move Type to its own package, then we don't need to dance around import cycles. + +package gc + +import ( + "cmd/compile/internal/ssa" + "fmt" +) + +func (t *Type) Size() int64 { + dowidth(t) + return t.Width +} + +func (t *Type) Alignment() int64 { + dowidth(t) + return int64(t.Align) +} + +func (t *Type) SimpleString() string { + return Econv(t.Etype) +} + +func (t *Type) Equal(u ssa.Type) bool { + x, ok := u.(*Type) + if !ok { + return false + } + return Eqtype(t, x) +} + +// Compare compares types for purposes of the SSA back +// end, returning an ssa.Cmp (one of CMPlt, CMPeq, CMPgt). +// The answers are correct for an optimizer +// or code generator, but not for Go source. +// For example, "type gcDrainFlags int" results in +// two Go-different types that Compare equal. +// The order chosen is also arbitrary, only division into +// equivalence classes (Types that compare CMPeq) matters. +func (t *Type) Compare(u ssa.Type) ssa.Cmp { + x, ok := u.(*Type) + // ssa.CompilerType is smaller than gc.Type + // bare pointer equality is easy. + if !ok { + return ssa.CMPgt + } + if x == t { + return ssa.CMPeq + } + return t.cmp(x) +} + +func cmpForNe(x bool) ssa.Cmp { + if x { + return ssa.CMPlt + } + return ssa.CMPgt +} + +func (r *Sym) cmpsym(s *Sym) ssa.Cmp { + if r == s { + return ssa.CMPeq + } + if r == nil { + return ssa.CMPlt + } + if s == nil { + return ssa.CMPgt + } + // Fast sort, not pretty sort + if len(r.Name) != len(s.Name) { + return cmpForNe(len(r.Name) < len(s.Name)) + } + if r.Pkg != s.Pkg { + if len(r.Pkg.Prefix) != len(s.Pkg.Prefix) { + return cmpForNe(len(r.Pkg.Prefix) < len(s.Pkg.Prefix)) + } + if r.Pkg.Prefix != s.Pkg.Prefix { + return cmpForNe(r.Pkg.Prefix < s.Pkg.Prefix) + } + } + if r.Name != s.Name { + return cmpForNe(r.Name < s.Name) + } + return ssa.CMPeq +} + +// cmp compares two *Types t and x, returning ssa.CMPlt, +// ssa.CMPeq, ssa.CMPgt as t<x, t==x, t>x, for an arbitrary +// and optimizer-centric notion of comparison. +func (t *Type) cmp(x *Type) ssa.Cmp { + // This follows the structure of Eqtype in subr.go + // with two exceptions. + // 1. Symbols are compared more carefully because a <,=,> result is desired. + // 2. Maps are treated specially to avoid endless recursion -- maps + // contain an internal data type not expressible in Go source code. + if t == x { + return ssa.CMPeq + } + if t == nil { + return ssa.CMPlt + } + if x == nil { + return ssa.CMPgt + } + + if t.Etype != x.Etype { + return cmpForNe(t.Etype < x.Etype) + } + + if t.Sym != nil || x.Sym != nil { + // Special case: we keep byte and uint8 separate + // for error messages. Treat them as equal. + switch t.Etype { + case TUINT8: + if (t == Types[TUINT8] || t == bytetype) && (x == Types[TUINT8] || x == bytetype) { + return ssa.CMPeq + } + + case TINT32: + if (t == Types[runetype.Etype] || t == runetype) && (x == Types[runetype.Etype] || x == runetype) { + return ssa.CMPeq + } + } + } + + csym := t.Sym.cmpsym(x.Sym) + if csym != ssa.CMPeq { + return csym + } + + if x.Sym != nil { + // Syms non-nil, if vargens match then equal. + if t.Vargen == x.Vargen { + return ssa.CMPeq + } + if t.Vargen < x.Vargen { + return ssa.CMPlt + } + return ssa.CMPgt + } + // both syms nil, look at structure below. + + switch t.Etype { + case TBOOL, TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128, TUNSAFEPTR, TUINTPTR, + TINT8, TINT16, TINT32, TINT64, TINT, TUINT8, TUINT16, TUINT32, TUINT64, TUINT: + return ssa.CMPeq + } + + switch t.Etype { + case TMAP, TFIELD: + // No special cases for these two, they are handled + // by the general code after the switch. + + case TPTR32, TPTR64: + return t.Type.cmp(x.Type) + + case TSTRUCT: + if t.Map == nil { + if x.Map != nil { + return ssa.CMPlt // nil < non-nil + } + // to the fallthrough + } else if x.Map == nil { + return ssa.CMPgt // nil > non-nil + } else if t.Map.Bucket == t { + // Both have non-nil Map + // Special case for Maps which include a recursive type where the recursion is not broken with a named type + if x.Map.Bucket != x { + return ssa.CMPlt // bucket maps are least + } + return t.Map.cmp(x.Map) + } // If t != t.Map.Bucket, fall through to general case + + fallthrough + case TINTER: + t1 := t.Type + x1 := x.Type + for ; t1 != nil && x1 != nil; t1, x1 = t1.Down, x1.Down { + if t1.Embedded != x1.Embedded { + if t1.Embedded < x1.Embedded { + return ssa.CMPlt + } + return ssa.CMPgt + } + if t1.Note != x1.Note { + if t1.Note == nil { + return ssa.CMPlt + } + if x1.Note == nil { + return ssa.CMPgt + } + if *t1.Note != *x1.Note { + if *t1.Note < *x1.Note { + return ssa.CMPlt + } + return ssa.CMPgt + } + } + c := t1.Sym.cmpsym(x1.Sym) + if c != ssa.CMPeq { + return c + } + c = t1.Type.cmp(x1.Type) + if c != ssa.CMPeq { + return c + } + } + if t1 == x1 { + return ssa.CMPeq + } + if t1 == nil { + return ssa.CMPlt + } + return ssa.CMPgt + + case TFUNC: + t1 := t.Type + t2 := x.Type + for ; t1 != nil && t2 != nil; t1, t2 = t1.Down, t2.Down { + // Loop over fields in structs, ignoring argument names. + ta := t1.Type + tb := t2.Type + for ; ta != nil && tb != nil; ta, tb = ta.Down, tb.Down { + if ta.Isddd != tb.Isddd { + if ta.Isddd { + return ssa.CMPgt + } + return ssa.CMPlt + } + c := ta.Type.cmp(tb.Type) + if c != ssa.CMPeq { + return c + } + } + + if ta != tb { + if t1 == nil { + return ssa.CMPlt + } + return ssa.CMPgt + } + } + if t1 != t2 { + if t1 == nil { + return ssa.CMPlt + } + return ssa.CMPgt + } + return ssa.CMPeq + + case TARRAY: + if t.Bound != x.Bound { + return cmpForNe(t.Bound < x.Bound) + } + + case TCHAN: + if t.Chan != x.Chan { + return cmpForNe(t.Chan < x.Chan) + } + + default: + e := fmt.Sprintf("Do not know how to compare %s with %s", t, x) + panic(e) + } + + c := t.Down.cmp(x.Down) + if c != ssa.CMPeq { + return c + } + return t.Type.cmp(x.Type) +} + +func (t *Type) IsBoolean() bool { + return t.Etype == TBOOL +} + +func (t *Type) IsInteger() bool { + switch t.Etype { + case TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32, TINT64, TUINT64, TINT, TUINT, TUINTPTR: + return true + } + return false +} + +func (t *Type) IsSigned() bool { + switch t.Etype { + case TINT8, TINT16, TINT32, TINT64, TINT: + return true + } + return false +} + +func (t *Type) IsFloat() bool { + return t.Etype == TFLOAT32 || t.Etype == TFLOAT64 +} + +func (t *Type) IsComplex() bool { + return t.Etype == TCOMPLEX64 || t.Etype == TCOMPLEX128 +} + +func (t *Type) IsPtr() bool { + return t.Etype == TPTR32 || t.Etype == TPTR64 || t.Etype == TUNSAFEPTR || + t.Etype == TMAP || t.Etype == TCHAN || t.Etype == TFUNC +} + +func (t *Type) IsString() bool { + return t.Etype == TSTRING +} + +func (t *Type) IsMap() bool { + return t.Etype == TMAP +} + +func (t *Type) IsChan() bool { + return t.Etype == TCHAN +} + +func (t *Type) IsSlice() bool { + return t.Etype == TARRAY && t.Bound < 0 +} + +func (t *Type) IsArray() bool { + return t.Etype == TARRAY && t.Bound >= 0 +} + +func (t *Type) IsStruct() bool { + return t.Etype == TSTRUCT +} + +func (t *Type) IsInterface() bool { + return t.Etype == TINTER +} + +func (t *Type) Elem() ssa.Type { + return t.Type +} +func (t *Type) PtrTo() ssa.Type { + return Ptrto(t) +} + +func (t *Type) NumFields() int64 { + return int64(countfield(t)) +} +func (t *Type) FieldType(i int64) ssa.Type { + // TODO: store fields in a slice so we can + // look them up by index in constant time. + for t1 := t.Type; t1 != nil; t1 = t1.Down { + if t1.Etype != TFIELD { + panic("non-TFIELD in a TSTRUCT") + } + if i == 0 { + return t1.Type + } + i-- + } + panic("not enough fields") +} +func (t *Type) FieldOff(i int64) int64 { + for t1 := t.Type; t1 != nil; t1 = t1.Down { + if t1.Etype != TFIELD { + panic("non-TFIELD in a TSTRUCT") + } + if i == 0 { + return t1.Width + } + i-- + } + panic("not enough fields") +} + +func (t *Type) NumElem() int64 { + if t.Etype != TARRAY { + panic("NumElem on non-TARRAY") + } + return int64(t.Bound) +} + +func (t *Type) IsMemory() bool { return false } +func (t *Type) IsFlags() bool { return false } +func (t *Type) IsVoid() bool { return false } diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index d0f942d8bc..7d4c697e7d 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -2566,7 +2566,7 @@ func paramstoheap(argin **Type, out int) []*Node { // Defer might stop a panic and show the // return values as they exist at the time of panic. // Make sure to zero them on entry to the function. - nn = append(nn, Nod(OAS, nodarg(t, 1), nil)) + nn = append(nn, Nod(OAS, nodarg(t, -1), nil)) } if v == nil || v.Class&PHEAP == 0 { |
