internal assembler-reader x86 (local/global var) - validate asm-opcode-attsuffix and memrefsize

git-svn-id: branches/tg74/avx512-0037785@47984 -
This commit is contained in:
tg74 2021-01-02 22:13:27 +00:00
parent 7bba64854b
commit f8fc007324
9 changed files with 440 additions and 423 deletions

View File

@ -425,9 +425,9 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufINT,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
@ -539,11 +539,6 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
@ -607,6 +602,11 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,

View File

@ -425,9 +425,9 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufINT,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
@ -539,11 +539,6 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
@ -607,6 +602,11 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,

View File

@ -2907,6 +2907,7 @@ asmr_e_multiple_segment_overrides=07139_E_Cannot use multiple segment overrides
asmr_w_multiple_segment_overrides=07140_W_Multiple segment overrides (only the last one will take effect)
asmr_w_segment_override_ignored_in_64bit_mode=07141_W_Segment base $1 will be generated, but is ignored by the CPU in 64-bit mode
asmr_e_mismatch_broadcasting_elements=07142_E_Mismatch broadcasting elements (expected: {$1} found: {$2})
asmr_e_not_supported_combination_attsuffix_memrefsize_type=07143_E_Not supported combination opcode: $1 - att-suffix-type {$2} and memrefsize-type {$3}
#
# Assembler/binary writers
#

View File

