bid_gcc_intrinsics.h revision 1.1
1/* Copyright (C) 2007, 2009 Free Software Foundation, Inc. 2 3This file is part of GCC. 4 5GCC is free software; you can redistribute it and/or modify it under 6the terms of the GNU General Public License as published by the Free 7Software Foundation; either version 3, or (at your option) any later 8version. 9 10GCC is distributed in the hope that it will be useful, but WITHOUT ANY 11WARRANTY; without even the implied warranty of MERCHANTABILITY or 12FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13for more details. 14 15Under Section 7 of GPL version 3, you are granted additional 16permissions described in the GCC Runtime Library Exception, version 173.1, as published by the Free Software Foundation. 18 19You should have received a copy of the GNU General Public License and 20a copy of the GCC Runtime Library Exception along with this program; 21see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22<http://www.gnu.org/licenses/>. */ 23 24#ifndef _BID_GCC_INTRINSICS_H 25#define _BID_GCC_INTRINSICS_H 26 27#ifdef IN_LIBGCC2 28 29#include "tconfig.h" 30#include "coretypes.h" 31#include "tm.h" 32 33#ifndef LIBGCC2_WORDS_BIG_ENDIAN 34#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN 35#endif 36 37#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN 38#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN LIBGCC2_WORDS_BIG_ENDIAN 39#endif 40 41#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE 42#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE 43#endif 44 45#ifndef LIBGCC2_HAS_XF_MODE 46#define LIBGCC2_HAS_XF_MODE \ 47 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80) 48#endif 49 50#ifndef LIBGCC2_HAS_TF_MODE 51#define LIBGCC2_HAS_TF_MODE \ 52 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128) 53#endif 54 55#ifndef BID_HAS_XF_MODE 56#define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE 57#endif 58 59#ifndef BID_HAS_TF_MODE 60#define BID_HAS_TF_MODE LIBGCC2_HAS_TF_MODE 61#endif 62 63/* Some handy typedefs. */ 64 65typedef float SFtype __attribute__ ((mode (SF))); 66typedef float DFtype __attribute__ ((mode (DF))); 67#if LIBGCC2_HAS_XF_MODE 68typedef float XFtype __attribute__ ((mode (XF))); 69#endif /* LIBGCC2_HAS_XF_MODE */ 70#if LIBGCC2_HAS_TF_MODE 71typedef float TFtype __attribute__ ((mode (TF))); 72#endif /* LIBGCC2_HAS_XF_MODE */ 73 74typedef int SItype __attribute__ ((mode (SI))); 75typedef int DItype __attribute__ ((mode (DI))); 76typedef unsigned int USItype __attribute__ ((mode (SI))); 77typedef unsigned int UDItype __attribute__ ((mode (DI))); 78 79/* The type of the result of a decimal float comparison. This must 80 match `word_mode' in GCC for the target. */ 81 82typedef int CMPtype __attribute__ ((mode (word))); 83 84typedef int SINT8 __attribute__ ((mode (QI))); 85typedef unsigned int UINT8 __attribute__ ((mode (QI))); 86typedef USItype UINT32; 87typedef SItype SINT32; 88typedef UDItype UINT64; 89typedef DItype SINT64; 90 91/* It has to be identical to the one defined in bid_functions.h. */ 92typedef __attribute__ ((aligned(16))) struct 93{ 94 UINT64 w[2]; 95} UINT128; 96#else /* if not IN_LIBGCC2 */ 97 98#ifndef BID_HAS_XF_MODE 99#define BID_HAS_XF_MODE 1 100#endif 101 102#ifndef BID_HAS_TF_MODE 103#if defined __i386__ 104#define BID_HAS_TF_MODE 0 105#else 106#define BID_HAS_TF_MODE 1 107#endif 108#endif 109 110#ifndef SFtype 111#define SFtype float 112#endif 113 114#ifndef DFtype 115#define DFtype double 116#endif 117 118#if BID_HAS_XF_MODE 119#ifndef XFtype 120#define XFtype long double 121#endif 122 123#endif /* IN_LIBGCC2 */ 124 125#if BID_HAS_TF_MODE 126#ifndef TFtype 127#define TFtype __float128 128#endif 129#endif 130 131#ifndef SItype 132#define SItype SINT32 133#endif 134 135#ifndef DItype 136#define DItype SINT64 137#endif 138 139#ifndef USItype 140#define USItype UINT32 141#endif 142 143#ifndef UDItype 144#define UDItype UINT64 145#endif 146 147#ifndef CMPtype 148#define CMPtype long 149#endif 150#endif /* IN_LIBGCC2 */ 151 152#if BID_HAS_GCC_DECIMAL_INTRINSICS 153/* Prototypes for gcc instrinsics */ 154 155extern _Decimal64 __bid_adddd3 (_Decimal64, _Decimal64); 156extern _Decimal64 __bid_subdd3 (_Decimal64, _Decimal64); 157extern _Decimal32 __bid_addsd3 (_Decimal32, _Decimal32); 158extern _Decimal32 __bid_subsd3 (_Decimal32, _Decimal32); 159extern _Decimal128 __bid_addtd3 (_Decimal128, _Decimal128); 160extern _Decimal128 __bid_subtd3 (_Decimal128, _Decimal128); 161extern DFtype __bid_truncdddf (_Decimal64); 162extern DItype __bid_fixdddi (_Decimal64); 163extern _Decimal32 __bid_truncddsd2 (_Decimal64); 164extern SFtype __bid_truncddsf (_Decimal64); 165extern SItype __bid_fixddsi (_Decimal64); 166extern _Decimal128 __bid_extendddtd2 (_Decimal64); 167#if BID_HAS_TF_MODE 168extern TFtype __bid_extendddtf (_Decimal64); 169#endif 170extern UDItype __bid_fixunsdddi (_Decimal64); 171extern USItype __bid_fixunsddsi (_Decimal64); 172#if BID_HAS_XF_MODE 173extern XFtype __bid_extendddxf (_Decimal64); 174#endif 175extern _Decimal64 __bid_extenddfdd (DFtype); 176extern _Decimal32 __bid_truncdfsd (DFtype); 177extern _Decimal128 __bid_extenddftd (DFtype); 178extern _Decimal64 __bid_floatdidd (DItype); 179extern _Decimal32 __bid_floatdisd (DItype); 180extern _Decimal128 __bid_floatditd (DItype); 181extern _Decimal64 __bid_divdd3 (_Decimal64, _Decimal64); 182extern _Decimal32 __bid_divsd3 (_Decimal32, _Decimal32); 183extern _Decimal128 __bid_divtd3 (_Decimal128, _Decimal128); 184extern CMPtype __bid_eqdd2 (_Decimal64, _Decimal64); 185extern CMPtype __bid_eqsd2 (_Decimal32, _Decimal32); 186extern CMPtype __bid_eqtd2 (_Decimal128, _Decimal128); 187extern CMPtype __bid_gedd2 (_Decimal64, _Decimal64); 188extern CMPtype __bid_gesd2 (_Decimal32, _Decimal32); 189extern CMPtype __bid_getd2 (_Decimal128, _Decimal128); 190extern CMPtype __bid_gtdd2 (_Decimal64, _Decimal64); 191extern CMPtype __bid_gtsd2 (_Decimal32, _Decimal32); 192extern CMPtype __bid_gttd2 (_Decimal128, _Decimal128); 193extern CMPtype __bid_ledd2 (_Decimal64, _Decimal64); 194extern CMPtype __bid_lesd2 (_Decimal32, _Decimal32); 195extern CMPtype __bid_letd2 (_Decimal128, _Decimal128); 196extern CMPtype __bid_ltdd2 (_Decimal64, _Decimal64); 197extern CMPtype __bid_ltsd2 (_Decimal32, _Decimal32); 198extern CMPtype __bid_lttd2 (_Decimal128, _Decimal128); 199extern CMPtype __bid_nedd2 (_Decimal64, _Decimal64); 200extern CMPtype __bid_nesd2 (_Decimal32, _Decimal32); 201extern CMPtype __bid_netd2 (_Decimal128, _Decimal128); 202extern CMPtype __bid_unorddd2 (_Decimal64, _Decimal64); 203extern CMPtype __bid_unordsd2 (_Decimal32, _Decimal32); 204extern CMPtype __bid_unordtd2 (_Decimal128, _Decimal128); 205extern _Decimal64 __bid_muldd3 (_Decimal64, _Decimal64); 206extern _Decimal32 __bid_mulsd3 (_Decimal32, _Decimal32); 207extern _Decimal128 __bid_multd3 (_Decimal128, _Decimal128); 208extern _Decimal64 __bid_extendsddd2 (_Decimal32); 209extern DFtype __bid_extendsddf (_Decimal32); 210extern DItype __bid_fixsddi (_Decimal32); 211extern SFtype __bid_truncsdsf (_Decimal32); 212extern SItype __bid_fixsdsi (_Decimal32); 213extern _Decimal128 __bid_extendsdtd2 (_Decimal32); 214#if BID_HAS_TF_MODE 215extern TFtype __bid_extendsdtf (_Decimal32); 216#endif 217extern UDItype __bid_fixunssddi (_Decimal32); 218extern USItype __bid_fixunssdsi (_Decimal32); 219#if BID_HAS_XF_MODE 220extern XFtype __bid_extendsdxf (_Decimal32); 221#endif 222extern _Decimal64 __bid_extendsfdd (SFtype); 223extern _Decimal32 __bid_extendsfsd (SFtype); 224extern _Decimal128 __bid_extendsftd (SFtype); 225extern _Decimal64 __bid_floatsidd (SItype); 226extern _Decimal32 __bid_floatsisd (SItype); 227extern _Decimal128 __bid_floatsitd (SItype); 228extern _Decimal64 __bid_trunctddd2 (_Decimal128); 229extern DFtype __bid_trunctddf (_Decimal128); 230extern DItype __bid_fixtddi (_Decimal128); 231extern _Decimal32 __bid_trunctdsd2 (_Decimal128); 232extern SFtype __bid_trunctdsf (_Decimal128); 233extern SItype __bid_fixtdsi (_Decimal128); 234#if BID_HAS_TF_MODE 235extern TFtype __bid_trunctdtf (_Decimal128); 236#endif 237extern UDItype __bid_fixunstddi (_Decimal128); 238extern USItype __bid_fixunstdsi (_Decimal128); 239#if BID_HAS_XF_MODE 240extern XFtype __bid_trunctdxf (_Decimal128); 241#endif 242#if BID_HAS_TF_MODE 243extern _Decimal64 __bid_trunctfdd (TFtype); 244extern _Decimal32 __bid_trunctfsd (TFtype); 245extern _Decimal128 __bid_extendtftd (TFtype); 246#endif 247extern _Decimal64 __bid_floatunsdidd (UDItype); 248extern _Decimal32 __bid_floatunsdisd (UDItype); 249extern _Decimal128 __bid_floatunsditd (UDItype); 250extern _Decimal64 __bid_floatunssidd (USItype); 251extern _Decimal32 __bid_floatunssisd (USItype); 252extern _Decimal128 __bid_floatunssitd (USItype); 253#if BID_HAS_XF_MODE 254extern _Decimal64 __bid_truncxfdd (XFtype); 255extern _Decimal32 __bid_truncxfsd (XFtype); 256extern _Decimal128 __bid_extendxftd (XFtype); 257#endif 258extern int isinfd32 (_Decimal32); 259extern int isinfd64 (_Decimal64); 260extern int isinfd128 (_Decimal128); 261#endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */ 262 263extern void __dfp_set_round (int); 264extern int __dfp_get_round (void); 265extern void __dfp_clear_except (void); 266extern int __dfp_test_except (int); 267extern void __dfp_raise_except (int); 268 269#if BID_HAS_GCC_DECIMAL_INTRINSICS 270/* Used by gcc intrinsics. We have to define them after UINT128 271 is defined. */ 272union decimal32 { 273 _Decimal32 d; 274 UINT32 i; 275}; 276 277union decimal64 { 278 _Decimal64 d; 279 UINT64 i; 280}; 281 282union decimal128 { 283 _Decimal128 d; 284 UINT128 i; 285}; 286 287#if BID_HAS_TF_MODE 288union float128 { 289 TFtype f; 290 UINT128 i; 291}; 292#endif 293#endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */ 294 295#endif /* _BID_GCC_INTRINSICS_H */ 296