* fpu fixes (merged)

This commit is contained in:
peter 2001-02-20 21:51:36 +00:00
parent 9fbe429084
commit 05160462c9
5 changed files with 205 additions and 41 deletions

View File

@ -1,22 +1,29 @@
#
# Don't edit, this file is generated by fpcmake v1.99.0 [2001/02/02]
# Don't edit, this file is generated by fpcmake v1.99.0 [2001/02/20]
#
default: all
override PATH:=$(subst \,/,$(PATH))
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
ifeq ($(findstring ;,$(PATH)),)
inUnix=1
SEARCHPATH=$(subst :, ,$(PATH))
else
SEARCHPATH=$(subst ;, ,$(PATH))
endif
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
ifeq ($(PWD),)
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
ifeq ($(PWD),)
nopwd:
@echo You need the GNU utils package to use this Makefile!
@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
@exit
else
inUnix=1
PWD:=$(firstword $(PWD))
SRCEXEEXT=
endif
else
PWD:=$(firstword $(PWD))
SRCEXEEXT=.exe
endif
ifndef inUnix
ifeq ($(OS),Windows_NT)
@ -26,11 +33,10 @@ ifdef OS2_SHELL
inOS2=1
endif
endif
endif
ifdef inUnix
SRCEXEEXT=
else
SRCEXEEXT=.exe
ifneq ($(findstring cygwin,$(MACH_TYPE)),)
inCygWin=1
endif
endif
ifdef inUnix
BATCHEXT=.sh
@ -46,11 +52,6 @@ PATHSEP=/
else
PATHSEP=$(subst /,\,/)
endif
ifdef inUnix
SEARCHPATH=$(subst :, ,$(PATH))
else
SEARCHPATH=$(subst ;, ,$(PATH))
endif
ifdef PWD
BASEDIR:=$(shell $(PWD))
else
@ -240,7 +241,7 @@ endif
ifndef LD
LD=ld
endif
PPAS=$(BATCHEXT)
PPAS=ppas$(BATCHEXT)
ifdef inUnix
LDCONFIG=ldconfig
else
@ -383,6 +384,7 @@ ifeq ($(OS_TARGET),os2)
PPUEXT=.ppo
ASMEXT=.so2
OEXT=.oo2
AOUTEXT=.out
SMARTEXT=.so
STATICLIBEXT=.ao2
SHAREDLIBEXT=.dll
@ -818,6 +820,9 @@ endif
-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-$(DELTREE) *$(SMARTEXT)
-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
ifdef AOUTEXT
-$(DEL) *$(AOUTEXT)
endif
.PHONY: fpc_info
fpc_info:
@$(ECHO)

View File

