|
@@ -545,192 +545,6 @@ interface
|
|
|
end;
|
|
|
|
|
|
|
|
|
-{*****************************************************************************
|
|
|
- AddMMX
|
|
|
-*****************************************************************************}
|
|
|
-
|
|
|
-{$ifdef SUPPORT_MMX}
|
|
|
- procedure ti386addnode.second_addmmx;
|
|
|
- var
|
|
|
- op : TAsmOp;
|
|
|
- cmpop : boolean;
|
|
|
- mmxbase : tmmxtype;
|
|
|
- hregister : tregister;
|
|
|
- begin
|
|
|
- pass_left_and_right;
|
|
|
-
|
|
|
- cmpop:=false;
|
|
|
- mmxbase:=mmx_type(left.resultdef);
|
|
|
- case nodetype of
|
|
|
- addn :
|
|
|
- begin
|
|
|
- if (cs_mmx_saturation in current_settings.localswitches) then
|
|
|
- begin
|
|
|
- case mmxbase of
|
|
|
- mmxs8bit:
|
|
|
- op:=A_PADDSB;
|
|
|
- mmxu8bit:
|
|
|
- op:=A_PADDUSB;
|
|
|
- mmxs16bit,mmxfixed16:
|
|
|
- op:=A_PADDSB;
|
|
|
- mmxu16bit:
|
|
|
- op:=A_PADDUSW;
|
|
|
- end;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- case mmxbase of
|
|
|
- mmxs8bit,mmxu8bit:
|
|
|
- op:=A_PADDB;
|
|
|
- mmxs16bit,mmxu16bit,mmxfixed16:
|
|
|
- op:=A_PADDW;
|
|
|
- mmxs32bit,mmxu32bit:
|
|
|
- op:=A_PADDD;
|
|
|
- end;
|
|
|
- end;
|
|
|
- end;
|
|
|
- muln :
|
|
|
- begin
|
|
|
- case mmxbase of
|
|
|
- mmxs16bit,mmxu16bit:
|
|
|
- op:=A_PMULLW;
|
|
|
- mmxfixed16:
|
|
|
- op:=A_PMULHW;
|
|
|
- end;
|
|
|
- end;
|
|
|
- subn :
|
|
|
- begin
|
|
|
- if (cs_mmx_saturation in current_settings.localswitches) then
|
|
|
- begin
|
|
|
- case mmxbase of
|
|
|
- mmxs8bit:
|
|
|
- op:=A_PSUBSB;
|
|
|
- mmxu8bit:
|
|
|
- op:=A_PSUBUSB;
|
|
|
- mmxs16bit,mmxfixed16:
|
|
|
- op:=A_PSUBSB;
|
|
|
- mmxu16bit:
|
|
|
- op:=A_PSUBUSW;
|
|
|
- end;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- case mmxbase of
|
|
|
- mmxs8bit,mmxu8bit:
|
|
|
- op:=A_PSUBB;
|
|
|
- mmxs16bit,mmxu16bit,mmxfixed16:
|
|
|
- op:=A_PSUBW;
|
|
|
- mmxs32bit,mmxu32bit:
|
|
|
- op:=A_PSUBD;
|
|
|
- end;
|
|
|
- end;
|
|
|
- end;
|
|
|
- xorn:
|
|
|
- op:=A_PXOR;
|
|
|
- orn:
|
|
|
- op:=A_POR;
|
|
|
- andn:
|
|
|
- op:=A_PAND;
|
|
|
- else
|
|
|
- internalerror(200403183);
|
|
|
- end;
|
|
|
-
|
|
|
- { left and right no register? }
|
|
|
- { then one must be demanded }
|
|
|
- if (left.location.loc<>LOC_MMXREGISTER) then
|
|
|
- begin
|
|
|
- if (right.location.loc=LOC_MMXREGISTER) then
|
|
|
- begin
|
|
|
- location_swap(left.location,right.location);
|
|
|
- toggleflag(nf_swapped);
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- { register variable ? }
|
|
|
- if (left.location.loc=LOC_CMMXREGISTER) then
|
|
|
- begin
|
|
|
- hregister:=rg.getregistermm(current_asmdata.CurrAsmList);
|
|
|
- emit_reg_reg(A_MOVQ,S_NO,left.location.register,hregister);
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
|
|
|
- internalerror(200203245);
|
|
|
-
|
|
|
- location_release(current_asmdata.CurrAsmList,left.location);
|
|
|
-
|
|
|
- hregister:=rg.getregistermm(current_asmdata.CurrAsmList);
|
|
|
- emit_ref_reg(A_MOVQ,S_NO,left.location.reference,hregister);
|
|
|
- end;
|
|
|
-
|
|
|
- location_reset(left.location,LOC_MMXREGISTER,OS_NO);
|
|
|
- left.location.register:=hregister;
|
|
|
- end;
|
|
|
- end;
|
|
|
-
|
|
|
- { at this point, left.location.loc should be LOC_MMXREGISTER }
|
|
|
- if right.location.loc<>LOC_MMXREGISTER then
|
|
|
- begin
|
|
|
- if (nodetype=subn) and (nf_swapped in flags) then
|
|
|
- begin
|
|
|
- if right.location.loc=LOC_CMMXREGISTER then
|
|
|
- begin
|
|
|
- emit_reg_reg(A_MOVQ,S_NO,right.location.register,R_MM7);
|
|
|
- emit_reg_reg(op,S_NO,left.location.register,R_MM7);
|
|
|
- emit_reg_reg(A_MOVQ,S_NO,R_MM7,left.location.register);
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
|
|
|
- internalerror(200203247);
|
|
|
- emit_ref_reg(A_MOVQ,S_NO,right.location.reference,R_MM7);
|
|
|
- emit_reg_reg(op,S_NO,left.location.register,R_MM7);
|
|
|
- emit_reg_reg(A_MOVQ,S_NO,R_MM7,left.location.register);
|
|
|
- location_release(current_asmdata.CurrAsmList,right.location);
|
|
|
- end;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- if (right.location.loc=LOC_CMMXREGISTER) then
|
|
|
- begin
|
|
|
- emit_reg_reg(op,S_NO,right.location.register,left.location.register);
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- if not(right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
|
|
|
- internalerror(200203246);
|
|
|
- emit_ref_reg(op,S_NO,right.location.reference,left.location.register);
|
|
|
- location_release(current_asmdata.CurrAsmList,right.location);
|
|
|
- end;
|
|
|
- end;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- { right.location=LOC_MMXREGISTER }
|
|
|
- if (nodetype=subn) and (nf_swapped in flags) then
|
|
|
- begin
|
|
|
- emit_reg_reg(op,S_NO,left.location.register,right.location.register);
|
|
|
- location_swap(left.location,right.location);
|
|
|
- toggleflag(nf_swapped);
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- emit_reg_reg(op,S_NO,right.location.register,left.location.register);
|
|
|
- end;
|
|
|
- end;
|
|
|
-
|
|
|
- location_freetemp(current_asmdata.CurrAsmList,right.location);
|
|
|
- location_release(current_asmdata.CurrAsmList,right.location);
|
|
|
- if cmpop then
|
|
|
- begin
|
|
|
- location_freetemp(current_asmdata.CurrAsmList,left.location);
|
|
|
- location_release(current_asmdata.CurrAsmList,left.location);
|
|
|
- end;
|
|
|
- set_result_location(cmpop,true);
|
|
|
- end;
|
|
|
-{$endif SUPPORT_MMX}
|
|
|
-
|
|
|
-
|
|
|
{*****************************************************************************
|
|
|
pass_2
|
|
|
*****************************************************************************}
|