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)   fconst0[mode - QQmode]
 
#define FCONST1(mode)   fconst1[mode - HAmode]
 
#define CONST_FIXED_FROM_FIXED_VALUE(r, m)    const_fixed_from_fixed_value (r, m)
 
#define FIXED_VALUES_IDENTICAL(x, y)   fixed_identical (&(x), &(y))
 
#define FIXED_VALUE_NEGATIVE(x)   fixed_isneg (&(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 )    const_fixed_from_fixed_value (r, m)
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)    fconst0[mode - QQmode]
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)    fconst1[mode - HAmode]

◆ FIXED_VALUE_NEGATIVE

#define FIXED_VALUE_NEGATIVE ( x)    fixed_isneg (&(x))
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 )   fixed_identical (&(x), &(y))

◆ 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 ggc_alloc(), lookup_const_fixed(), PUT_MODE(), and rtx_alloc().

◆ 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, gcc_unreachable, and ggc_alloc().

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, ggc_alloc(), 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, ggc_alloc(), double_int::high, HOST_BITS_PER_DOUBLE_INT, double_int::lshift(), 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, ggc_alloc(), HOST_BITS_PER_DOUBLE_INT, 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(), FIXED_GT_MAX_EPS, FIXED_MAX_EPS, FIXED_UNDERFLOW, GET_MODE_FBIT, GET_MODE_IBIT, GET_MODE_PRECISION(), ggc_alloc(), HOST_BITS_PER_DOUBLE_INT, real_2expN(), real_arithmetic(), real_to_integer(), REAL_VALUE_TYPE, 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, ggc_alloc(), HOST_BITS_PER_DOUBLE_INT, SIGNED_SCALAR_FIXED_POINT_MODE_P, and UNSIGNED_SCALAR_FIXED_POINT_MODE_P.

Referenced by build_minus_one_cst(), and native_interpret_fixed().

◆ fixed_from_string()

◆ fixed_hash()

◆ 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, ggc_alloc(), and SIGNED_FIXED_POINT_MODE_P.

◆ fixed_to_decimal()

◆ real_convert_from_fixed()

void real_convert_from_fixed ( REAL_VALUE_TYPE * r,
scalar_mode mode,
const FIXED_VALUE_TYPE * f )
extern

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