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.1 of the GNU Lesser General Public License 00007 as 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 Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 /* automatically generated file, do not edit */ 00037 00038 #include "f90_intrinsic.h" 00039 00040 void 00041 _TRANS( 00042 DopeVectorType *result, 00043 DopeVectorType *matrix) 00044 { 00045 char * result_p, * result_b ; 00046 char * matrix_p, * matrix_b ; 00047 00048 size_t src_extent [MAX_NARY_DIMS] ; 00049 size_t src_stride [MAX_NARY_DIMS] ; 00050 size_t src_offset [MAX_NARY_DIMS] ; 00051 size_t counter[MAX_NARY_DIMS] ; 00052 00053 size_t res_stride [MAX_NARY_DIMS] ; 00054 size_t res_extent [MAX_NARY_DIMS] ; 00055 size_t res_offset [MAX_NARY_DIMS] ; 00056 00057 int32_t j,ii; 00058 char *rp, *ap ; 00059 int32_t res_rank ; 00060 int32_t src_rank = GET_RANK_FROM_DESC(matrix) - 1; 00061 00062 size_t typ_sz = GET_ELEMENT_SZ_FROM_DESC(matrix); 00063 00064 size_t a_size,a_stride,r_stride, i,k ; 00065 int8_t zero_szd_source = FALSE; 00066 int8_t byte_aligned = FALSE; 00067 00068 int32_t ddim ; 00069 00070 size_t num_trues ; 00071 int32_t local_alloc ; 00072 size_t tot_ext ; 00073 size_t str_sz ; 00074 00075 size_t src_size ; 00076 00077 size_t res_sz; 00078 size_t xfer_sz; 00079 size_t tot_sz; 00080 00081 for ( j = 0 ; j <= src_rank ; j ++ ) { 00082 src_extent[j] = GET_EXTENT_FROM_DESC(matrix,j) ; 00083 src_stride[j] = GET_STRIDE_FROM_DESC(matrix,j) ; 00084 counter[j] = 0 ; 00085 zero_szd_source = zero_szd_source || (src_extent[j] == 0) ; 00086 } 00087 00088 byte_aligned = GET_BYTEALIGNED_FROM_DESC(matrix) ; 00089 00090 if (!GET_ASSOCIATED_FROM_DESC(result)) { 00091 00092 size_t nbytes ; 00093 size_t ext ; 00094 char *p ; 00095 00096 SET_ADDRESS_IN_DESC(result,NULL); 00097 SET_ORIG_BS_IN_DESC(result,NULL) ; 00098 SET_ORIG_SZ_IN_DESC(result,0) ; 00099 00100 p = NULL ; 00101 tot_ext = 1 ; 00102 nbytes = typ_sz ; 00103 str_sz = MK_STRIDE(byte_aligned,typ_sz); 00104 00105 for ( i = 0 ; i <= src_rank ; i ++) { 00106 ext = GET_EXTENT_FROM_DESC(matrix,src_rank-i) ; 00107 SET_LBOUND_IN_DESC(result,i,1); 00108 SET_EXTENT_IN_DESC(result,i,ext); 00109 SET_STRMULT_IN_DESC(result,i,tot_ext * str_sz ); 00110 tot_ext *= ext; 00111 nbytes *= ext; 00112 } 00113 00114 if (nbytes > 0) { 00115 p = (void *) malloc (nbytes); 00116 if (p == NULL) 00117 ERROR(_LELVL_ABORT, FENOMEMY); 00118 00119 SET_ADDRESS_IN_DESC(result,p); 00120 } 00121 00122 SET_CONTIG_IN_DESC(result); 00123 SET_ASSOCIATED_IN_DESC(result); 00124 if (GET_DV_ASCII_FROM_DESC(matrix)) { 00125 SET_CHARPTR_IN_DESC(result,p,typ_sz); 00126 } 00127 SET_ORIG_BS_IN_DESC(result,p) ; 00128 SET_ORIG_SZ_IN_DESC(result,nbytes * 8) ; 00129 } 00130 00131 for ( j = 0 ; j <= src_rank ; j ++ ) { 00132 res_stride [j] = GET_STRIDE_FROM_DESC(result,src_rank - j) ; 00133 } 00134 00135 for ( j = 1 ; j <= src_rank ; j ++ ) { 00136 src_offset[j-1] = src_stride[j] - (src_stride [j-1] * (src_extent[j-1])) ; 00137 res_offset[j-1] = res_stride[j] - (res_stride [j-1] * (src_extent[j-1])) ; 00138 } 00139 00140 if (zero_szd_source) 00141 return ; 00142 00143 a_size = src_extent[0] ; 00144 a_stride = src_stride[0] ; 00145 r_stride = res_stride[0] ; 00146 matrix_p = GET_ADDRESS_FROM_DESC(matrix); 00147 result_p = GET_ADDRESS_FROM_DESC(result); 00148 00149 { 00150 while (counter[src_rank] < src_extent[src_rank] ) { 00151 for ( i = 0 ; i < a_size ; i ++ ) { 00152 ap = matrix_p ; 00153 rp = result_p ; 00154 if (typ_sz > BIGDEFAULTSZ) 00155 (void) memcpy (rp, ap, typ_sz); 00156 else 00157 for (j = 0 ; j < typ_sz ; j ++) *rp++ = *ap ++ ; 00158 matrix_p += a_stride ; 00159 result_p += r_stride ; 00160 } 00161 counter[0] = a_size ; 00162 j = 0 ; 00163 while ((counter[j] == src_extent[j]) && (j < src_rank)) { 00164 matrix_p += src_offset[j] ; 00165 result_p += res_offset[j] ; 00166 counter[j+1]++ ; 00167 counter[j] = 0 ; 00168 j ++ ; 00169 } 00170 00171 } 00172 } 00173 }