cg386add.pas 109 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Generate i386 assembler for in 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 cg386add;
  19. interface
  20. {$define usecreateset}
  21. uses
  22. tree;
  23. procedure secondadd(var p : ptree);
  24. implementation
  25. uses
  26. globtype,systems,
  27. cobjects,verbose,globals,
  28. symconst,symtable,aasm,types,
  29. hcodegen,temp_gen,pass_2,
  30. cpubase,cpuasm,
  31. cgai386,tgeni386;
  32. {*****************************************************************************
  33. Helpers
  34. *****************************************************************************}
  35. procedure locflags2reg(var l:tlocation;opsize:topsize);
  36. var
  37. hregister : tregister;
  38. begin
  39. if (l.loc=LOC_FLAGS) then
  40. begin
  41. case opsize of
  42. S_L : hregister:=getregister32;
  43. S_W : hregister:=reg32toreg16(getregister32);
  44. S_B : hregister:=reg32toreg8(getregister32);
  45. end;
  46. emit_flag2reg(l.resflags,hregister);
  47. l.loc:=LOC_REGISTER;
  48. l.register:=hregister;
  49. end;
  50. end;
  51. function getresflags(p : ptree;unsigned : boolean) : tresflags;
  52. begin
  53. if not(unsigned) then
  54. begin
  55. if p^.swaped then
  56. case p^.treetype of
  57. equaln : getresflags:=F_E;
  58. unequaln : getresflags:=F_NE;
  59. ltn : getresflags:=F_G;
  60. lten : getresflags:=F_GE;
  61. gtn : getresflags:=F_L;
  62. gten : getresflags:=F_LE;
  63. end
  64. else
  65. case p^.treetype of
  66. equaln : getresflags:=F_E;
  67. unequaln : getresflags:=F_NE;
  68. ltn : getresflags:=F_L;
  69. lten : getresflags:=F_LE;
  70. gtn : getresflags:=F_G;
  71. gten : getresflags:=F_GE;
  72. end;
  73. end
  74. else
  75. begin
  76. if p^.swaped then
  77. case p^.treetype of
  78. equaln : getresflags:=F_E;
  79. unequaln : getresflags:=F_NE;
  80. ltn : getresflags:=F_A;
  81. lten : getresflags:=F_AE;
  82. gtn : getresflags:=F_B;
  83. gten : getresflags:=F_BE;
  84. end
  85. else
  86. case p^.treetype of
  87. equaln : getresflags:=F_E;
  88. unequaln : getresflags:=F_NE;
  89. ltn : getresflags:=F_B;
  90. lten : getresflags:=F_BE;
  91. gtn : getresflags:=F_A;
  92. gten : getresflags:=F_AE;
  93. end;
  94. end;
  95. end;
  96. procedure SetResultLocation(cmpop,unsigned:boolean;var p :ptree);
  97. begin
  98. { remove temporary location if not a set or string }
  99. { that's a bad hack (FK) who did this ? }
  100. if (p^.left^.resulttype^.deftype<>stringdef) and
  101. ((p^.left^.resulttype^.deftype<>setdef) or (psetdef(p^.left^.resulttype)^.settype=smallset)) and
  102. (p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  103. ungetiftemp(p^.left^.location.reference);
  104. if (p^.right^.resulttype^.deftype<>stringdef) and
  105. ((p^.right^.resulttype^.deftype<>setdef) or (psetdef(p^.right^.resulttype)^.settype=smallset)) and
  106. (p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  107. ungetiftemp(p^.right^.location.reference);
  108. { in case of comparison operation the put result in the flags }
  109. if cmpop then
  110. begin
  111. clear_location(p^.location);
  112. p^.location.loc:=LOC_FLAGS;
  113. p^.location.resflags:=getresflags(p,unsigned);
  114. end;
  115. end;
  116. {*****************************************************************************
  117. Addstring
  118. *****************************************************************************}
  119. procedure addstring(var p : ptree);
  120. var
  121. pushedregs : tpushed;
  122. href : treference;
  123. pushed,
  124. cmpop : boolean;
  125. begin
  126. { string operations are not commutative }
  127. if p^.swaped then
  128. swaptree(p);
  129. case pstringdef(p^.left^.resulttype)^.string_typ of
  130. st_ansistring:
  131. begin
  132. case p^.treetype of
  133. addn:
  134. begin
  135. cmpop:=false;
  136. secondpass(p^.left);
  137. { to avoid problem with maybe_push and restore }
  138. set_location(p^.location,p^.left^.location);
  139. pushed:=maybe_push(p^.right^.registers32,p,false);
  140. secondpass(p^.right);
  141. if pushed then restore(p,false);
  142. { get the temp location, must be done before regs are
  143. released/pushed because after the release the regs are
  144. still used for the push (PFV) }
  145. clear_location(p^.location);
  146. p^.location.loc:=LOC_MEM;
  147. if gettempansistringreference(p^.location.reference) then
  148. decrstringref(cansistringdef,p^.location.reference);
  149. { release used registers }
  150. del_location(p^.right^.location);
  151. del_location(p^.left^.location);
  152. { push the still used registers }
  153. pushusedregisters(pushedregs,$ff);
  154. { push data }
  155. emitpushreferenceaddr(p^.location.reference);
  156. emit_push_loc(p^.right^.location);
  157. emit_push_loc(p^.left^.location);
  158. emitcall('FPC_ANSISTR_CONCAT');
  159. popusedregisters(pushedregs);
  160. maybe_loadesi;
  161. ungetiftempansi(p^.left^.location.reference);
  162. ungetiftempansi(p^.right^.location.reference);
  163. end;
  164. ltn,lten,gtn,gten,
  165. equaln,unequaln:
  166. begin
  167. cmpop:=true;
  168. secondpass(p^.left);
  169. pushed:=maybe_push(p^.right^.registers32,p,false);
  170. secondpass(p^.right);
  171. if pushed then restore(p,false);
  172. { release used registers }
  173. del_location(p^.right^.location);
  174. del_location(p^.left^.location);
  175. { push the still used registers }
  176. pushusedregisters(pushedregs,$ff);
  177. { push data }
  178. case p^.right^.location.loc of
  179. LOC_REFERENCE,LOC_MEM:
  180. emit_push_mem(p^.right^.location.reference);
  181. LOC_REGISTER,LOC_CREGISTER:
  182. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.right^.location.register)));
  183. end;
  184. case p^.left^.location.loc of
  185. LOC_REFERENCE,LOC_MEM:
  186. emit_push_mem(p^.left^.location.reference);
  187. LOC_REGISTER,LOC_CREGISTER:
  188. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.left^.location.register)));
  189. end;
  190. emitcall('FPC_ANSISTR_COMPARE');
  191. emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
  192. popusedregisters(pushedregs);
  193. maybe_loadesi;
  194. ungetiftempansi(p^.left^.location.reference);
  195. ungetiftempansi(p^.right^.location.reference);
  196. end;
  197. end;
  198. { the result of ansicompare is signed }
  199. SetResultLocation(cmpop,false,p);
  200. end;
  201. st_shortstring:
  202. begin
  203. case p^.treetype of
  204. addn:
  205. begin
  206. cmpop:=false;
  207. secondpass(p^.left);
  208. { if str_concat is set in expr
  209. s:=s+ ... no need to create a temp string (PM) }
  210. if (p^.left^.treetype<>addn) and not (p^.use_strconcat) then
  211. begin
  212. { can only reference be }
  213. { string in register would be funny }
  214. { therefore produce a temporary string }
  215. { release the registers }
  216. del_reference(p^.left^.location.reference);
  217. gettempofsizereference(256,href);
  218. copyshortstring(href,p^.left^.location.reference,255,false);
  219. ungetiftemp(p^.left^.location.reference);
  220. { does not hurt: }
  221. clear_location(p^.left^.location);
  222. p^.left^.location.loc:=LOC_MEM;
  223. p^.left^.location.reference:=href;
  224. end;
  225. secondpass(p^.right);
  226. { on the right we do not need the register anymore too }
  227. {$IfNDef regallocfix}
  228. del_reference(p^.right^.location.reference);
  229. pushusedregisters(pushedregs,$ff);
  230. {$Else regallocfix}
  231. pushusedregisters(pushedregs,$ff
  232. xor ($80 shr byte(p^.right^.location.reference.base))
  233. xor ($80 shr byte(p^.right^.location.reference.index)));
  234. {$EndIf regallocfix}
  235. emitpushreferenceaddr(p^.left^.location.reference);
  236. emitpushreferenceaddr(p^.right^.location.reference);
  237. {$IfDef regallocfix}
  238. del_reference(p^.right^.location.reference);
  239. {$EndIf regallocfix}
  240. emitcall('FPC_SHORTSTR_CONCAT');
  241. maybe_loadesi;
  242. popusedregisters(pushedregs);
  243. set_location(p^.location,p^.left^.location);
  244. ungetiftemp(p^.right^.location.reference);
  245. end;
  246. ltn,lten,gtn,gten,
  247. equaln,unequaln :
  248. begin
  249. cmpop:=true;
  250. { generate better code for s='' and s<>'' }
  251. if (p^.treetype in [equaln,unequaln]) and
  252. (((p^.left^.treetype=stringconstn) and (str_length(p^.left)=0)) or
  253. ((p^.right^.treetype=stringconstn) and (str_length(p^.right)=0))) then
  254. begin
  255. secondpass(p^.left);
  256. { are too few registers free? }
  257. pushed:=maybe_push(p^.right^.registers32,p,false);
  258. secondpass(p^.right);
  259. if pushed then restore(p,false);
  260. { only one node can be stringconstn }
  261. { else pass 1 would have evaluted }
  262. { this node }
  263. if p^.left^.treetype=stringconstn then
  264. exprasmlist^.concat(new(pai386,op_const_ref(
  265. A_CMP,S_B,0,newreference(p^.right^.location.reference))))
  266. else
  267. exprasmlist^.concat(new(pai386,op_const_ref(
  268. A_CMP,S_B,0,newreference(p^.left^.location.reference))));
  269. del_reference(p^.right^.location.reference);
  270. del_reference(p^.left^.location.reference);
  271. end
  272. else
  273. begin
  274. pushusedregisters(pushedregs,$ff);
  275. secondpass(p^.left);
  276. emitpushreferenceaddr(p^.left^.location.reference);
  277. del_reference(p^.left^.location.reference);
  278. secondpass(p^.right);
  279. emitpushreferenceaddr(p^.right^.location.reference);
  280. del_reference(p^.right^.location.reference);
  281. emitcall('FPC_SHORTSTR_COMPARE');
  282. maybe_loadesi;
  283. popusedregisters(pushedregs);
  284. end;
  285. ungetiftemp(p^.left^.location.reference);
  286. ungetiftemp(p^.right^.location.reference);
  287. end;
  288. else CGMessage(type_e_mismatch);
  289. end;
  290. SetResultLocation(cmpop,true,p);
  291. end;
  292. end;
  293. end;
  294. {*****************************************************************************
  295. Addset
  296. *****************************************************************************}
  297. procedure addset(var p : ptree);
  298. var
  299. createset,
  300. cmpop,
  301. pushed : boolean;
  302. href : treference;
  303. pushedregs : tpushed;
  304. begin
  305. cmpop:=false;
  306. { not commutative }
  307. if p^.swaped then
  308. swaptree(p);
  309. { optimize first loading of a set }
  310. {$ifdef usecreateset}
  311. if (p^.right^.treetype=setelementn) and
  312. not(assigned(p^.right^.right)) and
  313. is_emptyset(p^.left) then
  314. createset:=true
  315. else
  316. {$endif}
  317. begin
  318. createset:=false;
  319. secondpass(p^.left);
  320. end;
  321. { are too few registers free? }
  322. pushed:=maybe_push(p^.right^.registers32,p,false);
  323. secondpass(p^.right);
  324. if codegenerror then
  325. exit;
  326. if pushed then
  327. restore(p,false);
  328. set_location(p^.location,p^.left^.location);
  329. { handle operations }
  330. {$IfDef regallocfix}
  331. pushusedregisters(pushedregs,$ff
  332. xor ($80 shr byte(p^.left^.location.reference.base))
  333. xor ($80 shr byte(p^.left^.location.reference.index))
  334. xor ($80 shr byte(p^.right^.location.reference.base))
  335. xor ($80 shr byte(p^.right^.location.reference.index)));
  336. {$EndIf regallocfix}
  337. case p^.treetype of
  338. equaln,
  339. unequaln
  340. {$IfNDef NoSetInclusion}
  341. ,lten, gten
  342. {$EndIf NoSetInclusion}
  343. : begin
  344. cmpop:=true;
  345. {$IfNDef regallocfix}
  346. del_location(p^.left^.location);
  347. del_location(p^.right^.location);
  348. pushusedregisters(pushedregs,$ff);
  349. {$EndIf regallocfix}
  350. {$IfNDef NoSetInclusion}
  351. If (p^.treetype in [equaln, unequaln, lten]) Then
  352. Begin
  353. {$EndIf NoSetInclusion}
  354. emitpushreferenceaddr(p^.right^.location.reference);
  355. {$IfDef regallocfix}
  356. del_location(p^.right^.location);
  357. {$EndIf regallocfix}
  358. emitpushreferenceaddr(p^.left^.location.reference);
  359. {$IfDef regallocfix}
  360. del_location(p^.left^.location);
  361. {$EndIf regallocfix}
  362. {$IfNDef NoSetInclusion}
  363. End
  364. Else {gten = lten, if the arguments are reversed}
  365. Begin
  366. emitpushreferenceaddr(p^.left^.location.reference);
  367. {$IfDef regallocfix}
  368. del_location(p^.left^.location);
  369. {$EndIf regallocfix}
  370. emitpushreferenceaddr(p^.right^.location.reference);
  371. {$IfDef regallocfix}
  372. del_location(p^.right^.location);
  373. {$EndIf regallocfix}
  374. End;
  375. Case p^.treetype of
  376. equaln, unequaln:
  377. {$EndIf NoSetInclusion}
  378. emitcall('FPC_SET_COMP_SETS');
  379. {$IfNDef NoSetInclusion}
  380. lten, gten: emitcall('FPC_SET_CONTAINS_SETS')
  381. End;
  382. {$EndIf NoSetInclusion}
  383. maybe_loadesi;
  384. popusedregisters(pushedregs);
  385. ungetiftemp(p^.left^.location.reference);
  386. ungetiftemp(p^.right^.location.reference);
  387. end;
  388. addn : begin
  389. { add can be an other SET or Range or Element ! }
  390. {$IfNDef regallocfix}
  391. del_location(p^.left^.location);
  392. del_location(p^.right^.location);
  393. pushusedregisters(pushedregs,$ff);
  394. {$EndIf regallocfix}
  395. href.symbol:=nil;
  396. gettempofsizereference(32,href);
  397. if createset then
  398. begin
  399. {$IfDef regallocfix}
  400. del_location(p^.left^.location);
  401. del_location(p^.right^.location);
  402. {$EndIf regallocfix}
  403. pushsetelement(p^.right^.left);
  404. emitpushreferenceaddr(href);
  405. emitcall('FPC_SET_CREATE_ELEMENT');
  406. end
  407. else
  408. begin
  409. { add a range or a single element? }
  410. if p^.right^.treetype=setelementn then
  411. begin
  412. {$IfNDef regallocfix}
  413. concatcopy(p^.left^.location.reference,href,32,false,false);
  414. {$Else regallocfix}
  415. concatcopy(p^.left^.location.reference,href,32,true,false);
  416. {$EndIf regallocfix}
  417. if assigned(p^.right^.right) then
  418. begin
  419. pushsetelement(p^.right^.right);
  420. pushsetelement(p^.right^.left);
  421. emitpushreferenceaddr(href);
  422. emitcall('FPC_SET_SET_RANGE');
  423. end
  424. else
  425. begin
  426. pushsetelement(p^.right^.left);
  427. emitpushreferenceaddr(href);
  428. emitcall('FPC_SET_SET_BYTE');
  429. end;
  430. end
  431. else
  432. begin
  433. { must be an other set }
  434. emitpushreferenceaddr(href);
  435. emitpushreferenceaddr(p^.right^.location.reference);
  436. {$IfDef regallocfix}
  437. del_location(p^.right^.location);
  438. {$EndIf regallocfix}
  439. emitpushreferenceaddr(p^.left^.location.reference);
  440. {$IfDef regallocfix}
  441. del_location(p^.left^.location);
  442. {$EndIf regallocfix}
  443. emitcall('FPC_SET_ADD_SETS');
  444. end;
  445. end;
  446. maybe_loadesi;
  447. popusedregisters(pushedregs);
  448. ungetiftemp(p^.left^.location.reference);
  449. ungetiftemp(p^.right^.location.reference);
  450. p^.location.loc:=LOC_MEM;
  451. p^.location.reference:=href;
  452. end;
  453. subn,
  454. symdifn,
  455. muln : begin
  456. {$IfNDef regallocfix}
  457. del_location(p^.left^.location);
  458. del_location(p^.right^.location);
  459. pushusedregisters(pushedregs,$ff);
  460. {$EndIf regallocfix}
  461. href.symbol:=nil;
  462. gettempofsizereference(32,href);
  463. emitpushreferenceaddr(href);
  464. emitpushreferenceaddr(p^.right^.location.reference);
  465. {$IfDef regallocfix}
  466. del_location(p^.right^.location);
  467. {$EndIf regallocfix}
  468. emitpushreferenceaddr(p^.left^.location.reference);
  469. {$IfDef regallocfix}
  470. del_location(p^.left^.location);
  471. {$EndIf regallocfix}
  472. case p^.treetype of
  473. subn : emitcall('FPC_SET_SUB_SETS');
  474. symdifn : emitcall('FPC_SET_SYMDIF_SETS');
  475. muln : emitcall('FPC_SET_MUL_SETS');
  476. end;
  477. maybe_loadesi;
  478. popusedregisters(pushedregs);
  479. ungetiftemp(p^.left^.location.reference);
  480. ungetiftemp(p^.right^.location.reference);
  481. p^.location.loc:=LOC_MEM;
  482. p^.location.reference:=href;
  483. end;
  484. else
  485. CGMessage(type_e_mismatch);
  486. end;
  487. SetResultLocation(cmpop,true,p);
  488. end;
  489. {*****************************************************************************
  490. SecondAdd
  491. *****************************************************************************}
  492. procedure secondadd(var p : ptree);
  493. { is also being used for xor, and "mul", "sub, or and comparative }
  494. { operators }
  495. label do_normal;
  496. var
  497. hregister,hregister2 : tregister;
  498. noswap,popeax,popedx,
  499. pushed,mboverflow,cmpop : boolean;
  500. op,op2 : tasmop;
  501. flags : tresflags;
  502. otl,ofl,hl : pasmlabel;
  503. power : longint;
  504. opsize : topsize;
  505. hl4: pasmlabel;
  506. hr : preference;
  507. { true, if unsigned types are compared }
  508. unsigned : boolean;
  509. { true, if a small set is handled with the longint code }
  510. is_set : boolean;
  511. { is_in_dest if the result is put directly into }
  512. { the resulting refernce or varregister }
  513. is_in_dest : boolean;
  514. { true, if for sets subtractions the extra not should generated }
  515. extra_not : boolean;
  516. {$ifdef SUPPORT_MMX}
  517. mmxbase : tmmxtype;
  518. {$endif SUPPORT_MMX}
  519. pushedreg : tpushed;
  520. hloc : tlocation;
  521. procedure firstjmp64bitcmp;
  522. var
  523. oldtreetype : ttreetyp;
  524. begin
  525. { the jump the sequence is a little bit hairy }
  526. case p^.treetype of
  527. ltn,gtn:
  528. begin
  529. emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
  530. { cheat a little bit for the negative test }
  531. p^.swaped:=not(p^.swaped);
  532. emitjmp(flag_2_cond[getresflags(p,unsigned)],falselabel);
  533. p^.swaped:=not(p^.swaped);
  534. end;
  535. lten,gten:
  536. begin
  537. oldtreetype:=p^.treetype;
  538. if p^.treetype=lten then
  539. p^.treetype:=ltn
  540. else
  541. p^.treetype:=gtn;
  542. emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
  543. { cheat for the negative test }
  544. if p^.treetype=ltn then
  545. p^.treetype:=gtn
  546. else
  547. p^.treetype:=ltn;
  548. emitjmp(flag_2_cond[getresflags(p,unsigned)],falselabel);
  549. p^.treetype:=oldtreetype;
  550. end;
  551. equaln:
  552. emitjmp(C_NE,falselabel);
  553. unequaln:
  554. emitjmp(C_NE,truelabel);
  555. end;
  556. end;
  557. procedure secondjmp64bitcmp;
  558. begin
  559. { the jump the sequence is a little bit hairy }
  560. case p^.treetype of
  561. ltn,gtn,lten,gten:
  562. begin
  563. { the comparisaion of the low dword have to be }
  564. { always unsigned! }
  565. emitjmp(flag_2_cond[getresflags(p,true)],truelabel);
  566. emitjmp(C_None,falselabel);
  567. end;
  568. equaln:
  569. begin
  570. emitjmp(C_NE,falselabel);
  571. emitjmp(C_None,truelabel);
  572. end;
  573. unequaln:
  574. begin
  575. emitjmp(C_NE,truelabel);
  576. emitjmp(C_None,falselabel);
  577. end;
  578. end;
  579. end;
  580. begin
  581. { to make it more readable, string and set (not smallset!) have their
  582. own procedures }
  583. case p^.left^.resulttype^.deftype of
  584. stringdef : begin
  585. addstring(p);
  586. exit;
  587. end;
  588. setdef : begin
  589. { normalsets are handled separate }
  590. if not(psetdef(p^.left^.resulttype)^.settype=smallset) then
  591. begin
  592. addset(p);
  593. exit;
  594. end;
  595. end;
  596. end;
  597. { defaults }
  598. unsigned:=false;
  599. is_in_dest:=false;
  600. extra_not:=false;
  601. noswap:=false;
  602. opsize:=S_L;
  603. { are we a (small)set, must be set here because the side can be
  604. swapped ! (PFV) }
  605. is_set:=(p^.left^.resulttype^.deftype=setdef);
  606. { calculate the operator which is more difficult }
  607. firstcomplex(p);
  608. { handling boolean expressions extra: }
  609. if is_boolean(p^.left^.resulttype) and
  610. is_boolean(p^.right^.resulttype) then
  611. begin
  612. if (porddef(p^.left^.resulttype)^.typ=bool8bit) or
  613. (porddef(p^.right^.resulttype)^.typ=bool8bit) then
  614. opsize:=S_B
  615. else
  616. if (porddef(p^.left^.resulttype)^.typ=bool16bit) or
  617. (porddef(p^.right^.resulttype)^.typ=bool16bit) then
  618. opsize:=S_W
  619. else
  620. opsize:=S_L;
  621. case p^.treetype of
  622. andn,
  623. orn : begin
  624. clear_location(p^.location);
  625. p^.location.loc:=LOC_JUMP;
  626. cmpop:=false;
  627. case p^.treetype of
  628. andn : begin
  629. otl:=truelabel;
  630. getlabel(truelabel);
  631. secondpass(p^.left);
  632. maketojumpbool(p^.left);
  633. emitlab(truelabel);
  634. truelabel:=otl;
  635. end;
  636. orn : begin
  637. ofl:=falselabel;
  638. getlabel(falselabel);
  639. secondpass(p^.left);
  640. maketojumpbool(p^.left);
  641. emitlab(falselabel);
  642. falselabel:=ofl;
  643. end;
  644. else
  645. CGMessage(type_e_mismatch);
  646. end;
  647. secondpass(p^.right);
  648. maketojumpbool(p^.right);
  649. end;
  650. unequaln,
  651. equaln,xorn : begin
  652. if p^.left^.treetype=ordconstn then
  653. swaptree(p);
  654. if p^.left^.location.loc=LOC_JUMP then
  655. begin
  656. otl:=truelabel;
  657. getlabel(truelabel);
  658. ofl:=falselabel;
  659. getlabel(falselabel);
  660. end;
  661. secondpass(p^.left);
  662. { if in flags then copy first to register, because the
  663. flags can be destroyed }
  664. case p^.left^.location.loc of
  665. LOC_FLAGS:
  666. locflags2reg(p^.left^.location,opsize);
  667. LOC_JUMP:
  668. begin
  669. case opsize of
  670. S_L : hregister:=getregister32;
  671. S_W : hregister:=reg32toreg16(getregister32);
  672. S_B : hregister:=reg32toreg8(getregister32);
  673. end;
  674. p^.left^.location.loc:=LOC_REGISTER;
  675. p^.left^.location.register:=hregister;
  676. emitlab(truelabel);
  677. truelabel:=otl;
  678. exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,opsize,1,
  679. hregister)));
  680. getlabel(hl);
  681. emitjmp(C_None,hl);
  682. emitlab(falselabel);
  683. falselabel:=ofl;
  684. exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,S_L,makereg32(hregister),
  685. makereg32(hregister))));
  686. emitlab(hl);
  687. end;
  688. end;
  689. set_location(p^.location,p^.left^.location);
  690. pushed:=maybe_push(p^.right^.registers32,p,false);
  691. if p^.right^.location.loc=LOC_JUMP then
  692. begin
  693. otl:=truelabel;
  694. getlabel(truelabel);
  695. ofl:=falselabel;
  696. getlabel(falselabel);
  697. end;
  698. secondpass(p^.right);
  699. if pushed then restore(p,false);
  700. case p^.right^.location.loc of
  701. LOC_FLAGS:
  702. locflags2reg(p^.right^.location,opsize);
  703. LOC_JUMP:
  704. begin
  705. case opsize of
  706. S_L : hregister:=getregister32;
  707. S_W : hregister:=reg32toreg16(getregister32);
  708. S_B : hregister:=reg32toreg8(getregister32);
  709. end;
  710. p^.right^.location.loc:=LOC_REGISTER;
  711. p^.right^.location.register:=hregister;
  712. emitlab(truelabel);
  713. truelabel:=otl;
  714. exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,opsize,1,
  715. hregister)));
  716. getlabel(hl);
  717. emitjmp(C_None,hl);
  718. emitlab(falselabel);
  719. falselabel:=ofl;
  720. exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,S_L,makereg32(hregister),
  721. makereg32(hregister))));
  722. emitlab(hl);
  723. end;
  724. end;
  725. goto do_normal;
  726. end
  727. else
  728. CGMessage(type_e_mismatch);
  729. end
  730. end
  731. else
  732. begin
  733. { in case of constant put it to the left }
  734. if (p^.left^.treetype=ordconstn) then
  735. swaptree(p);
  736. secondpass(p^.left);
  737. { this will be complicated as
  738. a lot of code below assumes that
  739. p^.location and p^.left^.location are the same }
  740. {$ifdef test_dest_loc}
  741. if dest_loc_known and (dest_loc_tree=p) and
  742. ((dest_loc.loc=LOC_REGISTER) or (dest_loc.loc=LOC_CREGISTER)) then
  743. begin
  744. set_location(p^.location,dest_loc);
  745. in_dest_loc:=true;
  746. is_in_dest:=true;
  747. end
  748. else
  749. {$endif test_dest_loc}
  750. set_location(p^.location,p^.left^.location);
  751. { are too few registers free? }
  752. pushed:=maybe_push(p^.right^.registers32,p,is_64bitint(p^.left^.resulttype));
  753. secondpass(p^.right);
  754. if pushed then
  755. restore(p,is_64bitint(p^.left^.resulttype));
  756. if (p^.left^.resulttype^.deftype=pointerdef) or
  757. (p^.right^.resulttype^.deftype=pointerdef) or
  758. ((p^.right^.resulttype^.deftype=objectdef) and
  759. pobjectdef(p^.right^.resulttype)^.is_class and
  760. (p^.left^.resulttype^.deftype=objectdef) and
  761. pobjectdef(p^.left^.resulttype)^.is_class
  762. ) or
  763. (p^.left^.resulttype^.deftype=classrefdef) or
  764. (p^.left^.resulttype^.deftype=procvardef) or
  765. ((p^.left^.resulttype^.deftype=enumdef) and
  766. (p^.left^.resulttype^.size=4)) or
  767. ((p^.left^.resulttype^.deftype=orddef) and
  768. (porddef(p^.left^.resulttype)^.typ=s32bit)) or
  769. ((p^.right^.resulttype^.deftype=orddef) and
  770. (porddef(p^.right^.resulttype)^.typ=s32bit)) or
  771. ((p^.left^.resulttype^.deftype=orddef) and
  772. (porddef(p^.left^.resulttype)^.typ=u32bit)) or
  773. ((p^.right^.resulttype^.deftype=orddef) and
  774. (porddef(p^.right^.resulttype)^.typ=u32bit)) or
  775. { as well as small sets }
  776. is_set then
  777. begin
  778. do_normal:
  779. mboverflow:=false;
  780. cmpop:=false;
  781. if (p^.left^.resulttype^.deftype=pointerdef) or
  782. (p^.right^.resulttype^.deftype=pointerdef) or
  783. ((p^.left^.resulttype^.deftype=orddef) and
  784. (porddef(p^.left^.resulttype)^.typ=u32bit)) or
  785. ((p^.right^.resulttype^.deftype=orddef) and
  786. (porddef(p^.right^.resulttype)^.typ=u32bit)) then
  787. unsigned:=true;
  788. case p^.treetype of
  789. addn : begin
  790. if is_set then
  791. begin
  792. { adding elements is not commutative }
  793. if p^.swaped and (p^.left^.treetype=setelementn) then
  794. swaptree(p);
  795. { are we adding set elements ? }
  796. if p^.right^.treetype=setelementn then
  797. begin
  798. { no range support for smallsets! }
  799. if assigned(p^.right^.right) then
  800. internalerror(43244);
  801. { bts requires both elements to be registers }
  802. if p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE] then
  803. begin
  804. ungetiftemp(p^.left^.location.reference);
  805. del_location(p^.left^.location);
  806. {!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
  807. hregister:=getregister32;
  808. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  809. newreference(p^.left^.location.reference),hregister)));
  810. clear_location(p^.left^.location);
  811. p^.left^.location.loc:=LOC_REGISTER;
  812. p^.left^.location.register:=hregister;
  813. set_location(p^.location,p^.left^.location);
  814. end;
  815. if p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE] then
  816. begin
  817. ungetiftemp(p^.right^.location.reference);
  818. del_location(p^.right^.location);
  819. hregister:=getregister32;
  820. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  821. newreference(p^.right^.location.reference),hregister)));
  822. clear_location(p^.right^.location);
  823. p^.right^.location.loc:=LOC_REGISTER;
  824. p^.right^.location.register:=hregister;
  825. end;
  826. op:=A_BTS;
  827. noswap:=true;
  828. end
  829. else
  830. op:=A_OR;
  831. mboverflow:=false;
  832. unsigned:=false;
  833. end
  834. else
  835. begin
  836. op:=A_ADD;
  837. mboverflow:=true;
  838. end;
  839. end;
  840. symdifn : begin
  841. { the symetric diff is only for sets }
  842. if is_set then
  843. begin
  844. op:=A_XOR;
  845. mboverflow:=false;
  846. unsigned:=false;
  847. end
  848. else
  849. CGMessage(type_e_mismatch);
  850. end;
  851. muln : begin
  852. if is_set then
  853. begin
  854. op:=A_AND;
  855. mboverflow:=false;
  856. unsigned:=false;
  857. end
  858. else
  859. begin
  860. if unsigned then
  861. op:=A_MUL
  862. else
  863. op:=A_IMUL;
  864. mboverflow:=true;
  865. end;
  866. end;
  867. subn : begin
  868. if is_set then
  869. begin
  870. op:=A_AND;
  871. mboverflow:=false;
  872. unsigned:=false;
  873. {$IfNDef NoSetConstNot}
  874. If (p^.right^.treetype = setconstn) then
  875. p^.right^.location.reference.offset := not(p^.right^.location.reference.offset)
  876. Else
  877. {$EndIf NoNosetConstNot}
  878. extra_not:=true;
  879. end
  880. else
  881. begin
  882. op:=A_SUB;
  883. mboverflow:=true;
  884. end;
  885. end;
  886. ltn,lten,
  887. gtn,gten,
  888. equaln,unequaln : begin
  889. {$IfNDef NoSetInclusion}
  890. If is_set Then
  891. Case p^.treetype of
  892. lten,gten:
  893. Begin
  894. If p^.treetype = gten then
  895. swaptree(p);
  896. if p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE] then
  897. begin
  898. ungetiftemp(p^.left^.location.reference);
  899. del_reference(p^.left^.location.reference);
  900. hregister:=getregister32;
  901. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  902. newreference(p^.left^.location.reference),hregister)));
  903. clear_location(p^.left^.location);
  904. p^.left^.location.loc:=LOC_REGISTER;
  905. p^.left^.location.register:=hregister;
  906. set_location(p^.location,p^.left^.location);
  907. end
  908. else
  909. if p^.left^.location.loc = LOC_CREGISTER Then
  910. {save the register var in a temp register, because
  911. its value is going to be modified}
  912. begin
  913. hregister := getregister32;
  914. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOV,opsize,
  915. p^.left^.location.register,hregister)));
  916. clear_location(p^.left^.location);
  917. p^.left^.location.loc:=LOC_REGISTER;
  918. p^.left^.location.register:=hregister;
  919. set_location(p^.location,p^.left^.location);
  920. end;
  921. {here, p^.left^.location should be LOC_REGISTER}
  922. If p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE] Then
  923. exprasmlist^.concat(new(pai386,op_ref_reg(A_AND,opsize,
  924. newreference(p^.right^.location.reference),p^.left^.location.register)))
  925. Else
  926. exprasmlist^.concat(new(pai386,op_reg_reg(A_AND,opsize,
  927. p^.right^.location.register,p^.left^.location.register)));
  928. {warning: ugly hack ahead: we need a "jne" after the cmp, so
  929. change the treetype from lten/gten to equaln}
  930. p^.treetype := equaln
  931. End;
  932. {no < or > support for sets}
  933. ltn,gtn: CGMessage(type_e_mismatch);
  934. End;
  935. {$EndIf NoSetInclusion}
  936. op:=A_CMP;
  937. cmpop:=true;
  938. end;
  939. xorn : op:=A_XOR;
  940. orn : op:=A_OR;
  941. andn : op:=A_AND;
  942. else
  943. CGMessage(type_e_mismatch);
  944. end;
  945. { filter MUL, which requires special handling }
  946. if op=A_MUL then
  947. begin
  948. popeax:=false;
  949. popedx:=false;
  950. { here you need to free the symbol first }
  951. clear_location(p^.location);
  952. release_loc(p^.right^.location);
  953. release_loc(p^.left^.location);
  954. p^.location.register:=getregister32;
  955. p^.location.loc:=LOC_REGISTER;
  956. {$IfNDef NoShlMul}
  957. if p^.right^.treetype=ordconstn then
  958. swaptree(p);
  959. If (p^.left^.treetype = ordconstn) and
  960. ispowerof2(p^.left^.value, power) and
  961. not(cs_check_overflow in aktlocalswitches) then
  962. Begin
  963. emitloadord2reg(p^.right^.location,u32bitdef,p^.location.register,true);
  964. exprasmlist^.concat(new(pai386,op_const_reg(A_SHL,S_L,power,p^.location.register)))
  965. End
  966. Else
  967. Begin
  968. {$EndIf NoShlMul}
  969. if not(R_EAX in unused) and (p^.location.register<>R_EAX) then
  970. begin
  971. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EAX)));
  972. popeax:=true;
  973. end;
  974. if not(R_EDX in unused) and (p^.location.register<>R_EDX) then
  975. begin
  976. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EDX)));
  977. popedx:=true;
  978. end;
  979. { p^.left^.location can be R_EAX !!! }
  980. emitloadord2reg(p^.left^.location,u32bitdef,R_EDI,true);
  981. emitloadord2reg(p^.right^.location,u32bitdef,R_EAX,true);
  982. exprasmlist^.concat(new(pai386,op_reg(A_MUL,S_L,R_EDI)));
  983. emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.register);
  984. if popedx then
  985. exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EDX)));
  986. if popeax then
  987. exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EAX)));
  988. {$IfNDef NoShlMul}
  989. End;
  990. {$endif NoShlMul}
  991. SetResultLocation(false,true,p);
  992. exit;
  993. end;
  994. { Convert flags to register first }
  995. if (p^.left^.location.loc=LOC_FLAGS) then
  996. locflags2reg(p^.left^.location,opsize);
  997. if (p^.right^.location.loc=LOC_FLAGS) then
  998. locflags2reg(p^.right^.location,opsize);
  999. { left and right no register? }
  1000. { then one must be demanded }
  1001. if (p^.left^.location.loc<>LOC_REGISTER) and
  1002. (p^.right^.location.loc<>LOC_REGISTER) then
  1003. begin
  1004. { register variable ? }
  1005. if (p^.left^.location.loc=LOC_CREGISTER) then
  1006. begin
  1007. { it is OK if this is the destination }
  1008. if is_in_dest then
  1009. begin
  1010. hregister:=p^.location.register;
  1011. emit_reg_reg(A_MOV,opsize,p^.left^.location.register,
  1012. hregister);
  1013. end
  1014. else
  1015. if cmpop then
  1016. begin
  1017. { do not disturb the register }
  1018. hregister:=p^.location.register;
  1019. end
  1020. else
  1021. begin
  1022. case opsize of
  1023. S_L : hregister:=getregister32;
  1024. S_B : hregister:=reg32toreg8(getregister32);
  1025. end;
  1026. emit_reg_reg(A_MOV,opsize,p^.left^.location.register,
  1027. hregister);
  1028. end
  1029. end
  1030. else
  1031. begin
  1032. ungetiftemp(p^.left^.location.reference);
  1033. del_reference(p^.left^.location.reference);
  1034. if is_in_dest then
  1035. begin
  1036. hregister:=p^.location.register;
  1037. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  1038. newreference(p^.left^.location.reference),hregister)));
  1039. end
  1040. else
  1041. begin
  1042. { first give free, then demand new register }
  1043. case opsize of
  1044. S_L : hregister:=getregister32;
  1045. S_W : hregister:=reg32toreg16(getregister32);
  1046. S_B : hregister:=reg32toreg8(getregister32);
  1047. end;
  1048. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  1049. newreference(p^.left^.location.reference),hregister)));
  1050. end;
  1051. end;
  1052. clear_location(p^.location);
  1053. p^.location.loc:=LOC_REGISTER;
  1054. p^.location.register:=hregister;
  1055. end
  1056. else
  1057. { if on the right the register then swap }
  1058. if not(noswap) and (p^.right^.location.loc=LOC_REGISTER) then
  1059. begin
  1060. swap_location(p^.location,p^.right^.location);
  1061. { newly swapped also set swapped flag }
  1062. p^.swaped:=not(p^.swaped);
  1063. end;
  1064. { at this point, p^.location.loc should be LOC_REGISTER }
  1065. { and p^.location.register should be a valid register }
  1066. { containing the left result }
  1067. if p^.right^.location.loc<>LOC_REGISTER then
  1068. begin
  1069. if (p^.treetype=subn) and p^.swaped then
  1070. begin
  1071. if p^.right^.location.loc=LOC_CREGISTER then
  1072. begin
  1073. if extra_not then
  1074. exprasmlist^.concat(new(pai386,op_reg(A_NOT,opsize,p^.location.register)));
  1075. emit_reg_reg(A_MOV,opsize,p^.right^.location.register,R_EDI);
  1076. emit_reg_reg(op,opsize,p^.location.register,R_EDI);
  1077. emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
  1078. end
  1079. else
  1080. begin
  1081. if extra_not then
  1082. exprasmlist^.concat(new(pai386,op_reg(A_NOT,opsize,p^.location.register)));
  1083. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  1084. newreference(p^.right^.location.reference),R_EDI)));
  1085. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,p^.location.register,R_EDI)));
  1086. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOV,opsize,R_EDI,p^.location.register)));
  1087. ungetiftemp(p^.right^.location.reference);
  1088. del_reference(p^.right^.location.reference);
  1089. end;
  1090. end
  1091. else
  1092. begin
  1093. if (p^.right^.treetype=ordconstn) and
  1094. (op=A_CMP) and
  1095. (p^.right^.value=0) then
  1096. begin
  1097. exprasmlist^.concat(new(pai386,op_reg_reg(A_TEST,opsize,p^.location.register,
  1098. p^.location.register)));
  1099. end
  1100. else if (p^.right^.treetype=ordconstn) and
  1101. (op=A_ADD) and
  1102. (p^.right^.value=1) and
  1103. not(cs_check_overflow in aktlocalswitches) then
  1104. begin
  1105. exprasmlist^.concat(new(pai386,op_reg(A_INC,opsize,
  1106. p^.location.register)));
  1107. end
  1108. else if (p^.right^.treetype=ordconstn) and
  1109. (op=A_SUB) and
  1110. (p^.right^.value=1) and
  1111. not(cs_check_overflow in aktlocalswitches) then
  1112. begin
  1113. exprasmlist^.concat(new(pai386,op_reg(A_DEC,opsize,
  1114. p^.location.register)));
  1115. end
  1116. else if (p^.right^.treetype=ordconstn) and
  1117. (op=A_IMUL) and
  1118. (ispowerof2(p^.right^.value,power)) and
  1119. not(cs_check_overflow in aktlocalswitches) then
  1120. begin
  1121. exprasmlist^.concat(new(pai386,op_const_reg(A_SHL,opsize,power,
  1122. p^.location.register)));
  1123. end
  1124. else
  1125. begin
  1126. if (p^.right^.location.loc=LOC_CREGISTER) then
  1127. begin
  1128. if extra_not then
  1129. begin
  1130. emit_reg_reg(A_MOV,S_L,p^.right^.location.register,R_EDI);
  1131. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,R_EDI)));
  1132. emit_reg_reg(A_AND,S_L,R_EDI,
  1133. p^.location.register);
  1134. end
  1135. else
  1136. begin
  1137. emit_reg_reg(op,opsize,p^.right^.location.register,
  1138. p^.location.register);
  1139. end;
  1140. end
  1141. else
  1142. begin
  1143. if extra_not then
  1144. begin
  1145. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,newreference(
  1146. p^.right^.location.reference),R_EDI)));
  1147. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,R_EDI)));
  1148. emit_reg_reg(A_AND,S_L,R_EDI,
  1149. p^.location.register);
  1150. end
  1151. else
  1152. begin
  1153. exprasmlist^.concat(new(pai386,op_ref_reg(op,opsize,newreference(
  1154. p^.right^.location.reference),p^.location.register)));
  1155. end;
  1156. ungetiftemp(p^.right^.location.reference);
  1157. del_reference(p^.right^.location.reference);
  1158. end;
  1159. end;
  1160. end;
  1161. end
  1162. else
  1163. begin
  1164. { when swapped another result register }
  1165. if (p^.treetype=subn) and p^.swaped then
  1166. begin
  1167. if extra_not then
  1168. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,p^.location.register)));
  1169. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,
  1170. p^.location.register,p^.right^.location.register)));
  1171. swap_location(p^.location,p^.right^.location);
  1172. { newly swapped also set swapped flag }
  1173. { just to maintain ordering }
  1174. p^.swaped:=not(p^.swaped);
  1175. end
  1176. else
  1177. begin
  1178. if extra_not then
  1179. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,p^.right^.location.register)));
  1180. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,
  1181. p^.right^.location.register,
  1182. p^.location.register)));
  1183. end;
  1184. case opsize of
  1185. S_L : ungetregister32(p^.right^.location.register);
  1186. S_B : ungetregister32(reg8toreg32(p^.right^.location.register));
  1187. end;
  1188. end;
  1189. if cmpop then
  1190. case opsize of
  1191. S_L : ungetregister32(p^.location.register);
  1192. S_B : ungetregister32(reg8toreg32(p^.location.register));
  1193. end;
  1194. { only in case of overflow operations }
  1195. { produce overflow code }
  1196. { we must put it here directly, because sign of operation }
  1197. { is in unsigned VAR!! }
  1198. if mboverflow then
  1199. begin
  1200. if cs_check_overflow in aktlocalswitches then
  1201. begin
  1202. getlabel(hl4);
  1203. if unsigned then
  1204. emitjmp(C_NB,hl4)
  1205. else
  1206. emitjmp(C_NO,hl4);
  1207. emitcall('FPC_OVERFLOW');
  1208. emitlab(hl4);
  1209. end;
  1210. end;
  1211. end
  1212. else
  1213. { Char type }
  1214. if ((p^.left^.resulttype^.deftype=orddef) and
  1215. (porddef(p^.left^.resulttype)^.typ=uchar)) or
  1216. { enumeration type 16 bit }
  1217. ((p^.left^.resulttype^.deftype=enumdef) and
  1218. (p^.left^.resulttype^.size=1)) then
  1219. begin
  1220. case p^.treetype of
  1221. ltn,lten,gtn,gten,
  1222. equaln,unequaln :
  1223. cmpop:=true;
  1224. else CGMessage(type_e_mismatch);
  1225. end;
  1226. unsigned:=true;
  1227. { left and right no register? }
  1228. { the one must be demanded }
  1229. if (p^.location.loc<>LOC_REGISTER) and
  1230. (p^.right^.location.loc<>LOC_REGISTER) then
  1231. begin
  1232. if p^.location.loc=LOC_CREGISTER then
  1233. begin
  1234. if cmpop then
  1235. { do not disturb register }
  1236. hregister:=p^.location.register
  1237. else
  1238. begin
  1239. hregister:=reg32toreg8(getregister32);
  1240. emit_reg_reg(A_MOV,S_B,p^.location.register,
  1241. hregister);
  1242. end;
  1243. end
  1244. else
  1245. begin
  1246. del_reference(p^.location.reference);
  1247. { first give free then demand new register }
  1248. hregister:=reg32toreg8(getregister32);
  1249. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_B,newreference(p^.location.reference),
  1250. hregister)));
  1251. end;
  1252. clear_location(p^.location);
  1253. p^.location.loc:=LOC_REGISTER;
  1254. p^.location.register:=hregister;
  1255. end;
  1256. { now p always a register }
  1257. if (p^.right^.location.loc=LOC_REGISTER) and
  1258. (p^.location.loc<>LOC_REGISTER) then
  1259. begin
  1260. swap_location(p^.location,p^.right^.location);
  1261. { newly swapped also set swapped flag }
  1262. p^.swaped:=not(p^.swaped);
  1263. end;
  1264. if p^.right^.location.loc<>LOC_REGISTER then
  1265. begin
  1266. if p^.right^.location.loc=LOC_CREGISTER then
  1267. begin
  1268. emit_reg_reg(A_CMP,S_B,
  1269. p^.right^.location.register,p^.location.register);
  1270. end
  1271. else
  1272. begin
  1273. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_B,newreference(
  1274. p^.right^.location.reference),p^.location.register)));
  1275. del_reference(p^.right^.location.reference);
  1276. end;
  1277. end
  1278. else
  1279. begin
  1280. emit_reg_reg(A_CMP,S_B,p^.right^.location.register,
  1281. p^.location.register);
  1282. ungetregister32(reg8toreg32(p^.right^.location.register));
  1283. end;
  1284. ungetregister32(reg8toreg32(p^.location.register));
  1285. end
  1286. else
  1287. { 16 bit enumeration type }
  1288. if ((p^.left^.resulttype^.deftype=enumdef) and
  1289. (p^.left^.resulttype^.size=2)) then
  1290. begin
  1291. case p^.treetype of
  1292. ltn,lten,gtn,gten,
  1293. equaln,unequaln :
  1294. cmpop:=true;
  1295. else CGMessage(type_e_mismatch);
  1296. end;
  1297. unsigned:=true;
  1298. { left and right no register? }
  1299. { the one must be demanded }
  1300. if (p^.location.loc<>LOC_REGISTER) and
  1301. (p^.right^.location.loc<>LOC_REGISTER) then
  1302. begin
  1303. if p^.location.loc=LOC_CREGISTER then
  1304. begin
  1305. if cmpop then
  1306. { do not disturb register }
  1307. hregister:=p^.location.register
  1308. else
  1309. begin
  1310. hregister:=reg32toreg16(getregister32);
  1311. emit_reg_reg(A_MOV,S_W,p^.location.register,
  1312. hregister);
  1313. end;
  1314. end
  1315. else
  1316. begin
  1317. del_reference(p^.location.reference);
  1318. { first give free then demand new register }
  1319. hregister:=reg32toreg16(getregister32);
  1320. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_W,newreference(p^.location.reference),
  1321. hregister)));
  1322. end;
  1323. clear_location(p^.location);
  1324. p^.location.loc:=LOC_REGISTER;
  1325. p^.location.register:=hregister;
  1326. end;
  1327. { now p always a register }
  1328. if (p^.right^.location.loc=LOC_REGISTER) and
  1329. (p^.location.loc<>LOC_REGISTER) then
  1330. begin
  1331. swap_location(p^.location,p^.right^.location);
  1332. { newly swapped also set swapped flag }
  1333. p^.swaped:=not(p^.swaped);
  1334. end;
  1335. if p^.right^.location.loc<>LOC_REGISTER then
  1336. begin
  1337. if p^.right^.location.loc=LOC_CREGISTER then
  1338. begin
  1339. emit_reg_reg(A_CMP,S_W,
  1340. p^.right^.location.register,p^.location.register);
  1341. end
  1342. else
  1343. begin
  1344. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_W,newreference(
  1345. p^.right^.location.reference),p^.location.register)));
  1346. del_reference(p^.right^.location.reference);
  1347. end;
  1348. end
  1349. else
  1350. begin
  1351. emit_reg_reg(A_CMP,S_W,p^.right^.location.register,
  1352. p^.location.register);
  1353. ungetregister32(reg16toreg32(p^.right^.location.register));
  1354. end;
  1355. ungetregister32(reg16toreg32(p^.location.register));
  1356. end
  1357. else
  1358. { 64 bit types }
  1359. if is_64bitint(p^.left^.resulttype) then
  1360. begin
  1361. mboverflow:=false;
  1362. cmpop:=false;
  1363. unsigned:=((p^.left^.resulttype^.deftype=orddef) and
  1364. (porddef(p^.left^.resulttype)^.typ=u64bit)) or
  1365. ((p^.right^.resulttype^.deftype=orddef) and
  1366. (porddef(p^.right^.resulttype)^.typ=u64bit));
  1367. case p^.treetype of
  1368. addn : begin
  1369. begin
  1370. op:=A_ADD;
  1371. op2:=A_ADC;
  1372. mboverflow:=true;
  1373. end;
  1374. end;
  1375. subn : begin
  1376. op:=A_SUB;
  1377. op2:=A_SBB;
  1378. mboverflow:=true;
  1379. end;
  1380. ltn,lten,
  1381. gtn,gten,
  1382. equaln,unequaln:
  1383. begin
  1384. op:=A_CMP;
  1385. op2:=A_CMP;
  1386. cmpop:=true;
  1387. end;
  1388. xorn:
  1389. begin
  1390. op:=A_XOR;
  1391. op2:=A_XOR;
  1392. end;
  1393. orn:
  1394. begin
  1395. op:=A_OR;
  1396. op2:=A_OR;
  1397. end;
  1398. andn:
  1399. begin
  1400. op:=A_AND;
  1401. op2:=A_AND;
  1402. end;
  1403. muln:
  1404. ;
  1405. else
  1406. CGMessage(type_e_mismatch);
  1407. end;
  1408. if p^.treetype=muln then
  1409. begin
  1410. { save p^.lcoation, because we change it now }
  1411. set_location(hloc,p^.location);
  1412. release_qword_loc(p^.location);
  1413. release_qword_loc(p^.right^.location);
  1414. p^.location.registerlow:=getexplicitregister32(R_EAX);
  1415. p^.location.registerhigh:=getexplicitregister32(R_EDX);
  1416. pushusedregisters(pushedreg,$ff
  1417. and not($80 shr byte(p^.location.registerlow))
  1418. and not($80 shr byte(p^.location.registerhigh)));
  1419. if cs_check_overflow in aktlocalswitches then
  1420. push_int(1)
  1421. else
  1422. push_int(0);
  1423. { the left operand is in hloc, because the
  1424. location of left is p^.location but p^.location
  1425. is already destroyed
  1426. }
  1427. emit_pushq_loc(hloc);
  1428. clear_location(hloc);
  1429. emit_pushq_loc(p^.right^.location);
  1430. if porddef(p^.resulttype)^.typ=u64bit then
  1431. emitcall('FPC_MUL_QWORD')
  1432. else
  1433. emitcall('FPC_MUL_INT64');
  1434. emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.registerlow);
  1435. emit_reg_reg(A_MOV,S_L,R_EDX,p^.location.registerhigh);
  1436. popusedregisters(pushedreg);
  1437. p^.location.loc:=LOC_REGISTER;
  1438. end
  1439. else
  1440. begin
  1441. { left and right no register? }
  1442. { then one must be demanded }
  1443. if (p^.left^.location.loc<>LOC_REGISTER) and
  1444. (p^.right^.location.loc<>LOC_REGISTER) then
  1445. begin
  1446. { register variable ? }
  1447. if (p^.left^.location.loc=LOC_CREGISTER) then
  1448. begin
  1449. { it is OK if this is the destination }
  1450. if is_in_dest then
  1451. begin
  1452. hregister:=p^.location.registerlow;
  1453. hregister2:=p^.location.registerhigh;
  1454. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerlow,
  1455. hregister);
  1456. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerlow,
  1457. hregister2);
  1458. end
  1459. else
  1460. if cmpop then
  1461. begin
  1462. { do not disturb the register }
  1463. hregister:=p^.location.registerlow;
  1464. hregister2:=p^.location.registerhigh;
  1465. end
  1466. else
  1467. begin
  1468. hregister:=getregister32;
  1469. hregister2:=getregister32;
  1470. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerlow,
  1471. hregister);
  1472. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerhigh,
  1473. hregister2);
  1474. end
  1475. end
  1476. else
  1477. begin
  1478. ungetiftemp(p^.left^.location.reference);
  1479. del_reference(p^.left^.location.reference);
  1480. if is_in_dest then
  1481. begin
  1482. hregister:=p^.location.registerlow;
  1483. hregister2:=p^.location.registerhigh;
  1484. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1485. newreference(p^.left^.location.reference),hregister)));
  1486. hr:=newreference(p^.left^.location.reference);
  1487. inc(hr^.offset,4);
  1488. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1489. hr,hregister2)));
  1490. end
  1491. else
  1492. begin
  1493. hregister:=getregister32;
  1494. hregister2:=getregister32;
  1495. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1496. newreference(p^.left^.location.reference),hregister)));
  1497. hr:=newreference(p^.left^.location.reference);
  1498. inc(hr^.offset,4);
  1499. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1500. hr,hregister2)));
  1501. end;
  1502. end;
  1503. clear_location(p^.location);
  1504. p^.location.loc:=LOC_REGISTER;
  1505. p^.location.registerlow:=hregister;
  1506. p^.location.registerhigh:=hregister2;
  1507. end
  1508. else
  1509. { if on the right the register then swap }
  1510. if not(noswap) and (p^.right^.location.loc=LOC_REGISTER) then
  1511. begin
  1512. swap_location(p^.location,p^.right^.location);
  1513. { newly swapped also set swapped flag }
  1514. p^.swaped:=not(p^.swaped);
  1515. end;
  1516. { at this point, p^.location.loc should be LOC_REGISTER }
  1517. { and p^.location.register should be a valid register }
  1518. { containing the left result }
  1519. if p^.right^.location.loc<>LOC_REGISTER then
  1520. begin
  1521. if (p^.treetype=subn) and p^.swaped then
  1522. begin
  1523. if p^.right^.location.loc=LOC_CREGISTER then
  1524. begin
  1525. emit_reg_reg(A_MOV,opsize,p^.right^.location.register,R_EDI);
  1526. emit_reg_reg(op,opsize,p^.location.register,R_EDI);
  1527. emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
  1528. emit_reg_reg(A_MOV,opsize,p^.right^.location.registerhigh,R_EDI);
  1529. { the carry flag is still ok }
  1530. emit_reg_reg(op2,opsize,p^.location.registerhigh,R_EDI);
  1531. emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.registerhigh);
  1532. end
  1533. else
  1534. begin
  1535. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  1536. newreference(p^.right^.location.reference),R_EDI)));
  1537. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,p^.location.registerlow,R_EDI)));
  1538. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOV,opsize,R_EDI,p^.location.registerlow)));
  1539. hr:=newreference(p^.right^.location.reference);
  1540. inc(hr^.offset,4);
  1541. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  1542. hr,R_EDI)));
  1543. { here the carry flag is still preserved }
  1544. exprasmlist^.concat(new(pai386,op_reg_reg(op2,opsize,p^.location.registerhigh,R_EDI)));
  1545. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOV,opsize,R_EDI,
  1546. p^.location.registerhigh)));
  1547. ungetiftemp(p^.right^.location.reference);
  1548. del_reference(p^.right^.location.reference);
  1549. end;
  1550. end
  1551. else if cmpop then
  1552. begin
  1553. if (p^.right^.location.loc=LOC_CREGISTER) then
  1554. begin
  1555. emit_reg_reg(A_CMP,S_L,p^.right^.location.registerhigh,
  1556. p^.location.registerhigh);
  1557. firstjmp64bitcmp;
  1558. emit_reg_reg(A_CMP,S_L,p^.right^.location.registerlow,
  1559. p^.location.registerlow);
  1560. secondjmp64bitcmp;
  1561. end
  1562. else
  1563. begin
  1564. hr:=newreference(p^.right^.location.reference);
  1565. inc(hr^.offset,4);
  1566. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_L,
  1567. hr,p^.location.registerhigh)));
  1568. firstjmp64bitcmp;
  1569. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_L,newreference(
  1570. p^.right^.location.reference),p^.location.registerlow)));
  1571. secondjmp64bitcmp;
  1572. emitjmp(C_None,falselabel);
  1573. ungetiftemp(p^.right^.location.reference);
  1574. del_reference(p^.right^.location.reference);
  1575. end;
  1576. end
  1577. else
  1578. begin
  1579. {
  1580. if (p^.right^.treetype=ordconstn) and
  1581. (op=A_CMP) and
  1582. (p^.right^.value=0) then
  1583. begin
  1584. exprasmlist^.concat(new(pai386,op_reg_reg(A_TEST,opsize,p^.location.register,
  1585. p^.location.register)));
  1586. end
  1587. else if (p^.right^.treetype=ordconstn) and
  1588. (op=A_IMUL) and
  1589. (ispowerof2(p^.right^.value,power)) then
  1590. begin
  1591. exprasmlist^.concat(new(pai386,op_const_reg(A_SHL,opsize,power,
  1592. p^.location.register)));
  1593. end
  1594. else
  1595. }
  1596. begin
  1597. if (p^.right^.location.loc=LOC_CREGISTER) then
  1598. begin
  1599. emit_reg_reg(op,S_L,p^.right^.location.registerlow,
  1600. p^.location.registerlow);
  1601. emit_reg_reg(op2,S_L,p^.right^.location.registerhigh,
  1602. p^.location.registerhigh);
  1603. end
  1604. else
  1605. begin
  1606. exprasmlist^.concat(new(pai386,op_ref_reg(op,S_L,newreference(
  1607. p^.right^.location.reference),p^.location.registerlow)));
  1608. hr:=newreference(p^.right^.location.reference);
  1609. inc(hr^.offset,4);
  1610. exprasmlist^.concat(new(pai386,op_ref_reg(op2,S_L,
  1611. hr,p^.location.registerhigh)));
  1612. ungetiftemp(p^.right^.location.reference);
  1613. del_reference(p^.right^.location.reference);
  1614. end;
  1615. end;
  1616. end;
  1617. end
  1618. else
  1619. begin
  1620. { when swapped another result register }
  1621. if (p^.treetype=subn) and p^.swaped then
  1622. begin
  1623. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_L,
  1624. p^.location.registerlow,
  1625. p^.right^.location.registerlow)));
  1626. exprasmlist^.concat(new(pai386,op_reg_reg(op2,S_L,
  1627. p^.location.registerhigh,
  1628. p^.right^.location.registerhigh)));
  1629. swap_location(p^.location,p^.right^.location);
  1630. { newly swapped also set swapped flag }
  1631. { just to maintain ordering }
  1632. p^.swaped:=not(p^.swaped);
  1633. end
  1634. else if cmpop then
  1635. begin
  1636. exprasmlist^.concat(new(pai386,op_reg_reg(A_CMP,S_L,
  1637. p^.right^.location.registerhigh,
  1638. p^.location.registerhigh)));
  1639. firstjmp64bitcmp;
  1640. exprasmlist^.concat(new(pai386,op_reg_reg(A_CMP,S_L,
  1641. p^.right^.location.registerlow,
  1642. p^.location.registerlow)));
  1643. secondjmp64bitcmp;
  1644. end
  1645. else
  1646. begin
  1647. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_L,
  1648. p^.right^.location.registerlow,
  1649. p^.location.registerlow)));
  1650. exprasmlist^.concat(new(pai386,op_reg_reg(op2,S_L,
  1651. p^.right^.location.registerhigh,
  1652. p^.location.registerhigh)));
  1653. end;
  1654. ungetregister32(p^.right^.location.registerlow);
  1655. ungetregister32(p^.right^.location.registerhigh);
  1656. end;
  1657. if cmpop then
  1658. begin
  1659. ungetregister32(p^.location.registerlow);
  1660. ungetregister32(p^.location.registerhigh);
  1661. end;
  1662. { only in case of overflow operations }
  1663. { produce overflow code }
  1664. { we must put it here directly, because sign of operation }
  1665. { is in unsigned VAR!! }
  1666. if mboverflow then
  1667. begin
  1668. if cs_check_overflow in aktlocalswitches then
  1669. begin
  1670. getlabel(hl4);
  1671. if unsigned then
  1672. emitjmp(C_NB,hl4)
  1673. else
  1674. emitjmp(C_NO,hl4);
  1675. emitcall('FPC_OVERFLOW');
  1676. emitlab(hl4);
  1677. end;
  1678. end;
  1679. { we have LOC_JUMP as result }
  1680. if cmpop then
  1681. begin
  1682. clear_location(p^.location);
  1683. p^.location.loc:=LOC_JUMP;
  1684. cmpop:=false;
  1685. end;
  1686. end;
  1687. end
  1688. else
  1689. { Floating point }
  1690. if (p^.left^.resulttype^.deftype=floatdef) and
  1691. (pfloatdef(p^.left^.resulttype)^.typ<>f32bit) then
  1692. begin
  1693. { real constants to the left }
  1694. if p^.left^.treetype=realconstn then
  1695. swaptree(p);
  1696. cmpop:=false;
  1697. case p^.treetype of
  1698. addn : op:=A_FADDP;
  1699. muln : op:=A_FMULP;
  1700. subn : op:=A_FSUBP;
  1701. slashn : op:=A_FDIVP;
  1702. ltn,lten,gtn,gten,
  1703. equaln,unequaln : begin
  1704. op:=A_FCOMPP;
  1705. cmpop:=true;
  1706. end;
  1707. else CGMessage(type_e_mismatch);
  1708. end;
  1709. if (p^.right^.location.loc<>LOC_FPU) then
  1710. begin
  1711. if p^.right^.location.loc=LOC_CFPUREGISTER then
  1712. begin
  1713. exprasmlist^.concat(new(pai386,op_reg(A_FLD,S_NO,
  1714. correct_fpuregister(p^.right^.location.register,fpuvaroffset))));
  1715. inc(fpuvaroffset);
  1716. end
  1717. else
  1718. floatload(pfloatdef(p^.right^.resulttype)^.typ,p^.right^.location.reference);
  1719. if (p^.left^.location.loc<>LOC_FPU) then
  1720. begin
  1721. if p^.left^.location.loc=LOC_CFPUREGISTER then
  1722. begin
  1723. exprasmlist^.concat(new(pai386,op_reg(A_FLD,S_NO,
  1724. correct_fpuregister(p^.left^.location.register,fpuvaroffset))));
  1725. inc(fpuvaroffset);
  1726. end
  1727. else
  1728. floatload(pfloatdef(p^.left^.resulttype)^.typ,p^.left^.location.reference)
  1729. end
  1730. { left was on the stack => swap }
  1731. else
  1732. p^.swaped:=not(p^.swaped);
  1733. { releases the right reference }
  1734. del_reference(p^.right^.location.reference);
  1735. end
  1736. { the nominator in st0 }
  1737. else if (p^.left^.location.loc<>LOC_FPU) then
  1738. begin
  1739. if p^.left^.location.loc=LOC_CFPUREGISTER then
  1740. begin
  1741. exprasmlist^.concat(new(pai386,op_reg(A_FLD,S_NO,
  1742. correct_fpuregister(p^.left^.location.register,fpuvaroffset))));
  1743. inc(fpuvaroffset);
  1744. end
  1745. else
  1746. floatload(pfloatdef(p^.left^.resulttype)^.typ,p^.left^.location.reference)
  1747. end
  1748. { fpu operands are always in the wrong order on the stack }
  1749. else
  1750. p^.swaped:=not(p^.swaped);
  1751. { releases the left reference }
  1752. if (p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  1753. del_reference(p^.left^.location.reference);
  1754. { if we swaped the tree nodes, then use the reverse operator }
  1755. if p^.swaped then
  1756. begin
  1757. if (p^.treetype=slashn) then
  1758. op:=A_FDIVRP
  1759. else if (p^.treetype=subn) then
  1760. op:=A_FSUBRP;
  1761. end;
  1762. { to avoid the pentium bug
  1763. if (op=FDIVP) and (opt_processors=pentium) then
  1764. exprasmlist^.concat(new(pai386,op_CALL,S_NO,'EMUL_FDIVP')
  1765. else
  1766. }
  1767. { the Intel assemblers want operands }
  1768. if op<>A_FCOMPP then
  1769. begin
  1770. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,R_ST,R_ST1)));
  1771. dec(fpuvaroffset);
  1772. end
  1773. else
  1774. begin
  1775. exprasmlist^.concat(new(pai386,op_none(op,S_NO)));
  1776. dec(fpuvaroffset,2);
  1777. end;
  1778. { on comparison load flags }
  1779. if cmpop then
  1780. begin
  1781. if not(R_EAX in unused) then
  1782. emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
  1783. exprasmlist^.concat(new(pai386,op_reg(A_FNSTSW,S_NO,R_AX)));
  1784. exprasmlist^.concat(new(pai386,op_none(A_SAHF,S_NO)));
  1785. if not(R_EAX in unused) then
  1786. emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
  1787. if p^.swaped then
  1788. begin
  1789. case p^.treetype of
  1790. equaln : flags:=F_E;
  1791. unequaln : flags:=F_NE;
  1792. ltn : flags:=F_A;
  1793. lten : flags:=F_AE;
  1794. gtn : flags:=F_B;
  1795. gten : flags:=F_BE;
  1796. end;
  1797. end
  1798. else
  1799. begin
  1800. case p^.treetype of
  1801. equaln : flags:=F_E;
  1802. unequaln : flags:=F_NE;
  1803. ltn : flags:=F_B;
  1804. lten : flags:=F_BE;
  1805. gtn : flags:=F_A;
  1806. gten : flags:=F_AE;
  1807. end;
  1808. end;
  1809. clear_location(p^.location);
  1810. p^.location.loc:=LOC_FLAGS;
  1811. p^.location.resflags:=flags;
  1812. cmpop:=false;
  1813. end
  1814. else
  1815. begin
  1816. clear_location(p^.location);
  1817. p^.location.loc:=LOC_FPU;
  1818. end;
  1819. end
  1820. {$ifdef SUPPORT_MMX}
  1821. else
  1822. { MMX Arrays }
  1823. if is_mmx_able_array(p^.left^.resulttype) then
  1824. begin
  1825. cmpop:=false;
  1826. mmxbase:=mmx_type(p^.left^.resulttype);
  1827. case p^.treetype of
  1828. addn : begin
  1829. if (cs_mmx_saturation in aktlocalswitches) then
  1830. begin
  1831. case mmxbase of
  1832. mmxs8bit:
  1833. op:=A_PADDSB;
  1834. mmxu8bit:
  1835. op:=A_PADDUSB;
  1836. mmxs16bit,mmxfixed16:
  1837. op:=A_PADDSB;
  1838. mmxu16bit:
  1839. op:=A_PADDUSW;
  1840. end;
  1841. end
  1842. else
  1843. begin
  1844. case mmxbase of
  1845. mmxs8bit,mmxu8bit:
  1846. op:=A_PADDB;
  1847. mmxs16bit,mmxu16bit,mmxfixed16:
  1848. op:=A_PADDW;
  1849. mmxs32bit,mmxu32bit:
  1850. op:=A_PADDD;
  1851. end;
  1852. end;
  1853. end;
  1854. muln : begin
  1855. case mmxbase of
  1856. mmxs16bit,mmxu16bit:
  1857. op:=A_PMULLW;
  1858. mmxfixed16:
  1859. op:=A_PMULHW;
  1860. end;
  1861. end;
  1862. subn : begin
  1863. if (cs_mmx_saturation in aktlocalswitches) then
  1864. begin
  1865. case mmxbase of
  1866. mmxs8bit:
  1867. op:=A_PSUBSB;
  1868. mmxu8bit:
  1869. op:=A_PSUBUSB;
  1870. mmxs16bit,mmxfixed16:
  1871. op:=A_PSUBSB;
  1872. mmxu16bit:
  1873. op:=A_PSUBUSW;
  1874. end;
  1875. end
  1876. else
  1877. begin
  1878. case mmxbase of
  1879. mmxs8bit,mmxu8bit:
  1880. op:=A_PSUBB;
  1881. mmxs16bit,mmxu16bit,mmxfixed16:
  1882. op:=A_PSUBW;
  1883. mmxs32bit,mmxu32bit:
  1884. op:=A_PSUBD;
  1885. end;
  1886. end;
  1887. end;
  1888. {
  1889. ltn,lten,gtn,gten,
  1890. equaln,unequaln :
  1891. begin
  1892. op:=A_CMP;
  1893. cmpop:=true;
  1894. end;
  1895. }
  1896. xorn:
  1897. op:=A_PXOR;
  1898. orn:
  1899. op:=A_POR;
  1900. andn:
  1901. op:=A_PAND;
  1902. else CGMessage(type_e_mismatch);
  1903. end;
  1904. { left and right no register? }
  1905. { then one must be demanded }
  1906. if (p^.left^.location.loc<>LOC_MMXREGISTER) and
  1907. (p^.right^.location.loc<>LOC_MMXREGISTER) then
  1908. begin
  1909. { register variable ? }
  1910. if (p^.left^.location.loc=LOC_CMMXREGISTER) then
  1911. begin
  1912. { it is OK if this is the destination }
  1913. if is_in_dest then
  1914. begin
  1915. hregister:=p^.location.register;
  1916. emit_reg_reg(A_MOVQ,S_NO,p^.left^.location.register,
  1917. hregister);
  1918. end
  1919. else
  1920. begin
  1921. hregister:=getregistermmx;
  1922. emit_reg_reg(A_MOVQ,S_NO,p^.left^.location.register,
  1923. hregister);
  1924. end
  1925. end
  1926. else
  1927. begin
  1928. del_reference(p^.left^.location.reference);
  1929. if is_in_dest then
  1930. begin
  1931. hregister:=p^.location.register;
  1932. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOVQ,S_NO,
  1933. newreference(p^.left^.location.reference),hregister)));
  1934. end
  1935. else
  1936. begin
  1937. hregister:=getregistermmx;
  1938. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOVQ,S_NO,
  1939. newreference(p^.left^.location.reference),hregister)));
  1940. end;
  1941. end;
  1942. clear_location(p^.location);
  1943. p^.location.loc:=LOC_MMXREGISTER;
  1944. p^.location.register:=hregister;
  1945. end
  1946. else
  1947. { if on the right the register then swap }
  1948. if (p^.right^.location.loc=LOC_MMXREGISTER) then
  1949. begin
  1950. swap_location(p^.location,p^.right^.location);
  1951. { newly swapped also set swapped flag }
  1952. p^.swaped:=not(p^.swaped);
  1953. end;
  1954. { at this point, p^.location.loc should be LOC_MMXREGISTER }
  1955. { and p^.location.register should be a valid register }
  1956. { containing the left result }
  1957. if p^.right^.location.loc<>LOC_MMXREGISTER then
  1958. begin
  1959. if (p^.treetype=subn) and p^.swaped then
  1960. begin
  1961. if p^.right^.location.loc=LOC_CMMXREGISTER then
  1962. begin
  1963. emit_reg_reg(A_MOVQ,S_NO,p^.right^.location.register,R_MM7);
  1964. emit_reg_reg(op,S_NO,p^.location.register,R_EDI);
  1965. emit_reg_reg(A_MOVQ,S_NO,R_MM7,p^.location.register);
  1966. end
  1967. else
  1968. begin
  1969. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOVQ,S_NO,
  1970. newreference(p^.right^.location.reference),R_MM7)));
  1971. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,p^.location.register,
  1972. R_MM7)));
  1973. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOVQ,S_NO,
  1974. R_MM7,p^.location.register)));
  1975. del_reference(p^.right^.location.reference);
  1976. end;
  1977. end
  1978. else
  1979. begin
  1980. if (p^.right^.location.loc=LOC_CREGISTER) then
  1981. begin
  1982. emit_reg_reg(op,S_NO,p^.right^.location.register,
  1983. p^.location.register);
  1984. end
  1985. else
  1986. begin
  1987. exprasmlist^.concat(new(pai386,op_ref_reg(op,S_NO,newreference(
  1988. p^.right^.location.reference),p^.location.register)));
  1989. del_reference(p^.right^.location.reference);
  1990. end;
  1991. end;
  1992. end
  1993. else
  1994. begin
  1995. { when swapped another result register }
  1996. if (p^.treetype=subn) and p^.swaped then
  1997. begin
  1998. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,
  1999. p^.location.register,p^.right^.location.register)));
  2000. swap_location(p^.location,p^.right^.location);
  2001. { newly swapped also set swapped flag }
  2002. { just to maintain ordering }
  2003. p^.swaped:=not(p^.swaped);
  2004. end
  2005. else
  2006. begin
  2007. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,
  2008. p^.right^.location.register,
  2009. p^.location.register)));
  2010. end;
  2011. ungetregistermmx(p^.right^.location.register);
  2012. end;
  2013. end
  2014. {$endif SUPPORT_MMX}
  2015. else CGMessage(type_e_mismatch);
  2016. end;
  2017. SetResultLocation(cmpop,unsigned,p);
  2018. end;
  2019. end.
  2020. {
  2021. $Log$
  2022. Revision 1.73 1999-08-07 11:29:26 peter
  2023. * better fix for muln register allocation
  2024. Revision 1.72 1999/08/04 13:45:17 florian
  2025. + floating point register variables !!
  2026. * pairegalloc is now generated for register variables
  2027. Revision 1.71 1999/08/04 00:22:40 florian
  2028. * renamed i386asm and i386base to cpuasm and cpubase
  2029. Revision 1.70 1999/08/03 22:02:31 peter
  2030. * moved bitmask constants to sets
  2031. * some other type/const renamings
  2032. Revision 1.69 1999/07/05 20:13:06 peter
  2033. * removed temp defines
  2034. Revision 1.68 1999/07/02 12:18:46 jonas
  2035. * released setconstnot (changed to $ifndef nosetconstnot)
  2036. * released shlmul (changed to $ifndef no shlmul)
  2037. Revision 1.67 1999/06/14 17:47:45 peter
  2038. * merged
  2039. Revision 1.66.2.1 1999/06/14 17:24:40 peter
  2040. * fixed saving of registers with decr_ansistr
  2041. Revision 1.66 1999/06/09 23:22:37 peter
  2042. + del_location
  2043. Revision 1.65 1999/06/09 23:00:11 peter
  2044. * small ansistring fixes
  2045. * val_ansistr_sint destsize changed to longint
  2046. * don't write low/hi ascii with -al
  2047. Revision 1.64 1999/06/02 10:11:39 florian
  2048. * make cycle fixed i.e. compilation with 0.99.10
  2049. * some fixes for qword
  2050. * start of register calling conventions
  2051. Revision 1.63 1999/05/31 20:35:45 peter
  2052. * ansistring fixes, decr_ansistr called after all temp ansi reuses
  2053. Revision 1.62 1999/05/27 19:44:04 peter
  2054. * removed oldasm
  2055. * plabel -> pasmlabel
  2056. * -a switches to source writing automaticly
  2057. * assembler readers OOPed
  2058. * asmsymbol automaticly external
  2059. * jumptables and other label fixes for asm readers
  2060. Revision 1.61 1999/05/25 20:36:11 florian
  2061. * some bugs in the qword code generation fixed
  2062. Revision 1.60 1999/05/23 19:55:10 florian
  2063. * qword/int64 multiplication fixed
  2064. + qword/int64 subtraction
  2065. Revision 1.59 1999/05/19 10:31:53 florian
  2066. * two bugs reported by Romio (bugs 13) are fixed:
  2067. - empty array constructors are now handled correctly (e.g. for sysutils.format)
  2068. - comparsion of ansistrings was sometimes coded wrong
  2069. Revision 1.58 1999/05/18 21:58:22 florian
  2070. * fixed some bugs related to temp. ansistrings and functions results
  2071. which return records/objects/arrays which need init/final.
  2072. Revision 1.57 1999/05/18 14:15:18 peter
  2073. * containsself fixes
  2074. * checktypes()
  2075. Revision 1.56 1999/05/17 21:56:58 florian
  2076. * new temporary ansistring handling
  2077. Revision 1.55 1999/05/10 14:37:49 pierre
  2078. problem with EAX being overwritten before used in A_MULL code fixed
  2079. Revision 1.54 1999/05/09 17:58:42 jonas
  2080. + change "MUL <power of 2>, reg" to SHL (-d ShlMul)
  2081. * do the NOT of a constant set when it's substracted internally
  2082. (-dsetconstnot)
  2083. Revision 1.53 1999/05/01 13:24:01 peter
  2084. * merged nasm compiler
  2085. * old asm moved to oldasm/
  2086. Revision 1.52 1999/04/19 09:39:01 pierre
  2087. * fixes for tempansi
  2088. Revision 1.51 1999/04/16 20:44:34 florian
  2089. * the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
  2090. operands fixed, small things for new ansistring management
  2091. Revision 1.50 1999/04/16 13:42:35 jonas
  2092. * more regalloc fixes (still not complete)
  2093. Revision 1.49 1999/04/16 11:44:24 peter
  2094. * better support for flags result
  2095. Revision 1.48 1999/04/14 09:14:45 peter
  2096. * first things to store the symbol/def number in the ppu
  2097. Revision 1.47 1999/04/12 19:09:08 florian
  2098. * comparsions for small enumerations type are now generated
  2099. correct
  2100. Revision 1.46 1999/03/02 18:21:36 peter
  2101. + flags support for add and case
  2102. Revision 1.45 1999/02/25 21:02:20 peter
  2103. * ag386bin updates
  2104. + coff writer
  2105. Revision 1.44 1999/02/22 02:15:02 peter
  2106. * updates for ag386bin
  2107. Revision 1.43 1999/02/16 00:46:30 peter
  2108. * fixed bug 206
  2109. Revision 1.42 1999/02/12 10:43:56 florian
  2110. * internal error 10 with ansistrings fixed
  2111. Revision 1.41 1999/01/20 19:23:10 jonas
  2112. * fixed set1 <= set2 for small sets
  2113. Revision 1.40 1999/01/20 17:39:22 jonas
  2114. + fixed bug0163 (set1 <= set2 support)
  2115. Revision 1.39 1999/01/19 10:18:58 florian
  2116. * bug with mul. of dwords fixed, reported by Alexander Stohr
  2117. * some changes to compile with TP
  2118. + small enhancements for the new code generator
  2119. Revision 1.38 1999/01/05 17:03:36 jonas
  2120. * don't output inc/dec if cs_check_overflow is on, because inc/dec don't change
  2121. the carry flag
  2122. Revision 1.37 1998/12/22 13:10:56 florian
  2123. * memory leaks for ansistring type casts fixed
  2124. Revision 1.36 1998/12/19 00:23:40 florian
  2125. * ansistring memory leaks fixed
  2126. Revision 1.35 1998/12/11 23:36:06 florian
  2127. + again more stuff for int64/qword:
  2128. - comparision operators
  2129. - code generation for: str, read(ln), write(ln)
  2130. Revision 1.34 1998/12/11 00:02:46 peter
  2131. + globtype,tokens,version unit splitted from globals
  2132. Revision 1.33 1998/12/10 11:16:00 florian
  2133. + some basic operations with qwords and int64 added: +, xor, and, or;
  2134. the register allocation works fine
  2135. Revision 1.32 1998/12/10 09:47:13 florian
  2136. + basic operations with int64/qord (compiler with -dint64)
  2137. + rtti of enumerations extended: names are now written
  2138. Revision 1.31 1998/11/30 09:42:59 pierre
  2139. * some range check bugs fixed (still not working !)
  2140. + added DLL writing support for win32 (also accepts variables)
  2141. + TempAnsi for code that could be used for Temporary ansi strings
  2142. handling
  2143. Revision 1.30 1998/11/24 12:52:40 peter
  2144. * sets are not written twice anymore
  2145. * optimize for emptyset+single element which uses a new routine from
  2146. set.inc FPC_SET_CREATE_ELEMENT
  2147. Revision 1.29 1998/11/18 15:44:05 peter
  2148. * VALUEPARA for tp7 compatible value parameters
  2149. Revision 1.28 1998/11/18 09:18:01 pierre
  2150. + automatic loading of profile unit with -pg option
  2151. in go32v2 mode (also defines FPC_PROFILE)
  2152. * some memory leaks removed
  2153. * unreleased temp problem with sets solved
  2154. Revision 1.27 1998/11/17 00:36:38 peter
  2155. * more ansistring fixes
  2156. Revision 1.26 1998/11/16 16:17:16 peter
  2157. * fixed ansistring temp which forgot a reset
  2158. Revision 1.25 1998/11/16 15:35:35 peter
  2159. * rename laod/copystring -> load/copyshortstring
  2160. * fixed int-bool cnv bug
  2161. + char-ansistring conversion
  2162. Revision 1.24 1998/11/07 12:49:30 peter
  2163. * fixed ansicompare which returns signed
  2164. Revision 1.23 1998/10/29 15:42:43 florian
  2165. + partial disposing of temp. ansistrings
  2166. Revision 1.22 1998/10/28 18:26:12 pierre
  2167. * removed some erros after other errors (introduced by useexcept)
  2168. * stabs works again correctly (for how long !)
  2169. Revision 1.21 1998/10/25 23:32:48 peter
  2170. * fixed unsigned mul
  2171. Revision 1.20 1998/10/21 08:39:56 florian
  2172. + ansistring operator +
  2173. + $h and string[n] for n>255 added
  2174. * small problem with TP fixed
  2175. Revision 1.19 1998/10/20 15:09:21 florian
  2176. + binary operators for ansi strings
  2177. Revision 1.18 1998/10/20 08:06:38 pierre
  2178. * several memory corruptions due to double freemem solved
  2179. => never use p^.loc.location:=p^.left^.loc.location;
  2180. + finally I added now by default
  2181. that ra386dir translates global and unit symbols
  2182. + added a first field in tsymtable and
  2183. a nextsym field in tsym
  2184. (this allows to obtain ordered type info for
  2185. records and objects in gdb !)
  2186. Revision 1.17 1998/10/09 11:47:45 pierre
  2187. * still more memory leaks fixes !!
  2188. Revision 1.16 1998/10/09 08:56:21 pierre
  2189. * several memory leaks fixed
  2190. Revision 1.15 1998/10/08 17:17:10 pierre
  2191. * current_module old scanner tagged as invalid if unit is recompiled
  2192. + added ppheap for better info on tracegetmem of heaptrc
  2193. (adds line column and file index)
  2194. * several memory leaks removed ith help of heaptrc !!
  2195. Revision 1.14 1998/09/28 16:57:13 pierre
  2196. * changed all length(p^.value_str^) into str_length(p)
  2197. to get it work with and without ansistrings
  2198. * changed sourcefiles field of tmodule to a pointer
  2199. Revision 1.13 1998/09/17 09:42:09 peter
  2200. + pass_2 for cg386
  2201. * Message() -> CGMessage() for pass_1/pass_2
  2202. Revision 1.12 1998/09/14 10:43:44 peter
  2203. * all internal RTL functions start with FPC_
  2204. Revision 1.11 1998/09/07 18:45:52 peter
  2205. * update smartlinking, uses getdatalabel
  2206. * renamed ptree.value vars to value_str,value_real,value_set
  2207. Revision 1.10 1998/09/04 10:05:04 florian
  2208. * ugly fix for STRCAT, nevertheless it needs more fixing !!!!!!!
  2209. we need an new version of STRCAT which takes a length parameter
  2210. Revision 1.9 1998/09/04 08:41:36 peter
  2211. * updated some error CGMessages
  2212. Revision 1.8 1998/08/28 10:54:18 peter
  2213. * fixed smallset generation from elements, it has never worked before!
  2214. Revision 1.7 1998/08/19 14:56:59 peter
  2215. * forgot to removed some unused code in addset for set<>set
  2216. Revision 1.6 1998/08/18 09:24:35 pierre
  2217. * small warning position bug fixed
  2218. * support_mmx switches splitting was missing
  2219. * rhide error and warning output corrected
  2220. Revision 1.5 1998/08/14 18:18:37 peter
  2221. + dynamic set contruction
  2222. * smallsets are now working (always longint size)
  2223. Revision 1.4 1998/08/10 14:49:42 peter
  2224. + localswitches, moduleswitches, globalswitches splitting
  2225. Revision 1.3 1998/06/25 08:48:04 florian
  2226. * first version of rtti support
  2227. Revision 1.2 1998/06/08 13:13:28 pierre
  2228. + temporary variables now in temp_gen.pas unit
  2229. because it is processor independent
  2230. * mppc68k.bat modified to undefine i386 and support_mmx
  2231. (which are defaults for i386)
  2232. Revision 1.1 1998/06/05 17:44:10 peter
  2233. * splitted cgi386
  2234. }