213
216
if (right.location.loc<>LOC_FPUREGISTER) then
215
cg.a_loadfpu_loc_reg(exprasmlist,right.location,NR_ST);
216
if (right.location.loc <> LOC_CFPUREGISTER) then
217
location_freetemp(exprasmlist,left.location);
218
location_force_fpureg(exprasmlist,right.location,false);
218
219
if (left.location.loc<>LOC_FPUREGISTER) then
220
cg.a_loadfpu_loc_reg(exprasmlist,left.location,NR_ST);
221
if (left.location.loc <> LOC_CFPUREGISTER) then
222
location_freetemp(exprasmlist,left.location);
220
location_force_fpureg(exprasmlist,left.location,false)
226
{ left was on the stack => swap }
227
toggleflag(nf_swaped);
222
{ left was on the stack => swap }
223
toggleflag(nf_swaped);
230
225
{ the nominator in st0 }
231
226
else if (left.location.loc<>LOC_FPUREGISTER) then
233
cg.a_loadfpu_loc_reg(exprasmlist,left.location,NR_ST);
234
if (left.location.loc <> LOC_CFPUREGISTER) then
235
location_freetemp(exprasmlist,left.location);
227
location_force_fpureg(exprasmlist,left.location,false)
239
230
{ fpu operands are always in the wrong order on the stack }
438
429
{*****************************************************************************
431
*****************************************************************************}
434
procedure tx86addnode.second_opmmx;
440
hregister : tregister;
445
mmxbase:=mmx_type(left.resulttype.def);
446
location_reset(location,LOC_MMXREGISTER,def_cgsize(resulttype.def));
450
if (cs_mmx_saturation in aktlocalswitches) then
457
mmxs16bit,mmxfixed16:
468
mmxs16bit,mmxu16bit,mmxfixed16:
486
if (cs_mmx_saturation in aktlocalswitches) then
493
mmxs16bit,mmxfixed16:
504
mmxs16bit,mmxu16bit,mmxfixed16:
518
internalerror(2003042214);
521
{ left and right no register? }
522
{ then one must be demanded }
523
if (left.location.loc<>LOC_MMXREGISTER) then
525
if (right.location.loc=LOC_MMXREGISTER) then
527
location_swap(left.location,right.location);
528
toggleflag(nf_swaped);
532
{ register variable ? }
533
if (left.location.loc=LOC_CMMXREGISTER) then
535
hregister:=tcgx86(cg).getmmxregister(exprasmlist);
536
emit_reg_reg(A_MOVQ,S_NO,left.location.register,hregister);
540
if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
541
internalerror(200203245);
543
hregister:=tcgx86(cg).getmmxregister(exprasmlist);
544
emit_ref_reg(A_MOVQ,S_NO,left.location.reference,hregister);
547
location_reset(left.location,LOC_MMXREGISTER,OS_NO);
548
left.location.register:=hregister;
552
{ at this point, left.location.loc should be LOC_MMXREGISTER }
553
if right.location.loc<>LOC_MMXREGISTER then
555
if (nodetype=subn) and (nf_swaped in flags) then
557
hreg:=tcgx86(cg).getmmxregister(exprasmlist);
558
if right.location.loc=LOC_CMMXREGISTER then
560
emit_reg_reg(A_MOVQ,S_NO,right.location.register,hreg);
561
emit_reg_reg(op,S_NO,left.location.register,hreg);
565
if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
566
internalerror(200203247);
567
emit_ref_reg(A_MOVQ,S_NO,right.location.reference,hreg);
568
emit_reg_reg(op,S_NO,left.location.register,hreg);
570
location.register:=hreg;
574
if (right.location.loc=LOC_CMMXREGISTER) then
575
emit_reg_reg(op,S_NO,right.location.register,left.location.register)
578
if not(right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
579
internalerror(200203246);
580
emit_ref_reg(op,S_NO,right.location.reference,left.location.register);
582
location.register:=left.location.register;
587
{ right.location=LOC_MMXREGISTER }
588
if (nodetype=subn) and (nf_swaped in flags) then
590
emit_reg_reg(op,S_NO,left.location.register,right.location.register);
591
location_swap(left.location,right.location);
592
toggleflag(nf_swaped);
596
emit_reg_reg(op,S_NO,right.location.register,left.location.register);
598
location.register:=left.location.register;
601
location_freetemp(exprasmlist,right.location);
603
location_freetemp(exprasmlist,left.location);
608
{*****************************************************************************
610
*****************************************************************************}
613
procedure tx86addnode.second_opmmxset;
615
var opsize : TCGSize;
628
{ are we adding set elements ? }
629
if right.nodetype=setelementn then
631
{ adding elements is not commutative }
632
{ if nf_swaped in flags then
634
{ bts requires both elements to be registers }
635
{ location_force_reg(exprasmlist,left.location,opsize_2_cgsize[opsize],false);
636
location_force_reg(exprasmlist,right.location,opsize_2_cgsize[opsize],true);
657
if (not(nf_swaped in flags) and (nodetype = lten)) or
658
((nf_swaped in flags) and (nodetype = gten)) then
660
location_force_reg(exprasmlist,left.location,opsize,true);
661
emit_op_right_left(A_AND,opsize);
664
{ warning: ugly hack, we need a JE so change the node to equaln }
674
internalerror(2003042215);
676
{ left must be a register }
677
left_must_be_reg(opsize,noswap);
678
{ emit_generic_code(op,opsize,true,extra_not,false);}
679
location_freetemp(exprasmlist,right.location);
681
location_freetemp(exprasmlist,left.location);
687
{*****************************************************************************
440
689
*****************************************************************************}