podman
28 строк · 993.0 Байт
1// Copyright 2020 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 RISCV64
6// instruction set, to minimize its interaction with the core of the
7// assembler.
8
9package arch
10
11import (
12"github.com/twitchyliquid64/golang-asm/obj"
13"github.com/twitchyliquid64/golang-asm/obj/riscv"
14)
15
16// IsRISCV64AMO reports whether the op (as defined by a riscv.A*
17// constant) is one of the AMO instructions that requires special
18// handling.
19func IsRISCV64AMO(op obj.As) bool {
20switch op {
21case riscv.ASCW, riscv.ASCD, riscv.AAMOSWAPW, riscv.AAMOSWAPD, riscv.AAMOADDW, riscv.AAMOADDD,
22riscv.AAMOANDW, riscv.AAMOANDD, riscv.AAMOORW, riscv.AAMOORD, riscv.AAMOXORW, riscv.AAMOXORD,
23riscv.AAMOMINW, riscv.AAMOMIND, riscv.AAMOMINUW, riscv.AAMOMINUD,
24riscv.AAMOMAXW, riscv.AAMOMAXD, riscv.AAMOMAXUW, riscv.AAMOMAXUD:
25return true
26}
27return false
28}
29