/* Definitions for code generation pass of GNU compiler.
- Copyright (C) 2001-2017 Free Software Foundation, Inc.
+ Copyright (C) 2001-2020 Free Software Foundation, Inc.
This file is part of GCC.
#include "optabs-query.h"
#include "optabs-libfuncs.h"
+#include "vec-perm-indices.h"
/* Generate code for a widening multiply. */
extern rtx expand_widening_mult (machine_mode, rtx, rtx, rtx, int, optab);
};
/* Information about an operand for instruction expansion. */
-struct expand_operand {
+class expand_operand {
+public:
/* The type of operand. */
ENUM_BITFIELD (expand_operand_type) type : 8;
/* The value of the operand. */
rtx value;
+
+ /* The value of an EXPAND_INTEGER operand. */
+ poly_int64 int_value;
};
/* Initialize OP with the given fields. Initialise the other fields
to their default values. */
static inline void
-create_expand_operand (struct expand_operand *op,
+create_expand_operand (class expand_operand *op,
enum expand_operand_type type,
rtx value, machine_mode mode,
- bool unsigned_p)
+ bool unsigned_p, poly_int64 int_value = 0)
{
op->type = type;
op->unsigned_p = unsigned_p;
+ op->target = 0;
op->unused = 0;
op->mode = mode;
op->value = value;
+ op->int_value = int_value;
}
/* Make OP describe an operand that must use rtx X, even if X is volatile. */
static inline void
-create_fixed_operand (struct expand_operand *op, rtx x)
+create_fixed_operand (class expand_operand *op, rtx x)
{
create_expand_operand (op, EXPAND_FIXED, x, VOIDmode, false);
}
be ignored in that case. */
static inline void
-create_output_operand (struct expand_operand *op, rtx x,
+create_output_operand (class expand_operand *op, rtx x,
machine_mode mode)
{
create_expand_operand (op, EXPAND_OUTPUT, x, mode, false);
as an operand. */
static inline void
-create_input_operand (struct expand_operand *op, rtx value,
+create_input_operand (class expand_operand *op, rtx value,
machine_mode mode)
{
create_expand_operand (op, EXPAND_INPUT, value, mode, false);
to mode MODE. UNSIGNED_P says whether VALUE is unsigned. */
static inline void
-create_convert_operand_to (struct expand_operand *op, rtx value,
+create_convert_operand_to (class expand_operand *op, rtx value,
machine_mode mode, bool unsigned_p)
{
create_expand_operand (op, EXPAND_CONVERT_TO, value, mode, unsigned_p);
/* Make OP describe an input operand that should have the same value
as VALUE, after any mode conversion that the backend might request.
If VALUE is a CONST_INT, it should be treated as having mode MODE.
- UNSIGNED_P says whether VALUE is unsigned. */
+ UNSIGNED_P says whether VALUE is unsigned.
+
+ The conversion of VALUE can include a combination of numerical
+ conversion (as for convert_modes) and duplicating a scalar to fill
+ a vector (if VALUE is a scalar but the operand is a vector). */
static inline void
-create_convert_operand_from (struct expand_operand *op, rtx value,
+create_convert_operand_from (class expand_operand *op, rtx value,
machine_mode mode, bool unsigned_p)
{
create_expand_operand (op, EXPAND_CONVERT_FROM, value, mode, unsigned_p);
of the address, but it may need to be converted to Pmode first. */
static inline void
-create_address_operand (struct expand_operand *op, rtx value)
+create_address_operand (class expand_operand *op, rtx value)
{
create_expand_operand (op, EXPAND_ADDRESS, value, Pmode, false);
}
-/* Make OP describe an input operand that has value INTVAL and that has
- no inherent mode. This function should only be used for operands that
- are always expand-time constants. The backend may request that INTVAL
- be copied into a different kind of rtx, but it must specify the mode
- of that rtx if so. */
-
-static inline void
-create_integer_operand (struct expand_operand *op, HOST_WIDE_INT intval)
-{
- create_expand_operand (op, EXPAND_INTEGER, GEN_INT (intval), VOIDmode, false);
-}
-
+extern void create_integer_operand (class expand_operand *, poly_int64);
/* Passed to expand_simple_binop and expand_binop to say which options
to try to use if the requested operation can't be open-coded on the
(without splitting it into pieces). */
extern int can_compare_p (enum rtx_code, machine_mode,
enum can_compare_purpose);
+
+/* Return whether the backend can emit a vector comparison for code CODE,
+ comparing operands of mode CMP_OP_MODE and producing a result with
+ VALUE_MODE. */
+extern bool can_vcond_compare_p (enum rtx_code, machine_mode, machine_mode);
+
extern rtx prepare_operand (enum insn_code, rtx, int, machine_mode,
machine_mode, int);
/* Emit a pair of rtl insns to compare two rtx's and to jump
extern rtx_insn *gen_cond_trap (enum rtx_code, rtx, rtx, rtx);
/* Generate code for VEC_PERM_EXPR. */
-extern rtx expand_vec_perm (machine_mode, rtx, rtx, rtx, rtx);
+extern rtx expand_vec_perm_var (machine_mode, rtx, rtx, rtx, rtx);
+extern rtx expand_vec_perm_const (machine_mode, rtx, rtx,
+ const vec_perm_builder &, machine_mode, rtx);
/* Generate code for vector comparison. */
extern rtx expand_vec_cmp_expr (tree, tree, rtx);
extern bool insn_operand_matches (enum insn_code icode, unsigned int opno,
rtx operand);
extern bool valid_multiword_target_p (rtx);
-extern void create_convert_operand_from_type (struct expand_operand *op,
+extern void create_convert_operand_from_type (class expand_operand *op,
rtx value, tree type);
extern bool maybe_legitimize_operands (enum insn_code icode,
unsigned int opno, unsigned int nops,
- struct expand_operand *ops);
+ class expand_operand *ops);
extern rtx_insn *maybe_gen_insn (enum insn_code icode, unsigned int nops,
- struct expand_operand *ops);
+ class expand_operand *ops);
extern bool maybe_expand_insn (enum insn_code icode, unsigned int nops,
- struct expand_operand *ops);
+ class expand_operand *ops);
extern bool maybe_expand_jump_insn (enum insn_code icode, unsigned int nops,
- struct expand_operand *ops);
+ class expand_operand *ops);
extern void expand_insn (enum insn_code icode, unsigned int nops,
- struct expand_operand *ops);
+ class expand_operand *ops);
extern void expand_jump_insn (enum insn_code icode, unsigned int nops,
- struct expand_operand *ops);
+ class expand_operand *ops);
extern enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp);