GCC Middle and Back End API Reference
fixed-value.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fixed_value
 

Macros

#define FIXED_VALUE_TYPE   struct fixed_value
 
#define MAX_FCONST0
 
#define MAX_FCONST1
 
#define FCONST0(mode)
 
#define FCONST1(mode)
 
#define CONST_FIXED_FROM_FIXED_VALUE(r, m)
 
#define FIXED_VALUES_IDENTICAL(x, y)
 
#define FIXED_VALUE_NEGATIVE(x)
 

Functions

rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, machine_mode)
 
FIXED_VALUE_TYPE fixed_from_double_int (double_int, scalar_mode)
 
rtx const_fixed_from_double_int (double_int payload, scalar_mode mode)
 
void fixed_from_string (FIXED_VALUE_TYPE *, const char *, scalar_mode)
 
tree build_fixed (tree, FIXED_VALUE_TYPE)
 
bool fixed_convert (FIXED_VALUE_TYPE *, scalar_mode, const FIXED_VALUE_TYPE *, bool)
 
bool fixed_convert_from_int (FIXED_VALUE_TYPE *, scalar_mode, double_int, bool, bool)
 
bool fixed_convert_from_real (FIXED_VALUE_TYPE *, scalar_mode, const REAL_VALUE_TYPE *, bool)
 
void real_convert_from_fixed (REAL_VALUE_TYPE *, scalar_mode, const FIXED_VALUE_TYPE *)
 
bool fixed_identical (const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *)
 
unsigned int fixed_hash (const FIXED_VALUE_TYPE *)
 
void fixed_to_decimal (char *str, const FIXED_VALUE_TYPE *, size_t)
 
bool fixed_arithmetic (FIXED_VALUE_TYPE *, int, const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *, bool)
 
bool fixed_compare (int, const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *)
 
bool fixed_isneg (const FIXED_VALUE_TYPE *)
 

Variables

FIXED_VALUE_TYPE fconst0 [MAX_FCONST0]
 
FIXED_VALUE_TYPE fconst1 [MAX_FCONST1]
 

Macro Definition Documentation

◆ CONST_FIXED_FROM_FIXED_VALUE

#define CONST_FIXED_FROM_FIXED_VALUE ( r,
m )
Value:
rtx const_fixed_from_fixed_value(FIXED_VALUE_TYPE, machine_mode)
Definition emit-rtl.cc:601
poly_int< N, C > r
Definition poly-int.h:774
Return a CONST_FIXED with value R and mode M.   

Referenced by const_vector_from_tree(), expand_expr_real_1(), init_emit_once(), and native_decode_rtx().

◆ FCONST0

#define FCONST0 ( mode)
Value:
fconst0[mode - QQmode]
FIXED_VALUE_TYPE fconst0[MAX_FCONST0]
Definition emit-rtl.cc:116
Macros to access fconst0 and fconst1 via machine modes.   

Referenced by build_zero_cst(), convert_to_fixed(), and init_emit_once().

◆ FCONST1

#define FCONST1 ( mode)
Value:
fconst1[mode - HAmode]
FIXED_VALUE_TYPE fconst1[MAX_FCONST1]
Definition emit-rtl.cc:117

Referenced by build_one_cst(), convert_to_fixed(), and init_emit_once().

◆ FIXED_VALUE_NEGATIVE

#define FIXED_VALUE_NEGATIVE ( x)
Value:
bool fixed_isneg(const FIXED_VALUE_TYPE *)
Definition fixed-value.cc:1109
Determine whether a fixed-point value X is negative.   

Referenced by tree_single_nonnegative_warnv_p().

◆ FIXED_VALUE_TYPE

◆ FIXED_VALUES_IDENTICAL

#define FIXED_VALUES_IDENTICAL ( x,
y )
Value:
fixed_identical (&(x), &(y))
bool fixed_identical(const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *)
Definition fixed-value.cc:30
const T2 & y
Definition wide-int.h:3870

Referenced by compare_constant(), ipa_icf::sem_variable::equals(), operand_compare::operand_equal_p(), and simple_cst_equal().

◆ MAX_FCONST0

#define MAX_FCONST0
Value:
18 /* For storing 18 fixed-point zeros per
fract, ufract, accum, and uaccum modes . @endverbatim */

◆ MAX_FCONST1

#define MAX_FCONST1
Value:
8 /* For storing 8 fixed-point ones per accum
and uaccum modes. @endverbatim */

Function Documentation

◆ build_fixed()

◆ const_fixed_from_double_int()

rtx const_fixed_from_double_int ( double_int payload,
scalar_mode mode )
inline
Return a CONST_FIXED from a bit payload and machine mode MODE.
The bits in PAYLOAD are sign-extended/zero-extended according to MODE.   

◆ const_fixed_from_fixed_value()

rtx const_fixed_from_fixed_value ( FIXED_VALUE_TYPE value,
machine_mode mode )
extern
Return a CONST_FIXED rtx for a fixed-point value specified by
VALUE in mode MODE.   

References rtx_def::u::fv, lookup_const_fixed(), PUT_MODE(), rtx_alloc(), and rtx_def::u.

◆ fixed_arithmetic()

bool fixed_arithmetic ( FIXED_VALUE_TYPE * f,
int icode,
const FIXED_VALUE_TYPE * op0,
const FIXED_VALUE_TYPE * op1,
bool sat_p )
extern
Binary or unary arithmetic on tree_code.   
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().

◆ fixed_compare()

bool fixed_compare ( int icode,
const FIXED_VALUE_TYPE * op0,
const FIXED_VALUE_TYPE * op1 )
extern
Compare fixed-point values by tree_code.   
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().

◆ fixed_convert()

bool fixed_convert ( FIXED_VALUE_TYPE * f,
scalar_mode mode,
const FIXED_VALUE_TYPE * a,
bool sat_p )
extern
Extend or truncate to a new mode.   
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().

◆ fixed_convert_from_int()

bool fixed_convert_from_int ( FIXED_VALUE_TYPE * f,
scalar_mode mode,
double_int a,
bool unsigned_p,
bool sat_p )
extern
Convert to a fixed-point mode from an integer.   
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().

◆ fixed_convert_from_real()

bool fixed_convert_from_real ( FIXED_VALUE_TYPE * f,
scalar_mode mode,
const REAL_VALUE_TYPE * a,
bool sat_p )
extern
Convert to a fixed-point mode from a real.   
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_from_double_int()

FIXED_VALUE_TYPE fixed_from_double_int ( double_int payload,
scalar_mode mode )
extern
Construct a FIXED_VALUE from a bit payload and machine mode MODE.
The bits in PAYLOAD are sign-extended/zero-extended according to 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().

◆ fixed_from_string()

◆ fixed_hash()

unsigned int fixed_hash ( const FIXED_VALUE_TYPE * f)
extern

◆ fixed_identical()

bool fixed_identical ( const FIXED_VALUE_TYPE * a,
const FIXED_VALUE_TYPE * b )
extern
Compare two fixed-point objects for bitwise identity.   
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.   

References a, and b.

Referenced by const_fixed_hasher::equal().

◆ fixed_isneg()

bool fixed_isneg ( const FIXED_VALUE_TYPE * f)
extern
Determine whether a fixed-point value X is negative.   
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.

◆ fixed_to_decimal()

void fixed_to_decimal ( char * str,
const FIXED_VALUE_TYPE * f_orig,
size_t buf_size )
extern

◆ real_convert_from_fixed()

void real_convert_from_fixed ( REAL_VALUE_TYPE * r,
scalar_mode mode,
const FIXED_VALUE_TYPE * f )
extern
Convert to a real mode from a fixed-point.   
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().

Variable Documentation

◆ fconst0

FIXED_VALUE_TYPE fconst0[MAX_FCONST0]
extern
Constant fixed-point values 0 and 1.   
Record fixed-point constant 0 and 1.   

◆ fconst1

FIXED_VALUE_TYPE fconst1[MAX_FCONST1]
extern