Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
arith.h
Go to the documentation of this file.
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 #ifndef AR_H
00037 #define AR_H
00038 
00039 /* Integer type declarations */
00040 
00041 enum ar_int_size
00042 {
00043         ar_int_size_8,
00044         ar_int_size_24,
00045         ar_int_size_32,
00046         ar_int_size_46,
00047         ar_int_size_64,
00048         ar_int_size_128,
00049         ar_int_size_16
00050 };
00051 
00052 #define AR_INT_SIZE_8                           (ar_int_size_8 << 2)
00053 #define AR_INT_SIZE_24                          (ar_int_size_24 << 2)
00054 #define AR_INT_SIZE_32                          (ar_int_size_32 << 2)
00055 #define AR_INT_SIZE_46                          (ar_int_size_46 << 2)
00056 #define AR_INT_SIZE_64                          (ar_int_size_64 << 2)
00057 #define AR_INT_SIZE_128                         (ar_int_size_128 << 2)
00058 #define AR_INT_SIZE_16                          (ar_int_size_16 << 2)
00059 
00060 enum ar_pointer_format
00061 {
00062         ar_pointer_byte,                /* Cray T3D, etc. byte pointers */
00063         ar_pointer_char,                /* Cray Y-MP, etc. character/void pointers */
00064         ar_pointer_fctn,
00065         ar_pointer_word
00066 };
00067 
00068 #define AR_POINTER_BYTE                         (ar_pointer_byte << 2)
00069 #define AR_POINTER_CHAR                         (ar_pointer_char << 2)
00070 #define AR_POINTER_FCTN                         (ar_pointer_fctn << 2)
00071 #define AR_POINTER_WORD                         (ar_pointer_word << 2)
00072 
00073 enum ar_pointer_size
00074 {
00075         ar_pointer_size_24,
00076         ar_pointer_size_32,
00077         ar_pointer_size_64
00078 };
00079 
00080 #define AR_POINTER_24                           ar_pointer_size_24
00081 #define AR_POINTER_32                           ar_pointer_size_32
00082 #define AR_POINTER_64                           ar_pointer_size_64
00083 
00084 enum ar_signedness
00085 {
00086         ar_signed,
00087         ar_unsigned
00088 };
00089 
00090 #define AR_SIGNED                                       ar_signed
00091 #define AR_UNSIGNED                             ar_unsigned
00092 
00093 #ifdef _CRAY
00094         typedef long                                    AR_HOST_SINT64;
00095         typedef unsigned long                   AR_HOST_UINT64;
00096 #else
00097         typedef long long                               AR_HOST_SINT64;
00098         typedef unsigned long long              AR_HOST_UINT64;
00099 #endif
00100 
00101 
00102 /* Floating point type declarations */
00103 
00104 enum ar_float_format
00105 {
00106         ar_float_format_ieee,
00107         ar_float_format_cray
00108 };
00109 
00110 #define AR_FLOAT_IEEE                           (ar_float_format_ieee << 5)
00111 #define AR_FLOAT_CRAY                           (ar_float_format_cray << 5)
00112 
00113 #define AR_IEEE_FLOATING_POINT          ar_float_format_ieee
00114 #define AR_CRAY_FLOATING_POINT          ar_float_format_cray
00115 
00116 enum ar_float_size
00117 {
00118         ar_float_32,
00119         ar_float_64,
00120         ar_float_128
00121 };
00122 #define AR_FLOAT_32                             (ar_float_32  << 1)
00123 #define AR_FLOAT_64                             (ar_float_64  << 1)
00124 #define AR_FLOAT_128                            (ar_float_128 << 1)
00125 
00126 
00127 enum ar_float_complexity
00128 {
00129         ar_simple,
00130         ar_complex
00131 };
00132 #define AR_FLOAT_SIMPLE                         ar_simple
00133 #define AR_FLOAT_COMPLEX                        ar_complex
00134 
00135 enum ar_float_ieee_round
00136 {
00137         ar_float_ieee_round_nearest,
00138         ar_float_ieee_round_up,
00139         ar_float_ieee_round_down,
00140         ar_float_ieee_round_zero
00141 };
00142 
00143 #define AR_FLOAT_IEEE_ROUND_NEAREST (ar_float_ieee_round_nearest << 3)
00144 #define AR_FLOAT_IEEE_ROUND_ZERO        (ar_float_ieee_round_zero        << 3)
00145 #define AR_FLOAT_IEEE_ROUND_UP          (ar_float_ieee_round_up          << 3)
00146 #define AR_FLOAT_IEEE_ROUND_DOWN        (ar_float_ieee_round_down        << 3)
00147 
00148 #define AR_ROUND_NEAREST                        ar_float_ieee_round_nearest
00149 #define AR_ROUND_ZERO                           ar_float_ieee_round_zero
00150 #define AR_ROUND_PLUS_INFINITY          ar_float_ieee_round_up
00151 #define AR_ROUND_MINUS_INFINITY         ar_float_ieee_round_down
00152 
00153 enum ar_float_cray_round
00154 {
00155         ar_float_cray_round_c1,
00156         ar_reciprocal_iteration,
00157         ar_float_cray_round_c1f
00158 };
00159 
00160 #define AR_FLOAT_CRAY_ROUND_C1          (ar_float_cray_round_c1          << 3)
00161 #define AR_FLOAT_CRAY_ROUND_C1F         (ar_float_cray_round_c1f         << 3)
00162 
00163 #define AR_ROUNDED                                      ar_float_cray_round_c1
00164 #define AR_UNROUNDED                            ar_float_cray_round_c1f
00165 #define AR_RECIPROCAL_ITERATION         ar_reciprocal_iteration
00166 
00167 enum ar_float_underflow
00168 {
00169         ar_underflow_to_denorm,
00170         ar_underflow_to_plus_zero,
00171         ar_underflow_to_signed_zero,
00172         ar_underflow_to_signed_tiny
00173 };
00174 
00175 #define AR_UNDERFLOW_TO_DENORM          ar_underflow_to_denorm
00176 #define AR_UNDERFLOW_TO_PLUS_ZERO       ar_underflow_to_plus_zero
00177 #define AR_UNDERFLOW_TO_SIGNED_ZERO     ar_underflow_to_signed_zero
00178 #define AR_UNDERFLOW_TO_SIGNED_TINY     ar_underflow_to_signed_tiny
00179 
00180 enum ar_float_128_bit
00181 {
00182         ar_128_bit_extended_double,
00183         ar_128_bit_double_double
00184 };
00185 
00186 #define AR_128BIT_EXTENDED_DOUBLE       ar_128_bit_extended_double
00187 #define AR_128BIT_DOUBLE_DOUBLE         ar_128_bit_double_double
00188 
00189 
00190 /* Generic type declarations */
00191 
00192 typedef struct {
00193         AR_HOST_SINT64  ar_internal_data_item1;
00194         AR_HOST_SINT64  ar_internal_data_item2;
00195         AR_HOST_SINT64  ar_internal_data_item3;
00196         AR_HOST_SINT64  ar_internal_data_item4;
00197 } AR_DATA;
00198 
00199 enum ar_class
00200 {
00201         ar_class_int,
00202         ar_class_float,
00203         ar_class_pointer,
00204         ar_class_logical,
00205         ar_class_error
00206 };
00207 
00208 #define AR_CLASS_INT                            (ar_class_int     << 6)
00209 #define AR_CLASS_FLOAT                          (ar_class_float   << 6)
00210 #define AR_CLASS_POINTER                        (ar_class_pointer << 6)
00211 #define AR_CLASS_LOGICAL                        (ar_class_logical << 6)
00212 #define AR_CLASS_ERROR                          (ar_class_error   << 6)
00213 
00214         /******************************  NOTICE  ****************************/
00215         /*                                                                  */
00216         /*   THE FOLLOWING MACROS WILL BE ELIMINATED IN THE NEAR FUTURE     */
00217         /*                                                                  */
00218         /********************************************************************/
00219 
00220 #ifndef AR_INTERNAL_H
00221 #define AR_CLASS(type)                          (type & 0x1c0)
00222 
00223 #define AR_INT_SIZE(type)                       (type & 0x3c)
00224 
00225 #define AR_SIGNEDNESS(type)             (type & 0x1)
00226 #endif
00227 
00228 typedef enum
00229 {
00230         AR_Int_8_S                              = AR_CLASS_INT | AR_INT_SIZE_8   | AR_SIGNED,
00231         AR_Int_8_U                              = AR_CLASS_INT | AR_INT_SIZE_8   | AR_UNSIGNED,
00232         AR_Int_16_S                     = AR_CLASS_INT | AR_INT_SIZE_16  | AR_SIGNED,
00233         AR_Int_16_U                     = AR_CLASS_INT | AR_INT_SIZE_16  | AR_UNSIGNED,
00234         AR_Int_24_S                     = AR_CLASS_INT | AR_INT_SIZE_24  | AR_SIGNED,
00235         AR_Int_24_U                     = AR_CLASS_INT | AR_INT_SIZE_24  | AR_UNSIGNED,
00236         AR_Int_32_S                     = AR_CLASS_INT | AR_INT_SIZE_32  | AR_SIGNED,
00237         AR_Int_32_U                     = AR_CLASS_INT | AR_INT_SIZE_32  | AR_UNSIGNED,
00238         AR_Int_46_S                     = AR_CLASS_INT | AR_INT_SIZE_46  | AR_SIGNED,
00239         AR_Int_46_U                     = AR_CLASS_INT | AR_INT_SIZE_46  | AR_UNSIGNED,
00240         AR_Int_64_S                     = AR_CLASS_INT | AR_INT_SIZE_64  | AR_SIGNED,
00241         AR_Int_64_U                     = AR_CLASS_INT | AR_INT_SIZE_64  | AR_UNSIGNED,
00242         AR_Int_128_S                    = AR_CLASS_INT | AR_INT_SIZE_128 | AR_SIGNED,
00243         AR_Int_128_U                    = AR_CLASS_INT | AR_INT_SIZE_128 | AR_UNSIGNED,
00244 
00245         AR_Logical                              = AR_CLASS_LOGICAL,
00246 
00247         AR_Pointer_Byte                 = AR_CLASS_POINTER | AR_POINTER_BYTE,
00248         AR_Pointer_Char_24              = AR_CLASS_POINTER | AR_POINTER_CHAR | AR_POINTER_24,
00249         AR_Pointer_Char_32              = AR_CLASS_POINTER | AR_POINTER_CHAR | AR_POINTER_32,
00250         AR_Pointer_Char_64              = AR_CLASS_POINTER | AR_POINTER_CHAR | AR_POINTER_64,
00251         AR_Pointer_Fctn_24              = AR_CLASS_POINTER | AR_POINTER_FCTN | AR_POINTER_24,
00252         AR_Pointer_Fctn_32              = AR_CLASS_POINTER | AR_POINTER_FCTN | AR_POINTER_32,
00253         AR_Pointer_Fctn_64              = AR_CLASS_POINTER | AR_POINTER_FCTN | AR_POINTER_64,
00254         AR_Pointer_Word_24              = AR_CLASS_POINTER | AR_POINTER_WORD | AR_POINTER_24,
00255         AR_Pointer_Word_32              = AR_CLASS_POINTER | AR_POINTER_WORD | AR_POINTER_32,
00256         AR_Pointer_Word_64              = AR_CLASS_POINTER | AR_POINTER_WORD | AR_POINTER_64,
00257 
00258         AR_Float_32                             = AR_CLASS_FLOAT | AR_FLOAT_32 | AR_FLOAT_SIMPLE,
00259         AR_Float_64                             = AR_CLASS_FLOAT | AR_FLOAT_64 | AR_FLOAT_SIMPLE,
00260         AR_Float_128                    = AR_CLASS_FLOAT | AR_FLOAT_128 | AR_FLOAT_SIMPLE,
00261         AR_Complex_32                   = AR_CLASS_FLOAT | AR_FLOAT_32 | AR_FLOAT_COMPLEX,
00262         AR_Complex_64                   = AR_CLASS_FLOAT | AR_FLOAT_64 | AR_FLOAT_COMPLEX,
00263         AR_Complex_128                  = AR_CLASS_FLOAT | AR_FLOAT_128 | AR_FLOAT_COMPLEX,
00264 
00265         /******************************  NOTICE  ****************************/
00266         /*                                                                  */
00267         /*   THE FOLLOWING FLOATING POINT TYPES WILL BE ELIMINATED IN THE   */
00268         /*   3.0 VERSION OF ARITH.  SEE arith.doc MORE INFORMATION.         */
00269         /*                                                                  */
00270         /********************************************************************/
00271 
00272         AR_Float_Cray1_64               = AR_CLASS_FLOAT | AR_FLOAT_CRAY |
00273                                                           AR_FLOAT_CRAY_ROUND_C1 | AR_FLOAT_64 |
00274                                                           AR_FLOAT_SIMPLE,
00275 
00276         AR_Float_Cray1_64_F     = AR_CLASS_FLOAT | AR_FLOAT_CRAY |
00277                                                           AR_FLOAT_CRAY_ROUND_C1F | AR_FLOAT_64 |
00278                                                           AR_FLOAT_SIMPLE,
00279 
00280         AR_Float_Cray1_128              = AR_CLASS_FLOAT | AR_FLOAT_CRAY |
00281                                                           AR_FLOAT_CRAY_ROUND_C1 | AR_FLOAT_128 |
00282                                                           AR_FLOAT_SIMPLE,
00283 
00284         AR_Float_IEEE_NR_32     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00285                                                           AR_FLOAT_IEEE_ROUND_NEAREST | AR_FLOAT_32 |
00286                                                           AR_FLOAT_SIMPLE,
00287 
00288         AR_Float_IEEE_NR_64     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00289                                                           AR_FLOAT_IEEE_ROUND_NEAREST | AR_FLOAT_64 |
00290                                                           AR_FLOAT_SIMPLE,
00291 
00292         AR_Float_IEEE_NR_128    = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00293                                                           AR_FLOAT_IEEE_ROUND_NEAREST | AR_FLOAT_128 |
00294                                                           AR_FLOAT_SIMPLE,
00295 
00296         AR_Float_IEEE_ZE_32     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00297                                                           AR_FLOAT_IEEE_ROUND_ZERO | AR_FLOAT_32 |
00298                                                           AR_FLOAT_SIMPLE,
00299 
00300         AR_Float_IEEE_ZE_64     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00301                                                           AR_FLOAT_IEEE_ROUND_ZERO | AR_FLOAT_64 |
00302                                                           AR_FLOAT_SIMPLE,
00303 
00304         AR_Float_IEEE_ZE_128    = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00305                                                           AR_FLOAT_IEEE_ROUND_ZERO | AR_FLOAT_128 |
00306                                                           AR_FLOAT_SIMPLE,
00307 
00308         AR_Float_IEEE_UP_32     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00309                                                           AR_FLOAT_IEEE_ROUND_UP | AR_FLOAT_32 |
00310                                                           AR_FLOAT_SIMPLE,
00311 
00312         AR_Float_IEEE_UP_64     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00313                                                           AR_FLOAT_IEEE_ROUND_UP | AR_FLOAT_64 |
00314                                                           AR_FLOAT_SIMPLE,
00315 
00316         AR_Float_IEEE_UP_128    = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00317                                                           AR_FLOAT_IEEE_ROUND_UP | AR_FLOAT_128 |
00318                                                           AR_FLOAT_SIMPLE,
00319 
00320         AR_Float_IEEE_DN_32     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00321                                                           AR_FLOAT_IEEE_ROUND_DOWN | AR_FLOAT_32 |
00322                                                           AR_FLOAT_SIMPLE,
00323 
00324         AR_Float_IEEE_DN_64     = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00325                                                           AR_FLOAT_IEEE_ROUND_DOWN | AR_FLOAT_64 |
00326                                                           AR_FLOAT_SIMPLE,
00327 
00328         AR_Float_IEEE_DN_128    = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00329                                                           AR_FLOAT_IEEE_ROUND_DOWN | AR_FLOAT_128 |
00330                                                           AR_FLOAT_SIMPLE,
00331 
00332         AR_Complex_Cray1_64     = AR_CLASS_FLOAT | AR_FLOAT_CRAY |
00333                                                           AR_FLOAT_CRAY_ROUND_C1 | AR_FLOAT_64 |
00334                                                           AR_FLOAT_COMPLEX,
00335 
00336         AR_Complex_Cray1_64_F   = AR_CLASS_FLOAT | AR_FLOAT_CRAY |
00337                                                           AR_FLOAT_CRAY_ROUND_C1F | AR_FLOAT_64 |
00338                                                           AR_FLOAT_COMPLEX,
00339 
00340         AR_Complex_Cray1_128    = AR_CLASS_FLOAT | AR_FLOAT_CRAY |
00341                                                           AR_FLOAT_CRAY_ROUND_C1 | AR_FLOAT_128 |
00342                                                           AR_FLOAT_COMPLEX,
00343 
00344         AR_Complex_IEEE_NR_32   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00345                                                           AR_FLOAT_IEEE_ROUND_NEAREST | AR_FLOAT_32 |
00346                                                           AR_FLOAT_COMPLEX,
00347 
00348         AR_Complex_IEEE_NR_64   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00349                                                           AR_FLOAT_IEEE_ROUND_NEAREST | AR_FLOAT_64 |
00350                                                           AR_FLOAT_COMPLEX,
00351 
00352         AR_Complex_IEEE_NR_128  = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00353                                                           AR_FLOAT_IEEE_ROUND_NEAREST | AR_FLOAT_128 |
00354                                                           AR_FLOAT_COMPLEX,
00355 
00356         AR_Complex_IEEE_ZE_32   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00357                                                           AR_FLOAT_IEEE_ROUND_ZERO | AR_FLOAT_32 |
00358                                                           AR_FLOAT_COMPLEX,
00359 
00360         AR_Complex_IEEE_ZE_64   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00361                                                           AR_FLOAT_IEEE_ROUND_ZERO | AR_FLOAT_64 |
00362                                                           AR_FLOAT_COMPLEX,
00363 
00364         AR_Complex_IEEE_ZE_128  = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00365                                                           AR_FLOAT_IEEE_ROUND_ZERO | AR_FLOAT_128 |
00366                                                           AR_FLOAT_COMPLEX,
00367 
00368         AR_Complex_IEEE_UP_32   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00369                                                           AR_FLOAT_IEEE_ROUND_UP | AR_FLOAT_32 |
00370                                                           AR_FLOAT_COMPLEX,
00371 
00372         AR_Complex_IEEE_UP_64   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00373                                                           AR_FLOAT_IEEE_ROUND_UP | AR_FLOAT_64 |
00374                                                           AR_FLOAT_COMPLEX,
00375 
00376         AR_Complex_IEEE_UP_128  = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00377                                                           AR_FLOAT_IEEE_ROUND_UP | AR_FLOAT_128 |
00378                                                           AR_FLOAT_COMPLEX,
00379 
00380         AR_Complex_IEEE_DN_32   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00381                                                           AR_FLOAT_IEEE_ROUND_DOWN | AR_FLOAT_32 |
00382                                                           AR_FLOAT_COMPLEX,
00383 
00384         AR_Complex_IEEE_DN_64   = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00385                                                           AR_FLOAT_IEEE_ROUND_DOWN | AR_FLOAT_64 |
00386                                                           AR_FLOAT_COMPLEX,
00387 
00388         AR_Complex_IEEE_DN_128  = AR_CLASS_FLOAT | AR_FLOAT_IEEE |
00389                                                           AR_FLOAT_IEEE_ROUND_DOWN | AR_FLOAT_128 |
00390                                                           AR_FLOAT_COMPLEX,
00391 
00392         AR_Error                                = AR_CLASS_ERROR
00393 
00394 } AR_TYPE;
00395 
00396 
00397 /* Return values from AR_ functions */
00398 
00399 #define AR_STAT_OK                              0000
00400 #define AR_STAT_OVERFLOW                0001    /* error condition */
00401 #define AR_STAT_UNDERFLOW               0002    /* FYI; often also zero */
00402 #define AR_STAT_UNDEFINED               0004    /* possible error: IEEE NaN result
00403                                                                                          or undefined operation */
00404 #define AR_STAT_INEXACT                 0010    /* FYI: precision lost */
00405 #define AR_STAT_ZERO                    0020    /* FYI: result is zero */
00406 #define AR_STAT_NEGATIVE                0040    /* FYI: result sign bit set */
00407 #define AR_STAT_INVALID_TYPE    0100    /* invalid type for operation */
00408 #define AR_STAT_SEMIVALID               0200    /* FYI: result is algorithmically
00409                                                                                                   precise but incorrect */
00410 
00411 #define AR_ZERO                                 0020    /* FYI: result is zero */
00412 #define AR_NEGATIVE                     0040    /* FYI: result sign bit set */
00413 #define AR_ERROR_STATUS                 0105    /* Generally fatal error flags */
00414 
00415 
00416 /* Return values for function AR_compare */
00417 
00418 typedef enum
00419 {
00420         AR_Compare_LT,                          /* opnd1 less than opnd2 */
00421         AR_Compare_EQ,                          /* opnd1 greater than opnd2 */
00422         AR_Compare_GT,                          /* opnd1 equal to opnd2 */
00423         AR_Compare_Unord,                       /* comparison unordered */
00424         AR_Compare_NE,                          /* opnd1 not equal to opnd2 (complex only) */
00425         AR_Compare_Invalid                      /* compares can't be done on operand type */
00426 } AR_COMPARE_TYPE;
00427 
00428 
00429 /*********************** AR_ function declarations ************************/
00430 
00431 /* Basic arithmetic and logical functions */
00432 
00433 int AR_abs         (AR_DATA *result,
00434                                 const AR_TYPE *resulttype,
00435                                 const AR_DATA *opnd1,
00436                                 const AR_TYPE *opnd1type);
00437 
00438 int AR_add         (AR_DATA *result,
00439                                 const AR_TYPE *resulttype,
00440                                 const AR_DATA *opnd1,
00441                                 const AR_TYPE *opnd1type,
00442                                 const AR_DATA *opnd2,
00443                                 const AR_TYPE *opnd2type);
00444 
00445 int AR_add_ptr_int(AR_DATA *result,
00446                                 const AR_TYPE *resulttype,
00447                                 const AR_DATA *opnd1,
00448                                 const AR_TYPE *opnd1type,
00449                                 const AR_DATA *opnd2,
00450                                 const AR_TYPE *opnd2type,
00451                                 const AR_DATA *opnd3,
00452                                 const AR_TYPE *opnd3type);
00453 
00454 int AR_bitor   (AR_DATA *result,
00455                                 const AR_TYPE *resulttype,
00456                                 const AR_DATA *opnd1,
00457                                 const AR_TYPE *opnd1type,
00458                                 const AR_DATA *opnd2,
00459                                 const AR_TYPE *opnd2type);
00460 
00461 int AR_bitand  (AR_DATA *result,
00462                                 const AR_TYPE *resulttype,
00463                                 const AR_DATA *opnd1,
00464                                 const AR_TYPE *opnd1type,
00465                                 const AR_DATA *opnd2,
00466                                 const AR_TYPE *opnd2type);
00467 
00468 int AR_bitxor  (AR_DATA *result,
00469                                 const AR_TYPE *resulttype,
00470                                 const AR_DATA *opnd1,
00471                                 const AR_TYPE *opnd1type,
00472                                 const AR_DATA *opnd2,
00473                                 const AR_TYPE *opnd2type);
00474 
00475 int AR_bitcomplement(AR_DATA *result,
00476                                 const AR_TYPE *resulttype,
00477                                 const AR_DATA *opnd1,
00478                                 const AR_TYPE *opnd1type);
00479 
00480 int AR_cimag   (AR_DATA *result,
00481                                 const AR_TYPE *resulttype,
00482                                 const AR_DATA *opnd1,
00483                                 const AR_TYPE *opnd1type);
00484 
00485 AR_COMPARE_TYPE AR_compare(const AR_DATA *opnd1,
00486                                 const AR_TYPE *opnd1type,
00487                                 const AR_DATA *opnd2,
00488                                 const AR_TYPE *opnd2type);
00489 
00490 int AR_conj    (AR_DATA *result,
00491                                 const AR_TYPE *resulttype,
00492                                 const AR_DATA *opnd1,
00493                                 const AR_TYPE *opnd1type);
00494 
00495 int AR_creal   (AR_DATA *result,
00496                                 const AR_TYPE *resulttype,
00497                                 const AR_DATA *opnd1,
00498                                 const AR_TYPE *opnd1type);
00499 
00500 int AR_divide  (AR_DATA *result,
00501                                 const AR_TYPE *resulttype,
00502                                 const AR_DATA *opnd1,
00503                                 const AR_TYPE *opnd1type,
00504                                 const AR_DATA *opnd2,
00505                                 const AR_TYPE *opnd2type);
00506 
00507 int AR_dshiftl (AR_DATA *result,
00508                                 const AR_TYPE *resulttype,
00509                                 const AR_DATA *opnd1,
00510                                 const AR_TYPE *opnd1type,
00511                                 const AR_DATA *opnd2,
00512                                 const AR_TYPE *opnd2type,
00513                                 const AR_DATA *opnd3,
00514                                 const AR_TYPE *opnd3type);
00515 
00516 int AR_dshiftr (AR_DATA *result,
00517                                 const AR_TYPE *resulttype,
00518                                 const AR_DATA *opnd1,
00519                                 const AR_TYPE *opnd1type,
00520                                 const AR_DATA *opnd2,
00521                                 const AR_TYPE *opnd2type,
00522                                 const AR_DATA *opnd3,
00523                                 const AR_TYPE *opnd3type);
00524 
00525 int AR_mask    (AR_DATA *result,
00526                                 const AR_TYPE *resulttype,
00527                                 const AR_DATA *opnd1,
00528                                 const AR_TYPE *opnd1type);
00529 
00530 int AR_leadz   (AR_DATA *result,
00531                                 const AR_TYPE *resulttype,
00532                                 const AR_DATA *opnd1,
00533                                 const AR_TYPE *opnd1type);
00534 
00535 int AR_make_complex(AR_DATA *result,
00536                                 const AR_TYPE *resulttype,
00537                                 const AR_DATA *opnd1,
00538                                 const AR_TYPE *opnd1type,
00539                                 const AR_DATA *opnd2,
00540                                 const AR_TYPE *opnd2type);
00541 
00542 int AR_make_imag(AR_DATA *result,
00543                                 const AR_TYPE *resulttype,
00544                                 const AR_DATA *opnd1,
00545                                 const AR_TYPE *opnd1type);
00546 
00547 int AR_mod         (AR_DATA *result,
00548                                 const AR_TYPE *resulttype,
00549                                 const AR_DATA *opnd1,
00550                                 const AR_TYPE *opnd1type,
00551                                 const AR_DATA *opnd2,
00552                                 const AR_TYPE *opnd2type);
00553 
00554 int AR_multiply(AR_DATA *result,
00555                                 const AR_TYPE *resulttype,
00556                                 const AR_DATA *opnd1,
00557                                 const AR_TYPE *opnd1type,
00558                                 const AR_DATA *opnd2,
00559                                 const AR_TYPE *opnd2type);
00560 
00561 int AR_negate  (AR_DATA *result,
00562                                 const AR_TYPE *resulttype,
00563                                 const AR_DATA *opnd1,
00564                                 const AR_TYPE *opnd1type);
00565 
00566 int AR_one         (AR_DATA *result,
00567                                 const AR_TYPE *type);
00568 
00569 int AR_popcnt  (AR_DATA *result,
00570                                 const AR_TYPE *resulttype,
00571                                 const AR_DATA *opnd1,
00572                                 const AR_TYPE *opnd1type);
00573 
00574 int AR_poppar  (AR_DATA *result,
00575                                 const AR_TYPE *resulttype,
00576                                 const AR_DATA *opnd1,
00577                                 const AR_TYPE *opnd1type);
00578 
00579 int AR_round_int_div (AR_DATA *result,
00580                                 const AR_TYPE *resulttype,
00581                                 const AR_DATA *opnd,
00582                                 const AR_TYPE *opndtype);
00583 
00584 int AR_shiftl  (AR_DATA *result,
00585                                 const AR_TYPE *resulttype,
00586                                 const AR_DATA *opnd1,
00587                                 const AR_TYPE *opnd1type,
00588                                 const AR_DATA *opnd2,
00589                                 const AR_TYPE *opnd2type);
00590 
00591 int AR_shiftr  (AR_DATA *result,
00592                                 const AR_TYPE *resulttype,
00593                                 const AR_DATA *opnd1,
00594                                 const AR_TYPE *opnd1type,
00595                                 const AR_DATA *opnd2,
00596                                 const AR_TYPE *opnd2type);
00597 
00598 int AR_ishft   (AR_DATA *result,
00599                                 const AR_TYPE *resulttype,
00600                                 const AR_DATA *opnd1,
00601                                 const AR_TYPE *opnd1type,
00602                                 const AR_DATA *opnd2,
00603                                 const AR_TYPE *opnd2type);
00604 
00605 int AR_ishftc  (AR_DATA *result,
00606                                 const AR_TYPE *resulttype,
00607                                 const AR_DATA *opnd1,
00608                                 const AR_TYPE *opnd1type,
00609                                 const AR_DATA *opnd2,
00610                                 const AR_TYPE *opnd2type,
00611                                 const AR_DATA *opnd3,
00612                                 const AR_TYPE *opnd3type);
00613 
00614 int AR_ibits   (AR_DATA *result,
00615                                 const AR_TYPE *resulttype,
00616                                 const AR_DATA *opnd1,
00617                                 const AR_TYPE *opnd1type,
00618                                 const AR_DATA *opnd2,
00619                                 const AR_TYPE *opnd2type,
00620                                 const AR_DATA *opnd3,
00621                                 const AR_TYPE *opnd3type);
00622 
00623 int AR_status  (const AR_DATA *opnd1,
00624                                 const AR_TYPE *opnd1type);
00625 
00626 int AR_subtract(AR_DATA *result,
00627                                 const AR_TYPE *resulttype,
00628                                 const AR_DATA *opnd1,
00629                                 const AR_TYPE *opnd1type,
00630                                 const AR_DATA *opnd2,
00631                                 const AR_TYPE *opnd2type);
00632 
00633 int AR_subtract_ptr_ptr(AR_DATA *result,
00634                                 const AR_TYPE *resulttype,
00635                                 const AR_DATA *opnd1,
00636                                 const AR_TYPE *opnd1type,
00637                                 const AR_DATA *opnd2,
00638                                 const AR_TYPE *opnd2type,
00639                                 const AR_DATA *opnd3,
00640                                 const AR_TYPE *opnd3type);
00641 
00642 
00643 /* Miscellaneous support Functions */
00644 
00645 int AR_CRAY_64_trunc_bits(int truncbits);
00646 
00647 const char *arith_vers_name(void);
00648 
00649 const char *arith_vers_ID(void);
00650 
00651 const char *arith_vers_number(void);
00652 
00653 
00654 /* Conversion functions (between types) */
00655 
00656 int AR_convert (AR_DATA *result,
00657                                 const AR_TYPE *resulttype,
00658                                 const AR_DATA *opnd1,
00659                                 const AR_TYPE *opnd1type);
00660 
00661 int AR_convert_float_to_str(char *resultstr,
00662                                 const AR_DATA *opnd1,
00663                                 const AR_TYPE *opnd1type);
00664 
00665 int AR_convert_hex_str_to_float(AR_DATA *result,
00666                                 const AR_TYPE *resulttype,
00667                                 const char *ar_str);
00668 
00669 int AR_convert_host_sint64_to_int(AR_DATA *result,
00670                                 const AR_TYPE *resulttype,
00671                                 AR_HOST_SINT64 i64val);
00672 
00673 int AR_convert_int_to_host_sint64(AR_HOST_SINT64 *i64val,
00674                                 const AR_DATA *opnd,
00675                                 const AR_TYPE *opndtype);
00676 
00677 int AR_convert_int_to_str(char *resultstr,
00678                                 const int *base,
00679                                 const AR_DATA *opnd1,
00680                                 const AR_TYPE *opnd1type);
00681 
00682 int AR_convert_str_to_int(AR_DATA *result,
00683                                 const AR_TYPE *resulttype,
00684                                 int *bits_used,
00685                                 const char *str,
00686                                 const int *base);
00687 
00688 int AR_convert_str_to_float(AR_DATA *result,
00689                                 const AR_TYPE *resulttype,
00690                                 const char *str);
00691 
00692 
00693 /* Mathematical (libm) intrinsic functions */
00694 
00695 int AR_cabs    (AR_DATA *result,
00696                                 const AR_TYPE *resulttype,
00697                                 const AR_DATA *opnd1,
00698                                 const AR_TYPE *opnd1type);
00699 
00700 int AR_exp         (AR_DATA *result,
00701                                 const AR_TYPE *resulttype,
00702                                 const AR_DATA *opnd1,
00703                                 const AR_TYPE *opnd1type);
00704 
00705 int AR_Modulo  (AR_DATA *result,
00706                                 const AR_TYPE *resulttype,
00707                                 const AR_DATA *opnd1,
00708                                 const AR_TYPE *opnd1type,
00709                                 const AR_DATA *opnd2,
00710                                 const AR_TYPE *opnd2type);
00711 
00712 int AR_modulo  (AR_DATA *result,
00713                                 const AR_TYPE *resulttype,
00714                                 const AR_DATA *opnd1,
00715                                 const AR_TYPE *opnd1type,
00716                                 const AR_DATA *opnd2,
00717                                 const AR_TYPE *opnd2type);
00718 
00719 int AR_log         (AR_DATA *result,
00720                                 const AR_TYPE *resulttype,
00721                                 const AR_DATA *opnd1,
00722                                 const AR_TYPE *opnd1type);
00723 
00724 int AR_power   (AR_DATA *result,
00725                                 const AR_TYPE *resulttype,
00726                                 const AR_DATA *opnd1,
00727                                 const AR_TYPE *opnd1type,
00728                                 const AR_DATA *opnd2,
00729                                 const AR_TYPE *opnd2type);
00730 
00731 int AR_sqrt    (AR_DATA *result,
00732                                 const AR_TYPE *resulttype,
00733                                 const AR_DATA *opnd,
00734                                 const AR_TYPE *opndtype);
00735 
00736 
00737 /* Language-specific (e.g., Fortran-90) intrinsic functions */
00738 
00739 int AR_index   (AR_DATA *result,
00740                                 const AR_TYPE *resulttype,
00741                                 const char* str1,
00742                                 const AR_DATA *str1len,
00743                                 const AR_TYPE *str1lentype,
00744                                 const char* str2,
00745                                 const AR_DATA *str2len,
00746                                 const AR_TYPE *str2lentype,
00747                                 const AR_DATA *backward,
00748                                 const AR_TYPE *backwardtype);
00749 
00750 int AR_reshape (void *result,
00751                                 const void *source,
00752                                 const void *shape,
00753                                 const void *pad,
00754                                 const void *order);
00755 
00756 int AR_scan    (AR_DATA *result,
00757                                 const AR_TYPE *resulttype,
00758                                 const char* str1,
00759                                 const AR_DATA *str1len,
00760                                 const AR_TYPE *str1lentype,
00761                                 const char* str2,
00762                                 const AR_DATA *str2len,
00763                                 const AR_TYPE *str2lentype,
00764                                 const AR_DATA *backward,
00765                                 const AR_TYPE *backwardtype);
00766 
00767 int AR_selected_real_kind(AR_DATA *result,
00768                                 const AR_TYPE *resulttype,
00769                                 const AR_DATA *opnd1,
00770                                 const AR_TYPE *opnd1type,
00771                                 const AR_DATA *opnd2,
00772                                 const AR_TYPE *opnd2type);
00773 
00774 int AR_transfer(void *result,
00775                                 const void *source,
00776                                 const void *mold,
00777                                 const AR_DATA *size,
00778                                 const AR_TYPE *sizetype);
00779 
00780 int AR_verify  (AR_DATA *result,
00781                                 const AR_TYPE *resulttype,
00782                                 const char* str1,
00783                                 const AR_DATA *str1len,
00784                                 const AR_TYPE *str1lentype,
00785                                 const char* str2,
00786                                 const AR_DATA *str2len,
00787                                 const AR_TYPE *str2lentype,
00788                                 const AR_DATA *backward,
00789                                 const AR_TYPE *backwardtype);
00790 
00791 
00792 /* Special global constants */
00793 
00794 extern AR_DATA AR_const_zero;
00795 extern AR_DATA AR_const_one;
00796 extern AR_DATA AR_const_two;
00797 
00798 extern AR_DATA AR_const_false;
00799 extern AR_DATA AR_const_true;
00800 
00801 #endif  /* AR_H */
00802 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines