]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/tilepro/tilepro-multiply.h
testsuite, Darwin: Fix darwin-comm-1.c error messages for Darwin <= 10.
[thirdparty/gcc.git] / gcc / config / tilepro / tilepro-multiply.h
CommitLineData
dd552284 1/* Header for constant multiple table for TILEPro.
7adcbafe 2 Copyright (C) 2011-2022 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_TILEPRO_MULTIPLY_H
22#define GCC_TILEPRO_MULTIPLY_H
23
24/* A node of a tilepro_multiply_insn_seq, corresponding to a single
25 machine instruction such as 'add', 's1a', or an shl by a
26 constant. */
27struct tilepro_multiply_insn_seq_entry
28{
29 /* Which operation this node performs (e.g. an add or sub). Don't
30 use this directly, call get_opcode() table to get a
31 insn_code. */
32 unsigned char compressed_opcode;
33
34 /* The left-hand side of this expression tree.
35 If equal to 0, it refers to 'zero'.
36 If equal to 1, it refers to the original input to the multiply
37 operation.
38 Otherwise, subtract two and it is an index into the containing
39 tilepro_multiply_insn_seq's 'op' array. Since it can only point
40 to some value that has already been computed it will always point
41 to an earlier entry in the array. */
42 unsigned char lhs;
43
44 /* This is like lhs, but for the right-hand side. However, for shift
45 opcodes this is a shift count rather than an operand index. */
46 unsigned char rhs;
47};
48
49/* Maximum size of op array. */
50#define tilepro_multiply_insn_seq_MAX_OPERATIONS 4
51
52/* This defines a DAG describing how to multiply by a constant in
53 terms of one or more machine instructions. */
54struct tilepro_multiply_insn_seq
55{
56 /* The constant factor by which this expression tree multiplies its
57 input. */
58 int multiplier;
59
60 /* The nodes of the parse tree. These are ordered so that
61 instructions can be emitted in the same order that they appear in
62 this array. Entry entry in this array can only refer to earlier
63 entries in the array. */
64 struct tilepro_multiply_insn_seq_entry
65 op[tilepro_multiply_insn_seq_MAX_OPERATIONS];
66
67};
68
69/* A mapping from the compressed opcode to the corresponding enum
70 insn_code. */
71extern const enum insn_code tilepro_multiply_insn_seq_decode_opcode[];
72
73/* Table mapping constant int multipliers to an expression tree that
74 efficiently performs that multiplication. This is sorted by its
75 'multiplier' field so a binary search can look for matches. */
76extern const struct tilepro_multiply_insn_seq
77 tilepro_multiply_insn_seq_table[];
78
79/* The number of elements in multiply_insn_seq_table. */
80extern const int tilepro_multiply_insn_seq_table_size;
81
82#endif /* !GCC_TILEPRO_MULTIPLY_H */