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