Commit eb7c792d authored by Chris Metcalf's avatar Chris Metcalf

arch/tile: factor out <arch/opcode.h> header

The kernel code was using some <asm> headers that included a mix
of hardware-specific information (typically found in Tilera <arch>
headers) and structures, enums, and function declarations supporting
the disassembly function of the tile-desc.c sources.

This change refactors that code so that a hardware-specific, but
OS- and application-agnostic header, is created: <arch/opcode.h>.
This header is then exported to userspace along with the other
<arch> headers and can be used to build userspace code; in particular,
it is used by glibc as part of implementing the backtrace() function.

The new header, together with a header that specifically describes
the disassembly code (<asm/tile-desc.h> with _32 and _64 variants),
replaces the old <asm/opcode-tile*.h> and <asm/opcode_constants*.h>
headers.

As part of this change, we are also renaming the 32-bit constants
from TILE_xxx to TILEPRO_xxx to better reflect the fact that they
are specific to the TILEPro architecture, and not to TILE-Gx
and any successor "tile" architecture chips.
Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent aeddea5d
/* /*
* Copyright 2010 Tilera Corporation. All Rights Reserved. * Copyright 2011 Tilera Corporation. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -12,15 +12,10 @@ ...@@ -12,15 +12,10 @@
* more details. * more details.
*/ */
#ifndef _ASM_TILE_OPCODE_CONSTANTS_H #if defined(__tilepro__)
#define _ASM_TILE_OPCODE_CONSTANTS_H #include <arch/opcode_tilepro.h>
#elif defined(__tilegx__)
#include <arch/chip.h> #include <arch/opcode_tilegx.h>
#if CHIP_WORD_SIZE() == 64
#include <asm/opcode_constants_64.h>
#else #else
#include <asm/opcode_constants_32.h> #error Unexpected Tilera chip type
#endif #endif
#endif /* _ASM_TILE_OPCODE_CONSTANTS_H */
/* /* TILE-Gx opcode information.
*
* Copyright 2011 Tilera Corporation. All Rights Reserved. * Copyright 2011 Tilera Corporation. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -10,13 +11,805 @@ ...@@ -10,13 +11,805 @@
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for * NON INFRINGEMENT. See the GNU General Public License for
* more details. * more details.
*
*
*
*
*
*/ */
/* This file is machine-generated; DO NOT EDIT! */ #ifndef __ARCH_OPCODE_H__
#define __ARCH_OPCODE_H__
#ifndef __ASSEMBLER__
typedef unsigned long long tilegx_bundle_bits;
/* These are the bits that determine if a bundle is in the X encoding. */
#define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62)
enum
{
/* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
/* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
TILEGX_NUM_PIPELINE_ENCODINGS = 5,
/* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */
TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
/* Instructions take this many bytes. */
TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES,
/* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */
TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
/* Bundles should be aligned modulo this number of bytes. */
TILEGX_BUNDLE_ALIGNMENT_IN_BYTES =
(1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
/* Number of registers (some are magic, such as network I/O). */
TILEGX_NUM_REGISTERS = 64,
};
/* Make a few "tile_" variables to simplify common code between
architectures. */
typedef tilegx_bundle_bits tile_bundle_bits;
#define TILE_BUNDLE_SIZE_IN_BYTES TILEGX_BUNDLE_SIZE_IN_BYTES
#define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES
#define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \
TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
/* 64-bit pattern for a { bpt ; nop } bundle. */
#define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL
static __inline unsigned int
get_BFEnd_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_BFOpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 24)) & 0xf);
}
static __inline unsigned int
get_BFStart_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3f);
}
static __inline unsigned int
get_BrOff_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 37)) & 0x0001ffc0);
}
static __inline unsigned int
get_BrType_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 54)) & 0x1f);
}
static __inline unsigned int
get_Dest_Imm8_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 43)) & 0x000000c0);
}
static __inline unsigned int
get_Dest_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Imm16_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xffff);
}
static __inline unsigned int
get_Imm16_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xffff);
}
static __inline unsigned int
get_Imm8OpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0xff);
}
static __inline unsigned int
get_Imm8OpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 51)) & 0xff);
}
static __inline unsigned int
get_Imm8_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_JumpOff_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x7ffffff);
}
static __inline unsigned int
get_JumpOpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 58)) & 0x1);
}
static __inline unsigned int
get_MF_Imm14_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3fff);
}
static __inline unsigned int
get_MT_Imm14_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 37)) & 0x00003fc0);
}
static __inline unsigned int
get_Mode(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 62)) & 0x3);
}
static __inline unsigned int
get_Opcode_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 28)) & 0x7);
}
static __inline unsigned int
get_Opcode_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 59)) & 0x7);
}
static __inline unsigned int
get_Opcode_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 27)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 58)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y2(tilegx_bundle_bits n)
{
return (((n >> 26)) & 0x00000001) |
(((unsigned int)(n >> 56)) & 0x00000002);
}
static __inline unsigned int
get_RRROpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3ff);
}
static __inline unsigned int
get_RRROpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3ff);
}
static __inline unsigned int
get_RRROpcodeExtension_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3);
}
static __inline unsigned int
get_RRROpcodeExtension_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3);
}
static __inline unsigned int
get_ShAmt_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_ShAmt_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_ShAmt_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_ShAmt_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_ShiftOpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3ff);
}
static __inline unsigned int
get_ShiftOpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3ff);
}
static __inline unsigned int
get_ShiftOpcodeExtension_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3);
}
static __inline unsigned int
get_ShiftOpcodeExtension_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3);
}
static __inline unsigned int
get_SrcA_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y2(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0x3f);
}
static __inline unsigned int
get_SrcBDest_Y2(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 51)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline int
sign_extend(int n, int num_bits)
{
int shift = (int)(sizeof(int) * 8 - num_bits);
return (n << shift) >> shift;
}
static __inline tilegx_bundle_bits
create_BFEnd_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_BFOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 24);
}
static __inline tilegx_bundle_bits
create_BFStart_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 18);
}
static __inline tilegx_bundle_bits
create_BrOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilegx_bundle_bits)(n & 0x0001ffc0)) << 37);
}
static __inline tilegx_bundle_bits
create_BrType_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x1f)) << 54);
}
static __inline tilegx_bundle_bits
create_Dest_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilegx_bundle_bits)(n & 0x000000c0)) << 43);
}
static __inline tilegx_bundle_bits
create_Dest_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tilegx_bundle_bits
create_Dest_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tilegx_bundle_bits
create_Dest_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tilegx_bundle_bits
create_Dest_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tilegx_bundle_bits
create_Imm16_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xffff) << 12);
}
static __inline tilegx_bundle_bits
create_Imm16_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xffff)) << 43);
}
static __inline tilegx_bundle_bits
create_Imm8OpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 20);
}
static __inline tilegx_bundle_bits
create_Imm8OpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xff)) << 51);
}
static __inline tilegx_bundle_bits
create_Imm8_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tilegx_bundle_bits
create_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xff)) << 43);
}
static __inline tilegx_bundle_bits
create_Imm8_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tilegx_bundle_bits
create_Imm8_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xff)) << 43);
}
static __inline tilegx_bundle_bits
create_JumpOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x7ffffff)) << 31);
}
static __inline tilegx_bundle_bits
create_JumpOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x1)) << 58);
}
static __inline tilegx_bundle_bits
create_MF_Imm14_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3fff)) << 37);
}
static __inline tilegx_bundle_bits
create_MT_Imm14_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilegx_bundle_bits)(n & 0x00003fc0)) << 37);
}
static __inline tilegx_bundle_bits
create_Mode(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3)) << 62);
}
static __inline tilegx_bundle_bits
create_Opcode_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7) << 28);
}
static __inline tilegx_bundle_bits
create_Opcode_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x7)) << 59);
}
static __inline tilegx_bundle_bits
create_Opcode_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 27);
}
static __inline tilegx_bundle_bits
create_Opcode_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xf)) << 58);
}
static __inline tilegx_bundle_bits
create_Opcode_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x00000001) << 26) |
(((tilegx_bundle_bits)(n & 0x00000002)) << 56);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 18);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 18);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3)) << 49);
}
static __inline tilegx_bundle_bits
create_ShAmt_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_ShAmt_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_ShAmt_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_ShAmt_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 18);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 18);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3)) << 49);
}
static __inline tilegx_bundle_bits
create_SrcA_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tilegx_bundle_bits
create_SrcA_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tilegx_bundle_bits
create_SrcA_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tilegx_bundle_bits
create_SrcA_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tilegx_bundle_bits
create_SrcA_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 20);
}
static __inline tilegx_bundle_bits
create_SrcBDest_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 51);
}
static __inline tilegx_bundle_bits
create_SrcB_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_SrcB_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_SrcB_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_SrcB_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
#ifndef _TILE_OPCODE_CONSTANTS_H
#define _TILE_OPCODE_CONSTANTS_H
enum enum
{ {
ADDI_IMM8_OPCODE_X0 = 1, ADDI_IMM8_OPCODE_X0 = 1,
...@@ -606,4 +1399,7 @@ enum ...@@ -606,4 +1399,7 @@ enum
XOR_RRR_5_OPCODE_Y1 = 3 XOR_RRR_5_OPCODE_Y1 = 3
}; };
#endif /* !_TILE_OPCODE_CONSTANTS_H */
#endif /* __ASSEMBLER__ */
#endif /* __ARCH_OPCODE_H__ */
/* /* TILEPro opcode information.
* Copyright 2010 Tilera Corporation. All Rights Reserved. *
* Copyright 2011 Tilera Corporation. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -10,13 +11,1000 @@ ...@@ -10,13 +11,1000 @@
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for * NON INFRINGEMENT. See the GNU General Public License for
* more details. * more details.
*
*
*
*
*
*/ */
/* This file is machine-generated; DO NOT EDIT! */ #ifndef __ARCH_OPCODE_H__
#define __ARCH_OPCODE_H__
#ifndef __ASSEMBLER__
typedef unsigned long long tilepro_bundle_bits;
/* This is the bit that determines if a bundle is in the Y encoding. */
#define TILEPRO_BUNDLE_Y_ENCODING_MASK ((tilepro_bundle_bits)1 << 63)
enum
{
/* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
/* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
TILEPRO_NUM_PIPELINE_ENCODINGS = 5,
/* Log base 2 of TILEPRO_BUNDLE_SIZE_IN_BYTES. */
TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
/* Instructions take this many bytes. */
TILEPRO_BUNDLE_SIZE_IN_BYTES = 1 << TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES,
/* Log base 2 of TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES. */
TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
/* Bundles should be aligned modulo this number of bytes. */
TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES =
(1 << TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
/* Log base 2 of TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES. */
TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1,
/* Static network instructions take this many bytes. */
TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES =
(1 << TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES),
/* Number of registers (some are magic, such as network I/O). */
TILEPRO_NUM_REGISTERS = 64,
/* Number of static network registers. */
TILEPRO_NUM_SN_REGISTERS = 4
};
/* Make a few "tile_" variables to simplify common code between
architectures. */
typedef tilepro_bundle_bits tile_bundle_bits;
#define TILE_BUNDLE_SIZE_IN_BYTES TILEPRO_BUNDLE_SIZE_IN_BYTES
#define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES
#define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \
TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
/* 64-bit pattern for a { bpt ; nop } bundle. */
#define TILEPRO_BPT_BUNDLE 0x400b3cae70166000ULL
static __inline unsigned int
get_BrOff_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3ff);
}
static __inline unsigned int
get_BrOff_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x00007fff) |
(((unsigned int)(n >> 20)) & 0x00018000);
}
static __inline unsigned int
get_BrType_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0xf);
}
static __inline unsigned int
get_Dest_Imm8_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 43)) & 0x000000c0);
}
static __inline unsigned int
get_Dest_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 2)) & 0x3);
}
static __inline unsigned int
get_Dest_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Imm16_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xffff);
}
static __inline unsigned int
get_Imm16_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xffff);
}
static __inline unsigned int
get_Imm8_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0xff);
}
static __inline unsigned int
get_Imm8_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_ImmOpcodeExtension_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0x7f);
}
static __inline unsigned int
get_ImmOpcodeExtension_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 51)) & 0x7f);
}
static __inline unsigned int
get_ImmRROpcodeExtension_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 8)) & 0x3);
}
static __inline unsigned int
get_JOffLong_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x00007fff) |
(((unsigned int)(n >> 20)) & 0x00018000) |
(((unsigned int)(n >> 14)) & 0x001e0000) |
(((unsigned int)(n >> 16)) & 0x07e00000) |
(((unsigned int)(n >> 31)) & 0x18000000);
}
static __inline unsigned int
get_JOff_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x00007fff) |
(((unsigned int)(n >> 20)) & 0x00018000) |
(((unsigned int)(n >> 14)) & 0x001e0000) |
(((unsigned int)(n >> 16)) & 0x07e00000) |
(((unsigned int)(n >> 31)) & 0x08000000);
}
static __inline unsigned int
get_MF_Imm15_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x00003fff) |
(((unsigned int)(n >> 44)) & 0x00004000);
}
static __inline unsigned int
get_MMEnd_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x1f);
}
static __inline unsigned int
get_MMEnd_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x1f);
}
static __inline unsigned int
get_MMStart_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 23)) & 0x1f);
}
static __inline unsigned int
get_MMStart_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 54)) & 0x1f);
}
static __inline unsigned int
get_MT_Imm15_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 37)) & 0x00003fc0) |
(((unsigned int)(n >> 44)) & 0x00004000);
}
static __inline unsigned int
get_Mode(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 63)) & 0x1);
}
static __inline unsigned int
get_NoRegOpcodeExtension_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0xf);
}
static __inline unsigned int
get_Opcode_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 10)) & 0x3f);
}
static __inline unsigned int
get_Opcode_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 28)) & 0x7);
}
static __inline unsigned int
get_Opcode_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 59)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 27)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 59)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y2(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 56)) & 0x7);
}
static __inline unsigned int
get_RROpcodeExtension_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 4)) & 0xf);
}
static __inline unsigned int
get_RRROpcodeExtension_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x1ff);
}
static __inline unsigned int
get_RRROpcodeExtension_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x1ff);
}
static __inline unsigned int
get_RRROpcodeExtension_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3);
}
static __inline unsigned int
get_RRROpcodeExtension_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3);
}
static __inline unsigned int
get_RouteOpcodeExtension_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3ff);
}
static __inline unsigned int
get_S_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 27)) & 0x1);
}
static __inline unsigned int
get_S_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 58)) & 0x1);
}
static __inline unsigned int
get_ShAmt_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_ShAmt_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_ShAmt_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_ShAmt_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_SrcA_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y2(tilepro_bundle_bits n)
{
return (((n >> 26)) & 0x00000001) |
(((unsigned int)(n >> 50)) & 0x0000003e);
}
static __inline unsigned int
get_SrcBDest_Y2(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_Src_SN(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3);
}
static __inline unsigned int
get_UnOpcodeExtension_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_UnOpcodeExtension_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_UnOpcodeExtension_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_UnOpcodeExtension_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_UnShOpcodeExtension_X0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 17)) & 0x3ff);
}
static __inline unsigned int
get_UnShOpcodeExtension_X1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 48)) & 0x3ff);
}
static __inline unsigned int
get_UnShOpcodeExtension_Y0(tilepro_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 17)) & 0x7);
}
static __inline unsigned int
get_UnShOpcodeExtension_Y1(tilepro_bundle_bits n)
{
return (((unsigned int)(n >> 48)) & 0x7);
}
static __inline int
sign_extend(int n, int num_bits)
{
int shift = (int)(sizeof(int) * 8 - num_bits);
return (n << shift) >> shift;
}
static __inline tilepro_bundle_bits
create_BrOff_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 0);
}
static __inline tilepro_bundle_bits
create_BrOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
(((tilepro_bundle_bits)(n & 0x00018000)) << 20);
}
static __inline tilepro_bundle_bits
create_BrType_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0xf)) << 31);
}
static __inline tilepro_bundle_bits
create_Dest_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilepro_bundle_bits)(n & 0x000000c0)) << 43);
}
static __inline tilepro_bundle_bits
create_Dest_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 2);
}
static __inline tilepro_bundle_bits
create_Dest_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tilepro_bundle_bits
create_Dest_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tilepro_bundle_bits
create_Dest_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tilepro_bundle_bits
create_Dest_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tilepro_bundle_bits
create_Imm16_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xffff) << 12);
}
static __inline tilepro_bundle_bits
create_Imm16_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0xffff)) << 43);
}
static __inline tilepro_bundle_bits
create_Imm8_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 0);
}
static __inline tilepro_bundle_bits
create_Imm8_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tilepro_bundle_bits
create_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0xff)) << 43);
}
static __inline tilepro_bundle_bits
create_Imm8_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tilepro_bundle_bits
create_Imm8_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0xff)) << 43);
}
static __inline tilepro_bundle_bits
create_ImmOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7f) << 20);
}
static __inline tilepro_bundle_bits
create_ImmOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x7f)) << 51);
}
static __inline tilepro_bundle_bits
create_ImmRROpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 8);
}
static __inline tilepro_bundle_bits
create_JOffLong_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
(((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
(((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
(((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
(((tilepro_bundle_bits)(n & 0x18000000)) << 31);
}
static __inline tilepro_bundle_bits
create_JOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
(((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
(((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
(((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
(((tilepro_bundle_bits)(n & 0x08000000)) << 31);
}
static __inline tilepro_bundle_bits
create_MF_Imm15_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x00003fff)) << 37) |
(((tilepro_bundle_bits)(n & 0x00004000)) << 44);
}
static __inline tilepro_bundle_bits
create_MMEnd_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 18);
}
static __inline tilepro_bundle_bits
create_MMEnd_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1f)) << 49);
}
static __inline tilepro_bundle_bits
create_MMStart_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 23);
}
static __inline tilepro_bundle_bits
create_MMStart_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1f)) << 54);
}
static __inline tilepro_bundle_bits
create_MT_Imm15_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilepro_bundle_bits)(n & 0x00003fc0)) << 37) |
(((tilepro_bundle_bits)(n & 0x00004000)) << 44);
}
static __inline tilepro_bundle_bits
create_Mode(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1)) << 63);
}
static __inline tilepro_bundle_bits
create_NoRegOpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 0);
}
static __inline tilepro_bundle_bits
create_Opcode_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 10);
}
static __inline tilepro_bundle_bits
create_Opcode_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7) << 28);
}
static __inline tilepro_bundle_bits
create_Opcode_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0xf)) << 59);
}
static __inline tilepro_bundle_bits
create_Opcode_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 27);
}
static __inline tilepro_bundle_bits
create_Opcode_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0xf)) << 59);
}
static __inline tilepro_bundle_bits
create_Opcode_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x7)) << 56);
}
static __inline tilepro_bundle_bits
create_RROpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 4);
}
static __inline tilepro_bundle_bits
create_RRROpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1ff) << 18);
}
static __inline tilepro_bundle_bits
create_RRROpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1ff)) << 49);
}
static __inline tilepro_bundle_bits
create_RRROpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 18);
}
static __inline tilepro_bundle_bits
create_RRROpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3)) << 49);
}
static __inline tilepro_bundle_bits
create_RouteOpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 0);
}
static __inline tilepro_bundle_bits
create_S_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1) << 27);
}
static __inline tilepro_bundle_bits
create_S_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1)) << 58);
}
static __inline tilepro_bundle_bits
create_ShAmt_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tilepro_bundle_bits
create_ShAmt_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tilepro_bundle_bits
create_ShAmt_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tilepro_bundle_bits
create_ShAmt_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tilepro_bundle_bits
create_SrcA_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tilepro_bundle_bits
create_SrcA_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tilepro_bundle_bits
create_SrcA_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tilepro_bundle_bits
create_SrcA_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tilepro_bundle_bits
create_SrcA_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x00000001) << 26) |
(((tilepro_bundle_bits)(n & 0x0000003e)) << 50);
}
static __inline tilepro_bundle_bits
create_SrcBDest_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 20);
}
static __inline tilepro_bundle_bits
create_SrcB_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilepro_bundle_bits
create_SrcB_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilepro_bundle_bits
create_SrcB_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilepro_bundle_bits
create_SrcB_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilepro_bundle_bits
create_Src_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 0);
}
static __inline tilepro_bundle_bits
create_UnOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tilepro_bundle_bits
create_UnOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tilepro_bundle_bits
create_UnOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tilepro_bundle_bits
create_UnOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tilepro_bundle_bits
create_UnShOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 17);
}
static __inline tilepro_bundle_bits
create_UnShOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x3ff)) << 48);
}
static __inline tilepro_bundle_bits
create_UnShOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7) << 17);
}
static __inline tilepro_bundle_bits
create_UnShOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilepro_bundle_bits)(n & 0x7)) << 48);
}
#ifndef _TILE_OPCODE_CONSTANTS_H
#define _TILE_OPCODE_CONSTANTS_H
enum enum
{ {
ADDBS_U_SPECIAL_0_OPCODE_X0 = 98, ADDBS_U_SPECIAL_0_OPCODE_X0 = 98,
...@@ -477,4 +1465,7 @@ enum ...@@ -477,4 +1465,7 @@ enum
XOR_SPECIAL_2_OPCODE_Y1 = 3 XOR_SPECIAL_2_OPCODE_Y1 = 3
}; };
#endif /* !_TILE_OPCODE_CONSTANTS_H */
#endif /* __ASSEMBLER__ */
#endif /* __ARCH_OPCODE_H__ */
/* tile.h -- Header file for TILE opcode table
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Tilera Corp. */
#ifndef opcode_tile_h
#define opcode_tile_h
typedef unsigned long long tile_bundle_bits;
enum
{
TILE_MAX_OPERANDS = 5 /* mm */
};
typedef enum
{
TILE_OPC_BPT,
TILE_OPC_INFO,
TILE_OPC_INFOL,
TILE_OPC_J,
TILE_OPC_JAL,
TILE_OPC_MOVE,
TILE_OPC_MOVE_SN,
TILE_OPC_MOVEI,
TILE_OPC_MOVEI_SN,
TILE_OPC_MOVELI,
TILE_OPC_MOVELI_SN,
TILE_OPC_MOVELIS,
TILE_OPC_PREFETCH,
TILE_OPC_RAISE,
TILE_OPC_ADD,
TILE_OPC_AD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a { bpt ; nop } bundle. */
#define TILE_BPT_BUNDLE 0x400b3cae70166000ULL
#define TILE_ELF_MACHINE_CODE EM_TILEPRO
#define TILE_ELF_NAME "elf32-tilepro"
static __inline unsigned int
get_BrOff_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3ff);
}
static __inline unsigned int
get_BrOff_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x00007fff) |
(((unsigned int)(n >> 20)) & 0x00018000);
}
static __inline unsigned int
get_BrType_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0xf);
}
static __inline unsigned int
get_Dest_Imm8_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 43)) & 0x000000c0);
}
static __inline unsigned int
get_Dest_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 2)) & 0x3);
}
static __inline unsigned int
get_Dest_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Imm16_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xffff);
}
static __inline unsigned int
get_Imm16_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xffff);
}
static __inline unsigned int
get_Imm8_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0xff);
}
static __inline unsigned int
get_Imm8_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_ImmOpcodeExtension_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0x7f);
}
static __inline unsigned int
get_ImmOpcodeExtension_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 51)) & 0x7f);
}
static __inline unsigned int
get_ImmRROpcodeExtension_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 8)) & 0x3);
}
static __inline unsigned int
get_JOffLong_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x00007fff) |
(((unsigned int)(n >> 20)) & 0x00018000) |
(((unsigned int)(n >> 14)) & 0x001e0000) |
(((unsigned int)(n >> 16)) & 0x07e00000) |
(((unsigned int)(n >> 31)) & 0x18000000);
}
static __inline unsigned int
get_JOff_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x00007fff) |
(((unsigned int)(n >> 20)) & 0x00018000) |
(((unsigned int)(n >> 14)) & 0x001e0000) |
(((unsigned int)(n >> 16)) & 0x07e00000) |
(((unsigned int)(n >> 31)) & 0x08000000);
}
static __inline unsigned int
get_MF_Imm15_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x00003fff) |
(((unsigned int)(n >> 44)) & 0x00004000);
}
static __inline unsigned int
get_MMEnd_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x1f);
}
static __inline unsigned int
get_MMEnd_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x1f);
}
static __inline unsigned int
get_MMStart_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 23)) & 0x1f);
}
static __inline unsigned int
get_MMStart_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 54)) & 0x1f);
}
static __inline unsigned int
get_MT_Imm15_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 37)) & 0x00003fc0) |
(((unsigned int)(n >> 44)) & 0x00004000);
}
static __inline unsigned int
get_Mode(tile_bundle_bits n)
{
return (((unsigned int)(n >> 63)) & 0x1);
}
static __inline unsigned int
get_NoRegOpcodeExtension_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0xf);
}
static __inline unsigned int
get_Opcode_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 10)) & 0x3f);
}
static __inline unsigned int
get_Opcode_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 28)) & 0x7);
}
static __inline unsigned int
get_Opcode_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 59)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 27)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 59)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y2(tile_bundle_bits n)
{
return (((unsigned int)(n >> 56)) & 0x7);
}
static __inline unsigned int
get_RROpcodeExtension_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 4)) & 0xf);
}
static __inline unsigned int
get_RRROpcodeExtension_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x1ff);
}
static __inline unsigned int
get_RRROpcodeExtension_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x1ff);
}
static __inline unsigned int
get_RRROpcodeExtension_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3);
}
static __inline unsigned int
get_RRROpcodeExtension_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3);
}
static __inline unsigned int
get_RouteOpcodeExtension_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3ff);
}
static __inline unsigned int
get_S_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 27)) & 0x1);
}
static __inline unsigned int
get_S_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 58)) & 0x1);
}
static __inline unsigned int
get_ShAmt_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_ShAmt_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_ShAmt_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_ShAmt_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_SrcA_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y2(tile_bundle_bits n)
{
return (((n >> 26)) & 0x00000001) |
(((unsigned int)(n >> 50)) & 0x0000003e);
}
static __inline unsigned int
get_SrcBDest_Y2(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_Src_SN(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3);
}
static __inline unsigned int
get_UnOpcodeExtension_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_UnOpcodeExtension_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_UnOpcodeExtension_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x1f);
}
static __inline unsigned int
get_UnOpcodeExtension_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x1f);
}
static __inline unsigned int
get_UnShOpcodeExtension_X0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 17)) & 0x3ff);
}
static __inline unsigned int
get_UnShOpcodeExtension_X1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 48)) & 0x3ff);
}
static __inline unsigned int
get_UnShOpcodeExtension_Y0(tile_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 17)) & 0x7);
}
static __inline unsigned int
get_UnShOpcodeExtension_Y1(tile_bundle_bits n)
{
return (((unsigned int)(n >> 48)) & 0x7);
}
static __inline int
sign_extend(int n, int num_bits)
{
int shift = (int)(sizeof(int) * 8 - num_bits);
return (n << shift) >> shift;
}
static __inline tile_bundle_bits
create_BrOff_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 0);
}
static __inline tile_bundle_bits
create_BrOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x00007fff)) << 43) |
(((tile_bundle_bits)(n & 0x00018000)) << 20);
}
static __inline tile_bundle_bits
create_BrType_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0xf)) << 31);
}
static __inline tile_bundle_bits
create_Dest_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x0000003f)) << 31) |
(((tile_bundle_bits)(n & 0x000000c0)) << 43);
}
static __inline tile_bundle_bits
create_Dest_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 2);
}
static __inline tile_bundle_bits
create_Dest_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tile_bundle_bits
create_Dest_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tile_bundle_bits
create_Dest_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tile_bundle_bits
create_Dest_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tile_bundle_bits
create_Imm16_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xffff) << 12);
}
static __inline tile_bundle_bits
create_Imm16_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0xffff)) << 43);
}
static __inline tile_bundle_bits
create_Imm8_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 0);
}
static __inline tile_bundle_bits
create_Imm8_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tile_bundle_bits
create_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0xff)) << 43);
}
static __inline tile_bundle_bits
create_Imm8_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tile_bundle_bits
create_Imm8_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0xff)) << 43);
}
static __inline tile_bundle_bits
create_ImmOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7f) << 20);
}
static __inline tile_bundle_bits
create_ImmOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x7f)) << 51);
}
static __inline tile_bundle_bits
create_ImmRROpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 8);
}
static __inline tile_bundle_bits
create_JOffLong_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x00007fff)) << 43) |
(((tile_bundle_bits)(n & 0x00018000)) << 20) |
(((tile_bundle_bits)(n & 0x001e0000)) << 14) |
(((tile_bundle_bits)(n & 0x07e00000)) << 16) |
(((tile_bundle_bits)(n & 0x18000000)) << 31);
}
static __inline tile_bundle_bits
create_JOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x00007fff)) << 43) |
(((tile_bundle_bits)(n & 0x00018000)) << 20) |
(((tile_bundle_bits)(n & 0x001e0000)) << 14) |
(((tile_bundle_bits)(n & 0x07e00000)) << 16) |
(((tile_bundle_bits)(n & 0x08000000)) << 31);
}
static __inline tile_bundle_bits
create_MF_Imm15_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x00003fff)) << 37) |
(((tile_bundle_bits)(n & 0x00004000)) << 44);
}
static __inline tile_bundle_bits
create_MMEnd_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 18);
}
static __inline tile_bundle_bits
create_MMEnd_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1f)) << 49);
}
static __inline tile_bundle_bits
create_MMStart_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 23);
}
static __inline tile_bundle_bits
create_MMStart_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1f)) << 54);
}
static __inline tile_bundle_bits
create_MT_Imm15_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x0000003f)) << 31) |
(((tile_bundle_bits)(n & 0x00003fc0)) << 37) |
(((tile_bundle_bits)(n & 0x00004000)) << 44);
}
static __inline tile_bundle_bits
create_Mode(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1)) << 63);
}
static __inline tile_bundle_bits
create_NoRegOpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 0);
}
static __inline tile_bundle_bits
create_Opcode_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 10);
}
static __inline tile_bundle_bits
create_Opcode_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7) << 28);
}
static __inline tile_bundle_bits
create_Opcode_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0xf)) << 59);
}
static __inline tile_bundle_bits
create_Opcode_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 27);
}
static __inline tile_bundle_bits
create_Opcode_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0xf)) << 59);
}
static __inline tile_bundle_bits
create_Opcode_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x7)) << 56);
}
static __inline tile_bundle_bits
create_RROpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 4);
}
static __inline tile_bundle_bits
create_RRROpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1ff) << 18);
}
static __inline tile_bundle_bits
create_RRROpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1ff)) << 49);
}
static __inline tile_bundle_bits
create_RRROpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 18);
}
static __inline tile_bundle_bits
create_RRROpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3)) << 49);
}
static __inline tile_bundle_bits
create_RouteOpcodeExtension_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 0);
}
static __inline tile_bundle_bits
create_S_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1) << 27);
}
static __inline tile_bundle_bits
create_S_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1)) << 58);
}
static __inline tile_bundle_bits
create_ShAmt_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tile_bundle_bits
create_ShAmt_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tile_bundle_bits
create_ShAmt_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tile_bundle_bits
create_ShAmt_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tile_bundle_bits
create_SrcA_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tile_bundle_bits
create_SrcA_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tile_bundle_bits
create_SrcA_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tile_bundle_bits
create_SrcA_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tile_bundle_bits
create_SrcA_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x00000001) << 26) |
(((tile_bundle_bits)(n & 0x0000003e)) << 50);
}
static __inline tile_bundle_bits
create_SrcBDest_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 20);
}
static __inline tile_bundle_bits
create_SrcB_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tile_bundle_bits
create_SrcB_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tile_bundle_bits
create_SrcB_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tile_bundle_bits
create_SrcB_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tile_bundle_bits
create_Src_SN(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 0);
}
static __inline tile_bundle_bits
create_UnOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tile_bundle_bits
create_UnOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tile_bundle_bits
create_UnOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x1f) << 12);
}
static __inline tile_bundle_bits
create_UnOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x1f)) << 43);
}
static __inline tile_bundle_bits
create_UnShOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 17);
}
static __inline tile_bundle_bits
create_UnShOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x3ff)) << 48);
}
static __inline tile_bundle_bits
create_UnShOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7) << 17);
}
static __inline tile_bundle_bits
create_UnShOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tile_bundle_bits)(n & 0x7)) << 48);
}
typedef enum
{
TILE_PIPELINE_X0,
TILE_PIPELINE_X1,
TILE_PIPELINE_Y0,
TILE_PIPELINE_Y1,
TILE_PIPELINE_Y2,
} tile_pipeline;
#define tile_is_x_pipeline(p) ((int)(p) <= (int)TILE_PIPELINE_X1)
typedef enum
{
TILE_OP_TYPE_REGISTER,
TILE_OP_TYPE_IMMEDIATE,
TILE_OP_TYPE_ADDRESS,
TILE_OP_TYPE_SPR
} tile_operand_type;
/* This is the bit that determines if a bundle is in the Y encoding. */
#define TILE_BUNDLE_Y_ENCODING_MASK ((tile_bundle_bits)1 << 63)
enum
{
/* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
TILE_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
/* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
TILE_NUM_PIPELINE_ENCODINGS = 5,
/* Log base 2 of TILE_BUNDLE_SIZE_IN_BYTES. */
TILE_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
/* Instructions take this many bytes. */
TILE_BUNDLE_SIZE_IN_BYTES = 1 << TILE_LOG2_BUNDLE_SIZE_IN_BYTES,
/* Log base 2 of TILE_BUNDLE_ALIGNMENT_IN_BYTES. */
TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
/* Bundles should be aligned modulo this number of bytes. */
TILE_BUNDLE_ALIGNMENT_IN_BYTES =
(1 << TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
/* Log base 2 of TILE_SN_INSTRUCTION_SIZE_IN_BYTES. */
TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1,
/* Static network instructions take this many bytes. */
TILE_SN_INSTRUCTION_SIZE_IN_BYTES =
(1 << TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES),
/* Number of registers (some are magic, such as network I/O). */
TILE_NUM_REGISTERS = 64,
/* Number of static network registers. */
TILE_NUM_SN_REGISTERS = 4
};
struct tile_operand
{
/* Is this operand a register, immediate or address? */
tile_operand_type type;
/* The default relocation type for this operand. */
signed int default_reloc : 16;
/* How many bits is this value? (used for range checking) */
unsigned int num_bits : 5;
/* Is the value signed? (used for range checking) */
unsigned int is_signed : 1;
/* Is this operand a source register? */
unsigned int is_src_reg : 1;
/* Is this operand written? (i.e. is it a destination register) */
unsigned int is_dest_reg : 1;
/* Is this operand PC-relative? */
unsigned int is_pc_relative : 1;
/* By how many bits do we right shift the value before inserting? */
unsigned int rightshift : 2;
/* Return the bits for this operand to be ORed into an existing bundle. */
tile_bundle_bits (*insert) (int op);
/* Extract this operand and return it. */
unsigned int (*extract) (tile_bundle_bits bundle);
};
extern const struct tile_operand tile_operands[];
/* One finite-state machine per pipe for rapid instruction decoding. */
extern const unsigned short * const
tile_bundle_decoder_fsms[TILE_NUM_PIPELINE_ENCODINGS];
struct tile_opcode
{
/* The opcode mnemonic, e.g. "add" */
const char *name;
/* The enum value for this mnemonic. */
tile_mnemonic mnemonic;
/* A bit mask of which of the five pipes this instruction
is compatible with:
X0 0x01
X1 0x02
Y0 0x04
Y1 0x08
Y2 0x10 */
unsigned char pipes;
/* How many operands are there? */
unsigned char num_operands;
/* Which register does this write implicitly, or TREG_ZERO if none? */
unsigned char implicitly_written_register;
/* Can this be bundled with other instructions (almost always true). */
unsigned char can_bundle;
/* The description of the operands. Each of these is an
* index into the tile_operands[] table. */
unsigned char operands[TILE_NUM_PIPELINE_ENCODINGS][TILE_MAX_OPERANDS];
};
extern const struct tile_opcode tile_opcodes[];
/* Used for non-textual disassembly into structs. */
struct tile_decoded_instruction
{
const struct tile_opcode *opcode;
const struct tile_operand *operands[TILE_MAX_OPERANDS];
int operand_values[TILE_MAX_OPERANDS];
};
/* Disassemble a bundle into a struct for machine processing. */
extern int parse_insn_tile(tile_bundle_bits bits,
unsigned int pc,
struct tile_decoded_instruction
decoded[TILE_MAX_INSTRUCTIONS_PER_BUNDLE]);
/* Given a set of bundle bits and a specific pipe, returns which
* instruction the bundle contains in that pipe.
*/
extern const struct tile_opcode *
find_opcode(tile_bundle_bits bits, tile_pipeline pipe);
#endif /* opcode_tile_h */
/* /*
* Copyright 2010 Tilera Corporation. All Rights Reserved. * Copyright 2011 Tilera Corporation. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -12,19 +12,8 @@ ...@@ -12,19 +12,8 @@
* more details. * more details.
*/ */
#ifndef _ASM_TILE_OPCODE_TILE_H #ifndef __tilegx__
#define _ASM_TILE_OPCODE_TILE_H #include <asm/tile-desc_32.h>
#include <arch/chip.h>
#if CHIP_WORD_SIZE() == 64
#include <asm/opcode-tile_64.h>
#else #else
#include <asm/opcode-tile_32.h> #include <asm/tile-desc_64.h>
#endif #endif
/* These definitions are not correct for TILE64, so just avoid them. */
#undef TILE_ELF_MACHINE_CODE
#undef TILE_ELF_NAME
#endif /* _ASM_TILE_OPCODE_TILE_H */
/* TILEPro opcode information.
*
* Copyright 2011 Tilera Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*
*
*
*
*
*/
#ifndef opcode_tilepro_h
#define opcode_tilepro_h
#include <arch/opcode.h>
enum
{
TILEPRO_MAX_OPERANDS = 5 /* mm */
};
typedef enum
{
TILEPRO_OPC_BPT,
TILEPRO_OPC_INFO,
TILEPRO_OPC_INFOL,
TILEPRO_OPC_J,
TILEPRO_OPC_JAL,
TILEPRO_OPC_MOVE,
TILEPRO_OPC_MOVE_SN,
TILEPRO_O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O_OPC_TBLIDXB1_SN,
TILEPRO_OPC_TBLIDXB2,
TILEPRO_OPC_TBLIDXB2_SN,
TILEPRO_OPC_TBLIDXB3,
TILEPRO_OPC_TBLIDXB3_SN,
TILEPRO_OPC_TNS,
TILEPRO_OPC_TNS_SN,
TILEPRO_OPC_WH64,
TILEPRO_OPC_XOR,
TILEPRO_OPC_XOR_SN,
TILEPRO_OPC_XORI,
TILEPRO_OPC_XORI_SN,
TILEPRO_OPC_NONE
} tilepro_mnemonic;
typedef enum
{
TILEPRO_PIPELINE_X0,
TILEPRO_PIPELINE_X1,
TILEPRO_PIPELINE_Y0,
TILEPRO_PIPELINE_Y1,
TILEPRO_PIPELINE_Y2,
} tilepro_pipeline;
#define tilepro_is_x_pipeline(p) ((int)(p) <= (int)TILEPRO_PIPELINE_X1)
typedef enum
{
TILEPRO_OP_TYPE_REGISTER,
TILEPRO_OP_TYPE_IMMEDIATE,
TILEPRO_OP_TYPE_ADDRESS,
TILEPRO_OP_TYPE_SPR
} tilepro_operand_type;
struct tilepro_operand
{
/* Is this operand a register, immediate or address? */
tilepro_operand_type type;
/* The default relocation type for this operand. */
signed int default_reloc : 16;
/* How many bits is this value? (used for range checking) */
unsigned int num_bits : 5;
/* Is the value signed? (used for range checking) */
unsigned int is_signed : 1;
/* Is this operand a source register? */
unsigned int is_src_reg : 1;
/* Is this operand written? (i.e. is it a destination register) */
unsigned int is_dest_reg : 1;
/* Is this operand PC-relative? */
unsigned int is_pc_relative : 1;
/* By how many bits do we right shift the value before inserting? */
unsigned int rightshift : 2;
/* Return the bits for this operand to be ORed into an existing bundle. */
tilepro_bundle_bits (*insert) (int op);
/* Extract this operand and return it. */
unsigned int (*extract) (tilepro_bundle_bits bundle);
};
extern const struct tilepro_operand tilepro_operands[];
/* One finite-state machine per pipe for rapid instruction decoding. */
extern const unsigned short * const
tilepro_bundle_decoder_fsms[TILEPRO_NUM_PIPELINE_ENCODINGS];
struct tilepro_opcode
{
/* The opcode mnemonic, e.g. "add" */
const char *name;
/* The enum value for this mnemonic. */
tilepro_mnemonic mnemonic;
/* A bit mask of which of the five pipes this instruction
is compatible with:
X0 0x01
X1 0x02
Y0 0x04
Y1 0x08
Y2 0x10 */
unsigned char pipes;
/* How many operands are there? */
unsigned char num_operands;
/* Which register does this write implicitly, or TREG_ZERO if none? */
unsigned char implicitly_written_register;
/* Can this be bundled with other instructions (almost always true). */
unsigned char can_bundle;
/* The description of the operands. Each of these is an
* index into the tilepro_operands[] table. */
unsigned char operands[TILEPRO_NUM_PIPELINE_ENCODINGS][TILEPRO_MAX_OPERANDS];
};
extern const struct tilepro_opcode tilepro_opcodes[];
/* Used for non-textual disassembly into structs. */
struct tilepro_decoded_instruction
{
const struct tilepro_opcode *opcode;
const struct tilepro_operand *operands[TILEPRO_MAX_OPERANDS];
int operand_values[TILEPRO_MAX_OPERANDS];
};
/* Disassemble a bundle into a struct for machine processing. */
extern int parse_insn_tilepro(tilepro_bundle_bits bits,
unsigned int pc,
struct tilepro_decoded_instruction
decoded[TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE]);
/* Given a set of bundle bits and a specific pipe, returns which
* instruction the bundle contains in that pipe.
*/
extern const struct tilepro_opcode *
find_opcode(tilepro_bundle_bits bits, tilepro_pipeline pipe);
#endif /* opcode_tilepro_h */
/* tile.h -- Header file for TILE opcode table /* TILE-Gx opcode information.
Copyright (C) 2005 Free Software Foundation, Inc. *
Contributed by Tilera Corp. */ * Copyright 2011 Tilera Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*
*
*
*
*
*/
#ifndef opcode_tile_h #ifndef opcode_tile_h
#define opcode_tile_h #define opcode_tile_h
typedef unsigned long long tilegx_bundle_bits; #include <arch/opcode.h>
enum enum
...@@ -351,758 +367,6 @@ typedef enum ...@@ -351,758 +367,6 @@ typedef enum
TILEGX_OPC_NONE TILEGX_OPC_NONE
} tilegx_mnemonic; } tilegx_mnemonic;
/* 64-bit pattern for a { bpt ; nop } bundle. */
#define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL
#define TILE_ELF_MACHINE_CODE EM_TILE64
#define TILE_ELF_NAME "elf32-tile64"
static __inline unsigned int
get_BFEnd_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_BFOpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 24)) & 0xf);
}
static __inline unsigned int
get_BFStart_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3f);
}
static __inline unsigned int
get_BrOff_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 37)) & 0x0001ffc0);
}
static __inline unsigned int
get_BrType_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 54)) & 0x1f);
}
static __inline unsigned int
get_Dest_Imm8_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 43)) & 0x000000c0);
}
static __inline unsigned int
get_Dest_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 0)) & 0x3f);
}
static __inline unsigned int
get_Dest_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x3f);
}
static __inline unsigned int
get_Imm16_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xffff);
}
static __inline unsigned int
get_Imm16_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xffff);
}
static __inline unsigned int
get_Imm8OpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0xff);
}
static __inline unsigned int
get_Imm8OpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 51)) & 0xff);
}
static __inline unsigned int
get_Imm8_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0xff);
}
static __inline unsigned int
get_Imm8_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0xff);
}
static __inline unsigned int
get_JumpOff_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x7ffffff);
}
static __inline unsigned int
get_JumpOpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 58)) & 0x1);
}
static __inline unsigned int
get_MF_Imm14_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3fff);
}
static __inline unsigned int
get_MT_Imm14_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 31)) & 0x0000003f) |
(((unsigned int)(n >> 37)) & 0x00003fc0);
}
static __inline unsigned int
get_Mode(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 62)) & 0x3);
}
static __inline unsigned int
get_Opcode_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 28)) & 0x7);
}
static __inline unsigned int
get_Opcode_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 59)) & 0x7);
}
static __inline unsigned int
get_Opcode_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 27)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 58)) & 0xf);
}
static __inline unsigned int
get_Opcode_Y2(tilegx_bundle_bits n)
{
return (((n >> 26)) & 0x00000001) |
(((unsigned int)(n >> 56)) & 0x00000002);
}
static __inline unsigned int
get_RRROpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3ff);
}
static __inline unsigned int
get_RRROpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3ff);
}
static __inline unsigned int
get_RRROpcodeExtension_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3);
}
static __inline unsigned int
get_RRROpcodeExtension_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3);
}
static __inline unsigned int
get_ShAmt_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_ShAmt_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_ShAmt_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_ShAmt_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_ShiftOpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3ff);
}
static __inline unsigned int
get_ShiftOpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3ff);
}
static __inline unsigned int
get_ShiftOpcodeExtension_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 18)) & 0x3);
}
static __inline unsigned int
get_ShiftOpcodeExtension_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 49)) & 0x3);
}
static __inline unsigned int
get_SrcA_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 6)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 37)) & 0x3f);
}
static __inline unsigned int
get_SrcA_Y2(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 20)) & 0x3f);
}
static __inline unsigned int
get_SrcBDest_Y2(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 51)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_SrcB_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_X0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_X1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_Y0(tilegx_bundle_bits num)
{
const unsigned int n = (unsigned int)num;
return (((n >> 12)) & 0x3f);
}
static __inline unsigned int
get_UnaryOpcodeExtension_Y1(tilegx_bundle_bits n)
{
return (((unsigned int)(n >> 43)) & 0x3f);
}
static __inline int
sign_extend(int n, int num_bits)
{
int shift = (int)(sizeof(int) * 8 - num_bits);
return (n << shift) >> shift;
}
static __inline tilegx_bundle_bits
create_BFEnd_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_BFOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 24);
}
static __inline tilegx_bundle_bits
create_BFStart_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 18);
}
static __inline tilegx_bundle_bits
create_BrOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilegx_bundle_bits)(n & 0x0001ffc0)) << 37);
}
static __inline tilegx_bundle_bits
create_BrType_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x1f)) << 54);
}
static __inline tilegx_bundle_bits
create_Dest_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilegx_bundle_bits)(n & 0x000000c0)) << 43);
}
static __inline tilegx_bundle_bits
create_Dest_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tilegx_bundle_bits
create_Dest_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tilegx_bundle_bits
create_Dest_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 0);
}
static __inline tilegx_bundle_bits
create_Dest_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
}
static __inline tilegx_bundle_bits
create_Imm16_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xffff) << 12);
}
static __inline tilegx_bundle_bits
create_Imm16_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xffff)) << 43);
}
static __inline tilegx_bundle_bits
create_Imm8OpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 20);
}
static __inline tilegx_bundle_bits
create_Imm8OpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xff)) << 51);
}
static __inline tilegx_bundle_bits
create_Imm8_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tilegx_bundle_bits
create_Imm8_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xff)) << 43);
}
static __inline tilegx_bundle_bits
create_Imm8_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xff) << 12);
}
static __inline tilegx_bundle_bits
create_Imm8_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xff)) << 43);
}
static __inline tilegx_bundle_bits
create_JumpOff_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x7ffffff)) << 31);
}
static __inline tilegx_bundle_bits
create_JumpOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x1)) << 58);
}
static __inline tilegx_bundle_bits
create_MF_Imm14_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3fff)) << 37);
}
static __inline tilegx_bundle_bits
create_MT_Imm14_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
(((tilegx_bundle_bits)(n & 0x00003fc0)) << 37);
}
static __inline tilegx_bundle_bits
create_Mode(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3)) << 62);
}
static __inline tilegx_bundle_bits
create_Opcode_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x7) << 28);
}
static __inline tilegx_bundle_bits
create_Opcode_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x7)) << 59);
}
static __inline tilegx_bundle_bits
create_Opcode_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0xf) << 27);
}
static __inline tilegx_bundle_bits
create_Opcode_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0xf)) << 58);
}
static __inline tilegx_bundle_bits
create_Opcode_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x00000001) << 26) |
(((tilegx_bundle_bits)(n & 0x00000002)) << 56);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 18);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 18);
}
static __inline tilegx_bundle_bits
create_RRROpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3)) << 49);
}
static __inline tilegx_bundle_bits
create_ShAmt_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_ShAmt_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_ShAmt_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_ShAmt_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3ff) << 18);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3) << 18);
}
static __inline tilegx_bundle_bits
create_ShiftOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3)) << 49);
}
static __inline tilegx_bundle_bits
create_SrcA_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tilegx_bundle_bits
create_SrcA_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tilegx_bundle_bits
create_SrcA_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 6);
}
static __inline tilegx_bundle_bits
create_SrcA_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
}
static __inline tilegx_bundle_bits
create_SrcA_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 20);
}
static __inline tilegx_bundle_bits
create_SrcBDest_Y2(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 51);
}
static __inline tilegx_bundle_bits
create_SrcB_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_SrcB_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_SrcB_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_SrcB_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_X0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_X1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_Y0(int num)
{
const unsigned int n = (unsigned int)num;
return ((n & 0x3f) << 12);
}
static __inline tilegx_bundle_bits
create_UnaryOpcodeExtension_Y1(int num)
{
const unsigned int n = (unsigned int)num;
return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
}
typedef enum typedef enum
...@@ -1124,35 +388,6 @@ typedef enum ...@@ -1124,35 +388,6 @@ typedef enum
TILEGX_OP_TYPE_SPR TILEGX_OP_TYPE_SPR
} tilegx_operand_type; } tilegx_operand_type;
/* These are the bits that determine if a bundle is in the X encoding. */
#define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62)
enum
{
/* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
/* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
TILEGX_NUM_PIPELINE_ENCODINGS = 5,
/* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */
TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
/* Instructions take this many bytes. */
TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES,
/* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */
TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
/* Bundles should be aligned modulo this number of bytes. */
TILEGX_BUNDLE_ALIGNMENT_IN_BYTES =
(1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
/* Number of registers (some are magic, such as network I/O). */
TILEGX_NUM_REGISTERS = 64,
};
struct tilegx_operand struct tilegx_operand
{ {
/* Is this operand a register, immediate or address? */ /* Is this operand a register, immediate or address? */
......
/* /*
* Copyright 2010 Tilera Corporation. All Rights Reserved. * Copyright 2011 Tilera Corporation. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -15,13 +15,11 @@ ...@@ -15,13 +15,11 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <asm/backtrace.h> #include <asm/backtrace.h>
#include <asm/opcode-tile.h> #include <asm/tile-desc.h>
#include <arch/abi.h> #include <arch/abi.h>
#ifdef __tilegx__ #ifdef __tilegx__
#define tile_bundle_bits tilegx_bundle_bits
#define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE #define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE
#define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES
#define tile_decoded_instruction tilegx_decoded_instruction #define tile_decoded_instruction tilegx_decoded_instruction
#define tile_mnemonic tilegx_mnemonic #define tile_mnemonic tilegx_mnemonic
#define parse_insn_tile parse_insn_tilegx #define parse_insn_tile parse_insn_tilegx
...@@ -35,7 +33,18 @@ ...@@ -35,7 +33,18 @@
#define OPCODE_STORE TILEGX_OPC_ST #define OPCODE_STORE TILEGX_OPC_ST
typedef long long bt_int_reg_t; typedef long long bt_int_reg_t;
#else #else
#define OPCODE_STORE TILE_OPC_SW #define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE
#define tile_decoded_instruction tilepro_decoded_instruction
#define tile_mnemonic tilepro_mnemonic
#define parse_insn_tile parse_insn_tilepro
#define TILE_OPC_IRET TILEPRO_OPC_IRET
#define TILE_OPC_ADDI TILEPRO_OPC_ADDI
#define TILE_OPC_ADDLI TILEPRO_OPC_ADDLI
#define TILE_OPC_INFO TILEPRO_OPC_INFO
#define TILE_OPC_INFOL TILEPRO_OPC_INFOL
#define TILE_OPC_JRP TILEPRO_OPC_JRP
#define TILE_OPC_MOVE TILEPRO_OPC_MOVE
#define OPCODE_STORE TILEPRO_OPC_SW
typedef int bt_int_reg_t; typedef int bt_int_reg_t;
#endif #endif
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/opcode-tile.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/homecache.h> #include <asm/homecache.h>
#include <arch/opcode.h>
#ifdef __tilegx__ #ifdef __tilegx__
# define Elf_Rela Elf64_Rela # define Elf_Rela Elf64_Rela
......
...@@ -25,9 +25,8 @@ ...@@ -25,9 +25,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/opcode-tile.h>
#include <asm/opcode_constants.h>
#include <arch/abi.h> #include <arch/abi.h>
#include <arch/opcode.h>
#define signExtend17(val) sign_extend((val), 17) #define signExtend17(val) sign_extend((val), 17)
#define TILE_X1_MASK (0xffffffffULL << 31) #define TILE_X1_MASK (0xffffffffULL << 31)
...@@ -118,7 +117,7 @@ static tile_bundle_bits rewrite_load_store_unaligned( ...@@ -118,7 +117,7 @@ static tile_bundle_bits rewrite_load_store_unaligned(
int val_reg, addr_reg, err, val; int val_reg, addr_reg, err, val;
/* Get address and value registers */ /* Get address and value registers */
if (bundle & TILE_BUNDLE_Y_ENCODING_MASK) { if (bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK) {
addr_reg = get_SrcA_Y2(bundle); addr_reg = get_SrcA_Y2(bundle);
val_reg = get_SrcBDest_Y2(bundle); val_reg = get_SrcBDest_Y2(bundle);
} else if (mem_op == MEMOP_LOAD || mem_op == MEMOP_LOAD_POSTINCR) { } else if (mem_op == MEMOP_LOAD || mem_op == MEMOP_LOAD_POSTINCR) {
...@@ -229,7 +228,7 @@ P("\n"); ...@@ -229,7 +228,7 @@ P("\n");
} }
++unaligned_fixup_count; ++unaligned_fixup_count;
if (bundle & TILE_BUNDLE_Y_ENCODING_MASK) { if (bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK) {
/* Convert the Y2 instruction to a prefetch. */ /* Convert the Y2 instruction to a prefetch. */
bundle &= ~(create_SrcBDest_Y2(-1) | bundle &= ~(create_SrcBDest_Y2(-1) |
create_Opcode_Y2(-1)); create_Opcode_Y2(-1));
...@@ -389,7 +388,7 @@ void single_step_once(struct pt_regs *regs) ...@@ -389,7 +388,7 @@ void single_step_once(struct pt_regs *regs)
state->branch_next_pc = 0; state->branch_next_pc = 0;
state->update = 0; state->update = 0;
if (!(bundle & TILE_BUNDLE_Y_ENCODING_MASK)) { if (!(bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK)) {
/* two wide, check for control flow */ /* two wide, check for control flow */
int opcode = get_Opcode_X1(bundle); int opcode = get_Opcode_X1(bundle);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* TILE-Gx opcode information.
*
* Copyright 2011 Tilera Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*
*
*
*
*
*/
/* This define is BFD_RELOC_##x for real bfd, or -1 for everyone else. */ /* This define is BFD_RELOC_##x for real bfd, or -1 for everyone else. */
#define BFD_RELOC(x) -1 #define BFD_RELOC(x) -1
...@@ -6,10 +26,8 @@ ...@@ -6,10 +26,8 @@
#define TREG_SN 56 #define TREG_SN 56
#define TREG_ZERO 63 #define TREG_ZERO 63
/* FIXME: Rename this. */
#include <asm/opcode-tile_64.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <asm/tile-desc.h>
const struct tilegx_opcode tilegx_opcodes[334] = const struct tilegx_opcode tilegx_opcodes[334] =
{ {
...@@ -2040,12 +2058,12 @@ const struct tilegx_operand tilegx_operands[35] = ...@@ -2040,12 +2058,12 @@ const struct tilegx_operand tilegx_operands[35] =
create_BrOff_X1, get_BrOff_X1 create_BrOff_X1, get_BrOff_X1
}, },
{ {
TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(NONE), TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_MMSTART_X0),
6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0,
create_BFStart_X0, get_BFStart_X0 create_BFStart_X0, get_BFStart_X0
}, },
{ {
TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(NONE), TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_MMEND_X0),
6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0,
create_BFEnd_X0, get_BFEnd_X0 create_BFEnd_X0, get_BFEnd_X0
}, },
......
...@@ -19,13 +19,12 @@ ...@@ -19,13 +19,12 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <asm/opcode-tile.h>
#include <asm/opcode_constants.h>
#include <asm/stack.h> #include <asm/stack.h>
#include <asm/traps.h> #include <asm/traps.h>
#include <arch/interrupts.h> #include <arch/interrupts.h>
#include <arch/spr_def.h> #include <arch/spr_def.h>
#include <arch/opcode.h>
void __init trap_init(void) void __init trap_init(void)
{ {
...@@ -135,7 +134,7 @@ static int special_ill(bundle_bits bundle, int *sigp, int *codep) ...@@ -135,7 +134,7 @@ static int special_ill(bundle_bits bundle, int *sigp, int *codep)
if (get_UnaryOpcodeExtension_X1(bundle) != ILL_UNARY_OPCODE_X1) if (get_UnaryOpcodeExtension_X1(bundle) != ILL_UNARY_OPCODE_X1)
return 0; return 0;
#else #else
if (bundle & TILE_BUNDLE_Y_ENCODING_MASK) if (bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK)
return 0; return 0;
if (get_Opcode_X1(bundle) != SHUN_0_OPCODE_X1) if (get_Opcode_X1(bundle) != SHUN_0_OPCODE_X1)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment