4 * this is machine dependent, but it is totally
5 * common on all of the 64-bit symulating machines.
8 #define FNX 100 /* botch -- redefinition */
68 char etconv[NTYPE]; /* for _vasop */
85 fvn(char *name, int type)
90 n->sym = slookup(name);
91 n->sym->sig = SIGINTERN;
92 if(fntypes[type] == 0)
93 fntypes[type] = typ(TFUNC, types[type]);
94 n->type = fntypes[type];
107 nodaddv = fvn("_addv", TVLONG);
108 nodsubv = fvn("_subv", TVLONG);
109 nodmulv = fvn("_mulv", TVLONG);
110 noddivv = fvn("_divv", TVLONG);
111 noddivvu = fvn("_divvu", TVLONG);
112 nodmodv = fvn("_modv", TVLONG);
113 nodmodvu = fvn("_modvu", TVLONG);
114 nodlshv = fvn("_lshv", TVLONG);
115 nodrshav = fvn("_rshav", TVLONG);
116 nodrshlv = fvn("_rshlv", TVLONG);
117 nodandv = fvn("_andv", TVLONG);
118 nodorv = fvn("_orv", TVLONG);
119 nodxorv = fvn("_xorv", TVLONG);
120 nodnegv = fvn("_negv", TVLONG);
121 nodcomv = fvn("_comv", TVLONG);
123 nodtestv = fvn("_testv", TLONG);
124 nodeqv = fvn("_eqv", TLONG);
125 nodnev = fvn("_nev", TLONG);
126 nodlev = fvn("_lev", TLONG);
127 nodltv = fvn("_ltv", TLONG);
128 nodgev = fvn("_gev", TLONG);
129 nodgtv = fvn("_gtv", TLONG);
130 nodhiv = fvn("_hiv", TLONG);
131 nodhsv = fvn("_hsv", TLONG);
132 nodlov = fvn("_lov", TLONG);
133 nodlsv = fvn("_lsv", TLONG);
135 nodf2v = fvn("_f2v", TVLONG);
136 nodd2v = fvn("_d2v", TVLONG);
137 nodp2v = fvn("_p2v", TVLONG);
138 nodsi2v = fvn("_si2v", TVLONG);
139 nodui2v = fvn("_ui2v", TVLONG);
140 nodsl2v = fvn("_sl2v", TVLONG);
141 nodul2v = fvn("_ul2v", TVLONG);
142 nodsh2v = fvn("_sh2v", TVLONG);
143 noduh2v = fvn("_uh2v", TVLONG);
144 nodsc2v = fvn("_sc2v", TVLONG);
145 noduc2v = fvn("_uc2v", TVLONG);
147 nodv2f = fvn("_v2f", TFLOAT);
148 nodv2d = fvn("_v2d", TDOUBLE);
149 nodv2sl = fvn("_v2sl", TLONG);
150 nodv2ul = fvn("_v2ul", TULONG);
151 nodv2si = fvn("_v2si", TINT);
152 nodv2ui = fvn("_v2ui", TUINT);
153 nodv2sh = fvn("_v2sh", TSHORT);
154 nodv2uh = fvn("_v2ul", TUSHORT);
155 nodv2sc = fvn("_v2sc", TCHAR);
156 nodv2uc = fvn("_v2uc", TUCHAR);
158 nodvpp = fvn("_vpp", TVLONG);
159 nodppv = fvn("_ppv", TVLONG);
160 nodvmm = fvn("_vmm", TVLONG);
161 nodmmv = fvn("_mmv", TVLONG);
163 nodvasop = fvn("_vasop", TVLONG);
165 for(p = initetconv; p->code >= 0; p++)
166 etconv[p->code] = p->value;
182 if(l && l->type && typev[l->type->etype])
185 if(r && r->type && typev[r->type->etype])
227 r = new(OFUNC, nodtestv, r);
231 r->type = types[TLONG];
239 l = new(OFUNC, nodtestv, l);
243 l->type = types[TLONG];
255 r = new(OFUNC, nodtestv, r);
259 r->type = types[TLONG];
266 if(typev[n->type->etype]) {
271 diag(n, "unknown vlong %O", n->op);
339 switch(l->type->etype) {
374 diag(n, "unknown %T->vlong cast", l->type);
419 if(typefd[n->type->etype] && l && l->op == OFUNC) {
435 if(l->right && typev[l->right->etype]) {
436 diag(n, "sorry float <asop> vlong not implemented\n");
442 if(l->type && typev[l->type->etype]) {
445 switch(n->type->etype) {
476 case TIND: // small pun here
480 diag(n, "unknown vlong->%T cast", n->type);
489 n->right = new(OLIST, l, r);
495 l = new(OCAST, l, 0);
496 l->type = types[TLONG];
497 l->complex = l->left->complex;
508 l = new(OADDR, l, Z);
509 l->type = typ(TIND, l->left->type);
510 l->complex = l->left->complex;
511 n->right = new(OLIST, l, r);
520 n->right = new(OLIST, l, r);
523 n->type = types[TLONG];
532 t = new(OCONST, 0, 0);
533 t->vconst = etconv[l->type->etype];
534 t->type = types[TLONG];
536 r = new(OLIST, t, r);
538 t = new(OADDR, a, 0);
539 t->type = typ(TIND, a->type);
540 r = new(OLIST, t, r);
542 t = new(OADDR, l, 0);
543 t->type = typ(TIND, l->type);
544 t->complex = l->complex;
545 r = new(OLIST, t, r);
562 if(typev[n->type->etype]) {
563 n1 = new(OXXX, 0, 0);
571 n->type = types[TLONG];
576 * more machine depend stuff.
577 * this is common for 8,16,32,64 bit machines.
578 * this is common for ieee machines.
600 convftox(double d, int et)
604 diag(Z, "bad type in castftox %s", tnames[et]);
609 convvtox(vlong c, int et)