@ -849,6 +849,7 @@ const
asmr_w_multiple_segment_overrides=07140;
asmr_w_segment_override_ignored_in_64bit_mode=07141;
asmr_e_mismatch_broadcasting_elements=07142;
asmr_e_not_supported_combination_attsuffix_memrefsize_type=07143;
asmw_f_too_many_asm_files=08000;
asmw_f_assembler_output_not_supported=08001;
asmw_f_comp_not_supported=08002;
@ -1127,9 +1128,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 85795;
MsgTxtSize = 85888;
MsgIdxMax : array[1..20] of longint=(
28,106,356,130,99,63,143,36,223,68,
28,106,356,130,99,63,144,36,223,68,
62,20,30,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -685,6 +685,7 @@ interface
implementation
uses
typinfo,
cutils,
globals,
systems,
@ -2307,7 +2308,7 @@ implementation
function is_16_bit_ref(const ref:treference):boolean;
var
ir,br : Tregister;
isub,bsub : tsubregister;
isub,bsub : cgbase.tsubregister;
begin
if (ref.index<>NR_NO) and (getregtype(ref.index)=R_MMREGISTER) then
exit(false);
@ -2467,15 +2468,15 @@ implementation
// ax cx dx bx si di bp sp -- in x86reg.dat
// ax cx dx bx sp bp si di -- needed order
(0, 1, 2, 3, 6, 7, 5, 4);
maxsupreg: array[tregistertype] of tsuperregister=
maxsupreg: array[cgbase.tregistertype] of cgbase.tsuperregister=
{$ifdef x86_64}
(0, 16, 9, 8, 32, 32, 8, 0, 0, 0);
{$else x86_64}
(0, 8, 9, 8, 8, 32, 8, 0, 0, 0);
{$endif x86_64}
var
rs: tsuperregister;
rt: tregistertype;
rs: cgbase.tsuperregister;
rt: cgbase.tregistertype;
begin
rs:=getsupreg(r);
rt:=getregtype(r);
@ -2532,7 +2533,7 @@ implementation
base,index,scalefactor,
o : longint;
ir,br : Tregister;
isub,bsub : tsubregister;
isub,bsub : cgbase.tsubregister;
begin
result:=false;
ir:=input.ref^.index;
@ -4617,7 +4618,7 @@ implementation
end;
function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
function taicpu.is_same_reg_move(regtype: cgbase.Tregistertype):boolean;
begin
result:=(((opcode=A_MOV) or (opcode=A_XCHG)) and
(regtype = R_INTREGISTER) and
@ -5479,6 +5480,17 @@ implementation
InsTabMemRefSizeInfoCache^[AsmOp].RegYMMSizeMask:=RegYMMSizeMask;
InsTabMemRefSizeInfoCache^[AsmOp].RegZMMSizeMask:=RegZMMSizeMask;
if (InsTabMemRefSizeInfoCache^[AsmOp].ExistsSSEAVX) and
(gas_needsuffix[AsmOp] <> AttSufNONE) and
(not(InsTabMemRefSizeInfoCache^[AsmOp].MemRefSize in MemRefMultiples)) then
begin
// combination (attsuffix <> "AttSufNONE") and (MemRefSize is not in MemRefMultiples) is not supported =>> check opcode-definition in x86ins.dat');
//InternalError(20210102);
Message3(asmr_e_not_supported_combination_attsuffix_memrefsize_type,
std_op2str[AsmOp],
GetEnumName(typeinfo(TAttSuffix), ord(gas_needsuffix[AsmOp])),
GetEnumName(typeinfo(TMemRefSizeInfo), ord(InsTabMemRefSizeInfoCache^[AsmOp].MemRefSize)));
end;
end;
end;

View File

@ -1597,9 +1597,12 @@ procedure Tx86Instruction.SetInstructionOpsize;
end;
end;
end
else if not(MemRefSize in [msiMemRegSize]) then
else if
(gas_needsuffix[opcode] = AttSufNone) and
(not(MemRefSize in [msiMemRegSize])) then
begin
//bExistMemRef:=false;
// external gnu-assembler: no suffix =>> use instructions.opsize to define memory-reference size
// Tx86Instruction: local variable: operand.opsize
for i := 1 to ops do
if tx86operand(operands[i]).opr.typ in [OPR_REFERENCE,OPR_LOCAL] then

View File

@ -2344,7 +2344,7 @@ mmxreg,xmmreg \331\2\x0F\x2D\110 KATMAI,SSE,MMX
xmmreg,rm32 \333\321\2\x0F\x2A\110 KATMAI,SSE
xmmreg,rm64 \333\321\2\x0F\x2A\110 KATMAI,SSE,X86_64
[CVTSS2SI,cvtss2siX]
[CVTSS2SI]
(Ch_Wop2, Ch_Rop1)
reg32|64,mem32 \333\320\2\x0F\x2D\110 KATMAI,SSE
reg32|64,xmmreg \333\320\2\x0F\x2D\110 KATMAI,SSE
@ -2354,7 +2354,7 @@ reg32|64,xmmreg \333\320\2\x0F\x2D\110 KATMAI,SSE
mmxreg,mem64 \331\2\x0F\x2C\110 KATMAI,SSE,MMX
mmxreg,xmmreg \331\2\x0F\x2C\110 KATMAI,SSE,MMX
[CVTTSS2SI,cvttss2siX]
[CVTTSS2SI]
(Ch_Wop2, Ch_Rop1)
reg32|64,mem32 \333\320\2\x0F\x2C\110 KATMAI,SSE
reg32|64,xmmreg \333\320\2\x0F\x2C\110 KATMAI,SSE
@ -2866,7 +2866,7 @@ xmmreg,xmmrm \361\2\x0F\x5B\110 WILLAMETTE,SSE2,SM
xmmreg,xmmreg \2\x0F\x5A\110 WILLAMETTE,SSE2 ;,SQ
xmmreg,mem64 \2\x0F\x5A\110 WILLAMETTE,SSE2 ;,SQ
[CVTSD2SI,cvtsd2siX]
[CVTSD2SI]
(Ch_Wop2, Ch_Rop1)
reg32,xmmreg \334\2\x0F\x2D\110 WILLAMETTE,SSE2
reg32,mem64 \334\2\x0F\x2D\110 WILLAMETTE,SSE2
@ -2900,7 +2900,7 @@ xmmreg,xmmrm \361\2\x0F\xE6\110 WILLAMETTE,SSE2,SM
(Ch_Wop2, Ch_Rop1)
xmmreg,xmmrm \333\2\x0F\x5B\110 WILLAMETTE,SSE2,SM
[CVTTSD2SI,cvttsd2siX]
[CVTTSD2SI]
(Ch_Wop2, Ch_Rop1)
reg32|64,xmmreg \334\320\2\x0F\x2C\110 WILLAMETTE,SSE2
reg32|64,mem64 \334\320\2\x0F\x2C\110 WILLAMETTE,SSE2

View File

@ -411,9 +411,9 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufINT,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
@ -525,11 +525,6 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
@ -593,6 +588,11 @@ attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufNONE,
attsufINT,
attsufNONE,
attsufNONE,