Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 /* USMID @(#)5.0_pl/headers/fmath.h 5.1 04/29/99 21:22:31 */ 00037 /* The following values are used by the F90 compiler for a set of environment 00038 * intrinsics. Some of the values are also used by the libf/intrin library 00039 * to return a value for some of the array intrinsics: DIGITS, EPSILON, HUGE, 00040 * MAXEXPONENT, MINEXPONENT, PRECISION, RADIX, RANGE, TINY. 00041 * 00042 * The F90 compiler needs a complete set of each IEEE and non-IEEE values. 00043 * Please keep the complete set of values for YMP and for IEEE. 00044 * YMP/C90/etc: 00045 * Integer*1 = 2147483647 signed 00046 * Integer*2 = 2147483647 signed 00047 * Integer*4 = 2147483647 signed 00048 * Integer*8 = 9223372036854775807 signed 00049 * IEEE: 00050 * Integer*1 = 2147483647 signed 00051 * Integer*2 = 2147483647 signed 00052 * Integer*4 = 2147483647 signed 00053 * Integer*8 = 9223372036854775807 signed 00054 */ 00055 /* BIT_SIZE returns the number of bits s for an integer of kind n. 00056 * An integer object consists of s bits in sequence numbered from right to 00057 * left from zero to s-1 . 00058 */ 00059 /* YMP: */ 00060 #define BITSIZE_INT1_F90_Y 8 00061 #define BITSIZE_INT2_F90_Y 16 00062 #define BITSIZE_INT4_F90_Y 32 00063 #define BITSIZE_INT8_F90_Y 64 00064 /* IEEE: */ 00065 #define BITSIZE_INT1_F90_IEEE 8 00066 #define BITSIZE_INT2_F90_IEEE 16 00067 #define BITSIZE_INT4_F90_IEEE 32 00068 #define BITSIZE_INT8_F90_IEEE 64 00069 00070 #define BITSIZE_INT1_F90 (target_ieee ? \ 00071 BITSIZE_INT1_F90_IEEE : BITSIZE_INT1_F90_Y) 00072 #define BITSIZE_INT2_F90 (target_ieee ? \ 00073 BITSIZE_INT2_F90_IEEE : BITSIZE_INT2_F90_Y) 00074 #define BITSIZE_INT4_F90 (target_ieee ? \ 00075 BITSIZE_INT4_F90_IEEE : BITSIZE_INT4_F90_Y) 00076 #define BITSIZE_INT8_F90 (target_ieee ? \ 00077 BITSIZE_INT8_F90_IEEE : BITSIZE_INT8_F90_Y) 00078 00079 /* DIGITS for integer, real, and double precision is number of significant 00080 * digits in bits in the model. 00081 */ 00082 /* YMP: */ 00083 #define DIGITS_INT1_F90_Y 7 /* Integer (KIND=1) */ 00084 #define DIGITS_INT2_F90_Y 15 /* Integer (KIND=2) */ 00085 #define DIGITS_INT4_F90_Y 31 /* Integer (KIND=4) */ 00086 #define DIGITS_INT8_F90_Y 63 /* Integer (KIND=8) */ 00087 #define DIGITS_REAL4_F90_Y 24 /* Real (KIND=4) */ 00088 #define DIGITS_REAL8_F90_Y 47 /* Real (KIND=8) */ 00089 #define DIGITS_REAL16_F90_Y 95 /* Real (KIND=16) */ 00090 /* IEEE: */ 00091 #define DIGITS_INT1_F90_IEEE 7 /* Integer (KIND=1) */ 00092 #define DIGITS_INT2_F90_IEEE 15 /* Integer (KIND=2) */ 00093 #define DIGITS_INT4_F90_IEEE 31 /* Integer (KIND=4) */ 00094 #define DIGITS_INT8_F90_IEEE 63 /* Integer (KIND=8) */ 00095 #define DIGITS_REAL4_F90_IEEE 24 /* Real (KIND=4) */ 00096 #define DIGITS_REAL8_F90_IEEE 53 /* Real (KIND=8) */ 00097 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00098 #define DIGITS_REAL16_F90_IEEE 107 /* Real (KIND=16) */ 00099 #else 00100 #define DIGITS_REAL16_F90_IEEE 113 /* Real (KIND=16) */ 00101 #endif 00102 00103 #define DIGITS_INT1_F90 (target_ieee ? \ 00104 DIGITS_INT1_F90_IEEE : DIGITS_INT1_F90_Y) 00105 #define DIGITS_INT2_F90 (target_ieee ? \ 00106 DIGITS_INT2_F90_IEEE : DIGITS_INT2_F90_Y) 00107 #define DIGITS_INT4_F90 (target_ieee ? \ 00108 DIGITS_INT4_F90_IEEE : DIGITS_INT4_F90_Y) 00109 #define DIGITS_INT8_F90 (target_ieee ? \ 00110 DIGITS_INT8_F90_IEEE : DIGITS_INT8_F90_Y) 00111 #define DIGITS_REAL4_F90 (target_ieee ? \ 00112 DIGITS_REAL4_F90_IEEE : DIGITS_REAL4_F90_Y) 00113 #define DIGITS_REAL8_F90 (target_ieee ? \ 00114 DIGITS_REAL8_F90_IEEE : DIGITS_REAL8_F90_Y) 00115 #define DIGITS_REAL16_F90 (target_ieee ? \ 00116 DIGITS_REAL16_F90_IEEE : DIGITS_REAL16_F90_Y) 00117 00118 /* EPSILON for real and double precision 00119 * number that is almost negligible compared to one in the model 00120 * Real result = (b)**(1-p) = 2**(-47) where p = 48 00121 * real (KIND=8) = 377224000000000000000 00122 * real (KIND=16) is 2**(p-1) = 2**(-95) where p = 96 00123 * or 376424000000000000000 0000000000000000000000 00124 */ 00125 /* YMP: */ 00126 #define EPSILON_REAL4_F90_Y "0.1192092895507812E-06" 00127 #define EPSILON_REAL8_F90_Y "0.1421085471520200E-13" 00128 #define EPSILON_REAL16_F90_Y "0.50487097934144755546350628178090E-28" 00129 /* IEEE: */ 00130 #define EPSILON_REAL4_F90_IEEE "1.192092895507812500E-07" 00131 #define EPSILON_REAL8_F90_IEEE "2.220446049250313081E-16" 00132 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00133 #define EPSILON_REAL16_F90_IEEE "1.23259516440783094595582588325435348E-32" 00134 #else 00135 #define EPSILON_REAL16_F90_IEEE "1.925929944387235853055977942584927319E-34" 00136 #endif 00137 00138 #define EPSILON_REAL4_F90 (target_ieee ? \ 00139 EPSILON_REAL4_F90_IEEE : EPSILON_REAL4_F90_Y) 00140 #define EPSILON_REAL8_F90 (target_ieee ? \ 00141 EPSILON_REAL8_F90_IEEE : EPSILON_REAL8_F90_Y) 00142 #ifdef _TARGET_OS_MAX 00143 #define EPSILON_REAL16_F90 (target_ieee ? \ 00144 EPSILON_REAL8_F90_IEEE : EPSILON_REAL16_F90_Y) 00145 #else 00146 #define EPSILON_REAL16_F90 (target_ieee ? \ 00147 EPSILON_REAL16_F90_IEEE : EPSILON_REAL16_F90_Y) 00148 #endif 00149 00150 /* BHJ JBL All HUGE values are stored here as strings. They must be converted */ 00151 /* to constants using the routine cvrt_str_to_cn in lex.c. This is because of */ 00152 /* cross compiler problems with the use of these as "c" constants. */ 00153 00154 /* HUGE for integer, real and double precision in the model. 00155 * Integer result = (r**q)-1 00156 * Real result = b**emax*(1-b**(-p)) 00157 */ 00158 /* YMP: */ 00159 #define HUGE_INT1_F90_Y "127" 00160 #define HUGE_INT2_F90_Y "32767" 00161 #define HUGE_INT4_F90_Y "2147483647" 00162 #define HUGE_INT8_F90_Y "9223372036854775807" 00163 #define HUGE_REAL4_F90_Y "0.13634350882572e+2466" 00164 #define HUGE_REAL8_F90_Y "0.136343516952426e+2466" 00165 #define HUGE_REAL16_F90_Y "0.1363435169524269911828730305882e+2466" 00166 /* IEEE: */ 00167 #define HUGE_INT1_F90_IEEE "127" 00168 #define HUGE_INT2_F90_IEEE "32767" 00169 #define HUGE_INT4_F90_IEEE "2147483647" 00170 #define HUGE_INT8_F90_IEEE "9223372036854775807" 00171 #define HUGE_REAL4_F90_IEEE "3.4028234663852886E+38" 00172 #define HUGE_REAL8_F90_IEEE "1.7976931348623158E+308" 00173 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00174 #define HUGE_REAL16_F90_IEEE "8.98846567431157953864652595394506827E+307" 00175 #else 00176 #define HUGE_REAL16_F90_IEEE "1.189731495357231765085759326628007016E+4932" 00177 #endif 00178 00179 #define HUGE_INT1_F90 (target_ieee ? \ 00180 HUGE_INT1_F90_IEEE : HUGE_INT1_F90_Y) 00181 #define HUGE_INT2_F90 (target_ieee ? \ 00182 HUGE_INT2_F90_IEEE : HUGE_INT2_F90_Y) 00183 #define HUGE_INT4_F90 (target_ieee ? \ 00184 HUGE_INT4_F90_IEEE : HUGE_INT4_F90_Y) 00185 #define HUGE_INT8_F90 (target_ieee ? \ 00186 HUGE_INT8_F90_IEEE : HUGE_INT8_F90_Y) 00187 #define HUGE_REAL4_F90 (target_ieee ? \ 00188 HUGE_REAL4_F90_IEEE : HUGE_REAL4_F90_Y) 00189 #define HUGE_REAL8_F90 (target_ieee ? \ 00190 HUGE_REAL8_F90_IEEE : HUGE_REAL8_F90_Y) 00191 #define HUGE_REAL16_F90 (target_ieee ? \ 00192 HUGE_REAL16_F90_IEEE : HUGE_REAL16_F90_Y) 00193 00194 /* MAXEXPONENT = emax of real and double precision in the model */ 00195 /* YMP: */ 00196 #define MAXEXPONENT_REAL4_F90_Y 8189 00197 #define MAXEXPONENT_REAL8_F90_Y 8189 00198 #define MAXEXPONENT_REAL16_F90_Y 8189 00199 /* IEEE: */ 00200 #define MAXEXPONENT_REAL4_F90_IEEE 128 00201 #define MAXEXPONENT_REAL8_F90_IEEE 1024 00202 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00203 #define MAXEXPONENT_REAL16_F90_IEEE 1023 00204 #else 00205 #define MAXEXPONENT_REAL16_F90_IEEE 16384 00206 #endif 00207 00208 #define MAXEXPONENT_REAL4_F90 (target_ieee ? \ 00209 MAXEXPONENT_REAL4_F90_IEEE : MAXEXPONENT_REAL4_F90_Y) 00210 #define MAXEXPONENT_REAL8_F90 (target_ieee ? \ 00211 MAXEXPONENT_REAL8_F90_IEEE : MAXEXPONENT_REAL8_F90_Y) 00212 #define MAXEXPONENT_REAL16_F90 (target_ieee ? \ 00213 MAXEXPONENT_REAL16_F90_IEEE : MAXEXPONENT_REAL16_F90_Y) 00214 00215 /* MINEXPONENT = emin of real and double precision in the model */ 00216 /* YMP: */ 00217 #define MINEXPONENT_REAL4_F90_Y -8188 00218 #define MINEXPONENT_REAL8_F90_Y -8188 00219 #define MINEXPONENT_REAL16_F90_Y -8188 00220 /* IEEE: */ 00221 #define MINEXPONENT_REAL4_F90_IEEE -125 00222 #define MINEXPONENT_REAL8_F90_IEEE -1021 00223 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00224 #define MINEXPONENT_REAL16_F90_IEEE -915 00225 #else 00226 #define MINEXPONENT_REAL16_F90_IEEE -16381 00227 #endif 00228 00229 #define MINEXPONENT_REAL4_F90 (target_ieee ? \ 00230 MINEXPONENT_REAL4_F90_IEEE : MINEXPONENT_REAL4_F90_Y) 00231 #define MINEXPONENT_REAL8_F90 (target_ieee ? \ 00232 MINEXPONENT_REAL8_F90_IEEE : MINEXPONENT_REAL8_F90_Y) 00233 #define MINEXPONENT_REAL16_F90 (target_ieee ? \ 00234 MINEXPONENT_REAL16_F90_IEEE : MINEXPONENT_REAL16_F90_Y) 00235 00236 /* PRECISION for decimal precision of real and double precision in the model. 00237 * Result=INT((p-1)*LOG10(b))+k. K is one if b is an integral power of 10, 00238 * otherwise, k=0. 00239 */ 00240 /* YMP: */ 00241 #define PRECISION_REAL4_F90_Y 6 00242 #define PRECISION_REAL8_F90_Y 13 00243 #define PRECISION_REAL16_F90_Y 28 00244 /* IEEE: */ 00245 #define PRECISION_REAL4_F90_IEEE 6 00246 #define PRECISION_REAL8_F90_IEEE 15 00247 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00248 #define PRECISION_REAL16_F90_IEEE 31 00249 #else 00250 #define PRECISION_REAL16_F90_IEEE 33 00251 #endif 00252 00253 #define PRECISION_REAL4_F90 (target_ieee ? \ 00254 PRECISION_REAL4_F90_IEEE : PRECISION_REAL4_F90_Y) 00255 #define PRECISION_REAL8_F90 (target_ieee ? \ 00256 PRECISION_REAL8_F90_IEEE : PRECISION_REAL8_F90_Y) 00257 #define PRECISION_REAL16_F90 (target_ieee ? \ 00258 PRECISION_REAL16_F90_IEEE : PRECISION_REAL16_F90_Y) 00259 00260 /* RADIX for integer, real and double precision in the model. */ 00261 /* YMP: */ 00262 #define RADIX_F90_Y 2 00263 /* IEEE: */ 00264 #define RADIX_F90_IEEE 2 00265 #define RADIX_F90 (target_ieee ? \ 00266 RADIX_F90_IEEE : RADIX_F90_Y) 00267 00268 /* RANGE for integer, real and double precision, complex and double complex 00269 * in the model 00270 * Integer result = INT(LOG10 (huge)) where huge is the largest positive 00271 * integer in the model of the same kind. 00272 * Real result = INT(MIN(LOG10 (huge),-LOG10(tiny))) where huge and tiny are 00273 * the largest and smallest positive numbers in the model of the 00274 * same kind. 00275 */ 00276 /* YMP: */ 00277 #define RANGE_INT1_F90_Y 2 00278 #define RANGE_INT2_F90_Y 4 00279 #define RANGE_INT4_F90_Y 9 00280 #define RANGE_INT8_F90_Y 18 00281 #define RANGE_REAL4_F90_Y 2465 00282 #define RANGE_REAL8_F90_Y 2465 00283 #define RANGE_REAL16_F90_Y 2465 00284 /* IEEE: */ 00285 #define RANGE_INT1_F90_IEEE 2 00286 #define RANGE_INT2_F90_IEEE 4 00287 #define RANGE_INT4_F90_IEEE 9 00288 #define RANGE_INT8_F90_IEEE 18 00289 #define RANGE_REAL4_F90_IEEE 37 00290 #define RANGE_REAL8_F90_IEEE 307 00291 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00292 #define RANGE_REAL16_F90_IEEE 275 00293 #else 00294 #define RANGE_REAL16_F90_IEEE 4931 00295 #endif 00296 00297 #define RANGE_INT1_F90 (target_ieee ? \ 00298 RANGE_INT1_F90_IEEE : RANGE_INT1_F90_Y) 00299 #define RANGE_INT2_F90 (target_ieee ? \ 00300 RANGE_INT2_F90_IEEE : RANGE_INT2_F90_Y) 00301 #define RANGE_INT4_F90 (target_ieee ? \ 00302 RANGE_INT4_F90_IEEE : RANGE_INT4_F90_Y) 00303 #define RANGE_INT8_F90 (target_ieee ? \ 00304 RANGE_INT8_F90_IEEE : RANGE_INT8_F90_Y) 00305 #define RANGE_REAL4_F90 (target_ieee ? \ 00306 RANGE_REAL4_F90_IEEE : RANGE_REAL4_F90_Y) 00307 #define RANGE_REAL8_F90 (target_ieee ? \ 00308 RANGE_REAL8_F90_IEEE : RANGE_REAL8_F90_Y) 00309 #define RANGE_REAL16_F90 (target_ieee ? \ 00310 RANGE_REAL16_F90_IEEE : RANGE_REAL16_F90_Y) 00311 00312 /* BHJ JBL All TINY values are stored here as strings. They must be converted */ 00313 /* to constants using the routine cvrt_str_to_cn in lex.c. This is because of */ 00314 /* cross compiler problems with the use of these as "c" constants. */ 00315 00316 /* TINY for real and double precision is the smallest number in the model. 00317 * Result is b**(emin-1) 00318 */ 00319 /* YMP: */ 00320 #if defined(_HOST_OS_UNICOS) 00321 #define TINY_REAL4_F90_Y "0.73344154702194e-2465" 00322 #define TINY_REAL8_F90_Y "0.73344154702194e-2465" 00323 #define TINY_REAL16_F90_Y "0.733441547021938866248564956819e-2465" 00324 #else 00325 #define TINY_REAL4_F90_Y "0.0" 00326 #define TINY_REAL8_F90_Y "0.0" 00327 #define TINY_REAL16_F90_Y "0.0" 00328 #endif 00329 /* IEEE: */ 00330 #define TINY_REAL4_F90_IEEE "1.175494350822287508E-38" 00331 #define TINY_REAL8_F90_IEEE "2.225073858507201383E-308" 00332 00333 /* until REAL16 is ready on Cray ieee, this must be the same as REAL8 */ 00334 #if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) 00335 #define TINY_REAL16_F90_IEEE "0.1805194375864829576069262081173747E-275" 00336 #else 00337 #define TINY_REAL16_F90_IEEE "3.362103143112093506262677817321752603E-4932" 00338 #endif 00339 00340 #define TINY_REAL4_F90 (target_ieee ? \ 00341 TINY_REAL4_F90_IEEE : TINY_REAL4_F90_Y) 00342 #define TINY_REAL8_F90 (target_ieee ? \ 00343 TINY_REAL8_F90_IEEE : TINY_REAL8_F90_Y) 00344 #define TINY_REAL16_F90 (target_ieee ? \ 00345 TINY_REAL16_F90_IEEE : TINY_REAL16_F90_Y)