From 75acaad1219d06bb3821c4d964dbd6bc17241ea9 Mon Sep 17 00:00:00 2001 From: tg74 Date: Sun, 20 Dec 2020 04:44:37 +0000 Subject: [PATCH] working on new testmethods and bug-fixing size of (memref-operands | global and local variable - append correct gas-suffix on any vcvt.. opcodes git-svn-id: branches/tg74/avx512-0037785@47821 - --- compiler/x86/rax86.pas | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index 6ea51c392e..55c60deb76 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -1494,8 +1494,10 @@ procedure Tx86Instruction.SetInstructionOpsize; function CheckSSEAVX: Boolean; var i: integer; + iSizeMask: int64; bBroadcastMemRef: boolean; bExistMemRef: boolean; + ValidOpSizes: Set of topsize; begin Result := False; @@ -1538,18 +1540,43 @@ procedure Tx86Instruction.SetInstructionOpsize; end; end; - if result and (MemRefSize in [msiMultipleMinSize128, msiMultipleMinSize256, msiMultipleMinSize512]) then + if (result) and + (ops > 0) and + (MemRefSize in [msiMultipleMinSize128, msiMultipleMinSize256, msiMultipleMinSize512]) and + (gas_needsuffix[opcode] in [AttSufMMS, AttSufMMX]) then begin + // external gas assembler need suffix (different opsizes possible) + // - in fpc not exists datatypes for vector-variables + // =>> all memsize = ok, but any special opcodes (marked with attSufMMS,attSUFMMX) needed in any combination of operandtypes the exact opsize + // =>> check instructions-opsize and use the correct vector-mem-opsize + for i := 1 to ops do if tx86operand(operands[i]).opr.typ in [OPR_REGISTER] then begin + ValidOpSizes := []; + case tx86operand(operands[i]).opsize of - S_XMM: ; - S_YMM:; - S_ZMM:; + S_XMM: iSizeMask := RegXMMSizeMask; + S_YMM: iSizeMask := RegYMMSizeMask; + S_ZMM: iSizeMask := RegZMMSizeMask; + else iSizeMask := 0; end; - //opsize := tx86operand(operands[i]).opsize; - //result := true; + + if iSizemask and OT_BITS128 = OT_BITS128 then include(ValidOpSizes, S_XMM); + if iSizemask and OT_BITS256 = OT_BITS256 then include(ValidOpSizes, S_YMM); + if iSizemask and OT_BITS512 = OT_BITS512 then include(ValidOpSizes, S_ZMM); + + if (ValidOpsizes <> []) then + begin + if not(opsize in ValidOpSizes) then + begin + // instructions-opsize is invalid =>> use smallest valid opsize + if iSizemask and OT_BITS128 = OT_BITS128 then opsize := S_XMM + else if iSizemask and OT_BITS256 = OT_BITS256 then opsize := S_YMM + else if iSizemask and OT_BITS512 = OT_BITS512 then opsize := S_ZMM; + end; + end + else ; // empty ValidOpsize =>> nothing todo??? break; end;