narmadd.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. {
  2. Copyright (c) 2000-2002 by Florian Klaempfl
  3. Code generation for add nodes on the ARM
  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 narmadd;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. node,ncgadd,cpubase;
  22. type
  23. tarmaddnode = class(tcgaddnode)
  24. private
  25. function GetResFlags(unsigned:Boolean):TResFlags;
  26. public
  27. function pass_1 : tnode;override;
  28. protected
  29. function first_addfloat: tnode; override;
  30. procedure second_addfloat;override;
  31. procedure second_cmpfloat;override;
  32. procedure second_cmpordinal;override;
  33. procedure second_cmpsmallset;override;
  34. procedure second_cmp64bit;override;
  35. end;
  36. implementation
  37. uses
  38. globtype,systems,
  39. cutils,verbose,globals,
  40. constexp,
  41. symconst,symdef,paramgr,symtable,symtype,
  42. aasmbase,aasmtai,aasmdata,aasmcpu,defutil,htypechk,
  43. cgbase,cgutils,cgcpu,
  44. cpuinfo,pass_1,pass_2,regvars,procinfo,
  45. cpupara,
  46. ncon,nset,nadd,ncnv,ncal,nmat,
  47. ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32,
  48. hlcgobj
  49. ;
  50. {*****************************************************************************
  51. TSparcAddNode
  52. *****************************************************************************}
  53. function tarmaddnode.GetResFlags(unsigned:Boolean):TResFlags;
  54. begin
  55. case NodeType of
  56. equaln:
  57. GetResFlags:=F_EQ;
  58. unequaln:
  59. GetResFlags:=F_NE;
  60. else
  61. if not(unsigned) then
  62. begin
  63. if nf_swapped in flags then
  64. case NodeType of
  65. ltn:
  66. GetResFlags:=F_GT;
  67. lten:
  68. GetResFlags:=F_GE;
  69. gtn:
  70. GetResFlags:=F_LT;
  71. gten:
  72. GetResFlags:=F_LE;
  73. end
  74. else
  75. case NodeType of
  76. ltn:
  77. GetResFlags:=F_LT;
  78. lten:
  79. GetResFlags:=F_LE;
  80. gtn:
  81. GetResFlags:=F_GT;
  82. gten:
  83. GetResFlags:=F_GE;
  84. end;
  85. end
  86. else
  87. begin
  88. if nf_swapped in Flags then
  89. case NodeType of
  90. ltn:
  91. GetResFlags:=F_HI;
  92. lten:
  93. GetResFlags:=F_CS;
  94. gtn:
  95. GetResFlags:=F_CC;
  96. gten:
  97. GetResFlags:=F_LS;
  98. end
  99. else
  100. case NodeType of
  101. ltn:
  102. GetResFlags:=F_CC;
  103. lten:
  104. GetResFlags:=F_LS;
  105. gtn:
  106. GetResFlags:=F_HI;
  107. gten:
  108. GetResFlags:=F_CS;
  109. end;
  110. end;
  111. end;
  112. end;
  113. procedure tarmaddnode.second_addfloat;
  114. var
  115. op : TAsmOp;
  116. singleprec: boolean;
  117. begin
  118. pass_left_right;
  119. if (nf_swapped in flags) then
  120. swapleftright;
  121. case current_settings.fputype of
  122. fpu_fpa,
  123. fpu_fpa10,
  124. fpu_fpa11:
  125. begin
  126. { force fpureg as location, left right doesn't matter
  127. as both will be in a fpureg }
  128. location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
  129. location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER));
  130. location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
  131. if left.location.loc<>LOC_CFPUREGISTER then
  132. location.register:=left.location.register
  133. else
  134. location.register:=right.location.register;
  135. case nodetype of
  136. addn :
  137. op:=A_ADF;
  138. muln :
  139. op:=A_MUF;
  140. subn :
  141. op:=A_SUF;
  142. slashn :
  143. op:=A_DVF;
  144. else
  145. internalerror(200308313);
  146. end;
  147. current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op,
  148. location.register,left.location.register,right.location.register),
  149. cgsize2fpuoppostfix[def_cgsize(resultdef)]));
  150. end;
  151. fpu_vfpv2,
  152. fpu_vfpv3,
  153. fpu_vfpv3_d16:
  154. begin
  155. { force mmreg as location, left right doesn't matter
  156. as both will be in a fpureg }
  157. location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,true);
  158. location_force_mmregscalar(current_asmdata.CurrAsmList,right.location,true);
  159. location_reset(location,LOC_MMREGISTER,def_cgsize(resultdef));
  160. if left.location.loc<>LOC_CMMREGISTER then
  161. location.register:=left.location.register
  162. else if right.location.loc<>LOC_CMMREGISTER then
  163. location.register:=right.location.register
  164. else
  165. location.register:=cg.getmmregister(current_asmdata.CurrAsmList,location.size);
  166. singleprec:=tfloatdef(left.resultdef).floattype=s32real;
  167. case nodetype of
  168. addn :
  169. if singleprec then
  170. op:=A_FADDS
  171. else
  172. op:=A_FADDD;
  173. muln :
  174. if singleprec then
  175. op:=A_FMULS
  176. else
  177. op:=A_FMULD;
  178. subn :
  179. if singleprec then
  180. op:=A_FSUBS
  181. else
  182. op:=A_FSUBD;
  183. slashn :
  184. if singleprec then
  185. op:=A_FDIVS
  186. else
  187. op:=A_FDIVD;
  188. else
  189. internalerror(2009111401);
  190. end;
  191. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,
  192. location.register,left.location.register,right.location.register));
  193. end;
  194. fpu_fpv4_s16:
  195. begin
  196. { force mmreg as location, left right doesn't matter
  197. as both will be in a fpureg }
  198. location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,true);
  199. location_force_mmregscalar(current_asmdata.CurrAsmList,right.location,true);
  200. location_reset(location,LOC_MMREGISTER,def_cgsize(resultdef));
  201. if left.location.loc<>LOC_CMMREGISTER then
  202. location.register:=left.location.register
  203. else if right.location.loc<>LOC_CMMREGISTER then
  204. location.register:=right.location.register
  205. else
  206. location.register:=cg.getmmregister(current_asmdata.CurrAsmList,location.size);
  207. case nodetype of
  208. addn :
  209. op:=A_VADD;
  210. muln :
  211. op:=A_VMUL;
  212. subn :
  213. op:=A_VSUB;
  214. slashn :
  215. op:=A_VDIV;
  216. else
  217. internalerror(2009111401);
  218. end;
  219. current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op, location.register,left.location.register,right.location.register), PF_F32));
  220. end;
  221. fpu_soft:
  222. { this case should be handled already by pass1 }
  223. internalerror(200308252);
  224. else
  225. internalerror(200308251);
  226. end;
  227. end;
  228. procedure tarmaddnode.second_cmpfloat;
  229. var
  230. op: TAsmOp;
  231. begin
  232. pass_left_right;
  233. if (nf_swapped in flags) then
  234. swapleftright;
  235. location_reset(location,LOC_FLAGS,OS_NO);
  236. location.resflags:=getresflags(true);
  237. case current_settings.fputype of
  238. fpu_fpa,
  239. fpu_fpa10,
  240. fpu_fpa11:
  241. begin
  242. { force fpureg as location, left right doesn't matter
  243. as both will be in a fpureg }
  244. location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
  245. location_force_fpureg(current_asmdata.CurrAsmList,right.location,true);
  246. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  247. if nodetype in [equaln,unequaln] then
  248. current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF,
  249. left.location.register,right.location.register),
  250. cgsize2fpuoppostfix[def_cgsize(resultdef)]))
  251. else
  252. current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE,
  253. left.location.register,right.location.register),
  254. cgsize2fpuoppostfix[def_cgsize(resultdef)]));
  255. end;
  256. fpu_vfpv2,
  257. fpu_vfpv3,
  258. fpu_vfpv3_d16:
  259. begin
  260. location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,true);
  261. location_force_mmregscalar(current_asmdata.CurrAsmList,right.location,true);
  262. if (tfloatdef(left.resultdef).floattype=s32real) then
  263. if nodetype in [equaln,unequaln] then
  264. op:=A_FCMPS
  265. else
  266. op:=A_FCMPES
  267. else if nodetype in [equaln,unequaln] then
  268. op:=A_FCMPD
  269. else
  270. op:=A_FCMPED;
  271. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,
  272. left.location.register,right.location.register));
  273. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  274. current_asmdata.CurrAsmList.concat(taicpu.op_none(A_FMSTAT));
  275. end;
  276. fpu_fpv4_s16:
  277. begin
  278. location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,true);
  279. location_force_mmregscalar(current_asmdata.CurrAsmList,right.location,true);
  280. if nodetype in [equaln,unequaln] then
  281. op:=A_VCMP
  282. else
  283. op:=A_VCMPE;
  284. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,
  285. left.location.register,right.location.register));
  286. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  287. current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg(A_VMRS, NR_APSR_nzcv, NR_FPSCR));
  288. end;
  289. fpu_soft:
  290. { this case should be handled already by pass1 }
  291. internalerror(2009112404);
  292. end;
  293. location_reset(location,LOC_FLAGS,OS_NO);
  294. location.resflags:=getresflags(false);
  295. end;
  296. procedure tarmaddnode.second_cmpsmallset;
  297. var
  298. tmpreg : tregister;
  299. b: byte;
  300. begin
  301. pass_left_right;
  302. location_reset(location,LOC_FLAGS,OS_NO);
  303. if (not(nf_swapped in flags) and
  304. (nodetype = lten)) or
  305. ((nf_swapped in flags) and
  306. (nodetype = gten)) then
  307. swapleftright;
  308. (* Try to keep right as a constant *)
  309. if (right.location.loc <> LOC_CONSTANT) or
  310. not(is_shifter_const(right.location.value, b)) then
  311. hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
  312. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
  313. case nodetype of
  314. equaln,
  315. unequaln:
  316. begin
  317. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  318. if right.location.loc = LOC_CONSTANT then
  319. current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,left.location.register,right.location.value))
  320. else
  321. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register));
  322. if nodetype = equaln then
  323. location.resflags:=F_EQ
  324. else
  325. location.resflags:=F_NE;
  326. end;
  327. lten,
  328. gten:
  329. begin
  330. tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
  331. if right.location.loc = LOC_CONSTANT then
  332. begin
  333. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_AND,tmpreg,left.location.register,right.location.value));
  334. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  335. current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,tmpreg,right.location.value));
  336. end
  337. else
  338. begin
  339. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_AND,tmpreg,left.location.register,right.location.register));
  340. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  341. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,tmpreg,right.location.register));
  342. end;
  343. location.resflags:=F_EQ;
  344. end;
  345. else
  346. internalerror(2004012401);
  347. end;
  348. end;
  349. procedure tarmaddnode.second_cmp64bit;
  350. var
  351. unsigned : boolean;
  352. oldnodetype : tnodetype;
  353. dummyreg : tregister;
  354. l: tasmlabel;
  355. begin
  356. unsigned:=not(is_signed(left.resultdef)) or
  357. not(is_signed(right.resultdef));
  358. pass_left_right;
  359. if (nodetype in [equaln,unequaln]) and
  360. (left.nodetype=ordconstn) and (tordconstnode(left).value=0) then
  361. begin
  362. location_reset(location,LOC_FLAGS,OS_NO);
  363. location.resflags:=getresflags(unsigned);
  364. if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then
  365. hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
  366. dummyreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
  367. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  368. current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ORR,dummyreg,right.location.register64.reglo,right.location.register64.reghi),PF_S));
  369. end
  370. else if (nodetype in [equaln,unequaln]) and
  371. (right.nodetype=ordconstn) and (tordconstnode(right).value=0) then
  372. begin
  373. location_reset(location,LOC_FLAGS,OS_NO);
  374. location.resflags:=getresflags(unsigned);
  375. if not(left.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then
  376. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
  377. dummyreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
  378. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  379. current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ORR,dummyreg,left.location.register64.reglo,left.location.register64.reghi),PF_S));
  380. end
  381. else
  382. begin
  383. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
  384. hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
  385. { operation requiring proper N, Z and C flags ? }
  386. if unsigned or (nodetype in [equaln,unequaln]) then
  387. begin
  388. location_reset(location,LOC_FLAGS,OS_NO);
  389. location.resflags:=getresflags(unsigned);
  390. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  391. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi));
  392. if current_settings.cputype in cpu_thumb2 then
  393. begin
  394. current_asmdata.getjumplabel(l);
  395. cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,l);
  396. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo));
  397. cg.a_label(current_asmdata.CurrAsmList,l);
  398. end
  399. else
  400. current_asmdata.CurrAsmList.concat(setcondition(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo),C_EQ));
  401. end
  402. else
  403. { operation requiring proper N, Z and V flags ? }
  404. begin
  405. location_reset(location,LOC_JUMP,OS_NO);
  406. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  407. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi));
  408. { the jump the sequence is a little bit hairy }
  409. case nodetype of
  410. ltn,gtn:
  411. begin
  412. cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(false),current_procinfo.CurrTrueLabel);
  413. { cheat a little bit for the negative test }
  414. toggleflag(nf_swapped);
  415. cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(false),current_procinfo.CurrFalseLabel);
  416. cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  417. toggleflag(nf_swapped);
  418. end;
  419. lten,gten:
  420. begin
  421. oldnodetype:=nodetype;
  422. if nodetype=lten then
  423. nodetype:=ltn
  424. else
  425. nodetype:=gtn;
  426. cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrTrueLabel);
  427. { cheat for the negative test }
  428. if nodetype=ltn then
  429. nodetype:=gtn
  430. else
  431. nodetype:=ltn;
  432. cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel);
  433. cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  434. nodetype:=oldnodetype;
  435. end;
  436. end;
  437. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  438. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo));
  439. { the comparisaion of the low dword have to be
  440. always unsigned! }
  441. cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(true),current_procinfo.CurrTrueLabel);
  442. cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
  443. cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  444. end;
  445. end;
  446. end;
  447. function tarmaddnode.pass_1 : tnode;
  448. var
  449. unsigned : boolean;
  450. begin
  451. result:=inherited pass_1;
  452. if not(assigned(result)) then
  453. begin
  454. unsigned:=not(is_signed(left.resultdef)) or
  455. not(is_signed(right.resultdef));
  456. if is_64bit(left.resultdef) and
  457. ((nodetype in [equaln,unequaln]) or
  458. (unsigned and (nodetype in [ltn,lten,gtn,gten]))
  459. ) then
  460. expectloc:=LOC_FLAGS;
  461. end;
  462. end;
  463. function tarmaddnode.first_addfloat: tnode;
  464. var
  465. procname: string[31];
  466. { do we need to reverse the result ? }
  467. notnode : boolean;
  468. fdef : tdef;
  469. begin
  470. result := nil;
  471. notnode := false;
  472. if current_settings.fputype = fpu_fpv4_s16 then
  473. begin
  474. case tfloatdef(left.resultdef).floattype of
  475. s32real:
  476. begin
  477. result:=nil;
  478. notnode:=false;
  479. end;
  480. s64real:
  481. begin
  482. fdef:=search_system_type('FLOAT64').typedef;
  483. procname:='float64';
  484. case nodetype of
  485. addn:
  486. procname:=procname+'_add';
  487. muln:
  488. procname:=procname+'_mul';
  489. subn:
  490. procname:=procname+'_sub';
  491. slashn:
  492. procname:=procname+'_div';
  493. ltn:
  494. procname:=procname+'_lt';
  495. lten:
  496. procname:=procname+'_le';
  497. gtn:
  498. begin
  499. procname:=procname+'_le';
  500. notnode:=true;
  501. end;
  502. gten:
  503. begin
  504. procname:=procname+'_lt';
  505. notnode:=true;
  506. end;
  507. equaln:
  508. procname:=procname+'_eq';
  509. unequaln:
  510. begin
  511. procname:=procname+'_eq';
  512. notnode:=true;
  513. end;
  514. else
  515. CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),left.resultdef.typename,right.resultdef.typename);
  516. end;
  517. if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then
  518. resultdef:=pasbool8type;
  519. result:=ctypeconvnode.create_internal(ccallnode.createintern(procname,ccallparanode.create(
  520. ctypeconvnode.create_internal(right,fdef),
  521. ccallparanode.create(
  522. ctypeconvnode.create_internal(left,fdef),nil))),resultdef);
  523. left:=nil;
  524. right:=nil;
  525. { do we need to reverse the result }
  526. if notnode then
  527. result:=cnotnode.create(result);
  528. end;
  529. end;
  530. end
  531. else
  532. result:=inherited first_addfloat;
  533. end;
  534. procedure tarmaddnode.second_cmpordinal;
  535. var
  536. unsigned : boolean;
  537. tmpreg : tregister;
  538. b : byte;
  539. begin
  540. pass_left_right;
  541. force_reg_left_right(true,true);
  542. unsigned:=not(is_signed(left.resultdef)) or
  543. not(is_signed(right.resultdef));
  544. cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
  545. if right.location.loc = LOC_CONSTANT then
  546. begin
  547. if is_shifter_const(right.location.value,b) then
  548. current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,left.location.register,right.location.value))
  549. else
  550. begin
  551. tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
  552. cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,
  553. right.location.value,tmpreg);
  554. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,tmpreg));
  555. end;
  556. end
  557. else
  558. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register));
  559. location_reset(location,LOC_FLAGS,OS_NO);
  560. location.resflags:=getresflags(unsigned);
  561. end;
  562. begin
  563. caddnode:=tarmaddnode;
  564. end.