GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "diagnostic-core.h"
Enumerations | |
enum | fixed_value_range_code { FIXED_OK , FIXED_UNDERFLOW , FIXED_GT_MAX_EPS , FIXED_MAX_EPS } |
|
static |
Check REAL_VALUE against the range of the fixed-point mode. Return FIXED_OK, if it is within the range. FIXED_UNDERFLOW, if it is less than the minimum. FIXED_GT_MAX_EPS, if it is greater than the maximum, but not equal to the maximum plus the epsilon. FIXED_MAX_EPS, if it is equal to the maximum plus the epsilon.
References FIXED_GT_MAX_EPS, FIXED_MAX_EPS, FIXED_OK, FIXED_UNDERFLOW, GET_MODE_FBIT, GET_MODE_IBIT, real_2expN(), real_arithmetic(), real_compare(), real_from_string(), real_value_negate(), REAL_VALUE_TYPE, and SIGNED_FIXED_POINT_MODE_P.
Referenced by fixed_convert_from_real(), and fixed_from_string().
|
static |
Calculate F = A + (SUBTRACT_P ? -B : B). If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, b, double_int::ext(), get_fixed_sign_bit(), GET_MODE_FBIT, GET_MODE_IBIT, HOST_BITS_PER_DOUBLE_INT, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fixed_arithmetic().
|
static |
Calculate F = A / B. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, b, double_int::divmod(), double_int_zero, fixed_saturate1(), fixed_saturate2(), GET_MODE_FBIT, GET_MODE_IBIT, GET_MODE_PRECISION(), double_int::high, HOST_BITS_PER_DOUBLE_INT, HOST_BITS_PER_WIDE_INT, i, double_int::llshift(), double_int::low, double_int::lshift(), r, double_int::ucmp(), and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fixed_arithmetic().
|
static |
Calculate F = A * B. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, b, fixed_saturate1(), fixed_saturate2(), GET_MODE_FBIT, GET_MODE_IBIT, GET_MODE_PRECISION(), double_int::high, HOST_BITS_PER_DOUBLE_INT, HOST_BITS_PER_WIDE_INT, double_int::llshift(), double_int::low, r, double_int::ult(), and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fixed_arithmetic().
|
static |
Calculate F = -A. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, GET_MODE_FBIT, GET_MODE_IBIT, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fixed_arithmetic().
|
static |
Calculate F = A << B if LEFT_P. Otherwise, F = A >> B. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, b, double_int::ext(), fixed_saturate1(), fixed_saturate2(), GET_MODE_FBIT, GET_MODE_IBIT, GET_MODE_PRECISION(), double_int::high, HOST_BITS_PER_DOUBLE_INT, HOST_BITS_PER_WIDE_INT, double_int::llshift(), double_int::low, double_int::lshift(), and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fixed_arithmetic().
bool fixed_arithmetic | ( | FIXED_VALUE_TYPE * | f, |
int | icode, | ||
const FIXED_VALUE_TYPE * | op0, | ||
const FIXED_VALUE_TYPE * | op1, | ||
bool | sat_p ) |
Perform the binary or unary operation described by CODE. Note that OP0 and OP1 must have the same mode for binary operators. For a unary operation, leave OP1 NULL. Return true, if !SAT_P and overflow.
References do_fixed_add(), do_fixed_divide(), do_fixed_multiply(), do_fixed_neg(), do_fixed_shift(), gcc_assert, and gcc_unreachable.
Referenced by const_binop(), and fold_negate_const().
bool fixed_compare | ( | int | icode, |
const FIXED_VALUE_TYPE * | op0, | ||
const FIXED_VALUE_TYPE * | op1 ) |
Compare fixed-point values by tree_code. Note that OP0 and OP1 must have the same mode.
References gcc_assert, gcc_unreachable, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fold_relational_const().
bool fixed_convert | ( | FIXED_VALUE_TYPE * | f, |
scalar_mode | mode, | ||
const FIXED_VALUE_TYPE * | a, | ||
bool | sat_p ) |
Extend or truncate to a new mode. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, fixed_saturate1(), fixed_saturate2(), GET_MODE_FBIT, GET_MODE_IBIT, double_int::high, HOST_BITS_PER_DOUBLE_INT, double_int::llshift(), double_int::lshift(), double_int::sext(), SIGNED_FIXED_POINT_MODE_P, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fold_convert_const_fixed_from_fixed().
bool fixed_convert_from_int | ( | FIXED_VALUE_TYPE * | f, |
scalar_mode | mode, | ||
double_int | a, | ||
bool | unsigned_p, | ||
bool | sat_p ) |
Convert to a new fixed-point mode from an integer. If UNSIGNED_P, this integer is unsigned. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, fixed_saturate2(), GET_MODE_FBIT, GET_MODE_IBIT, double_int::high, HOST_BITS_PER_DOUBLE_INT, double_int::llshift(), double_int::low, double_int::sext(), SIGNED_FIXED_POINT_MODE_P, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fold_convert_const_fixed_from_int().
bool fixed_convert_from_real | ( | FIXED_VALUE_TYPE * | f, |
scalar_mode | mode, | ||
const REAL_VALUE_TYPE * | a, | ||
bool | sat_p ) |
Convert to a new fixed-point mode from a real. If SAT_P, saturate the result to the max or the min. Return true, if !SAT_P and overflow.
References a, check_real_for_fixed_mode(), generic_wide_int< storage >::elt(), FIXED_GT_MAX_EPS, FIXED_MAX_EPS, FIXED_UNDERFLOW, GET_MODE_FBIT, GET_MODE_IBIT, GET_MODE_PRECISION(), HOST_BITS_PER_DOUBLE_INT, real_2expN(), real_arithmetic(), real_to_integer(), REAL_VALUE_TYPE, generic_wide_int< storage >::ulow(), and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fold_convert_const_fixed_from_real().
FIXED_VALUE_TYPE fixed_from_double_int | ( | double_int | payload, |
scalar_mode | mode ) |
Construct a CONST_FIXED from a bit payload and machine mode MODE. The bits in PAYLOAD are sign-extended/zero-extended according to MODE.
References FIXED_VALUE_TYPE, gcc_assert, gcc_unreachable, GET_MODE_BITSIZE(), GET_MODE_FBIT, GET_MODE_IBIT, HOST_BITS_PER_DOUBLE_INT, double_int::sext(), SIGNED_SCALAR_FIXED_POINT_MODE_P, UNSIGNED_SCALAR_FIXED_POINT_MODE_P, and double_int::zext().
Referenced by build_minus_one_cst(), and native_interpret_fixed().
void fixed_from_string | ( | FIXED_VALUE_TYPE * | f, |
const char * | str, | ||
scalar_mode | mode ) |
Initialize from a decimal or hexadecimal string.
References ALL_ACCUM_MODE_P, ALL_FRACT_MODE_P, check_real_for_fixed_mode(), generic_wide_int< storage >::elt(), FIXED_GT_MAX_EPS, FIXED_MAX_EPS, FIXED_UNDERFLOW, GET_MODE_FBIT, GET_MODE_IBIT, GET_MODE_PRECISION(), fixed_value::mode, real_2expN(), real_arithmetic(), real_from_string(), real_to_integer(), REAL_VALUE_TYPE, SIGNED_FIXED_POINT_MODE_P, generic_wide_int< storage >::ulow(), UNSIGNED_FIXED_POINT_MODE_P, and warning().
unsigned int fixed_hash | ( | const FIXED_VALUE_TYPE * | f | ) |
Calculate a hash value.
Referenced by const_hash_1(), const_rtx_hash_1(), cselib_hash_rtx(), const_fixed_hasher::hash(), operand_compare::hash_operand(), and hash_rtx().
bool fixed_identical | ( | const FIXED_VALUE_TYPE * | a, |
const FIXED_VALUE_TYPE * | b ) |
Fixed-point arithmetic support. Copyright (C) 2006-2024 Free Software Foundation, Inc. This file is part of GCC. GCC 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; either version 3, or (at your option) any later version. GCC 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Compare two fixed objects for bitwise identity.
Referenced by const_fixed_hasher::equal().
bool fixed_isneg | ( | const FIXED_VALUE_TYPE * | f | ) |
Determine whether a fixed-point value F is negative.
References get_fixed_sign_bit(), GET_MODE_FBIT, GET_MODE_IBIT, and SIGNED_FIXED_POINT_MODE_P.
|
static |
If SAT_P, saturate A to the maximum or the minimum, and save to *F based on the machine mode MODE. Do not modify *F otherwise. This function assumes the width of double_int is greater than the width of the fixed-point value (the sum of a possible sign bit, possible ibits, and fbits). Return true, if !SAT_P and overflow.
References a, GET_MODE_FBIT, GET_MODE_IBIT, HOST_BITS_PER_DOUBLE_INT, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by do_fixed_divide(), do_fixed_multiply(), do_fixed_shift(), and fixed_convert().
|
static |
If SAT_P, saturate {A_HIGH, A_LOW} to the maximum or the minimum, and save to *F based on the machine mode MODE. Do not modify *F otherwise. This function assumes the width of two double_int is greater than the width of the fixed-point value (the sum of a possible sign bit, possible ibits, and fbits). Return true, if !SAT_P and overflow.
References double_int::alshift(), GET_MODE_FBIT, GET_MODE_IBIT, double_int::high, HOST_BITS_PER_DOUBLE_INT, double_int::low, double_int::sext(), double_int::sgt(), double_int::slt(), double_int::ugt(), double_int::ult(), UNSIGNED_FIXED_POINT_MODE_P, and double_int::zext().
Referenced by do_fixed_divide(), do_fixed_multiply(), do_fixed_shift(), fixed_convert(), and fixed_convert_from_int().
void fixed_to_decimal | ( | char * | str, |
const FIXED_VALUE_TYPE * | f_orig, | ||
size_t | buf_size ) |
Render F as a decimal floating point constant.
References wide_int_storage::from(), GET_MODE_FBIT, GET_MODE_PRECISION(), real_2expN(), real_arithmetic(), real_from_integer(), real_to_decimal(), REAL_VALUE_TYPE, SIGNED, UNSIGNED, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by dump_fixed(), dump_generic_node(), print_node(), print_node_brief(), and print_value().
|
inlinestatic |
Return the sign bit based on I_F_BITS.
References a, and HOST_BITS_PER_WIDE_INT.
Referenced by do_fixed_add(), and fixed_isneg().
void real_convert_from_fixed | ( | REAL_VALUE_TYPE * | r, |
scalar_mode | mode, | ||
const FIXED_VALUE_TYPE * | f ) |
Convert to a new real mode from a fixed-point.
References wide_int_storage::from(), GET_MODE_FBIT, GET_MODE_PRECISION(), r, real_2expN(), real_arithmetic(), real_convert(), real_from_integer(), REAL_VALUE_TYPE, SIGNED, UNSIGNED, and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by fold_convert_const_real_from_fixed().