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 // 00037 // Generate pseudo instruction encoding and decoding information. 00040 #include "topcode.h" 00041 #include "isa_pseudo_gen.h" 00042 00043 main() 00044 { 00045 ISA_Pseudo_Begin("ia64"); 00046 00047 /* ========== machine to pseudo instruction translations ========== */ 00048 00049 Machine_To_Pseudo(TOP_alloc, TOP_alloc_3); 00050 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00051 Map_Arg("OPND(0)", "0"); // i = 0 00052 Map_Arg("OPND(1)", "OPND(1)"); // l = sol 00053 Map_Arg("OPND(2)", "OPND(0) - OPND(1)"); // o = sof - sol 00054 Map_Arg("OPND(3)", "OPND(2)"); // r = sor 00055 00056 Machine_To_Pseudo(TOP_br, TOP_br_cond); 00057 Require("OPND(0) == 0"); // qp == p0 00058 Require("OPND(1) == 0"); // bwh == sptk 00059 Map_Arg("OPND(0)", "OPND(2)"); // ph 00060 Map_Arg("OPND(1)", "OPND(3)"); // dh 00061 Map_Arg("OPND(2)", "OPND(4)"); // target_25 00062 00063 Machine_To_Pseudo(TOP_br_r, TOP_br_r_cond); 00064 Require("OPND(0) == 0"); // qp == p0 00065 Require("OPND(1) == 0"); // bwh == sptk 00066 Map_Arg("OPND(0)", "OPND(2)"); // ph 00067 Map_Arg("OPND(1)", "OPND(3)"); // dh 00068 Map_Arg("OPND(2)", "OPND(4)"); // b2 00069 00070 Machine_To_Pseudo(TOP_brl, TOP_brl_cond); 00071 Require("OPND(0) == 0"); // qp == p0 00072 Require("OPND(1) == 0"); // bwh == sptk 00073 Map_Arg("OPND(0)", "OPND(2)"); // ph 00074 Map_Arg("OPND(1)", "OPND(3)"); // dh 00075 Map_Arg("OPND(2)", "OPND(4)"); // target_64 00076 00077 Machine_To_Pseudo(TOP_fabs, TOP_fmerge_s); 00078 Require("OPND(1) == 0"); // f2 00079 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00080 Map_Arg("OPND(0)", "OPND(0)"); // qp 00081 Map_Arg("OPND(1)", "OPND(2)"); // f3 00082 00083 Machine_To_Pseudo(TOP_fadd, TOP_fma); 00084 Require("OPND(3) == 1"); // f4 00085 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00086 Map_Arg("OPND(0)", "OPND(0)"); // qp 00087 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00088 Map_Arg("OPND(2)", "OPND(2)"); // f3 00089 Map_Arg("OPND(3)", "OPND(4)"); // f2 00090 00091 Machine_To_Pseudo(TOP_fadd_d, TOP_fma_d); 00092 Require("OPND(3) == 1"); // f4 00093 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00094 Map_Arg("OPND(0)", "OPND(0)"); // qp 00095 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00096 Map_Arg("OPND(2)", "OPND(2)"); // f3 00097 Map_Arg("OPND(3)", "OPND(4)"); // f2 00098 00099 Machine_To_Pseudo(TOP_fadd_s, TOP_fma_s); 00100 Require("OPND(3) == 1"); // f4 00101 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00102 Map_Arg("OPND(0)", "OPND(0)"); // qp 00103 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00104 Map_Arg("OPND(2)", "OPND(2)"); // f3 00105 Map_Arg("OPND(3)", "OPND(4)"); // f2 00106 00107 // TOP_fclass_nm 00108 // TOP_fclass_nm_unc 00109 // These cannot be uniquely identified. 00110 00111 // TOP_fcvt_xuf 00112 // TOP_fcvt_xuf_s 00113 // TOP_fcvt_xuf_d 00114 // These have the same translation as fnorm. 00115 00116 Machine_To_Pseudo(TOP_fmpy, TOP_fma); 00117 Require("OPND(4) == 0"); // f2 00118 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00119 Map_Arg("OPND(0)", "OPND(0)"); // qp 00120 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00121 Map_Arg("OPND(2)", "OPND(2)"); // f3 00122 Map_Arg("OPND(3)", "OPND(3)"); // f4 00123 00124 Machine_To_Pseudo(TOP_fmpy_s, TOP_fma_s); 00125 Require("OPND(4) == 0"); // f2 00126 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00127 Map_Arg("OPND(0)", "OPND(0)"); // qp 00128 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00129 Map_Arg("OPND(2)", "OPND(2)"); // f3 00130 Map_Arg("OPND(3)", "OPND(3)"); // f4 00131 00132 Machine_To_Pseudo(TOP_fmpy_d, TOP_fma_d); 00133 Require("OPND(4) == 0"); // f2 00134 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00135 Map_Arg("OPND(0)", "OPND(0)"); // qp 00136 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00137 Map_Arg("OPND(2)", "OPND(2)"); // f3 00138 Map_Arg("OPND(3)", "OPND(3)"); // f4 00139 00140 Machine_To_Pseudo(TOP_fneg, TOP_fmerge_ns); 00141 Require("OPND(1) == OPND(2)"); // f3 00142 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00143 Map_Arg("OPND(0)", "OPND(0)"); // qp 00144 Map_Arg("OPND(1)", "OPND(1)"); // f3 00145 00146 Machine_To_Pseudo(TOP_fnegabs, TOP_fmerge_ns); 00147 Require("OPND(1) == 0"); // f2 00148 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00149 Map_Arg("OPND(0)", "OPND(0)"); // qp 00150 Map_Arg("OPND(1)", "OPND(2)"); // f3 00151 00152 Machine_To_Pseudo(TOP_fnmpy, TOP_fnma); 00153 Require("OPND(4) == 0"); // f2 00154 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00155 Map_Arg("OPND(0)", "OPND(0)"); // qp 00156 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00157 Map_Arg("OPND(2)", "OPND(2)"); // f3 00158 Map_Arg("OPND(3)", "OPND(3)"); // f4 00159 00160 Machine_To_Pseudo(TOP_fnmpy_s, TOP_fnma_s); 00161 Require("OPND(4) == 0"); // f2 00162 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00163 Map_Arg("OPND(0)", "OPND(0)"); // qp 00164 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00165 Map_Arg("OPND(2)", "OPND(2)"); // f3 00166 Map_Arg("OPND(3)", "OPND(3)"); // f4 00167 00168 Machine_To_Pseudo(TOP_fnmpy_d, TOP_fnma_d); 00169 Require("OPND(4) == 0"); // f2 00170 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00171 Map_Arg("OPND(0)", "OPND(0)"); // qp 00172 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00173 Map_Arg("OPND(2)", "OPND(2)"); // f3 00174 Map_Arg("OPND(3)", "OPND(3)"); // f4 00175 00176 Machine_To_Pseudo(TOP_fnorm, TOP_fma); 00177 Require("OPND(3) == 1"); // f4 00178 Require("OPND(4) == 0"); // f2 00179 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00180 Map_Arg("OPND(0)", "OPND(0)"); // qp 00181 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00182 Map_Arg("OPND(2)", "OPND(2)"); // f3 00183 00184 Machine_To_Pseudo(TOP_fnorm_s, TOP_fma_s); 00185 Require("OPND(3) == 1"); // f4 00186 Require("OPND(4) == 0"); // f2 00187 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00188 Map_Arg("OPND(0)", "OPND(0)"); // qp 00189 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00190 Map_Arg("OPND(2)", "OPND(2)"); // f3 00191 00192 Machine_To_Pseudo(TOP_fnorm_d, TOP_fma_d); 00193 Require("OPND(3) == 1"); // f4 00194 Require("OPND(4) == 0"); // f2 00195 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00196 Map_Arg("OPND(0)", "OPND(0)"); // qp 00197 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00198 Map_Arg("OPND(2)", "OPND(2)"); // f3 00199 00200 Machine_To_Pseudo(TOP_fpabs, TOP_fpmerge_s); 00201 Require("OPND(1) == 0"); // f2 00202 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00203 Map_Arg("OPND(0)", "OPND(0)"); // qp 00204 Map_Arg("OPND(1)", "OPND(2)"); // f3 00205 00206 Machine_To_Pseudo(TOP_fpmpy, TOP_fpma); 00207 Require("OPND(4) == 0"); // f2 00208 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00209 Map_Arg("OPND(0)", "OPND(0)"); // qp 00210 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00211 Map_Arg("OPND(2)", "OPND(2)"); // f3 00212 Map_Arg("OPND(3)", "OPND(3)"); // f4 00213 00214 Machine_To_Pseudo(TOP_fpneg, TOP_fpmerge_ns); 00215 Require("OPND(1) == OPND(2)"); // f3 00216 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00217 Map_Arg("OPND(0)", "OPND(0)"); // qp 00218 Map_Arg("OPND(1)", "OPND(1)"); // f3 00219 00220 Machine_To_Pseudo(TOP_fpnegabs, TOP_fpmerge_ns); 00221 Require("OPND(1) == 0"); // f2 00222 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00223 Map_Arg("OPND(0)", "OPND(0)"); // qp 00224 Map_Arg("OPND(1)", "OPND(2)"); // f3 00225 00226 Machine_To_Pseudo(TOP_fpnmpy, TOP_fpnma); 00227 Require("OPND(4) == 0"); // f2 00228 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00229 Map_Arg("OPND(0)", "OPND(0)"); // qp 00230 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00231 Map_Arg("OPND(2)", "OPND(2)"); // f3 00232 Map_Arg("OPND(3)", "OPND(3)"); // f4 00233 00234 Machine_To_Pseudo(TOP_fsub, TOP_fms); 00235 Require("OPND(3) == 1"); // f4 00236 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00237 Map_Arg("OPND(0)", "OPND(0)"); // qp 00238 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00239 Map_Arg("OPND(2)", "OPND(2)"); // f3 00240 Map_Arg("OPND(3)", "OPND(4)"); // f2 00241 00242 Machine_To_Pseudo(TOP_fsub_s, TOP_fms_s); 00243 Require("OPND(3) == 1"); // f4 00244 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00245 Map_Arg("OPND(0)", "OPND(0)"); // qp 00246 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00247 Map_Arg("OPND(2)", "OPND(2)"); // f3 00248 Map_Arg("OPND(3)", "OPND(4)"); // f2 00249 00250 Machine_To_Pseudo(TOP_fsub_d, TOP_fms_d); 00251 Require("OPND(3) == 1"); // f4 00252 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00253 Map_Arg("OPND(0)", "OPND(0)"); // qp 00254 Map_Arg("OPND(1)", "OPND(1)"); // .sf 00255 Map_Arg("OPND(2)", "OPND(2)"); // f3 00256 Map_Arg("OPND(3)", "OPND(4)"); // f2 00257 00258 Machine_To_Pseudo(TOP_mov_t_br, TOP_mov_t_br_i); 00259 Require("OPND(1) == 1"); // mwh == none 00260 Require("OPND(2) == 0"); // ph_pvec_ih == 0 00261 Require("OPND(4) == 0"); // tag_13 == 0 00262 Map_Arg("RESULT(0)", "RESULT(0)"); // b1 00263 Map_Arg("OPND(0)", "OPND(0)"); // qp 00264 Map_Arg("OPND(1)", "OPND(3)"); // r2 00265 00266 Machine_To_Pseudo(TOP_mov_f, TOP_fmerge_s); 00267 Require("OPND(1) == OPND(2)"); // f2 == f3 00268 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00269 Map_Arg("OPND(0)", "OPND(0)"); // qp 00270 Map_Arg("OPND(1)", "OPND(1)"); // f3 00271 00272 Machine_To_Pseudo(TOP_mov, TOP_adds); 00273 Require("OPND(1) == 0"); // imm_14 == 0 00274 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00275 Map_Arg("OPND(0)", "OPND(0)"); // qp 00276 Map_Arg("OPND(1)", "OPND(2)"); // r3 00277 00278 Machine_To_Pseudo(TOP_mov_i, TOP_addl); 00279 Require("OPND(2) == 0"); // r3 == 0 00280 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00281 Map_Arg("OPND(0)", "OPND(0)"); // qp 00282 Map_Arg("OPND(1)", "OPND(1)"); // imm_22 00283 00284 Machine_To_Pseudo(TOP_shl_i, TOP_dep_z); 00285 Require("OPND(2) == 64 - OPND(3)"); // pos_6 == 64 - len_6 00286 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00287 Map_Arg("OPND(0)", "OPND(0)"); // qp 00288 Map_Arg("OPND(1)", "OPND(1)"); // r2 00289 Map_Arg("OPND(2)", "OPND(2)"); // count_6 = pos_6 00290 00291 Machine_To_Pseudo(TOP_shr_i, TOP_extr); 00292 Require("OPND(2) == 64 - OPND(3)"); // pos_6 == 64 - len_6 00293 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00294 Map_Arg("OPND(0)", "OPND(0)"); // qp 00295 Map_Arg("OPND(1)", "OPND(1)"); // r2 00296 Map_Arg("OPND(2)", "OPND(2)"); // count_6 = pos_6 00297 00298 Machine_To_Pseudo(TOP_shr_i_u, TOP_extr_u); 00299 Require("OPND(2) == 64 - OPND(3)"); // pos_6 == 64 - len_6 00300 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00301 Map_Arg("OPND(0)", "OPND(0)"); // qp 00302 Map_Arg("OPND(1)", "OPND(1)"); // r2 00303 Map_Arg("OPND(2)", "OPND(2)"); // count_6 = pos_6 00304 00305 Machine_To_Pseudo(TOP_xmpy_l, TOP_xma_l); 00306 Require("OPND(3) == 0"); // f2 00307 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00308 Map_Arg("OPND(0)", "OPND(0)"); // qp 00309 Map_Arg("OPND(1)", "OPND(1)"); // f3 00310 Map_Arg("OPND(2)", "OPND(2)"); // f4 00311 00312 Machine_To_Pseudo(TOP_xmpy_h, TOP_xma_h); 00313 Require("OPND(3) == 0"); // f2 00314 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00315 Map_Arg("OPND(0)", "OPND(0)"); // qp 00316 Map_Arg("OPND(1)", "OPND(1)"); // f3 00317 Map_Arg("OPND(2)", "OPND(2)"); // f4 00318 00319 Machine_To_Pseudo(TOP_xmpy_hu, TOP_xma_hu); 00320 Require("OPND(3) == 0"); // f2 00321 Map_Arg("RESULT(0)", "RESULT(0)"); // f1 00322 Map_Arg("OPND(0)", "OPND(0)"); // qp 00323 Map_Arg("OPND(1)", "OPND(1)"); // f3 00324 Map_Arg("OPND(2)", "OPND(2)"); // f4 00325 00326 // TOP_tbit_nz 00327 // TOP_tbit_nz_unc 00328 // TOP_tnat_nz 00329 // TOP_tnat_nz_unc 00330 // TOP_xma_lu 00331 // TOP_xmpy_lu 00332 // These cannot be uniquely identified. 00333 00334 /* ========== pseudo to machine instruction translations ========== */ 00335 00336 Pseudo_To_Machine(TOP_alloc_3, TOP_alloc); 00337 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00338 Map_Arg("OPND(0)", "OPND(0) + OPND(1) + OPND(2)"); // sof = i + l + o 00339 Map_Arg("OPND(1)", "OPND(0) + OPND(1)"); // sol = i + l 00340 Map_Arg("OPND(2)", "OPND(3)"); // sor = r 00341 00342 Pseudo_To_Machine(TOP_dep_z, TOP_shl_i); 00343 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00344 Map_Arg("OPND(0)", "OPND(0)"); // qp 00345 Map_Arg("OPND(1)", "OPND(1)"); // r2 00346 Map_Arg("OPND(2)", "OPND(2)"); // pos_6 = count_6 00347 Map_Arg("OPND(3)", "64 - OPND(2)"); // len_6 = 64 - count_6 00348 00349 Pseudo_To_Machine(TOP_extr, TOP_shr_i); 00350 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00351 Map_Arg("OPND(0)", "OPND(0)"); // qp 00352 Map_Arg("OPND(1)", "OPND(1)"); // r2 00353 Map_Arg("OPND(2)", "OPND(2)"); // pos_6 = count_6 00354 Map_Arg("OPND(3)", "64 - OPND(2)"); // len_6 = 64 - count_6 00355 00356 Pseudo_To_Machine(TOP_extr_u, TOP_shr_i_u); 00357 Map_Arg("RESULT(0)", "RESULT(0)"); // r1 00358 Map_Arg("OPND(0)", "OPND(0)"); // qp 00359 Map_Arg("OPND(1)", "OPND(1)"); // r2 00360 Map_Arg("OPND(2)", "OPND(2)"); // pos_6 = count_6 00361 Map_Arg("OPND(3)", "64 - OPND(2)"); // len_6 = 64 - count_6 00362 00363 ISA_Pseudo_End(); 00364 return 0; 00365 }