opcodes.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef _OPCODES_H
  2. #define _OPCODES_H
  3. #define SPARC_CR_OPCODE_PRIORITY 300
  4. #define F3F(x,y,z) (((x)<<30)|((y)<<19)|((z)<<5))
  5. #define FPD_ENCODE(x) (((x) >> 5) | ((x) & ~(0x20)))
  6. #define RS1(x) (FPD_ENCODE(x) << 14)
  7. #define RS2(x) (FPD_ENCODE(x) << 0)
  8. #define RS3(x) (FPD_ENCODE(x) << 9)
  9. #define RD(x) (FPD_ENCODE(x) << 25)
  10. #define IMM5_0(x) ((x) << 0)
  11. #define IMM5_9(x) ((x) << 9)
  12. #define CRC32C(a,b,c) \
  13. .word (F3F(2,0x36,0x147)|RS1(a)|RS2(b)|RD(c));
  14. #define MD5 \
  15. .word 0x81b02800;
  16. #define SHA1 \
  17. .word 0x81b02820;
  18. #define SHA256 \
  19. .word 0x81b02840;
  20. #define SHA512 \
  21. .word 0x81b02860;
  22. #define AES_EROUND01(a,b,c,d) \
  23. .word (F3F(2, 0x19, 0)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  24. #define AES_EROUND23(a,b,c,d) \
  25. .word (F3F(2, 0x19, 1)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  26. #define AES_DROUND01(a,b,c,d) \
  27. .word (F3F(2, 0x19, 2)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  28. #define AES_DROUND23(a,b,c,d) \
  29. .word (F3F(2, 0x19, 3)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  30. #define AES_EROUND01_L(a,b,c,d) \
  31. .word (F3F(2, 0x19, 4)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  32. #define AES_EROUND23_L(a,b,c,d) \
  33. .word (F3F(2, 0x19, 5)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  34. #define AES_DROUND01_L(a,b,c,d) \
  35. .word (F3F(2, 0x19, 6)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  36. #define AES_DROUND23_L(a,b,c,d) \
  37. .word (F3F(2, 0x19, 7)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  38. #define AES_KEXPAND1(a,b,c,d) \
  39. .word (F3F(2, 0x19, 8)|RS1(a)|RS2(b)|IMM5_9(c)|RD(d));
  40. #define AES_KEXPAND0(a,b,c) \
  41. .word (F3F(2, 0x36, 0x130)|RS1(a)|RS2(b)|RD(c));
  42. #define AES_KEXPAND2(a,b,c) \
  43. .word (F3F(2, 0x36, 0x131)|RS1(a)|RS2(b)|RD(c));
  44. #define DES_IP(a,b) \
  45. .word (F3F(2, 0x36, 0x134)|RS1(a)|RD(b));
  46. #define DES_IIP(a,b) \
  47. .word (F3F(2, 0x36, 0x135)|RS1(a)|RD(b));
  48. #define DES_KEXPAND(a,b,c) \
  49. .word (F3F(2, 0x36, 0x136)|RS1(a)|IMM5_0(b)|RD(c));
  50. #define DES_ROUND(a,b,c,d) \
  51. .word (F3F(2, 0x19, 0x009)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  52. #define CAMELLIA_F(a,b,c,d) \
  53. .word (F3F(2, 0x19, 0x00c)|RS1(a)|RS2(b)|RS3(c)|RD(d));
  54. #define CAMELLIA_FL(a,b,c) \
  55. .word (F3F(2, 0x36, 0x13c)|RS1(a)|RS2(b)|RD(c));
  56. #define CAMELLIA_FLI(a,b,c) \
  57. .word (F3F(2, 0x36, 0x13d)|RS1(a)|RS2(b)|RD(c));
  58. #define MOVDTOX_F0_O4 \
  59. .word 0x99b02200
  60. #define MOVDTOX_F2_O5 \
  61. .word 0x9bb02202
  62. #define MOVXTOD_G1_F60 \
  63. .word 0xbbb02301
  64. #define MOVXTOD_G1_F62 \
  65. .word 0xbfb02301
  66. #define MOVXTOD_G3_F4 \
  67. .word 0x89b02303;
  68. #define MOVXTOD_G7_F6 \
  69. .word 0x8db02307;
  70. #define MOVXTOD_G3_F0 \
  71. .word 0x81b02303;
  72. #define MOVXTOD_G7_F2 \
  73. .word 0x85b02307;
  74. #define MOVXTOD_O0_F0 \
  75. .word 0x81b02308;
  76. #define MOVXTOD_O5_F0 \
  77. .word 0x81b0230d;
  78. #define MOVXTOD_O5_F2 \
  79. .word 0x85b0230d;
  80. #define MOVXTOD_O5_F4 \
  81. .word 0x89b0230d;
  82. #define MOVXTOD_O5_F6 \
  83. .word 0x8db0230d;
  84. #define MOVXTOD_G3_F60 \
  85. .word 0xbbb02303;
  86. #define MOVXTOD_G7_F62 \
  87. .word 0xbfb02307;
  88. #endif /* _OPCODES_H */