GCC Middle and Back End API Reference
fixed-value.h File Reference
#include "machmode.h"
#include "real.h"
#include "double-int.h"
Include dependency graph for fixed-value.h:
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, enum machine_mode)
FIXED_VALUE_TYPE fixed_from_double_int (double_int, enum machine_mode)
static rtx const_fixed_from_double_int (double_int payload, enum machine_mode mode)
void fixed_from_string (FIXED_VALUE_TYPE *, const char *, enum machine_mode)
tree build_fixed (tree, FIXED_VALUE_TYPE)
bool fixed_convert (FIXED_VALUE_TYPE *, enum machine_mode, const FIXED_VALUE_TYPE *, bool)
bool fixed_convert_from_int (FIXED_VALUE_TYPE *, enum machine_mode, double_int, bool, bool)
bool fixed_convert_from_real (FIXED_VALUE_TYPE *, enum machine_mode, const REAL_VALUE_TYPE *, bool)
void real_convert_from_fixed (REAL_VALUE_TYPE *, enum machine_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

#define CONST_FIXED_FROM_FIXED_VALUE (   r,
 
)    const_fixed_from_fixed_value (r, m)

Return a CONST_FIXED with value R and mode M.

#define FCONST0 (   mode)    fconst0[mode - QQmode]

Macros to access fconst0 and fconst1 via machine modes.

Referenced by build_one_cst().

#define FCONST1 (   mode)    fconst1[mode - HAmode]
#define FIXED_VALUE_NEGATIVE (   x)    fixed_isneg (&(x))

Determine whether a fixed-point value X is negative.

#define FIXED_VALUES_IDENTICAL (   x,
 
)    fixed_identical (&(x), &(y))

Referenced by decode_addr_const().

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

Function Documentation

tree build_fixed ( tree  ,
FIXED_VALUE_TYPE   
)

In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node.

Referenced by build_one_cst(), build_string(), fold_convert_const_int_from_fixed(), and tree_unary_nonnegative_warnv_p().

static rtx const_fixed_from_double_int ( double_int  payload,
enum machine_mode  mode 
)
inlinestatic

Return a CONST_FIXED from a bit payload and machine mode MODE. The bits in PAYLOAD are sign-extended/zero-extended according to MODE.

rtx const_fixed_from_fixed_value ( FIXED_VALUE_TYPE  ,
enum  machine_mode 
)
bool fixed_arithmetic ( FIXED_VALUE_TYPE f,
int  icode,
const FIXED_VALUE_TYPE op0,
const FIXED_VALUE_TYPE op1,
bool  sat_p 
)

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.

Referenced by tree_unary_nonnegative_warnv_p().

bool fixed_compare ( int  icode,
const FIXED_VALUE_TYPE op0,
const FIXED_VALUE_TYPE op1 
)

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 fixed_saturate2(), GET_MODE_FBIT, double_int::llshift(), double_int::lshift(), double_int::sext(), and SIGNED_FIXED_POINT_MODE_P.

bool fixed_convert ( FIXED_VALUE_TYPE f,
enum machine_mode  mode,
const FIXED_VALUE_TYPE a,
bool  sat_p 
)

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.

     Left shift a to temp_high, temp_low based on a->mode.   
     Logical shift right to temp_high.   
         Take care of the cases when converting between signed and
         unsigned.   
             Signed -> Unsigned.   
             Unsigned -> Signed.   
                     Set to maximum.   
                                               Clear the sign.   
     Right shift a to temp based on a->mode.   
         Take care of the cases when converting between signed and
         unsigned.   
             Signed -> Unsigned.   
             Unsigned -> Signed.   
                     Set to maximum.   
                                               Clear the sign.   

Referenced by fold_convert_const_int_from_fixed().

bool fixed_convert_from_int ( FIXED_VALUE_TYPE f,
enum machine_mode  mode,
double_int  a,
bool  unsigned_p,
bool  sat_p 
)

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.

 Left shift a to temp_high, temp_low.   
     Logical shift right to temp_high.   
     Take care of the cases when converting between signed and unsigned.   
         Signed -> Unsigned.   
         Unsigned -> Signed.   
                 Set to maximum.   
                                           Clear the sign.   

References GET_MODE_FBIT, and GET_MODE_IBIT.

bool fixed_convert_from_real ( FIXED_VALUE_TYPE f,
enum machine_mode  mode,
const REAL_VALUE_TYPE a,
bool  sat_p 
)

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.

FIXED_VALUE_TYPE fixed_from_double_int ( double_int  ,
enum  machine_mode 
)

Construct a FIXED_VALUE from a bit payload and machine mode MODE. The bits in PAYLOAD are sign-extended/zero-extended according to MODE.

void fixed_from_string ( FIXED_VALUE_TYPE ,
const char *  ,
enum  machine_mode 
)

Initialize from a decimal or hexadecimal string.

unsigned int fixed_hash ( const FIXED_VALUE_TYPE )

Calculate a hash value.

bool fixed_identical ( const FIXED_VALUE_TYPE ,
const FIXED_VALUE_TYPE  
)

Compare two fixed-point objects for bitwise identity.

bool fixed_isneg ( const FIXED_VALUE_TYPE )

Determine whether a fixed-point value X is negative.

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

Render F as a decimal floating point constant.

Referenced by dump_int(), and print_value().

void real_convert_from_fixed ( REAL_VALUE_TYPE r,
enum machine_mode  mode,
const FIXED_VALUE_TYPE f 
)

Convert to a real mode from a fixed-point.

Convert to a new real mode from a fixed-point.


Variable Documentation

Constant fixed-point values 0 and 1.

Record fixed-point constant 0 and 1.