]> gcc.gnu.org Git - gcc.git/blame - gcc/machmode.h
optabs.c (prepare_cmp_insn): Use SCALAR_FLOAT_MODE_P.
[gcc.git] / gcc / machmode.h
CommitLineData
5e6908ea 1/* Machine mode definitions for GCC; included by rtl.h and tree.h.
0c20a65f 2 Copyright (C) 1991, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2003
72c602fc 3 Free Software Foundation, Inc.
fc152a4b 4
1322177d 5This file is part of GCC.
fc152a4b 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
fc152a4b 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
fc152a4b
RK
16
17You should have received a copy of the GNU General Public License
1322177d 18along with GCC; see the file COPYING. If not, write to the Free
366ccddb
KC
19Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2002110-1301, USA. */
fc152a4b 21
fc152a4b 22#ifndef HAVE_MACHINE_MODES
70c75d9f
DE
23#define HAVE_MACHINE_MODES
24
fc152a4b 25/* Make an enum class that gives all the machine modes. */
0974c7d7 26#include "insn-modes.h"
fc152a4b
RK
27
28/* Get the name of mode MODE as a string. */
29
86460bab 30extern const char * const mode_name[NUM_MACHINE_MODES];
0974c7d7
ZW
31#define GET_MODE_NAME(MODE) mode_name[MODE]
32
33/* Mode classes. */
fc152a4b 34
0974c7d7
ZW
35#include "mode-classes.def"
36#define DEF_MODE_CLASS(M) M
37enum mode_class { MODE_CLASSES, MAX_MODE_CLASS };
38#undef DEF_MODE_CLASS
39#undef MODE_CLASSES
fc152a4b
RK
40
41/* Get the general kind of object that mode MODE represents
42 (integer, floating, complex, etc.) */
43
0974c7d7
ZW
44extern const unsigned char mode_class[NUM_MACHINE_MODES];
45#define GET_MODE_CLASS(MODE) mode_class[MODE]
fc152a4b 46
ae1ae48c
RK
47/* Nonzero if MODE is an integral mode. */
48#define INTEGRAL_MODE_P(MODE) \
49 (GET_MODE_CLASS (MODE) == MODE_INT \
50 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \
f9f27ee5
BS
51 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
52 || GET_MODE_CLASS (MODE) == MODE_VECTOR_INT)
ae1ae48c
RK
53
54/* Nonzero if MODE is a floating-point mode. */
55#define FLOAT_MODE_P(MODE) \
56 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
f9f27ee5
BS
57 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
58 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
ae1ae48c 59
76080169
RH
60/* Nonzero if MODE is a complex mode. */
61#define COMPLEX_MODE_P(MODE) \
62 (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
63 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
64
f9f27ee5
BS
65/* Nonzero if MODE is a vector mode. */
66#define VECTOR_MODE_P(MODE) \
67 (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
68 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
69
71012d97
GK
70/* Nonzero if MODE is a scalar integral mode. */
71#define SCALAR_INT_MODE_P(MODE) \
72 (GET_MODE_CLASS (MODE) == MODE_INT \
73 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT)
74
075fc17a
JH
75/* Nonzero if MODE is a scalar floating point mode. */
76#define SCALAR_FLOAT_MODE_P(MODE) \
77 (GET_MODE_CLASS (MODE) == MODE_FLOAT)
78
37783865 79/* Get the size in bytes and bits of an object of mode MODE. */
fc152a4b 80
b8eaca23 81extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
37783865
ZW
82#define GET_MODE_SIZE(MODE) ((unsigned short) mode_size[MODE])
83#define GET_MODE_BITSIZE(MODE) ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
fc152a4b 84
37783865
ZW
85/* Get the number of value bits of an object of mode MODE. */
86extern const unsigned short mode_precision[NUM_MACHINE_MODES];
87#define GET_MODE_PRECISION(MODE) mode_precision[MODE]
fc152a4b
RK
88
89/* Get a bitmask containing 1 for all bits in a word
90 that fit within mode MODE. */
91
86460bab 92extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
913f68c1 93
0974c7d7 94#define GET_MODE_MASK(MODE) mode_mask_array[MODE]
fc152a4b 95
69ef87e2
AH
96/* Return the mode of the inner elements in a vector. */
97
02befdf4 98extern const unsigned char mode_inner[NUM_MACHINE_MODES];
0974c7d7 99#define GET_MODE_INNER(MODE) mode_inner[MODE]
69ef87e2 100
02befdf4
ZW
101/* Get the size in bytes of the basic parts of an object of mode MODE. */
102
103#define GET_MODE_UNIT_SIZE(MODE) \
104 (GET_MODE_INNER (MODE) == VOIDmode \
105 ? GET_MODE_SIZE (MODE) \
106 : GET_MODE_SIZE (GET_MODE_INNER (MODE)))
107
108/* Get the number of units in the object. */
109
110extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
111#define GET_MODE_NUNITS(MODE) mode_nunits[MODE]
112
fc152a4b
RK
113/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
114
0974c7d7
ZW
115extern const unsigned char mode_wider[NUM_MACHINE_MODES];
116#define GET_MODE_WIDER_MODE(MODE) mode_wider[MODE]
fc152a4b 117
d2348bd5
DD
118extern const unsigned char mode_2xwider[NUM_MACHINE_MODES];
119#define GET_MODE_2XWIDER_MODE(MODE) mode_2xwider[MODE]
120
c92c981a
RK
121/* Return the mode for data of a given size SIZE and mode class CLASS.
122 If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
123 The value is BLKmode if no other mode is found. */
124
0c20a65f 125extern enum machine_mode mode_for_size (unsigned int, enum mode_class, int);
c92c981a 126
27922c13
RH
127/* Similar, but find the smallest mode for a given width. */
128
0c20a65f
AJ
129extern enum machine_mode smallest_mode_for_size (unsigned int,
130 enum mode_class);
27922c13
RH
131
132
d006aa54
RH
133/* Return an integer mode of the exact same size as the input mode,
134 or BLKmode on failure. */
135
0c20a65f 136extern enum machine_mode int_mode_for_mode (enum machine_mode);
d006aa54 137
fc152a4b
RK
138/* Find the best mode to use to access a bit field. */
139
0c20a65f
AJ
140extern enum machine_mode get_best_mode (int, int, unsigned int,
141 enum machine_mode, int);
fc152a4b
RK
142
143/* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
144
b8eaca23 145extern CONST_MODE_BASE_ALIGN unsigned char mode_base_align[NUM_MACHINE_MODES];
0974c7d7 146
0c20a65f 147extern unsigned get_mode_alignment (enum machine_mode);
36c265b1
NS
148
149#define GET_MODE_ALIGNMENT(MODE) get_mode_alignment (MODE)
fc152a4b 150
4a39a918
RK
151/* For each class, get the narrowest mode in that class. */
152
0974c7d7
ZW
153extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS];
154#define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[CLASS]
4a39a918 155
6c164c81
RK
156/* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
157 and the mode whose class is Pmode and whose size is POINTER_SIZE. */
4a39a918
RK
158
159extern enum machine_mode byte_mode;
160extern enum machine_mode word_mode;
6c164c81 161extern enum machine_mode ptr_mode;
4a39a918 162
b8eaca23
ZW
163/* Target-dependent machine mode initialization - in insn-modes.c. */
164extern void init_adjust_machine_modes (void);
165
3ef996b0 166#endif /* not HAVE_MACHINE_MODES */
This page took 2.490483 seconds and 5 git commands to generate.