@ -725,9 +725,9 @@ begin
{ if the first is ST and the second is also a register
it is necessarily ST1 .. ST7 }
(oper[0].reg=R_ST)) or
((ops=1) and
{ ((ops=1) and
(oper[0].typ=top_reg) and
(oper[0].reg in [R_ST1..R_ST7])) or
(oper[0].reg in [R_ST1..R_ST7])) or}
(ops=0) then
if opcode=A_FSUBR then
opcode:=A_FSUB
@ -745,6 +745,17 @@ begin
opcode:=A_FDIVP
else if opcode=A_FDIVP then
opcode:=A_FDIVRP;
if ((ops=1) and
(oper[0].typ=top_reg) and
(oper[0].reg in [R_ST1..R_ST7])) then
if opcode=A_FSUBRP then
opcode:=A_FSUBP
else if opcode=A_FSUBP then
opcode:=A_FSUBRP
else if opcode=A_FDIVRP then
opcode:=A_FDIVP
else if opcode=A_FDIVP then
opcode:=A_FDIVRP;
end;
@ -1738,7 +1749,10 @@ end;
end.
{
$Log$
Revision 1.10 2001-01-13 20:24:24 peter
Revision 1.11 2001-02-20 21:51:36 peter
* fpu fixes (merged)
Revision 1.10 2001/01/13 20:24:24 peter
* fixed operand order that got mixed up for external writers after
my previous assembler block valid instruction check

View File

@ -65,7 +65,22 @@ uses
{$endif}
globtype,symconst,symdef,systems,types,globals,verbose,cpuasm;
{$define ATTOP}
{$define INTELOP}
{$ifdef NORA386INT}
{$ifdef NOAG386NSM}
{$ifdef NOAG386INT}
{$undef INTELOP}
{$endif}
{$endif}
{$endif}
{$ifdef NORA386ATT}
{$ifdef NOAG386ATT}
{$undef ATTOP}
{$endif}
{$endif}
{*****************************************************************************
Parser Helpers
*****************************************************************************}
@ -417,9 +432,6 @@ begin
{ if the first is ST and the second is also a register
it is necessarily ST1 .. ST7 }
(operands[1]^.opr.reg=R_ST)) or
((ops=1) and
(operands[1]^.opr.typ=OPR_REGISTER) and
(operands[1]^.opr.reg in [R_ST1..R_ST7])) or
(ops=0) then
if opcode=A_FSUBR then
opcode:=A_FSUB
@ -437,6 +449,17 @@ begin
opcode:=A_FDIVP
else if opcode=A_FDIVP then
opcode:=A_FDIVRP;
if ((ops=1) and
(operands[1]^.opr.typ=OPR_REGISTER) and
(operands[1]^.opr.reg in [R_ST1..R_ST7])) then
if opcode=A_FSUBRP then
opcode:=A_FSUBP
else if opcode=A_FSUBP then
opcode:=A_FSUBRP
else if opcode=A_FDIVRP then
opcode:=A_FDIVP
else if opcode=A_FDIVP then
opcode:=A_FDIVRP;
end;
{*****************************************************************************
@ -464,10 +487,108 @@ begin
as alias of FADDP
and GNU AS interprets FADD without operand differently
for version 2.9.1 and 2.9.5 !! }
if (opcode=A_FADD) and (ops=0) then
if (ops=0) and
((opcode=A_FADD) or
(opcode=A_FMUL) or
(opcode=A_FSUB) or
(opcode=A_FSUBR) or
(opcode=A_FDIV) or
(opcode=A_FDIVR)) then
begin
opcode:=A_FADDP;
message(asmr_w_fadd_to_faddp);
if opcode=A_FADD then
opcode:=A_FADDP
else if opcode=A_FMUL then
opcode:=A_FMULP
else if opcode=A_FSUB then
opcode:=A_FSUBP
else if opcode=A_FSUBR then
opcode:=A_FSUBRP
else if opcode=A_FDIV then
opcode:=A_FDIVP
else if opcode=A_FDIVR then
opcode:=A_FDIVRP;
{$ifdef ATTOP}
message1(asmr_w_fadd_to_faddp,att_op2str[opcode]);
{$else}
{$ifdef INTELOP}
message1(asmr_w_fadd_to_faddp,int_op2str[opcode]);
{$else}
message1(asmr_w_fadd_to_faddp,'fXX');
{$endif INTELOP}
{$endif ATTOP}
end;
{ GNU AS interprets FDIV without operand differently
for version 2.9.1 and 2.10
we add explicit args to it !! }
if (ops=0) and
((opcode=A_FSUBP) or
(opcode=A_FSUBRP) or
(opcode=A_FDIVP) or
(opcode=A_FDIVRP) or
(opcode=A_FSUB) or
(opcode=A_FSUBR) or
(opcode=A_FDIV) or
(opcode=A_FDIVR)) then
begin
{$ifdef ATTOP}
message1(asmr_w_adding_explicit_args_fXX,att_op2str[opcode]);
{$else}
{$ifdef INTELOP}
message1(asmr_w_adding_explicit_args_fXX,int_op2str[opcode]);
{$else}
message1(asmr_w_adding_explicit_args_fXX,'fXX');
{$endif INTELOP}
{$endif ATTOP}
ops:=2;
operands[1]^.opr.typ:=OPR_REGISTER;
operands[2]^.opr.typ:=OPR_REGISTER;
operands[1]^.opr.reg:=R_ST;
operands[2]^.opr.reg:=R_ST1;
end;
if (ops=1) and
((operands[1]^.opr.typ=OPR_REGISTER) and
(operands[1]^.opr.reg in [R_ST1..R_ST7])) and
((opcode=A_FSUBP) or
(opcode=A_FSUBRP) or
(opcode=A_FDIVP) or
(opcode=A_FDIVRP)) then
begin
{$ifdef ATTOP}
message1(asmr_w_adding_explicit_first_arg_fXX,att_op2str[opcode]);
{$else}
{$ifdef INTELOP}
message1(asmr_w_adding_explicit_first_arg_fXX,int_op2str[opcode]);
{$else}
message1(asmr_w_adding_explicit_first_arg_fXX,'fXX');
{$endif INTELOP}
{$endif ATTOP}
ops:=2;
operands[2]^.opr.typ:=OPR_REGISTER;
operands[2]^.opr.reg:=operands[1]^.opr.reg;
operands[1]^.opr.reg:=R_ST;
end;
if (ops=1) and
((operands[1]^.opr.typ=OPR_REGISTER) and
(operands[1]^.opr.reg in [R_ST1..R_ST7])) and
((opcode=A_FSUB) or
(opcode=A_FSUBR) or
(opcode=A_FDIV) or
(opcode=A_FDIVR)) then
begin
{$ifdef ATTOP}
message1(asmr_w_adding_explicit_second_arg_fXX,att_op2str[opcode]);
{$else}
{$ifdef INTELOP}
message1(asmr_w_adding_explicit_second_arg_fXX,int_op2str[opcode]);
{$else}
message1(asmr_w_adding_explicit_second_arg_fXX,'fXX');
{$endif INTELOP}
{$endif ATTOP}
ops:=2;
operands[2]^.opr.typ:=OPR_REGISTER;
operands[2]^.opr.reg:=R_ST;
end;
{ I tried to convince Linus Torwald to add
@ -500,6 +621,12 @@ begin
end;
end;
if (opcode=A_CALL) and (opsize=S_FAR) then
opcode:=A_LCALL;
if (opcode=A_JMP) and (opsize=S_FAR) then
opcode:=A_LJMP;
if (opcode=A_LCALL) or (opcode=A_LJMP) then
opsize:=S_FAR;
{ Condition ? }
if condition<>C_None then
ai.SetCondition(condition);
@ -518,7 +645,10 @@ end;
end.
{
$Log$
Revision 1.5 2001-01-12 19:18:42 peter
Revision 1.6 2001-02-20 21:51:36 peter
* fpu fixes (merged)
Revision 1.5 2001/01/12 19:18:42 peter
* check for valid asm instructions
Revision 1.4 2000/12/25 00:07:34 peter

View File

@ -1605,6 +1605,7 @@ Procedure T386IntelInstruction.BuildOpCode;
var
PrefixOp,OverrideOp: tasmop;
size : topsize;
lasttoken : tasmtoken;
operandnum : longint;
Begin
PrefixOp:=A_None;
@ -1727,9 +1728,15 @@ Begin
AS_FAR :
Begin
if actasmtoken = AS_NEAR then
Message(asmr_w_near_ignored)
begin
Message(asmr_w_near_ignored);
opsize:=S_NEAR;
end
else
Message(asmr_w_far_ignored);
begin
Message(asmr_w_far_ignored);
opsize:=S_FAR;
end;
Consume(actasmtoken);
if actasmtoken=AS_PTR then
begin
@ -1943,7 +1950,10 @@ begin
end.
{
$Log$
Revision 1.8 2001-02-09 23:42:49 peter
Revision 1.9 2001-02-20 21:51:36 peter
* fpu fixes (merged)
Revision 1.8 2001/02/09 23:42:49 peter
* merged fix for bug 1327
Revision 1.7 2001/01/05 17:36:58 florian

View File

@ -1,22 +1,29 @@
#
# Don't edit, this file is generated by fpcmake v1.99.0 [2001/02/02]
# Don't edit, this file is generated by fpcmake v1.99.0 [2001/02/20]
#
default: all
override PATH:=$(subst \,/,$(PATH))
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
ifeq ($(findstring ;,$(PATH)),)
inUnix=1
SEARCHPATH=$(subst :, ,$(PATH))
else
SEARCHPATH=$(subst ;, ,$(PATH))
endif
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
ifeq ($(PWD),)
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
ifeq ($(PWD),)
nopwd:
@echo You need the GNU utils package to use this Makefile!
@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
@exit
else
inUnix=1
PWD:=$(firstword $(PWD))
SRCEXEEXT=
endif
else
PWD:=$(firstword $(PWD))
SRCEXEEXT=.exe
endif
ifndef inUnix
ifeq ($(OS),Windows_NT)
@ -26,11 +33,10 @@ ifdef OS2_SHELL
inOS2=1
endif
endif
endif
ifdef inUnix
SRCEXEEXT=
else
SRCEXEEXT=.exe
ifneq ($(findstring cygwin,$(MACH_TYPE)),)
inCygWin=1
endif
endif
ifdef inUnix
BATCHEXT=.sh
@ -46,11 +52,6 @@ PATHSEP=/
else
PATHSEP=$(subst /,\,/)
endif
ifdef inUnix
SEARCHPATH=$(subst :, ,$(PATH))
else
SEARCHPATH=$(subst ;, ,$(PATH))
endif
ifdef PWD
BASEDIR:=$(shell $(PWD))
else
@ -233,7 +234,7 @@ endif
ifndef LD
LD=ld
endif
PPAS=$(BATCHEXT)
PPAS=ppas$(BATCHEXT)
ifdef inUnix
LDCONFIG=ldconfig
else
@ -376,6 +377,7 @@ ifeq ($(OS_TARGET),os2)
PPUEXT=.ppo
ASMEXT=.so2
OEXT=.oo2
AOUTEXT=.out
SMARTEXT=.so
STATICLIBEXT=.ao2
SHAREDLIBEXT=.dll
@ -811,6 +813,9 @@ endif
-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-$(DELTREE) *$(SMARTEXT)
-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
ifdef AOUTEXT
-$(DEL) *$(AOUTEXT)
endif
.PHONY: fpc_info
fpc_info:
@$(ECHO)