s390x.go 1.2 KB

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