cg68kadd.pas 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Generate m68k assembler for add node
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit cg68kadd;
  19. interface
  20. uses
  21. tree;
  22. procedure secondadd(var p : ptree);
  23. implementation
  24. uses
  25. cobjects,verbose,globals,systems,
  26. symtable,aasm,types,
  27. temp_gen,hcodegen,pass_2,
  28. m68k,cga68k,tgen68k;
  29. {*****************************************************************************
  30. Helpers
  31. *****************************************************************************}
  32. procedure processcc(p: ptree);
  33. const
  34. { process condition codes bit definitions }
  35. CARRY_FLAG = $01;
  36. OVFL_FLAG = $02;
  37. ZERO_FLAG = $04;
  38. NEG_FLAG = $08;
  39. var
  40. label1,label2: plabel;
  41. (*************************************************************************)
  42. (* Description: This routine handles the conversion of Floating point *)
  43. (* condition codes to normal cpu condition codes. *)
  44. (*************************************************************************)
  45. begin
  46. getlabel(label1);
  47. getlabel(label2);
  48. case p^.treetype of
  49. equaln,unequaln: begin
  50. { not equal clear zero flag }
  51. emitl(A_FBEQ,label1);
  52. exprasmlist^.concat(new(pai68k, op_const_reg(
  53. A_AND, S_B, NOT ZERO_FLAG, R_CCR)));
  54. emitl(A_BRA,label2);
  55. emitl(A_LABEL,label1);
  56. { equal - set zero flag }
  57. exprasmlist^.concat(new(pai68k, op_const_reg(
  58. A_OR,S_B, ZERO_FLAG, R_CCR)));
  59. emitl(A_LABEL,label2);
  60. end;
  61. ltn: begin
  62. emitl(A_FBLT,label1);
  63. { not less than }
  64. { clear N and V flags }
  65. exprasmlist^.concat(new(pai68k, op_const_reg(
  66. A_AND, S_B, NOT (NEG_FLAG OR OVFL_FLAG), R_CCR)));
  67. emitl(A_BRA,label2);
  68. emitl(A_LABEL,label1);
  69. { less than }
  70. exprasmlist^.concat(new(pai68k, op_const_reg(
  71. A_OR,S_B, NEG_FLAG, R_CCR)));
  72. exprasmlist^.concat(new(pai68k, op_const_reg(
  73. A_AND,S_B, NOT OVFL_FLAG, R_CCR)));
  74. emitl(A_LABEL,label2);
  75. end;
  76. gtn: begin
  77. emitl(A_FBGT,label1);
  78. { not greater than }
  79. { set Z flag }
  80. exprasmlist^.concat(new(pai68k, op_const_reg(
  81. A_OR, S_B, ZERO_FLAG, R_CCR)));
  82. emitl(A_BRA,label2);
  83. emitl(A_LABEL,label1);
  84. { greater than }
  85. { set N and V flags }
  86. exprasmlist^.concat(new(pai68k, op_const_reg(
  87. A_OR,S_B, NEG_FLAG OR OVFL_FLAG , R_CCR)));
  88. emitl(A_LABEL,label2);
  89. end;
  90. gten: begin
  91. emitl(A_FBGE,label1);
  92. { not greater or equal }
  93. { set N and clear V }
  94. exprasmlist^.concat(new(pai68k, op_const_reg(
  95. A_AND, S_B, NOT OVFL_FLAG, R_CCR)));
  96. exprasmlist^.concat(new(pai68k, op_const_reg(
  97. A_OR,S_B, NEG_FLAG, R_CCR)));
  98. emitl(A_BRA,label2);
  99. emitl(A_LABEL,label1);
  100. { greater or equal }
  101. { clear V and N flags }
  102. exprasmlist^.concat(new(pai68k, op_const_reg(
  103. A_AND, S_B, NOT (OVFL_FLAG OR NEG_FLAG), R_CCR)));
  104. emitl(A_LABEL,label2);
  105. end;
  106. lten: begin
  107. emitl(A_FBLE,label1);
  108. { not less or equal }
  109. { clear Z, N and V }
  110. exprasmlist^.concat(new(pai68k, op_const_reg(
  111. A_AND, S_B, NOT (ZERO_FLAG OR NEG_FLAG OR OVFL_FLAG), R_CCR)));
  112. emitl(A_BRA,label2);
  113. emitl(A_LABEL,label1);
  114. { less or equal }
  115. { set Z and N }
  116. { and clear V }
  117. exprasmlist^.concat(new(pai68k, op_const_reg(
  118. A_OR,S_B, ZERO_FLAG OR NEG_FLAG, R_CCR)));
  119. exprasmlist^.concat(new(pai68k, op_const_reg(
  120. A_AND,S_B, NOT OVFL_FLAG, R_CCR)));
  121. emitl(A_LABEL,label2);
  122. end;
  123. else
  124. begin
  125. InternalError(34);
  126. end;
  127. end; { end case }
  128. end;
  129. procedure SetResultLocation(cmpop,unsigned:boolean;var p :ptree);
  130. var
  131. flags : tresflags;
  132. begin
  133. { remove temporary location if not a set or string }
  134. if (p^.left^.resulttype^.deftype<>stringdef) and
  135. ((p^.left^.resulttype^.deftype<>setdef) or (psetdef(p^.left^.resulttype)^.settype=smallset)) and
  136. (p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  137. ungetiftemp(p^.left^.location.reference);
  138. if (p^.right^.resulttype^.deftype<>stringdef) and
  139. ((p^.right^.resulttype^.deftype<>setdef) or (psetdef(p^.right^.resulttype)^.settype=smallset)) and
  140. (p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  141. ungetiftemp(p^.right^.location.reference);
  142. { in case of comparison operation the put result in the flags }
  143. if cmpop then
  144. begin
  145. if not(unsigned) then
  146. begin
  147. if p^.swaped then
  148. case p^.treetype of
  149. equaln : flags:=F_E;
  150. unequaln : flags:=F_NE;
  151. ltn : flags:=F_G;
  152. lten : flags:=F_GE;
  153. gtn : flags:=F_L;
  154. gten : flags:=F_LE;
  155. end
  156. else
  157. case p^.treetype of
  158. equaln : flags:=F_E;
  159. unequaln : flags:=F_NE;
  160. ltn : flags:=F_L;
  161. lten : flags:=F_LE;
  162. gtn : flags:=F_G;
  163. gten : flags:=F_GE;
  164. end;
  165. end
  166. else
  167. begin
  168. if p^.swaped then
  169. case p^.treetype of
  170. equaln : flags:=F_E;
  171. unequaln : flags:=F_NE;
  172. ltn : flags:=F_A;
  173. lten : flags:=F_AE;
  174. gtn : flags:=F_B;
  175. gten : flags:=F_BE;
  176. end
  177. else
  178. case p^.treetype of
  179. equaln : flags:=F_E;
  180. unequaln : flags:=F_NE;
  181. ltn : flags:=F_B;
  182. lten : flags:=F_BE;
  183. gtn : flags:=F_A;
  184. gten : flags:=F_AE;
  185. end;
  186. end;
  187. p^.location.loc:=LOC_FLAGS;
  188. p^.location.resflags:=flags;
  189. end;
  190. end;
  191. {*****************************************************************************
  192. Addstring
  193. *****************************************************************************}
  194. procedure addstring(var p : ptree);
  195. var
  196. pushedregs : tpushed;
  197. href : treference;
  198. pushed,
  199. cmpop : boolean;
  200. begin
  201. { string operations are not commutative }
  202. if p^.swaped then
  203. swaptree(p);
  204. {$ifdef UseAnsiString}
  205. if is_ansistring(p^.left^.resulttype) then
  206. begin
  207. case p^.treetype of
  208. addn :
  209. begin
  210. { we do not need destination anymore }
  211. del_reference(p^.left^.location.reference);
  212. del_reference(p^.right^.location.reference);
  213. { concatansistring(p); }
  214. end;
  215. ltn,lten,gtn,gten,
  216. equaln,unequaln :
  217. begin
  218. pushusedregisters(pushedregs,$ff);
  219. secondpass(p^.left);
  220. del_reference(p^.left^.location.reference);
  221. emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
  222. secondpass(p^.right);
  223. del_reference(p^.right^.location.reference);
  224. emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
  225. emitcall('ANSISTRCMP',true);
  226. maybe_loada5;
  227. popusedregisters(pushedregs);
  228. end;
  229. end;
  230. end
  231. else
  232. {$endif UseAnsiString}
  233. case p^.treetype of
  234. addn : begin
  235. cmpop:=false;
  236. secondpass(p^.left);
  237. if (p^.left^.treetype<>addn) then
  238. begin
  239. { can only reference be }
  240. { string in register would be funny }
  241. { therefore produce a temporary string }
  242. { release the registers }
  243. del_reference(p^.left^.location.reference);
  244. gettempofsizereference(256,href);
  245. copystring(href,p^.left^.location.reference,255);
  246. ungetiftemp(p^.left^.location.reference);
  247. { does not hurt: }
  248. p^.left^.location.loc:=LOC_MEM;
  249. p^.left^.location.reference:=href;
  250. end;
  251. secondpass(p^.right);
  252. { on the right we do not need the register anymore too }
  253. del_reference(p^.right^.location.reference);
  254. pushusedregisters(pushedregs,$ffff);
  255. { WE INVERSE THE PARAMETERS!!! }
  256. { Because parameters are inversed in the rtl }
  257. emitpushreferenceaddr(p^.right^.location.reference);
  258. emitpushreferenceaddr(p^.left^.location.reference);
  259. emitcall('STRCONCAT',true);
  260. maybe_loadA5;
  261. popusedregisters(pushedregs);
  262. set_location(p^.location,p^.left^.location);
  263. ungetiftemp(p^.right^.location.reference);
  264. end; { this case }
  265. ltn,lten,gtn,gten,
  266. equaln,unequaln :
  267. begin
  268. secondpass(p^.left);
  269. { are too few registers free? }
  270. pushed:=maybe_push(p^.right^.registers32,p);
  271. secondpass(p^.right);
  272. if pushed then restore(p);
  273. cmpop:=true;
  274. del_reference(p^.right^.location.reference);
  275. del_reference(p^.left^.location.reference);
  276. { generates better code }
  277. { s='' and s<>'' }
  278. if (p^.treetype in [equaln,unequaln]) and
  279. (
  280. ((p^.left^.treetype=stringconstn) and
  281. (p^.left^.value_str^='')) or
  282. ((p^.right^.treetype=stringconstn) and
  283. (p^.right^.value_str^=''))
  284. ) then
  285. begin
  286. { only one node can be stringconstn }
  287. { else pass 1 would have evaluted }
  288. { this node }
  289. if p^.left^.treetype=stringconstn then
  290. exprasmlist^.concat(new(pai68k,op_ref(
  291. A_TST,S_B,newreference(p^.right^.location.reference))))
  292. else
  293. exprasmlist^.concat(new(pai68k,op_ref(
  294. A_TST,S_B,newreference(p^.left^.location.reference))));
  295. end
  296. else
  297. begin
  298. pushusedregisters(pushedregs,$ffff);
  299. { parameters are directly passed via registers }
  300. { this has several advantages, no loss of the flags }
  301. { on exit ,and MUCH faster on m68k machines }
  302. { speed difference (68000) }
  303. { normal routine: entry, exit code + push = 124 }
  304. { (best case) }
  305. { assembler routine: param setup (worst case) = 48 }
  306. exprasmlist^.concat(new(pai68k,op_ref_reg(
  307. A_LEA,S_L,newreference(p^.left^.location.reference),R_A0)));
  308. exprasmlist^.concat(new(pai68k,op_ref_reg(
  309. A_LEA,S_L,newreference(p^.right^.location.reference),R_A1)));
  310. {
  311. emitpushreferenceaddr(p^.left^.location.reference);
  312. emitpushreferenceaddr(p^.right^.location.reference); }
  313. emitcall('STRCMP',true);
  314. maybe_loada5;
  315. popusedregisters(pushedregs);
  316. end;
  317. ungetiftemp(p^.left^.location.reference);
  318. ungetiftemp(p^.right^.location.reference);
  319. end; { end this case }
  320. else Message(type_e_mismatch);
  321. end; { end case }
  322. SetResultLocation(cmpop,true,p);
  323. end;
  324. {*****************************************************************************
  325. Addset
  326. *****************************************************************************}
  327. procedure addset(var p : ptree);
  328. var
  329. cmpop,
  330. pushed : boolean;
  331. href : treference;
  332. pushedregs : tpushed;
  333. begin
  334. cmpop:=false;
  335. { not commutative }
  336. if p^.swaped then
  337. swaptree(p);
  338. secondpass(p^.left);
  339. { are too few registers free? }
  340. pushed:=maybe_push(p^.right^.registers32,p);
  341. secondpass(p^.right);
  342. if codegenerror then
  343. exit;
  344. if pushed then
  345. restore(p);
  346. set_location(p^.location,p^.left^.location);
  347. { handle operations }
  348. case p^.treetype of
  349. equaln,
  350. unequaln : begin
  351. cmpop:=true;
  352. del_reference(p^.left^.location.reference);
  353. del_reference(p^.right^.location.reference);
  354. pushusedregisters(pushedregs,$ff);
  355. emitpushreferenceaddr(p^.right^.location.reference);
  356. emitpushreferenceaddr(p^.left^.location.reference);
  357. emitcall('SET_COMP_SETS',true);
  358. maybe_loada5;
  359. popusedregisters(pushedregs);
  360. ungetiftemp(p^.left^.location.reference);
  361. ungetiftemp(p^.right^.location.reference);
  362. end;
  363. addn : begin
  364. { add can be an other SET or Range or Element ! }
  365. del_reference(p^.left^.location.reference);
  366. del_reference(p^.right^.location.reference);
  367. pushusedregisters(pushedregs,$ff);
  368. href.symbol:=nil;
  369. gettempofsizereference(32,href);
  370. { add a range or a single element? }
  371. if p^.right^.treetype=setelementn then
  372. begin
  373. concatcopy(p^.left^.location.reference,href,32,false);
  374. if assigned(p^.right^.right) then
  375. begin
  376. loadsetelement(p^.right^.right);
  377. loadsetelement(p^.right^.left);
  378. emitpushreferenceaddr(href);
  379. emitcall('SET_SET_RANGE',true);
  380. end
  381. else
  382. begin
  383. loadsetelement(p^.right^.left);
  384. emitpushreferenceaddr(href);
  385. emitcall('SET_SET_BYTE',true);
  386. end;
  387. end
  388. else
  389. begin
  390. { must be an other set }
  391. emitpushreferenceaddr(href);
  392. emitpushreferenceaddr(p^.right^.location.reference);
  393. emitpushreferenceaddr(p^.left^.location.reference);
  394. emitcall('SET_ADD_SETS',true);
  395. end;
  396. maybe_loada5;
  397. popusedregisters(pushedregs);
  398. ungetiftemp(p^.left^.location.reference);
  399. ungetiftemp(p^.right^.location.reference);
  400. p^.location.loc:=LOC_MEM;
  401. stringdispose(p^.location.reference.symbol);
  402. p^.location.reference:=href;
  403. end;
  404. subn,
  405. symdifn,
  406. muln : begin
  407. del_reference(p^.left^.location.reference);
  408. del_reference(p^.right^.location.reference);
  409. href.symbol:=nil;
  410. pushusedregisters(pushedregs,$ff);
  411. gettempofsizereference(32,href);
  412. emitpushreferenceaddr(href);
  413. emitpushreferenceaddr(p^.right^.location.reference);
  414. emitpushreferenceaddr(p^.left^.location.reference);
  415. case p^.treetype of
  416. subn : emitcall('SET_SUB_SETS',true);
  417. symdifn : emitcall('SET_SYMDIF_SETS',true);
  418. muln : emitcall('SET_MUL_SETS',true);
  419. end;
  420. maybe_loada5;
  421. popusedregisters(pushedregs);
  422. ungetiftemp(p^.left^.location.reference);
  423. ungetiftemp(p^.right^.location.reference);
  424. p^.location.loc:=LOC_MEM;
  425. stringdispose(p^.location.reference.symbol);
  426. p^.location.reference:=href;
  427. end;
  428. else
  429. Message(type_e_mismatch);
  430. end;
  431. SetResultLocation(cmpop,true,p);
  432. end;
  433. {*****************************************************************************
  434. SecondAdd
  435. *****************************************************************************}
  436. procedure secondadd(var p : ptree);
  437. { is also being used for xor, and "mul", "sub, or and comparative }
  438. { operators }
  439. label do_normal;
  440. var
  441. hregister : tregister;
  442. noswap,
  443. pushed,mboverflow,cmpop : boolean;
  444. op : tasmop;
  445. flags : tresflags;
  446. otl,ofl : plabel;
  447. power : longint;
  448. opsize : topsize;
  449. hl4: plabel;
  450. tmpref : treference;
  451. { true, if unsigned types are compared }
  452. unsigned : boolean;
  453. { true, if a small set is handled with the longint code }
  454. is_set : boolean;
  455. { is_in_dest if the result is put directly into }
  456. { the resulting refernce or varregister }
  457. is_in_dest : boolean;
  458. { true, if for sets subtractions the extra not should generated }
  459. extra_not : boolean;
  460. begin
  461. { to make it more readable, string and set (not smallset!) have their
  462. own procedures }
  463. case p^.left^.resulttype^.deftype of
  464. stringdef : begin
  465. addstring(p);
  466. exit;
  467. end;
  468. setdef : begin
  469. { normalsets are handled separate }
  470. if not(psetdef(p^.left^.resulttype)^.settype=smallset) then
  471. begin
  472. addset(p);
  473. exit;
  474. end;
  475. end;
  476. end;
  477. { defaults }
  478. unsigned:=false;
  479. is_in_dest:=false;
  480. extra_not:=false;
  481. noswap:=false;
  482. opsize:=S_L;
  483. { are we a (small)set, must be set here because the side can be
  484. swapped ! (PFV) }
  485. is_set:=(p^.left^.resulttype^.deftype=setdef);
  486. { calculate the operator which is more difficult }
  487. firstcomplex(p);
  488. { handling boolean expressions extra: }
  489. if ((p^.left^.resulttype^.deftype=orddef) and
  490. (porddef(p^.left^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) or
  491. ((p^.right^.resulttype^.deftype=orddef) and
  492. (porddef(p^.right^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) then
  493. begin
  494. if (porddef(p^.left^.resulttype)^.typ=bool8bit) or
  495. (porddef(p^.right^.resulttype)^.typ=bool8bit) then
  496. opsize:=S_B
  497. else
  498. if (porddef(p^.left^.resulttype)^.typ=bool16bit) or
  499. (porddef(p^.right^.resulttype)^.typ=bool16bit) then
  500. opsize:=S_W
  501. else
  502. opsize:=S_L;
  503. case p^.treetype of
  504. andn,
  505. orn : begin
  506. p^.location.loc:=LOC_JUMP;
  507. cmpop:=false;
  508. case p^.treetype of
  509. andn : begin
  510. otl:=truelabel;
  511. getlabel(truelabel);
  512. secondpass(p^.left);
  513. maketojumpbool(p^.left);
  514. emitl(A_LABEL,truelabel);
  515. truelabel:=otl;
  516. end;
  517. orn : begin
  518. ofl:=falselabel;
  519. getlabel(falselabel);
  520. secondpass(p^.left);
  521. maketojumpbool(p^.left);
  522. emitl(A_LABEL,falselabel);
  523. falselabel:=ofl;
  524. end;
  525. else
  526. Message(type_e_mismatch);
  527. end;
  528. secondpass(p^.right);
  529. maketojumpbool(p^.right);
  530. end;
  531. unequaln,
  532. equaln,xorn : begin
  533. if p^.left^.treetype=ordconstn then
  534. swaptree(p);
  535. secondpass(p^.left);
  536. p^.location:=p^.left^.location;
  537. { are enough registers free ? }
  538. pushed:=maybe_push(p^.right^.registers32,p);
  539. secondpass(p^.right);
  540. if pushed then restore(p);
  541. goto do_normal;
  542. end
  543. else
  544. Message(type_e_mismatch);
  545. end
  546. end
  547. else
  548. begin
  549. { in case of constant put it to the left }
  550. if (p^.left^.treetype=ordconstn) then
  551. swaptree(p);
  552. secondpass(p^.left);
  553. { this will be complicated as
  554. a lot of code below assumes that
  555. p^.location and p^.left^.location are the same }
  556. {$ifdef test_dest_loc}
  557. if dest_loc_known and (dest_loc_tree=p) and
  558. ((dest_loc.loc=LOC_REGISTER) or (dest_loc.loc=LOC_CREGISTER)) then
  559. begin
  560. set_location(p^.location,dest_loc);
  561. in_dest_loc:=true;
  562. is_in_dest:=true;
  563. end
  564. else
  565. {$endif test_dest_loc}
  566. set_location(p^.location,p^.left^.location);
  567. { are too few registers free? }
  568. pushed:=maybe_push(p^.right^.registers32,p);
  569. secondpass(p^.right);
  570. if pushed then
  571. restore(p);
  572. if (p^.left^.resulttype^.deftype=pointerdef) or
  573. (p^.right^.resulttype^.deftype=pointerdef) or
  574. ((p^.right^.resulttype^.deftype=objectdef) and
  575. pobjectdef(p^.right^.resulttype)^.isclass and
  576. (p^.left^.resulttype^.deftype=objectdef) and
  577. pobjectdef(p^.left^.resulttype)^.isclass
  578. ) or
  579. (p^.left^.resulttype^.deftype=classrefdef) or
  580. (p^.left^.resulttype^.deftype=procvardef) or
  581. (p^.left^.resulttype^.deftype=enumdef) or
  582. ((p^.left^.resulttype^.deftype=orddef) and
  583. (porddef(p^.left^.resulttype)^.typ=s32bit)) or
  584. ((p^.right^.resulttype^.deftype=orddef) and
  585. (porddef(p^.right^.resulttype)^.typ=s32bit)) or
  586. ((p^.left^.resulttype^.deftype=orddef) and
  587. (porddef(p^.left^.resulttype)^.typ=u32bit)) or
  588. ((p^.right^.resulttype^.deftype=orddef) and
  589. (porddef(p^.right^.resulttype)^.typ=u32bit)) or
  590. { as well as small sets }
  591. is_set then
  592. begin
  593. do_normal:
  594. mboverflow:=false;
  595. cmpop:=false;
  596. if (p^.left^.resulttype^.deftype=pointerdef) or
  597. (p^.right^.resulttype^.deftype=pointerdef) or
  598. ((p^.left^.resulttype^.deftype=orddef) and
  599. (porddef(p^.left^.resulttype)^.typ=u32bit)) or
  600. ((p^.right^.resulttype^.deftype=orddef) and
  601. (porddef(p^.right^.resulttype)^.typ=u32bit)) then
  602. unsigned:=true;
  603. case p^.treetype of
  604. addn : begin
  605. if is_set then
  606. begin
  607. { adding elements is not commutative }
  608. if p^.swaped and (p^.left^.treetype=setelementn) then
  609. swaptree(p);
  610. { are we adding set elements ? }
  611. if p^.right^.treetype=setelementn then
  612. begin
  613. { no range support for smallsets! }
  614. if assigned(p^.right^.right) then
  615. internalerror(43244);
  616. { Not supported for m68k}
  617. Comment(V_Fatal,'No smallsets for m68k');
  618. end
  619. else
  620. op:=A_OR;
  621. mboverflow:=false;
  622. unsigned:=false;
  623. end
  624. else
  625. begin
  626. op:=A_ADD;
  627. mboverflow:=true;
  628. end;
  629. end;
  630. symdifn : begin
  631. { the symetric diff is only for sets }
  632. if is_set then
  633. begin
  634. op:=A_EOR;
  635. mboverflow:=false;
  636. unsigned:=false;
  637. end
  638. else
  639. Message(type_e_mismatch);
  640. end;
  641. muln : begin
  642. if is_set then
  643. begin
  644. op:=A_AND;
  645. mboverflow:=false;
  646. unsigned:=false;
  647. end
  648. else
  649. begin
  650. if unsigned then
  651. op:=A_MULU
  652. else
  653. op:=A_MULS;
  654. mboverflow:=true;
  655. end;
  656. end;
  657. subn : begin
  658. if is_set then
  659. begin
  660. op:=A_AND;
  661. mboverflow:=false;
  662. unsigned:=false;
  663. extra_not:=true;
  664. end
  665. else
  666. begin
  667. op:=A_SUB;
  668. mboverflow:=true;
  669. end;
  670. end;
  671. ltn,lten,
  672. gtn,gten,
  673. equaln,unequaln : begin
  674. op:=A_CMP;
  675. cmpop:=true;
  676. end;
  677. xorn : op:=A_EOR;
  678. orn : op:=A_OR;
  679. andn : op:=A_AND;
  680. else
  681. Message(type_e_mismatch);
  682. end;
  683. { left and right no register? }
  684. { then one must be demanded }
  685. if (p^.left^.location.loc<>LOC_REGISTER) and
  686. (p^.right^.location.loc<>LOC_REGISTER) then
  687. begin
  688. { register variable ? }
  689. if (p^.left^.location.loc=LOC_CREGISTER) then
  690. begin
  691. { it is OK if this is the destination }
  692. if is_in_dest then
  693. begin
  694. hregister:=p^.location.register;
  695. emit_reg_reg(A_MOVE,opsize,p^.left^.location.register,
  696. hregister);
  697. end
  698. else
  699. if cmpop then
  700. begin
  701. { do not disturb the register }
  702. hregister:=p^.location.register;
  703. end
  704. else
  705. begin
  706. emit_reg_reg(A_MOVE,opsize,p^.left^.location.register,
  707. hregister);
  708. end
  709. end
  710. else
  711. begin
  712. del_reference(p^.left^.location.reference);
  713. if is_in_dest then
  714. begin
  715. hregister:=p^.location.register;
  716. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
  717. newreference(p^.left^.location.reference),hregister)));
  718. end
  719. else
  720. begin
  721. { first give free, then demand new register }
  722. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
  723. newreference(p^.left^.location.reference),hregister)));
  724. end;
  725. end;
  726. p^.location.loc:=LOC_REGISTER;
  727. p^.location.register:=hregister;
  728. end
  729. else
  730. { if on the right the register then swap }
  731. if not(noswap) and (p^.right^.location.loc=LOC_REGISTER) then
  732. begin
  733. swap_location(p^.location,p^.right^.location);
  734. { newly swapped also set swapped flag }
  735. p^.swaped:=not(p^.swaped);
  736. end;
  737. { at this point, p^.location.loc should be LOC_REGISTER }
  738. { and p^.location.register should be a valid register }
  739. { containing the left result }
  740. if p^.right^.location.loc<>LOC_REGISTER then
  741. begin
  742. if (p^.treetype=subn) and p^.swaped then
  743. begin
  744. if p^.right^.location.loc=LOC_CREGISTER then
  745. begin
  746. if extra_not then
  747. exprasmlist^.concat(new(pai68k,op_reg(A_NOT,opsize,p^.location.register)));
  748. emit_reg_reg(A_MOVE,opsize,p^.right^.location.register,R_D6);
  749. emit_reg_reg(op,opsize,p^.location.register,R_D6);
  750. emit_reg_reg(A_MOVE,opsize,R_D6,p^.location.register);
  751. end
  752. else
  753. begin
  754. if extra_not then
  755. exprasmlist^.concat(new(pai68k,op_reg(A_NOT,opsize,p^.location.register)));
  756. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
  757. newreference(p^.right^.location.reference),R_D6)));
  758. exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,p^.location.register,R_D6)));
  759. exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,opsize,R_D6,p^.location.register)));
  760. del_reference(p^.right^.location.reference);
  761. end;
  762. end
  763. else
  764. begin
  765. if (p^.right^.treetype=ordconstn) and (op=A_CMP) and
  766. (p^.right^.value=0) then
  767. exprasmlist^.concat(new(pai68k,op_reg(A_TST,opsize,p^.location.register)))
  768. else
  769. if (p^.right^.treetype=ordconstn) and (op=A_MULS) and
  770. (ispowerof2(p^.right^.value,power)) then
  771. begin
  772. if (power <= 8) then
  773. exprasmlist^.concat(new(pai68k,op_const_reg(A_ASL,opsize,power,
  774. p^.location.register)))
  775. else
  776. begin
  777. exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,power,
  778. R_D6)));
  779. exprasmlist^.concat(new(pai68k,op_reg_reg(A_ASL,opsize,R_D6,
  780. p^.location.register)))
  781. end;
  782. end
  783. else
  784. begin
  785. if (p^.right^.location.loc=LOC_CREGISTER) then
  786. begin
  787. if extra_not then
  788. begin
  789. emit_reg_reg(A_MOVE,S_L,p^.right^.location.register,R_D6);
  790. exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,R_D6)));
  791. emit_reg_reg(A_AND,S_L,R_D6,
  792. p^.location.register);
  793. end
  794. else
  795. begin
  796. if (op=A_MULS) and (opsize = S_L) and (aktoptprocessor=MC68000) then
  797. { Emulation for MC68000 }
  798. begin
  799. emit_reg_reg(A_MOVE,opsize,p^.right^.location.register,
  800. R_D0);
  801. emit_reg_reg(A_MOVE,opsize,p^.location.register,R_D1);
  802. emitcall('LONGMUL',true);
  803. emit_reg_reg(A_MOVE,opsize,R_D0,p^.location.register);
  804. end
  805. else
  806. if (op=A_MULU) and (opsize = S_L) and (aktoptprocessor=MC68000) then
  807. Message(cg_f_32bit_not_supported_in_68000)
  808. else
  809. emit_reg_reg(op,opsize,p^.right^.location.register,
  810. p^.location.register);
  811. end;
  812. end
  813. else
  814. begin
  815. if extra_not then
  816. begin
  817. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(
  818. p^.right^.location.reference),R_D6)));
  819. exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,R_D6)));
  820. emit_reg_reg(A_AND,S_L,R_D6,
  821. p^.location.register);
  822. end
  823. else
  824. begin
  825. if (op=A_MULS) and (opsize = S_L) and (aktoptprocessor=MC68000) then
  826. { Emulation for MC68000 }
  827. begin
  828. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE, opsize,
  829. newreference(p^.right^.location.reference),R_D1)));
  830. emit_reg_reg(A_MOVE,opsize,p^.location.register,R_D0);
  831. emitcall('LONGMUL',true);
  832. emit_reg_reg(A_MOVE,opsize,R_D0,p^.location.register);
  833. end
  834. else
  835. if (op=A_MULU) and (opsize = S_L) and (aktoptprocessor=MC68000) then
  836. Message(cg_f_32bit_not_supported_in_68000)
  837. else
  838. { When one of the source/destination is a memory reference }
  839. { and the operator is EOR, the we must load it into the }
  840. { value into a register first since only EOR reg,reg exists }
  841. { on the m68k }
  842. if (op=A_EOR) then
  843. begin
  844. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,newreference(
  845. p^.right^.location.reference),R_D0)));
  846. exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,R_D0,
  847. p^.location.register)));
  848. end
  849. else
  850. exprasmlist^.concat(new(pai68k,op_ref_reg(op,opsize,newreference(
  851. p^.right^.location.reference),p^.location.register)));
  852. end;
  853. del_reference(p^.right^.location.reference);
  854. end;
  855. end;
  856. end;
  857. end
  858. else
  859. begin
  860. { when swapped another result register }
  861. if (p^.treetype=subn) and p^.swaped then
  862. begin
  863. if extra_not then
  864. exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.location.register)));
  865. exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,
  866. p^.location.register,p^.right^.location.register)));
  867. swap_location(p^.location,p^.right^.location);
  868. { newly swapped also set swapped flag }
  869. { just to maintain ordering }
  870. p^.swaped:=not(p^.swaped);
  871. end
  872. else
  873. begin
  874. if extra_not then
  875. exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.right^.location.register)));
  876. if (op=A_MULS) and (opsize = S_L) and (aktoptprocessor=MC68000) then
  877. { Emulation for MC68000 }
  878. begin
  879. emit_reg_reg(A_MOVE,opsize,p^.right^.location.register,
  880. R_D0);
  881. emit_reg_reg(A_MOVE,opsize,p^.location.register,R_D1);
  882. emitcall('LONGMUL',true);
  883. emit_reg_reg(A_MOVE,opsize,R_D0,p^.location.register);
  884. end
  885. else
  886. if (op=A_MULU) and (opsize = S_L) and (aktoptprocessor=MC68000) then
  887. Message(cg_f_32bit_not_supported_in_68000)
  888. else
  889. exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,
  890. p^.right^.location.register,
  891. p^.location.register)));
  892. end;
  893. ungetregister32(p^.right^.location.register);
  894. end;
  895. if cmpop then
  896. ungetregister32(p^.location.register);
  897. { only in case of overflow operations }
  898. { produce overflow code }
  899. if mboverflow then
  900. emitoverflowcheck(p);
  901. { only in case of overflow operations }
  902. { produce overflow code }
  903. { we must put it here directly, because sign of operation }
  904. { is in unsigned VAR!! }
  905. end
  906. else
  907. { Char type }
  908. if ((p^.left^.resulttype^.deftype=orddef) and
  909. (porddef(p^.left^.resulttype)^.typ=uchar)) then
  910. begin
  911. case p^.treetype of
  912. ltn,lten,gtn,gten,
  913. equaln,unequaln :
  914. cmpop:=true;
  915. else Message(type_e_mismatch);
  916. end;
  917. unsigned:=true;
  918. { left and right no register? }
  919. { the one must be demanded }
  920. if (p^.location.loc<>LOC_REGISTER) and
  921. (p^.right^.location.loc<>LOC_REGISTER) then
  922. begin
  923. if p^.location.loc=LOC_CREGISTER then
  924. begin
  925. if cmpop then
  926. { do not disturb register }
  927. hregister:=p^.location.register
  928. else
  929. begin
  930. hregister:=getregister32;
  931. emit_reg_reg(A_MOVE,S_B,p^.location.register,
  932. hregister);
  933. end;
  934. end
  935. else
  936. begin
  937. del_reference(p^.location.reference);
  938. { first give free then demand new register }
  939. hregister:=getregister32;
  940. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),
  941. hregister)));
  942. end;
  943. p^.location.loc:=LOC_REGISTER;
  944. p^.location.register:=hregister;
  945. end;
  946. { now p always a register }
  947. if (p^.right^.location.loc=LOC_REGISTER) and
  948. (p^.location.loc<>LOC_REGISTER) then
  949. begin
  950. swap_location(p^.location,p^.right^.location);
  951. { newly swapped also set swapped flag }
  952. p^.swaped:=not(p^.swaped);
  953. end;
  954. if p^.right^.location.loc<>LOC_REGISTER then
  955. begin
  956. if p^.right^.location.loc=LOC_CREGISTER then
  957. begin
  958. emit_reg_reg(A_CMP,S_B,
  959. p^.right^.location.register,p^.location.register);
  960. end
  961. else
  962. begin
  963. exprasmlist^.concat(new(pai68k,op_ref_reg(A_CMP,S_B,newreference(
  964. p^.right^.location.reference),p^.location.register)));
  965. del_reference(p^.right^.location.reference);
  966. end;
  967. end
  968. else
  969. begin
  970. emit_reg_reg(A_CMP,S_B,p^.right^.location.register,
  971. p^.location.register);
  972. ungetregister32(p^.right^.location.register);
  973. end;
  974. ungetregister32(p^.location.register);
  975. end
  976. else
  977. { Floating point }
  978. if (p^.left^.resulttype^.deftype=floatdef) and
  979. (pfloatdef(p^.left^.resulttype)^.typ<>f32bit) then
  980. begin
  981. { real constants to the left }
  982. if p^.left^.treetype=realconstn then
  983. swaptree(p);
  984. cmpop:=false;
  985. case p^.treetype of
  986. addn : op:=A_FADD;
  987. muln : op:=A_FMUL;
  988. subn : op:=A_FSUB;
  989. slashn : op:=A_FDIV;
  990. ltn,lten,gtn,gten,
  991. equaln,unequaln : begin
  992. op:=A_FCMP;
  993. cmpop:=true;
  994. end;
  995. else Message(type_e_mismatch);
  996. end;
  997. if (p^.left^.location.loc <> LOC_FPU) and
  998. (p^.right^.location.loc <> LOC_FPU) then
  999. begin
  1000. { we suppose left in reference }
  1001. del_reference(p^.left^.location.reference);
  1002. { get a copy, since we don't want to modify the same }
  1003. { node at the same time. }
  1004. tmpref:=p^.left^.location.reference;
  1005. if assigned(p^.left^.location.reference.symbol) then
  1006. tmpref.symbol:=stringdup(p^.left^.location.reference.symbol^);
  1007. floatload(pfloatdef(p^.left^.resulttype)^.typ, tmpref,
  1008. p^.left^.location);
  1009. clear_reference(tmpref);
  1010. end
  1011. else
  1012. begin
  1013. if (p^.right^.location.loc = LOC_FPU)
  1014. and(p^.left^.location.loc <> LOC_FPU) then
  1015. begin
  1016. swap_location(p^.left^.location, p^.right^.location);
  1017. p^.swaped := not(p^.swaped);
  1018. end
  1019. end;
  1020. { ---------------- LEFT = LOC_FPUREG -------------------- }
  1021. if ((p^.treetype =subn) or (p^.treetype = slashn)) and (p^.swaped) then
  1022. { fpu_reg = right(FP1) / fpu_reg }
  1023. { fpu_reg = right(FP1) - fpu_reg }
  1024. begin
  1025. if (cs_fp_emulation in aktmoduleswitches) then
  1026. begin
  1027. { fpu_reg = right / D1 }
  1028. { fpu_reg = right - D1 }
  1029. exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
  1030. { load value into D1 }
  1031. if p^.right^.location.loc <> LOC_FPU then
  1032. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
  1033. newreference(p^.right^.location.reference),R_D1)))
  1034. else
  1035. emit_reg_reg(A_MOVE,S_L,p^.right^.location.fpureg,R_D1);
  1036. { probably a faster way to do this but... }
  1037. case op of
  1038. A_FADD: emitcall('SINGLE_ADD',true);
  1039. A_FMUL: emitcall('SINGLE_MUL',true);
  1040. A_FSUB: emitcall('SINGLE_SUB',true);
  1041. A_FDIV: emitcall('SINGLE_DIV',true);
  1042. A_FCMP: emitcall('SINGLE_CMP',true);
  1043. end;
  1044. if not cmpop then { only flags are affected with cmpop }
  1045. exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,
  1046. p^.left^.location.fpureg)));
  1047. { if this was a reference, then delete as it }
  1048. { it no longer required. }
  1049. if p^.right^.location.loc <> LOC_FPU then
  1050. del_reference(p^.right^.location.reference);
  1051. end
  1052. else
  1053. begin
  1054. if p^.right^.location.loc <> LOC_FPU then
  1055. exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,
  1056. getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
  1057. newreference(p^.right^.location.reference),
  1058. R_FP1)))
  1059. else
  1060. { FPm --> FPn must use extended precision }
  1061. emit_reg_reg(A_FMOVE,S_FX,p^.right^.location.fpureg,R_FP1);
  1062. { arithmetic expression performed in extended mode }
  1063. exprasmlist^.concat(new(pai68k,op_reg_reg(op,S_FX,
  1064. p^.left^.location.fpureg,R_FP1)));
  1065. { cmpop does not change any floating point register!! }
  1066. if not cmpop then
  1067. emit_reg_reg(A_FMOVE,S_FX,R_FP1,p^.left^.location.fpureg)
  1068. { exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,
  1069. getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
  1070. R_FP1,p^.left^.location.fpureg)))}
  1071. else
  1072. { process comparison, to make it compatible with the rest of the code }
  1073. processcc(p);
  1074. { if this was a reference, then delete as it }
  1075. { it no longer required. }
  1076. if p^.right^.location.loc <> LOC_FPU then
  1077. del_reference(p^.right^.location.reference);
  1078. end;
  1079. end
  1080. else { everything is in the right order }
  1081. begin
  1082. { fpu_reg = fpu_reg / right }
  1083. { fpu_reg = fpu_reg - right }
  1084. { + commutative ops }
  1085. if cs_fp_emulation in aktmoduleswitches then
  1086. begin
  1087. { load value into D7 }
  1088. if p^.right^.location.loc <> LOC_FPU then
  1089. exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
  1090. newreference(p^.right^.location.reference),R_D0)))
  1091. else
  1092. emit_reg_reg(A_MOVE,S_L,p^.right^.location.fpureg,R_D0);
  1093. emit_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D1);
  1094. { probably a faster way to do this but... }
  1095. case op of
  1096. A_FADD: emitcall('SINGLE_ADD',true);
  1097. A_FMUL: emitcall('SINGLE_MUL',true);
  1098. A_FSUB: emitcall('SINGLE_SUB',true);
  1099. A_FDIV: emitcall('SINGLE_DIV',true);
  1100. A_FCMP: emitcall('SINGLE_CMP',true);
  1101. end;
  1102. if not cmpop then { only flags are affected with cmpop }
  1103. exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,
  1104. p^.left^.location.fpureg)));
  1105. { if this was a reference, then delete as it }
  1106. { it no longer required. }
  1107. if p^.right^.location.loc <> LOC_FPU then
  1108. del_reference(p^.right^.location.reference);
  1109. end
  1110. else
  1111. begin
  1112. if p^.right^.location.loc <> LOC_FPU then
  1113. exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,
  1114. getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
  1115. newreference(p^.right^.location.reference),R_FP1)))
  1116. else
  1117. emit_reg_reg(A_FMOVE,getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
  1118. p^.right^.location.fpureg,R_FP1);
  1119. emit_reg_reg(op,S_FX,R_FP1,p^.left^.location.fpureg);
  1120. if cmpop then
  1121. processcc(p);
  1122. { if this was a reference, then delete as it }
  1123. { it no longer required. }
  1124. if p^.right^.location.loc <> LOC_FPU then
  1125. del_reference(p^.right^.location.reference);
  1126. end
  1127. end; { endif treetype = .. }
  1128. if cmpop then
  1129. begin
  1130. if p^.swaped then
  1131. case p^.treetype of
  1132. equaln: flags := F_E;
  1133. unequaln: flags := F_NE;
  1134. ltn : flags := F_G;
  1135. lten : flags := F_GE;
  1136. gtn : flags := F_L;
  1137. gten: flags := F_LE;
  1138. end
  1139. else
  1140. case p^.treetype of
  1141. equaln: flags := F_E;
  1142. unequaln : flags := F_NE;
  1143. ltn: flags := F_L;
  1144. lten : flags := F_LE;
  1145. gtn : flags := F_G;
  1146. gten: flags := F_GE;
  1147. end;
  1148. p^.location.loc := LOC_FLAGS;
  1149. p^.location.resflags := flags;
  1150. cmpop := false;
  1151. end
  1152. else
  1153. begin
  1154. p^.location.loc := LOC_FPU;
  1155. if p^.left^.location.loc = LOC_FPU then
  1156. { copy fpu register result . }
  1157. { HERE ON EXIT FPU REGISTER IS IN EXTENDED MODE! }
  1158. p^.location.fpureg := p^.left^.location.fpureg
  1159. else
  1160. begin
  1161. InternalError(34);
  1162. end;
  1163. end;
  1164. end
  1165. else Message(type_e_mismatch);
  1166. end;
  1167. SetResultLocation(cmpop,unsigned,p);
  1168. end;
  1169. end.
  1170. {
  1171. $Log$
  1172. Revision 1.3 1998-09-07 18:45:55 peter
  1173. * update smartlinking, uses getdatalabel
  1174. * renamed ptree.value vars to value_str,value_real,value_set
  1175. Revision 1.2 1998/09/04 08:41:42 peter
  1176. * updated some error messages
  1177. Revision 1.1 1998/09/01 09:07:09 peter
  1178. * m68k fixes, splitted cg68k like cgi386
  1179. }