github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/asm/internal/arch/s390x.go (about)

     1  // Copyright 2016 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  // This file encapsulates some of the odd characteristics of the
     6  // s390x instruction set, to minimize its interaction
     7  // with the core of the assembler.
     8  
     9  package arch
    10  
    11  import (
    12  	"github.com/gagliardetto/golang-go/cmd/internal/obj/s390x"
    13  )
    14  
    15  func jumpS390x(word string) bool {
    16  	switch word {
    17  	case "BRC",
    18  		"BC",
    19  		"BCL",
    20  		"BEQ",
    21  		"BGE",
    22  		"BGT",
    23  		"BL",
    24  		"BLE",
    25  		"BLEU",
    26  		"BLT",
    27  		"BLTU",
    28  		"BNE",
    29  		"BR",
    30  		"BVC",
    31  		"BVS",
    32  		"BRCT",
    33  		"BRCTG",
    34  		"CMPBEQ",
    35  		"CMPBGE",
    36  		"CMPBGT",
    37  		"CMPBLE",
    38  		"CMPBLT",
    39  		"CMPBNE",
    40  		"CMPUBEQ",
    41  		"CMPUBGE",
    42  		"CMPUBGT",
    43  		"CMPUBLE",
    44  		"CMPUBLT",
    45  		"CMPUBNE",
    46  		"CRJ",
    47  		"CGRJ",
    48  		"CLRJ",
    49  		"CLGRJ",
    50  		"CIJ",
    51  		"CGIJ",
    52  		"CLIJ",
    53  		"CLGIJ",
    54  		"CALL",
    55  		"JMP":
    56  		return true
    57  	}
    58  	return false
    59  }
    60  
    61  func s390xRegisterNumber(name string, n int16) (int16, bool) {
    62  	switch name {
    63  	case "AR":
    64  		if 0 <= n && n <= 15 {
    65  			return s390x.REG_AR0 + n, true
    66  		}
    67  	case "F":
    68  		if 0 <= n && n <= 15 {
    69  			return s390x.REG_F0 + n, true
    70  		}
    71  	case "R":
    72  		if 0 <= n && n <= 15 {
    73  			return s390x.REG_R0 + n, true
    74  		}
    75  	case "V":
    76  		if 0 <= n && n <= 31 {
    77  			return s390x.REG_V0 + n, true
    78  		}
    79  	}
    80  	return 0, false
    81  }