Source file src/math/big/internal/asmgen/riscv64.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  package asmgen
     6  
     7  var ArchRISCV64 = &Arch{
     8  	Name:          "riscv64",
     9  	WordBits:      64,
    10  	WordBytes:     8,
    11  	CarrySafeLoop: true,
    12  
    13  	regs: []string{
    14  		// X0 is zero.
    15  		// X1 is LR.
    16  		// X2 is SP.
    17  		// X3 is SB.
    18  		// X4 is TP.
    19  		// X27 is g.
    20  		// X28 and X29 are our virtual carry flags.
    21  		// X31 is the assembler/linker temporary (which we use too).
    22  		"X5", "X6", "X7", "X8", "X9",
    23  		"X10", "X11", "X12", "X13", "X14", "X15", "X16", "X17", "X18", "X19",
    24  		"X20", "X21", "X22", "X23", "X24", "X25", "X26",
    25  		"X30",
    26  	},
    27  
    28  	reg0:        "X0",
    29  	regCarry:    "X28",
    30  	regAltCarry: "X29",
    31  	regTmp:      "X31",
    32  
    33  	mov:   "MOV",
    34  	add:   "ADD",
    35  	sub:   "SUB",
    36  	mul:   "MUL",
    37  	mulhi: "MULHU",
    38  	lsh:   "SLL",
    39  	rsh:   "SRL",
    40  	and:   "AND",
    41  	or:    "OR",
    42  	xor:   "XOR",
    43  	sltu:  "SLTU",
    44  
    45  	jmpZero:    "BEQZ %s, %s",
    46  	jmpNonZero: "BNEZ %s, %s",
    47  }
    48  

View as plain text