riscv64.go 993 B

12345678910111213141516171819202122232425262728
  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. // This file encapsulates some of the odd characteristics of the RISCV64
  5. // instruction set, to minimize its interaction with the core of the
  6. // assembler.
  7. package arch
  8. import (
  9. "github.com/twitchyliquid64/golang-asm/obj"
  10. "github.com/twitchyliquid64/golang-asm/obj/riscv"
  11. )
  12. // IsRISCV64AMO reports whether the op (as defined by a riscv.A*
  13. // constant) is one of the AMO instructions that requires special
  14. // handling.
  15. func IsRISCV64AMO(op obj.As) bool {
  16. switch op {
  17. case riscv.ASCW, riscv.ASCD, riscv.AAMOSWAPW, riscv.AAMOSWAPD, riscv.AAMOADDW, riscv.AAMOADDD,
  18. riscv.AAMOANDW, riscv.AAMOANDD, riscv.AAMOORW, riscv.AAMOORD, riscv.AAMOXORW, riscv.AAMOXORD,
  19. riscv.AAMOMINW, riscv.AAMOMIND, riscv.AAMOMINUW, riscv.AAMOMINUD,
  20. riscv.AAMOMAXW, riscv.AAMOMAXD, riscv.AAMOMAXUW, riscv.AAMOMAXUD:
  21. return true
  22. }
  23. return false
  24. }