Source file src/math/big/internal/asmgen/main.go

     1  // Copyright 2025 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Asmgen generates math/big assembly.
     6  //
     7  // Usage:
     8  //
     9  //	cd go/src/math/big
    10  //	go test ./internal/asmgen -generate
    11  //
    12  // Or:
    13  //
    14  //	go generate math/big
    15  package asmgen
    16  
    17  var arches = []*Arch{
    18  	Arch386,
    19  	ArchAMD64,
    20  	ArchARM,
    21  	ArchARM64,
    22  	ArchLoong64,
    23  	ArchMIPS,
    24  	ArchMIPS64x,
    25  	ArchPPC64x,
    26  	ArchRISCV64,
    27  	ArchS390X,
    28  }
    29  
    30  // generate returns the file name and content of the generated assembly for the given architecture.
    31  func generate(arch *Arch) (file string, data []byte) {
    32  	file = "arith_" + arch.Name + ".s"
    33  	a := NewAsm(arch)
    34  	addOrSubVV(a, "addVV")
    35  	addOrSubVV(a, "subVV")
    36  	shiftVU(a, "lshVU")
    37  	shiftVU(a, "rshVU")
    38  	mulAddVWW(a)
    39  	addMulVVWW(a)
    40  	return file, a.out.Bytes()
    41  }
    42  

View as plain text