nx86inl.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate x86 inline nodes
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit nx86inl;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. node,ninl,ncginl;
  22. type
  23. tx86inlinenode = class(tcginlinenode)
  24. { first pass override
  25. so that the code generator will actually generate
  26. these nodes.
  27. }
  28. function first_pi: tnode ; override;
  29. function first_arctan_real: tnode; override;
  30. function first_abs_real: tnode; override;
  31. function first_sqr_real: tnode; override;
  32. function first_sqrt_real: tnode; override;
  33. function first_ln_real: tnode; override;
  34. function first_cos_real: tnode; override;
  35. function first_sin_real: tnode; override;
  36. function first_round_real: tnode; override;
  37. function first_trunc_real: tnode; override;
  38. function first_popcnt: tnode; override;
  39. { second pass override to generate these nodes }
  40. procedure second_IncludeExclude;override;
  41. procedure second_pi; override;
  42. procedure second_arctan_real; override;
  43. procedure second_abs_real; override;
  44. procedure second_round_real; override;
  45. procedure second_sqr_real; override;
  46. procedure second_sqrt_real; override;
  47. procedure second_ln_real; override;
  48. procedure second_cos_real; override;
  49. procedure second_sin_real; override;
  50. procedure second_trunc_real; override;
  51. procedure second_prefetch;override;
  52. {$ifndef i8086}
  53. procedure second_abs_long;override;
  54. {$endif not i8086}
  55. procedure second_popcnt;override;
  56. private
  57. procedure load_fpu_location(lnode: tnode);
  58. end;
  59. implementation
  60. uses
  61. systems,
  62. globtype,globals,
  63. cutils,verbose,
  64. symconst,
  65. defutil,
  66. aasmbase,aasmtai,aasmdata,aasmcpu,
  67. symtype,symdef,
  68. cgbase,pass_2,
  69. cpuinfo,cpubase,paramgr,
  70. nbas,ncon,ncal,ncnv,nld,ncgutil,
  71. tgobj,
  72. cga,cgutils,cgx86,cgobj,hlcgobj;
  73. {*****************************************************************************
  74. TX86INLINENODE
  75. *****************************************************************************}
  76. function tx86inlinenode.first_pi : tnode;
  77. begin
  78. expectloc:=LOC_FPUREGISTER;
  79. first_pi := nil;
  80. end;
  81. function tx86inlinenode.first_arctan_real : tnode;
  82. begin
  83. expectloc:=LOC_FPUREGISTER;
  84. first_arctan_real := nil;
  85. end;
  86. function tx86inlinenode.first_abs_real : tnode;
  87. begin
  88. if use_vectorfpu(resultdef) then
  89. expectloc:=LOC_MMREGISTER
  90. else
  91. expectloc:=LOC_FPUREGISTER;
  92. first_abs_real := nil;
  93. end;
  94. function tx86inlinenode.first_sqr_real : tnode;
  95. begin
  96. expectloc:=LOC_FPUREGISTER;
  97. first_sqr_real := nil;
  98. end;
  99. function tx86inlinenode.first_sqrt_real : tnode;
  100. begin
  101. expectloc:=LOC_FPUREGISTER;
  102. first_sqrt_real := nil;
  103. end;
  104. function tx86inlinenode.first_ln_real : tnode;
  105. begin
  106. expectloc:=LOC_FPUREGISTER;
  107. first_ln_real := nil;
  108. end;
  109. function tx86inlinenode.first_cos_real : tnode;
  110. begin
  111. {$ifdef i8086}
  112. { FCOS is 387+ }
  113. if current_settings.cputype < cpu_386 then
  114. begin
  115. result := inherited;
  116. exit;
  117. end;
  118. {$endif i8086}
  119. expectloc:=LOC_FPUREGISTER;
  120. first_cos_real := nil;
  121. end;
  122. function tx86inlinenode.first_sin_real : tnode;
  123. begin
  124. {$ifdef i8086}
  125. { FSIN is 387+ }
  126. if current_settings.cputype < cpu_386 then
  127. begin
  128. result := inherited;
  129. exit;
  130. end;
  131. {$endif i8086}
  132. expectloc:=LOC_FPUREGISTER;
  133. first_sin_real := nil;
  134. end;
  135. function tx86inlinenode.first_round_real : tnode;
  136. begin
  137. {$ifdef x86_64}
  138. if use_vectorfpu(left.resultdef) then
  139. expectloc:=LOC_REGISTER
  140. else
  141. {$endif x86_64}
  142. expectloc:=LOC_REFERENCE;
  143. result:=nil;
  144. end;
  145. function tx86inlinenode.first_trunc_real: tnode;
  146. begin
  147. if (cs_opt_size in current_settings.optimizerswitches)
  148. {$ifdef x86_64}
  149. and not(use_vectorfpu(left.resultdef))
  150. {$endif x86_64}
  151. then
  152. result:=inherited
  153. else
  154. begin
  155. {$ifdef x86_64}
  156. if use_vectorfpu(left.resultdef) then
  157. expectloc:=LOC_REGISTER
  158. else
  159. {$endif x86_64}
  160. expectloc:=LOC_REFERENCE;
  161. result:=nil;
  162. end;
  163. end;
  164. function tx86inlinenode.first_popcnt: tnode;
  165. begin
  166. Result:=nil;
  167. if (current_settings.fputype<fpu_sse42)
  168. {$ifdef i386}
  169. or is_64bit(left.resultdef)
  170. {$endif i386}
  171. then
  172. Result:=inherited first_popcnt
  173. else
  174. expectloc:=LOC_REGISTER;
  175. end;
  176. procedure tx86inlinenode.second_Pi;
  177. begin
  178. location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
  179. emit_none(A_FLDPI,S_NO);
  180. tcgx86(cg).inc_fpu_stack;
  181. location.register:=NR_FPU_RESULT_REG;
  182. end;
  183. { load the FPU into the an fpu register }
  184. procedure tx86inlinenode.load_fpu_location(lnode: tnode);
  185. begin
  186. location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
  187. location.register:=NR_FPU_RESULT_REG;
  188. secondpass(lnode);
  189. case lnode.location.loc of
  190. LOC_FPUREGISTER:
  191. ;
  192. LOC_CFPUREGISTER:
  193. begin
  194. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,lnode.location.size,
  195. lnode.location.size,lnode.location.register,location.register);
  196. end;
  197. LOC_REFERENCE,LOC_CREFERENCE:
  198. begin
  199. cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,
  200. lnode.location.size,lnode.location.size,
  201. lnode.location.reference,location.register);
  202. end;
  203. LOC_MMREGISTER,LOC_CMMREGISTER:
  204. begin
  205. location:=lnode.location;
  206. location_force_fpureg(current_asmdata.CurrAsmList,location,false);
  207. end;
  208. else
  209. internalerror(309991);
  210. end;
  211. end;
  212. procedure tx86inlinenode.second_arctan_real;
  213. begin
  214. load_fpu_location(left);
  215. emit_none(A_FLD1,S_NO);
  216. emit_none(A_FPATAN,S_NO);
  217. end;
  218. procedure tx86inlinenode.second_abs_real;
  219. var
  220. href : treference;
  221. begin
  222. if use_vectorfpu(resultdef) then
  223. begin
  224. secondpass(left);
  225. hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
  226. location:=left.location;
  227. case tfloatdef(resultdef).floattype of
  228. s32real:
  229. reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_ABSMASK_SINGLE'),0,4);
  230. s64real:
  231. reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_ABSMASK_DOUBLE'),0,4);
  232. else
  233. internalerror(200506081);
  234. end;
  235. tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList, href);
  236. current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_ANDPS,S_XMM,href,location.register))
  237. end
  238. else
  239. begin
  240. load_fpu_location(left);
  241. emit_none(A_FABS,S_NO);
  242. end;
  243. end;
  244. procedure tx86inlinenode.second_round_real;
  245. begin
  246. {$ifdef x86_64}
  247. if use_vectorfpu(left.resultdef) then
  248. begin
  249. secondpass(left);
  250. hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
  251. location_reset(location,LOC_REGISTER,OS_S64);
  252. location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_S64);
  253. case left.location.size of
  254. OS_F32:
  255. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CVTSS2SI,S_Q,left.location.register,location.register));
  256. OS_F64:
  257. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CVTSD2SI,S_Q,left.location.register,location.register));
  258. else
  259. internalerror(2007031402);
  260. end;
  261. end
  262. else
  263. {$endif x86_64}
  264. begin
  265. load_fpu_location(left);
  266. location_reset_ref(location,LOC_REFERENCE,OS_S64,0);
  267. tg.GetTemp(current_asmdata.CurrAsmList,resultdef.size,resultdef.alignment,tt_normal,location.reference);
  268. emit_ref(A_FISTP,S_IQ,location.reference);
  269. tcgx86(cg).dec_fpu_stack;
  270. emit_none(A_FWAIT,S_NO);
  271. end;
  272. end;
  273. procedure tx86inlinenode.second_trunc_real;
  274. var
  275. oldcw,newcw : treference;
  276. begin
  277. {$ifdef x86_64}
  278. if use_vectorfpu(left.resultdef) and
  279. not((left.location.loc=LOC_FPUREGISTER) and (current_settings.fputype>=fpu_sse3)) then
  280. begin
  281. secondpass(left);
  282. hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
  283. location_reset(location,LOC_REGISTER,OS_S64);
  284. location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_S64);
  285. case left.location.size of
  286. OS_F32:
  287. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CVTTSS2SI,S_Q,left.location.register,location.register));
  288. OS_F64:
  289. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CVTTSD2SI,S_Q,left.location.register,location.register));
  290. else
  291. internalerror(2007031401);
  292. end;
  293. end
  294. else
  295. {$endif x86_64}
  296. begin
  297. if (current_settings.fputype>=fpu_sse3) then
  298. begin
  299. load_fpu_location(left);
  300. location_reset_ref(location,LOC_REFERENCE,OS_S64,0);
  301. tg.GetTemp(current_asmdata.CurrAsmList,resultdef.size,resultdef.alignment,tt_normal,location.reference);
  302. emit_ref(A_FISTTP,S_IQ,location.reference);
  303. tcgx86(cg).dec_fpu_stack;
  304. end
  305. else
  306. begin
  307. tg.GetTemp(current_asmdata.CurrAsmList,2,2,tt_normal,oldcw);
  308. tg.GetTemp(current_asmdata.CurrAsmList,2,2,tt_normal,newcw);
  309. emit_ref(A_FNSTCW,S_NO,newcw);
  310. emit_ref(A_FNSTCW,S_NO,oldcw);
  311. emit_const_ref(A_OR,S_W,$0f00,newcw);
  312. load_fpu_location(left);
  313. emit_ref(A_FLDCW,S_NO,newcw);
  314. location_reset_ref(location,LOC_REFERENCE,OS_S64,0);
  315. tg.GetTemp(current_asmdata.CurrAsmList,resultdef.size,resultdef.alignment,tt_normal,location.reference);
  316. emit_ref(A_FISTP,S_IQ,location.reference);
  317. tcgx86(cg).dec_fpu_stack;
  318. emit_ref(A_FLDCW,S_NO,oldcw);
  319. emit_none(A_FWAIT,S_NO);
  320. tg.UnGetTemp(current_asmdata.CurrAsmList,oldcw);
  321. tg.UnGetTemp(current_asmdata.CurrAsmList,newcw);
  322. end;
  323. end;
  324. end;
  325. procedure tx86inlinenode.second_sqr_real;
  326. begin
  327. if use_vectorfpu(resultdef) then
  328. begin
  329. secondpass(left);
  330. hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
  331. location:=left.location;
  332. cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,OP_MUL,left.location.size,left.location,left.location.register,mms_movescalar);
  333. end
  334. else
  335. begin
  336. load_fpu_location(left);
  337. emit_reg_reg(A_FMUL,S_NO,NR_ST0,NR_ST0);
  338. end;
  339. end;
  340. procedure tx86inlinenode.second_sqrt_real;
  341. begin
  342. if use_vectorfpu(resultdef) then
  343. begin
  344. secondpass(left);
  345. hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
  346. location:=left.location;
  347. case tfloatdef(resultdef).floattype of
  348. s32real:
  349. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SQRTSS,S_XMM,location.register,location.register));
  350. s64real:
  351. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SQRTSD,S_XMM,location.register,location.register));
  352. else
  353. internalerror(200510031);
  354. end;
  355. end
  356. else
  357. begin
  358. load_fpu_location(left);
  359. emit_none(A_FSQRT,S_NO);
  360. end;
  361. end;
  362. procedure tx86inlinenode.second_ln_real;
  363. begin
  364. load_fpu_location(left);
  365. emit_none(A_FLDLN2,S_NO);
  366. emit_none(A_FXCH,S_NO);
  367. emit_none(A_FYL2X,S_NO);
  368. end;
  369. procedure tx86inlinenode.second_cos_real;
  370. begin
  371. {$ifdef i8086}
  372. { FCOS is 387+ }
  373. if current_settings.cputype < cpu_386 then
  374. begin
  375. inherited;
  376. exit;
  377. end;
  378. {$endif i8086}
  379. load_fpu_location(left);
  380. emit_none(A_FCOS,S_NO);
  381. end;
  382. procedure tx86inlinenode.second_sin_real;
  383. begin
  384. {$ifdef i8086}
  385. { FSIN is 387+ }
  386. if current_settings.cputype < cpu_386 then
  387. begin
  388. inherited;
  389. exit;
  390. end;
  391. {$endif i8086}
  392. load_fpu_location(left);
  393. emit_none(A_FSIN,S_NO)
  394. end;
  395. procedure tx86inlinenode.second_prefetch;
  396. var
  397. ref : treference;
  398. r : tregister;
  399. begin
  400. {$if defined(i386) or defined(i8086)}
  401. if current_settings.cputype>=cpu_Pentium3 then
  402. {$endif i386 or i8086}
  403. begin
  404. secondpass(left);
  405. case left.location.loc of
  406. LOC_CREFERENCE,
  407. LOC_REFERENCE:
  408. begin
  409. r:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  410. cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,r);
  411. reference_reset_base(ref,r,0,left.location.reference.alignment);
  412. current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_PREFETCHNTA,S_NO,ref));
  413. end;
  414. else
  415. internalerror(200402021);
  416. end;
  417. end;
  418. end;
  419. {$ifndef i8086}
  420. procedure tx86inlinenode.second_abs_long;
  421. var
  422. hregister : tregister;
  423. opsize : tcgsize;
  424. hp : taicpu;
  425. begin
  426. {$ifdef i386}
  427. if current_settings.cputype<cpu_Pentium2 then
  428. begin
  429. opsize:=def_cgsize(left.resultdef);
  430. secondpass(left);
  431. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
  432. location:=left.location;
  433. location.register:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
  434. emit_reg_reg(A_MOV,S_L,left.location.register,location.register);
  435. emit_const_reg(A_SAR,tcgsize2opsize[opsize],31,left.location.register);
  436. emit_reg_reg(A_XOR,S_L,left.location.register,location.register);
  437. emit_reg_reg(A_SUB,S_L,left.location.register,location.register);
  438. end
  439. else
  440. {$endif i386}
  441. begin
  442. opsize:=def_cgsize(left.resultdef);
  443. secondpass(left);
  444. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
  445. hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
  446. location:=left.location;
  447. location.register:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
  448. cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,opsize,left.location.register,hregister);
  449. cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,opsize,left.location.register,location.register);
  450. emit_reg(A_NEG,tcgsize2opsize[opsize],hregister);
  451. hp:=taicpu.op_reg_reg(A_CMOVcc,tcgsize2opsize[opsize],hregister,location.register);
  452. hp.condition:=C_NS;
  453. current_asmdata.CurrAsmList.concat(hp);
  454. end;
  455. end;
  456. {$endif not i8086}
  457. {*****************************************************************************
  458. INCLUDE/EXCLUDE GENERIC HANDLING
  459. *****************************************************************************}
  460. procedure tx86inlinenode.second_IncludeExclude;
  461. var
  462. hregister,
  463. hregister2: tregister;
  464. setbase : aint;
  465. bitsperop,l : longint;
  466. cgop : topcg;
  467. asmop : tasmop;
  468. opdef : tdef;
  469. opsize,
  470. orgsize: tcgsize;
  471. begin
  472. {$ifdef i8086}
  473. { BTS and BTR are 386+ }
  474. if current_settings.cputype < cpu_386 then
  475. begin
  476. inherited;
  477. exit;
  478. end;
  479. {$endif i8086}
  480. if is_smallset(tcallparanode(left).resultdef) then
  481. begin
  482. opdef:=tcallparanode(left).resultdef;
  483. opsize:=int_cgsize(opdef.size)
  484. end
  485. else
  486. begin
  487. opdef:=u32inttype;
  488. opsize:=OS_32;
  489. end;
  490. bitsperop:=(8*tcgsize2size[opsize]);
  491. secondpass(tcallparanode(left).left);
  492. secondpass(tcallparanode(tcallparanode(left).right).left);
  493. setbase:=tsetdef(tcallparanode(left).left.resultdef).setbase;
  494. if tcallparanode(tcallparanode(left).right).left.location.loc=LOC_CONSTANT then
  495. begin
  496. { calculate bit position }
  497. l:=1 shl ((tcallparanode(tcallparanode(left).right).left.location.value-setbase) mod bitsperop);
  498. { determine operator }
  499. if inlinenumber=in_include_x_y then
  500. cgop:=OP_OR
  501. else
  502. begin
  503. cgop:=OP_AND;
  504. l:=not(l);
  505. end;
  506. case tcallparanode(left).left.location.loc of
  507. LOC_REFERENCE :
  508. begin
  509. inc(tcallparanode(left).left.location.reference.offset,
  510. ((tcallparanode(tcallparanode(left).right).left.location.value-setbase) div bitsperop)*tcgsize2size[opsize]);
  511. cg.a_op_const_ref(current_asmdata.CurrAsmList,cgop,opsize,l,tcallparanode(left).left.location.reference);
  512. end;
  513. LOC_CREGISTER :
  514. cg.a_op_const_reg(current_asmdata.CurrAsmList,cgop,tcallparanode(left).left.location.size,l,tcallparanode(left).left.location.register);
  515. else
  516. internalerror(200405022);
  517. end;
  518. end
  519. else
  520. begin
  521. orgsize:=opsize;
  522. if opsize in [OS_8,OS_S8] then
  523. begin
  524. opdef:=u32inttype;
  525. opsize:=OS_32;
  526. end;
  527. { determine asm operator }
  528. if inlinenumber=in_include_x_y then
  529. asmop:=A_BTS
  530. else
  531. asmop:=A_BTR;
  532. hlcg.location_force_reg(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,tcallparanode(tcallparanode(left).right).left.resultdef,opdef,true);
  533. register_maybe_adjust_setbase(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,setbase);
  534. hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
  535. if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
  536. emit_reg_ref(asmop,tcgsize2opsize[opsize],hregister,tcallparanode(left).left.location.reference)
  537. else
  538. begin
  539. { second argument can't be an 8 bit register either }
  540. hregister2:=tcallparanode(left).left.location.register;
  541. if (orgsize in [OS_8,OS_S8]) then
  542. hregister2:=cg.makeregsize(current_asmdata.CurrAsmList,hregister2,opsize);
  543. emit_reg_reg(asmop,tcgsize2opsize[opsize],hregister,hregister2);
  544. end;
  545. end;
  546. end;
  547. procedure tx86inlinenode.second_popcnt;
  548. var
  549. opsize: tcgsize;
  550. begin
  551. secondpass(left);
  552. opsize:=tcgsize2unsigned[left.location.size];
  553. { no 8 Bit popcont }
  554. if opsize=OS_8 then
  555. opsize:=OS_16;
  556. if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE]) or
  557. (left.location.size<>opsize) then
  558. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,cgsize_orddef(opsize),true);
  559. location_reset(location,LOC_REGISTER,opsize);
  560. location.register:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
  561. if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
  562. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_POPCNT,TCGSize2OpSize[opsize],left.location.register,location.register))
  563. else
  564. current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_POPCNT,TCGSize2OpSize[opsize],left.location.reference,location.register));
  565. end;
  566. end.