2 * Copyright 2015 Tilera Corporation. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
14 #ifndef __ASM_TILE_INSN_H
15 #define __ASM_TILE_INSN_H
17 #include <arch/opcode.h>
19 static inline tilegx_bundle_bits
NOP(void)
21 return create_UnaryOpcodeExtension_X0(FNOP_UNARY_OPCODE_X0
) |
22 create_RRROpcodeExtension_X0(UNARY_RRR_0_OPCODE_X0
) |
23 create_Opcode_X0(RRR_0_OPCODE_X0
) |
24 create_UnaryOpcodeExtension_X1(NOP_UNARY_OPCODE_X1
) |
25 create_RRROpcodeExtension_X1(UNARY_RRR_0_OPCODE_X1
) |
26 create_Opcode_X1(RRR_0_OPCODE_X1
);
29 static inline tilegx_bundle_bits
tilegx_gen_branch(unsigned long pc
,
33 tilegx_bundle_bits opcode_x0
, opcode_x1
;
34 long pcrel_by_instr
= (addr
- pc
) >> TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES
;
37 /* opcode: jal addr */
39 create_Opcode_X1(JUMP_OPCODE_X1
) |
40 create_JumpOpcodeExtension_X1(JAL_JUMP_OPCODE_X1
) |
41 create_JumpOff_X1(pcrel_by_instr
);
45 create_Opcode_X1(JUMP_OPCODE_X1
) |
46 create_JumpOpcodeExtension_X1(J_JUMP_OPCODE_X1
) |
47 create_JumpOff_X1(pcrel_by_instr
);
52 create_UnaryOpcodeExtension_X0(FNOP_UNARY_OPCODE_X0
) |
53 create_RRROpcodeExtension_X0(UNARY_RRR_0_OPCODE_X0
) |
54 create_Opcode_X0(RRR_0_OPCODE_X0
);
56 return opcode_x1
| opcode_x0
;
59 #endif /* __ASM_TILE_INSN_H */