]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/tilegx/tilegx-multiply.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / tilegx / tilegx-multiply.h
CommitLineData
dd552284 1/* Header for constant multiple table for TILE-Gx.
818ab71a 2 Copyright (C) 2011-2016 Free Software Foundation, Inc.
dd552284
WL
3 Contributed by Walter Lee (walt@tilera.com)
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_TILEGX_MULTIPLY_H
22#define GCC_TILEGX_MULTIPLY_H
23
24/* A node of a tilegx_multiply_insn_seq, corresponding to a single
25 machine instruction such as 'add', 's1a', or an shl by a constant. */
26struct tilegx_multiply_insn_seq_entry
27{
28 /* Which operation this node performs (e.g. an add or sub).
29 Don't use this directly, call get_opcode() table to get a insn_code. */
30 unsigned char compressed_opcode;
31
32 /* The left-hand side of this expression tree.
33 If equal to 0, it refers to 'zero'.
34 If equal to 1, it refers to the original input to the multiply operation.
35 Otherwise, subtract two and it is an index into the containing
36 tilegx_multiply_insn_seq's 'op' array. Since it can only point to some
37 value that has already been computed it will always point to an
38 earlier entry in the array. */
39 unsigned char lhs;
40
41 /* This is like lhs, but for the right-hand side. However, for shift
42 opcodes this is a shift count rather than an operand index. */
43 unsigned char rhs;
44};
45
46/* Maximum size of op array. */
47#define tilegx_multiply_insn_seq_MAX_OPERATIONS 4
48
49/* This defines a DAG describing how to multiply by a constant in
50 terms of one or more machine instructions. */
51struct tilegx_multiply_insn_seq
52{
53 /* The constant factor by which this expression tree multiplies its input. */
54 long long multiplier;
55
56 /* The nodes of the parse tree. These are ordered so that instructions
57 can be emitted in the same order that they appear in this array.
58 Entry entry in this array can only refer to earlier entries in
59 the array. */
60 struct tilegx_multiply_insn_seq_entry
61 op[tilegx_multiply_insn_seq_MAX_OPERATIONS];
62
63};
64
65/* A mapping from the compressed opcode to the corresponding enum
66 insn_code. */
67extern const enum insn_code tilegx_multiply_insn_seq_decode_opcode[];
68
69/* Table mapping constant int multipliers to an expression
70 tree that efficiently performs that multiplication.
71 This is sorted by its 'multiplier' field so a binary search
72 can look for matches. */
73extern const struct tilegx_multiply_insn_seq tilegx_multiply_insn_seq_table[];
74
75/* The number of elements in multiply_insn_seq_table. */
76extern const int tilegx_multiply_insn_seq_table_size;
77
78#endif /* !GCC_TILEGX_MULTIPLY_H */