ソースを参照

bugfix opcodes cvt.., vcvt.. memory operands and typesize

git-svn-id: branches/tg74/avx512-0037785@47113 -
tg74 4 年 前
コミット
c65b042856

+ 1 - 1
compiler/i386/i386att.inc

@@ -1194,7 +1194,7 @@
 'vcompresspd',
 'vcompressps',
 'vcvtpd2qq',
-'vcvtpd2udq',
+' vcvtpd2udq',
 'vcvtpd2uqq',
 'vcvtps2qq',
 'vcvtps2udq',

+ 8 - 8
compiler/i386/i386atts.inc

@@ -1194,14 +1194,17 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -1211,6 +1214,9 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
+attsufINT,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -1228,14 +1234,8 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
+attsufINT,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,

+ 1 - 1
compiler/i386/i386nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-4143;
+4149;

+ 53 - 11
compiler/i386/i386tab.inc

@@ -10493,6 +10493,13 @@
     code    : #232#233#248#1#91#72;
     flags   : [if_avx512]
   ),
+  (
+    opcode  : A_VCVTPD2DQ;
+    ops     : 2;
+    optypes : (ot_xmmreg_mz,ot_memory or ot_bits256,ot_none,ot_none);
+    code    : #220#232#234#242#244#248#1#230#72;
+    flags   : [if_avx,if_sandybridge,if_tfv]
+  ),
   (
     opcode  : A_VCVTPD2DQ;
     ops     : 2;
@@ -10503,9 +10510,9 @@
   (
     opcode  : A_VCVTPD2DQ;
     ops     : 2;
-    optypes : (ot_xmmreg_mz,ot_ymmrm,ot_none,ot_none);
+    optypes : (ot_xmmreg_mz,ot_ymmreg,ot_none,ot_none);
     code    : #220#232#234#242#244#248#1#230#72;
-    flags   : [if_avx,if_sandybridge,if_tfv]
+    flags   : [if_avx,if_sandybridge]
   ),
   (
     opcode  : A_VCVTPD2DQ;
@@ -22172,10 +22179,17 @@
   (
     opcode  : A_VCVTUSI2SD;
     ops     : 3;
-    optypes : (ot_xmmreg,ot_xmmreg_er,ot_rm_gpr or ot_bits64,ot_none);
+    optypes : (ot_xmmreg,ot_xmmreg_er,ot_memory or ot_bits64,ot_none);
     code    : #220#232#234#248#1#123#61#80;
     flags   : [if_avx512,if_t1s]
   ),
+  (
+    opcode  : A_VCVTUSI2SD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg_er,ot_reg64,ot_none);
+    code    : #220#232#234#248#1#123#61#80;
+    flags   : [if_avx512]
+  ),
   (
     opcode  : A_VCVTUSI2SD;
     ops     : 3;
@@ -22638,6 +22652,20 @@
     code    : #232#241#250#1#85#61#80#23;
     flags   : [if_avx512]
   ),
+  (
+    opcode  : A_VFPCLASSPD;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits256,ot_immediate or ot_bits8,ot_none);
+    code    : #232#234#241#244#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
+  (
+    opcode  : A_VFPCLASSPD;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits512,ot_immediate or ot_bits8,ot_none);
+    code    : #232#233#234#241#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
@@ -22655,9 +22683,9 @@
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_ymmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_ymmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#234#241#244#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPD;
@@ -22669,9 +22697,9 @@
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_zmmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_zmmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#233#234#241#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPD;
@@ -22680,6 +22708,20 @@
     code    : #232#233#234#241#250#1#102#72#22;
     flags   : [if_avx512,if_bcst8,if_tfv]
   ),
+  (
+    opcode  : A_VFPCLASSPS;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits256,ot_immediate or ot_bits8,ot_none);
+    code    : #232#241#244#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
+  (
+    opcode  : A_VFPCLASSPS;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits512,ot_immediate or ot_bits8,ot_none);
+    code    : #232#233#241#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
@@ -22697,9 +22739,9 @@
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_ymmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_ymmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#241#244#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPS;
@@ -22711,9 +22753,9 @@
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_zmmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_zmmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#233#241#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPS;

+ 1 - 1
compiler/i8086/i8086att.inc

@@ -1208,7 +1208,7 @@
 'vcompresspd',
 'vcompressps',
 'vcvtpd2qq',
-'vcvtpd2udq',
+' vcvtpd2udq',
 'vcvtpd2uqq',
 'vcvtps2qq',
 'vcvtps2udq',

+ 8 - 8
compiler/i8086/i8086atts.inc

@@ -1208,14 +1208,17 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -1225,6 +1228,9 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
+attsufINT,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -1242,14 +1248,8 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
+attsufINT,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,

+ 1 - 1
compiler/i8086/i8086nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-4175;
+4181;

+ 53 - 11
compiler/i8086/i8086tab.inc

@@ -10521,6 +10521,13 @@
     code    : #232#233#248#1#91#72;
     flags   : [if_avx512]
   ),
+  (
+    opcode  : A_VCVTPD2DQ;
+    ops     : 2;
+    optypes : (ot_xmmreg_mz,ot_memory or ot_bits256,ot_none,ot_none);
+    code    : #220#232#234#242#244#248#1#230#72;
+    flags   : [if_avx,if_sandybridge,if_tfv]
+  ),
   (
     opcode  : A_VCVTPD2DQ;
     ops     : 2;
@@ -10531,9 +10538,9 @@
   (
     opcode  : A_VCVTPD2DQ;
     ops     : 2;
-    optypes : (ot_xmmreg_mz,ot_ymmrm,ot_none,ot_none);
+    optypes : (ot_xmmreg_mz,ot_ymmreg,ot_none,ot_none);
     code    : #220#232#234#242#244#248#1#230#72;
-    flags   : [if_avx,if_sandybridge,if_tfv]
+    flags   : [if_avx,if_sandybridge]
   ),
   (
     opcode  : A_VCVTPD2DQ;
@@ -22396,10 +22403,17 @@
   (
     opcode  : A_VCVTUSI2SD;
     ops     : 3;
-    optypes : (ot_xmmreg,ot_xmmreg_er,ot_rm_gpr or ot_bits64,ot_none);
+    optypes : (ot_xmmreg,ot_xmmreg_er,ot_memory or ot_bits64,ot_none);
     code    : #220#232#234#248#1#123#61#80;
     flags   : [if_avx512,if_t1s]
   ),
+  (
+    opcode  : A_VCVTUSI2SD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg_er,ot_reg64,ot_none);
+    code    : #220#232#234#248#1#123#61#80;
+    flags   : [if_avx512]
+  ),
   (
     opcode  : A_VCVTUSI2SD;
     ops     : 3;
@@ -22862,6 +22876,20 @@
     code    : #232#241#250#1#85#61#80#23;
     flags   : [if_avx512]
   ),
+  (
+    opcode  : A_VFPCLASSPD;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits256,ot_immediate or ot_bits8,ot_none);
+    code    : #232#234#241#244#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
+  (
+    opcode  : A_VFPCLASSPD;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits512,ot_immediate or ot_bits8,ot_none);
+    code    : #232#233#234#241#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
@@ -22879,9 +22907,9 @@
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_ymmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_ymmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#234#241#244#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPD;
@@ -22893,9 +22921,9 @@
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_zmmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_zmmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#233#234#241#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPD;
@@ -22904,6 +22932,20 @@
     code    : #232#233#234#241#250#1#102#72#22;
     flags   : [if_avx512,if_bcst8,if_tfv]
   ),
+  (
+    opcode  : A_VFPCLASSPS;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits256,ot_immediate or ot_bits8,ot_none);
+    code    : #232#241#244#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
+  (
+    opcode  : A_VFPCLASSPS;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits512,ot_immediate or ot_bits8,ot_none);
+    code    : #232#233#241#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
@@ -22921,9 +22963,9 @@
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_ymmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_ymmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#241#244#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPS;
@@ -22935,9 +22977,9 @@
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_zmmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_zmmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#233#241#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPS;

+ 2 - 1
compiler/x86/cpubase.pas

@@ -505,7 +505,8 @@ implementation
             end;
           R_ADDRESSREGISTER:
             case reg of
-              NR_K0..NR_K7: reg_cgsize:=OS_64;
+              //NR_K0..NR_K7: reg_cgsize:=OS_64;
+              NR_K0..NR_K7: reg_cgsize:=OS_NO;
               else internalerror(2003031801);
             end;
           else

+ 252 - 73
compiler/x86/rax86.pas

@@ -1402,99 +1402,268 @@ end;
 
 
 procedure Tx86Instruction.SetInstructionOpsize;
+
+  function CheckSSEAVX: Boolean;
+  var
+    i: integer;
+    bBroadcastMemRef: boolean;
+  begin
+    Result := False;
+
+    with MemRefInfo(opcode) do
+    begin
+      if (ExistsSSEAVX) then
+      begin
+        bBroadcastMemRef := false;
+        for i := 1 to ops do
+         bBroadcastMemRef := bBroadcastMemRef or ((tx86operand(operands[i]).vopext and OTVE_VECTOR_BCST) = OTVE_VECTOR_BCST);
+
+        if bBroadcastMemRef then
+        begin
+          opsize := S_NO;
+          result := true;
+        end
+        else
+        begin
+          if MemRefSize in MemRefMultiples - [msiVMemMultiple] then
+          begin
+            case ops of
+              2: begin
+                   opsize:=tx86operand(operands[1]).opsize;
+                   result := true;
+                 end;
+              3: begin
+                   if (tx86operand(operands[1]).opr.typ <> OPR_CONSTANT) then
+                    opsize:=tx86operand(operands[1]).opsize
+                     else opsize:=tx86operand(operands[2]).opsize;
+                   result := true;
+                 end;
+            end;
+          end;
+        end;
+      end;
+    end;
+  end;
+
+var
+  iops: topsize;
+  isBCastMemRef: boolean;
 begin
   if opsize<>S_NO then
    exit;
+//  case ops of
+//    0 : ;
+//    1 :
+//      begin
+//        { "push es" must be stored as a long PM }
+//        if ((opcode=A_PUSH) or
+//            (opcode=A_POP)) and
+//           (operands[1].opr.typ=OPR_REGISTER) and
+//           is_segment_reg(operands[1].opr.reg) then
+//{$ifdef i8086}
+//          opsize:=S_W
+//{$else i8086}
+//          opsize:=S_L
+//{$endif i8086}
+//        else
+//          opsize:=tx86operand(operands[1]).opsize;
+//      end;
+//    2 :
+//      begin
+//        case opcode of
+//          A_MOVZX,A_MOVSX :
+//            begin
+//              if tx86operand(operands[1]).opsize=S_NO then
+//                begin
+//                  tx86operand(operands[1]).opsize:=S_B;
+//                  if (m_delphi in current_settings.modeswitches) then
+//                    Message(asmr_w_unable_to_determine_reference_size_using_byte)
+//                  else
+//                    Message(asmr_e_unable_to_determine_reference_size);
+//                end;
+//              case tx86operand(operands[1]).opsize of
+//                S_W :
+//                  case tx86operand(operands[2]).opsize of
+//                    S_L :
+//                      opsize:=S_WL;
+//{$ifdef x86_64}
+//                    S_Q :
+//                      opsize:=S_WQ;
+//{$endif}
+//                    else
+//                      ;
+//                  end;
+//                S_B :
+//                  begin
+//                    case tx86operand(operands[2]).opsize of
+//                      S_W :
+//                        opsize:=S_BW;
+//                      S_L :
+//                        opsize:=S_BL;
+//{$ifdef x86_64}
+//                      S_Q :
+//                        opsize:=S_BQ;
+//{$endif}
+//                      else
+//                        ;
+//                    end;
+//                  end;
+//                else
+//                  ;
+//              end;
+//            end;
+//          A_MOVSS,
+//          A_VMOVSS,
+//          A_MOVD : { movd is a move from a mmx register to a
+//                     32 bit register or memory, so no opsize is correct here PM }
+//            //exit;
+//            ;
+//          A_MOVQ :
+//            opsize:=S_IQ;
+//          A_CVTSI2SS,
+//          A_CVTSI2SD,
+//          A_VCVTPD2DQ,
+//          A_VCVTPD2PS,
+//          A_VCVTTPD2DQ,
+//          A_VCVTPD2UDQ,
+//          A_VCVTQQ2PS,
+//          A_VCVTTPD2UDQ,
+//          A_VCVTUQQ2PS,
+//
+//          A_OUT :
+//            opsize:=tx86operand(operands[1]).opsize;
+//          else
+//            opsize:=tx86operand(operands[2]).opsize;
+//        end;
+//      end;
+//    3 :
+//      begin
+//        case opcode of
+//          A_VCVTSI2SS,
+//          A_VCVTSI2SD,
+//          A_VCVTUSI2SS,
+//          A_VCVTUSI2SD:
+//            opsize:=tx86operand(operands[1]).opsize;
+//          A_VFPCLASSPD,
+//          A_VFPCLASSPS:
+//            opsize:=tx86operand(operands[2]).opsize;
+//        else
+//          opsize:=tx86operand(operands[ops]).opsize;
+//        end;
+//      end;
+//    4 :
+//        opsize:=tx86operand(operands[ops]).opsize;
+//
+//  end;
+
+//  iops := S_NO;
   case ops of
-    0 : ;
-    1 :
-      begin
-        { "push es" must be stored as a long PM }
-        if ((opcode=A_PUSH) or
-            (opcode=A_POP)) and
-           (operands[1].opr.typ=OPR_REGISTER) and
-           is_segment_reg(operands[1].opr.reg) then
-{$ifdef i8086}
-          opsize:=S_W
-{$else i8086}
-          opsize:=S_L
-{$endif i8086}
-        else
-          opsize:=tx86operand(operands[1]).opsize;
-      end;
-    2 :
-      begin
-        case opcode of
-          A_MOVZX,A_MOVSX :
-            begin
-              if tx86operand(operands[1]).opsize=S_NO then
-                begin
-                  tx86operand(operands[1]).opsize:=S_B;
-                  if (m_delphi in current_settings.modeswitches) then
-                    Message(asmr_w_unable_to_determine_reference_size_using_byte)
-                  else
-                    Message(asmr_e_unable_to_determine_reference_size);
-                end;
-              case tx86operand(operands[1]).opsize of
-                S_W :
-                  case tx86operand(operands[2]).opsize of
-                    S_L :
-                      opsize:=S_WL;
-{$ifdef x86_64}
-                    S_Q :
-                      opsize:=S_WQ;
-{$endif}
+    0,1: iops := opsize;
+    2 : begin
+          case opcode of
+            A_MOVZX,A_MOVSX :
+              begin
+                if tx86operand(operands[1]).opsize=S_NO then
+                  begin
+                    tx86operand(operands[1]).opsize:=S_B;
+                    if (m_delphi in current_settings.modeswitches) then
+                      Message(asmr_w_unable_to_determine_reference_size_using_byte)
                     else
-                      ;
+                      Message(asmr_e_unable_to_determine_reference_size);
                   end;
-                S_B :
-                  begin
+                case tx86operand(operands[1]).opsize of
+                  S_W :
                     case tx86operand(operands[2]).opsize of
-                      S_W :
-                        opsize:=S_BW;
                       S_L :
-                        opsize:=S_BL;
-{$ifdef x86_64}
+                        iops:=S_WL;
+  {$ifdef x86_64}
                       S_Q :
-                        opsize:=S_BQ;
-{$endif}
+                        iops:=S_WQ;
+  {$endif}
                       else
                         ;
                     end;
-                  end;
-                else
-                  ;
+                  S_B :
+                    begin
+                      case tx86operand(operands[2]).opsize of
+                        S_W :
+                          iops:=S_BW;
+                        S_L :
+                          iops:=S_BL;
+  {$ifdef x86_64}
+                        S_Q :
+                          iops:=S_BQ;
+  {$endif}
+                        else
+                          ;
+                      end;
+                    end;
+                  else
+                    ;
+                end;
               end;
-            end;
-          A_MOVSS,
-          A_VMOVSS,
-          A_MOVD : { movd is a move from a mmx register to a
-                     32 bit register or memory, so no opsize is correct here PM }
-            exit;
-          A_MOVQ :
-            opsize:=S_IQ;
-          A_CVTSI2SS,
-          A_CVTSI2SD,
-          A_OUT :
-            opsize:=tx86operand(operands[1]).opsize;
-          else
-            opsize:=tx86operand(operands[2]).opsize;
+            //A_MOVSS,
+            //A_VMOVSS,
+            A_MOVD : { movd is a move from a mmx register to a
+                       32 bit register or memory, so no opsize is correct here PM }
+              exit;
+            A_MOVQ :
+              opsize:=S_IQ;
+            //A_VCVTPD2DQ,
+            //A_VCVTPD2PS,
+            //A_VCVTTPD2DQ,
+            //A_VCVTPD2UDQ,
+            //A_VCVTQQ2PS,
+            //A_VCVTTPD2UDQ,
+            //A_VCVTUQQ2PS,
+
+            A_OUT :
+              opsize:=tx86operand(operands[1]).opsize;
+            else
+             if not CheckSSEAVX then
+              opsize:=tx86operand(operands[2]).opsize;
+          end;
         end;
-      end;
     3 :
-      begin
-        case opcode of
-          A_VCVTSI2SS,
-          A_VCVTSI2SD:
-            opsize:=tx86operand(operands[1]).opsize;
-        else
-          opsize:=tx86operand(operands[ops]).opsize;
+        begin
+          //case opcode of
+            //A_VCVTSI2SS,
+            //A_VCVTSI2SD,
+            //A_VCVTUSI2SS,
+            //A_VCVTUSI2SD:
+            //  iops:=tx86operand(operands[1]).opsize;
+            //A_VFPCLASSPD,
+            //A_VFPCLASSPS:
+            //  iops:=tx86operand(operands[2]).opsize;
+            //else
+            begin
+              if not CheckSSEAVX then
+               opsize:=tx86operand(operands[ops]).opsize;
+            end;
+          //end;
         end;
-      end;
     4 :
         opsize:=tx86operand(operands[ops]).opsize;
 
+
   end;
+
+// todo delete (only test)
+//  if opsize <> iops then
+//   begin
+//     if not isBCastMemRef then
+//    Message1(asmr_w_adding_explicit_args_fXX, std_op2str[opcode] + 'no broadcast')
+//    else
+//     begin
+//       Message1(asmr_w_adding_explicit_args_fXX, std_op2str[opcode] + ' -broadcast- ' + GetEnumName(TypeInfo(topsize), ord(opsize)) + ':' + GetEnumName(TypeInfo(topsize), ord(iops)));
+//
+//
+////    writeln(GetEnumName(TypeInfo(topsize), ord(opsize)));
+////    writeln(GetEnumName(TypeInfo(topsize), ord(iops)));
+//     end;
+//
+//   end;
+//  opsize := iops;
 end;
 
 
@@ -1988,7 +2157,17 @@ begin
                                begin
                                  s:=s+'reg';
                                  addsize:=true;
+                               end
+                             else
+                               if getregtype(opr.reg)=R_ADDRESSREGISTER then
+                               begin
+                                 // 14102020 TG TODO CHECK
+                                 if (opr.reg >= NR_K0) and (opr.reg >= NR_K7) then
+                                 begin
+                                   s:=s+'k' + regnr;
+                                 end;
                                end;
+
                            end;
                OPR_LOCAL,
             OPR_REFERENCE: begin

+ 26 - 14
compiler/x86/x86ins.dat

@@ -4174,10 +4174,13 @@ zmmreg_mz,bmem32                          \350\351\370\1\x5B\110
 zmmreg_mz,zmmreg_er                       \350\351\370\1\x5B\110                    AVX512
 
 
+; VCVTPD2DQ xmmreg_mz,mem256 must come first - map MemRefSize 256bits correct
+;                                              map all other MemrefSize (without broasdcast MemRef) to xmmreg, xmmrm
 [VCVTPD2DQ,vcvtpd2dqM]
 (Ch_Wop2, Ch_Rop1)
+xmmreg_mz,mem256                          \334\350\352\362\364\370\1\xE6\110        AVX,SANDYBRIDGE,TFV
 xmmreg_mz,xmmrm                           \334\350\352\362\370\1\xE6\110            AVX,SANDYBRIDGE,TFV
-xmmreg_mz,ymmrm                           \334\350\352\362\364\370\1\xE6\110        AVX,SANDYBRIDGE,TFV
+xmmreg_mz,ymmreg                           \334\350\352\362\364\370\1\xE6\110       AVX,SANDYBRIDGE
 xmmreg_mz,bmem64                          \334\350\352\370\1\xE6\110                AVX512,BCST2,TFV
 xmmreg_mz,bmem64                          \334\350\352\364\370\1\xE6\110            AVX512,BCST4,TFV
 
@@ -7277,7 +7280,7 @@ zmmreg_mz,mem512                          \350\351\352\361\370\1\x7B\110
 zmmreg_mz,bmem64                          \350\351\352\361\370\1\x7B\110            AVX512,TFV
 zmmreg_mz,zmmreg_er                       \350\351\352\361\370\1\x7B\110            AVX512
 
-[VCVTPD2UDQ]
+[VCVTPD2UDQ, vcvtpd2udqX]
 (Ch_All)
 xmmreg_mz,mem128                          \350\352\370\1\x79\110                    AVX512,TFV
 xmmreg_mz,mem256                          \350\352\364\370\1\x79\110                AVX512,TFV
@@ -7341,7 +7344,7 @@ zmmreg_mz,mem512                          \333\350\351\352\370\1\xE6\110
 zmmreg_mz,bmem64                          \333\350\351\352\370\1\xE6\110            AVX512,TFV
 zmmreg_mz,zmmreg_er                       \333\350\351\352\370\1\xE6\110            AVX512
 
-[VCVTQQ2PS]
+[VCVTQQ2PS,vcvtqq2psX]
 (Ch_All)
 xmmreg_mz,mem128                          \350\352\370\1\x5B\110                    AVX512,TFV
 xmmreg_mz,mem256                          \350\352\364\370\1\x5B\110                AVX512,TFV
@@ -7377,7 +7380,7 @@ zmmreg_mz,mem512                          \350\351\352\361\370\1\x7A\110
 zmmreg_mz,bmem64                          \350\351\352\361\370\1\x7A\110            AVX512,TFV
 zmmreg_mz,zmmreg_sae                      \350\351\352\361\370\1\x7A\110            AVX512
 
-[VCVTTPD2UDQ]
+[VCVTTPD2UDQ,vcvttpd2udqX]
 (Ch_All)
 xmmreg_mz,mem128                          \350\352\370\1\x78\110                    AVX512,TFV
 xmmreg_mz,mem256                          \350\352\364\370\1\x78\110                AVX512,TFV
@@ -7476,7 +7479,7 @@ zmmreg_mz,mem512                          \333\350\351\352\370\1\x7A\110
 zmmreg_mz,bmem64                          \333\350\351\352\370\1\x7A\110            AVX512,TFV
 zmmreg_mz,zmmreg_er                       \333\350\351\352\370\1\x7A\110            AVX512
 
-[VCVTUQQ2PS]
+[VCVTUQQ2PS,vcvtuqq2psX]
 (Ch_All)
 xmmreg_mz,mem128                          \334\350\352\370\1\x7A\110                AVX512,TFV
 xmmreg_mz,mem256                          \334\350\352\364\370\1\x7A\110            AVX512,TFV
@@ -7488,12 +7491,13 @@ ymmreg_mz,mem512                          \334\350\351\352\370\1\x7A\110
 ymmreg_mz,bmem64                          \334\350\351\352\370\1\x7A\110            AVX512,BCST8,TFV
 ymmreg_mz,zmmreg_er                       \334\350\351\352\370\1\x7A\110            AVX512
 
-[VCVTUSI2SD]
+[VCVTUSI2SD,vcvtusi2sdX]
 (Ch_All)
-xmmreg,xmmreg_er,rm64                     \334\350\352\370\1\x7B\75\120                AVX512,T1S
+xmmreg,xmmreg_er,mem64                     \334\350\352\370\1\x7B\75\120               AVX512,T1S
+xmmreg,xmmreg_er,reg64                     \334\350\352\370\1\x7B\75\120               AVX512
 xmmreg,xmmreg_er,rm32                     \334\350\370\1\x7B\75\120                    AVX512,T1S
 
-[VCVTUSI2SS]
+[VCVTUSI2SS,vcvtusi2ssX]
 (Ch_All)
 xmmreg,xmmreg_er,rm64                     \333\350\352\370\1\x7B\75\120                AVX512,T1S
 xmmreg,xmmreg_er,rm32                     \333\350\370\1\x7B\75\120                    AVX512,T1S
@@ -7613,22 +7617,30 @@ xmmreg_mz,xmmreg,mem32,imm8               \350\361\372\1\x55\75\120\27
 xmmreg_mz,xmmreg,xmmreg_sae,imm8          \350\361\372\1\x55\75\120\27              AVX512
 
 
-[VFPCLASSPD]
+; VFPCLASSPD kreg_m,mem256 and mem512 must come first - map MemRefSize 256,512bits correct
+;                                              map all other MemrefSize (without broasdcast MemRef) to kreg_m, xmmrm
+[VFPCLASSPD,vfpclasspdX]
 (Ch_All)
+kreg_m,mem256,imm8                        \350\352\361\364\372\1\x66\110\26         AVX512,TFV
+kreg_m,mem512,imm8                        \350\351\352\361\372\1\x66\110\26         AVX512,TFV
 kreg_m,xmmrm,imm8                         \350\352\361\372\1\x66\110\26             AVX512,TFV
 kreg_m,bmem64,imm8                        \350\352\361\372\1\x66\110\26             AVX512,BCST2,TFV
-kreg_m,ymmrm,imm8                         \350\352\361\364\372\1\x66\110\26         AVX512,TFV
+kreg_m,ymmreg,imm8                        \350\352\361\364\372\1\x66\110\26         AVX512
 kreg_m,bmem64,imm8                        \350\352\361\364\372\1\x66\110\26         AVX512,BCST4,TFV
-kreg_m,zmmrm,imm8                         \350\351\352\361\372\1\x66\110\26         AVX512,TFV
+kreg_m,zmmreg,imm8                        \350\351\352\361\372\1\x66\110\26         AVX512
 kreg_m,bmem64,imm8                        \350\351\352\361\372\1\x66\110\26         AVX512,BCST8,TFV
 
-[VFPCLASSPS]
+; VFPCLASSPS kreg_m,mem256 and mem512 must come first - map MemRefSize 256,512bits correct
+;                                              map all other MemrefSize (without broasdcast MemRef) to kreg_m, xmmrm
+[VFPCLASSPS,vfpclasspsX]
 (Ch_All)
+kreg_m,mem256,imm8                        \350\361\364\372\1\x66\110\26             AVX512,TFV
+kreg_m,mem512,imm8                        \350\351\361\372\1\x66\110\26             AVX512,TFV
 kreg_m,xmmrm,imm8                         \350\361\372\1\x66\110\26                 AVX512,TFV
 kreg_m,bmem32,imm8                        \350\361\372\1\x66\110\26                 AVX512,BCST4,TFV
-kreg_m,ymmrm,imm8                         \350\361\364\372\1\x66\110\26             AVX512,TFV
+kreg_m,ymmreg,imm8                        \350\361\364\372\1\x66\110\26             AVX512
 kreg_m,bmem32,imm8                        \350\361\364\372\1\x66\110\26             AVX512,BCST8,TFV
-kreg_m,zmmrm,imm8                         \350\351\361\372\1\x66\110\26             AVX512,TFV
+kreg_m,zmmreg,imm8                        \350\351\361\372\1\x66\110\26             AVX512
 kreg_m,bmem32,imm8                        \350\351\361\372\1\x66\110\26             AVX512,BCST16,TFV
 
 [VFPCLASSSD]

+ 8 - 8
compiler/x86_64/x8664ats.inc

@@ -1190,14 +1190,17 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -1207,6 +1210,9 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufINT,
+attsufINT,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -1224,14 +1230,8 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
-attsufNONE,
+attsufINT,
+attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,

+ 1 - 1
compiler/x86_64/x8664att.inc

@@ -1190,7 +1190,7 @@
 'vcompresspd',
 'vcompressps',
 'vcvtpd2qq',
-'vcvtpd2udq',
+' vcvtpd2udq',
 'vcvtpd2uqq',
 'vcvtps2qq',
 'vcvtps2udq',

+ 1 - 1
compiler/x86_64/x8664nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-4207;
+4213;

+ 53 - 11
compiler/x86_64/x8664tab.inc

@@ -10794,6 +10794,13 @@
     code    : #232#233#248#1#91#72;
     flags   : [if_avx512]
   ),
+  (
+    opcode  : A_VCVTPD2DQ;
+    ops     : 2;
+    optypes : (ot_xmmreg_mz,ot_memory or ot_bits256,ot_none,ot_none);
+    code    : #220#232#234#242#244#248#1#230#72;
+    flags   : [if_avx,if_sandybridge,if_tfv]
+  ),
   (
     opcode  : A_VCVTPD2DQ;
     ops     : 2;
@@ -10804,9 +10811,9 @@
   (
     opcode  : A_VCVTPD2DQ;
     ops     : 2;
-    optypes : (ot_xmmreg_mz,ot_ymmrm,ot_none,ot_none);
+    optypes : (ot_xmmreg_mz,ot_ymmreg,ot_none,ot_none);
     code    : #220#232#234#242#244#248#1#230#72;
-    flags   : [if_avx,if_sandybridge,if_tfv]
+    flags   : [if_avx,if_sandybridge]
   ),
   (
     opcode  : A_VCVTPD2DQ;
@@ -22620,10 +22627,17 @@
   (
     opcode  : A_VCVTUSI2SD;
     ops     : 3;
-    optypes : (ot_xmmreg,ot_xmmreg_er,ot_rm_gpr or ot_bits64,ot_none);
+    optypes : (ot_xmmreg,ot_xmmreg_er,ot_memory or ot_bits64,ot_none);
     code    : #220#232#234#248#1#123#61#80;
     flags   : [if_avx512,if_t1s]
   ),
+  (
+    opcode  : A_VCVTUSI2SD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg_er,ot_reg64,ot_none);
+    code    : #220#232#234#248#1#123#61#80;
+    flags   : [if_avx512]
+  ),
   (
     opcode  : A_VCVTUSI2SD;
     ops     : 3;
@@ -23086,6 +23100,20 @@
     code    : #232#241#250#1#85#61#80#23;
     flags   : [if_avx512]
   ),
+  (
+    opcode  : A_VFPCLASSPD;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits256,ot_immediate or ot_bits8,ot_none);
+    code    : #232#234#241#244#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
+  (
+    opcode  : A_VFPCLASSPD;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits512,ot_immediate or ot_bits8,ot_none);
+    code    : #232#233#234#241#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
@@ -23103,9 +23131,9 @@
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_ymmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_ymmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#234#241#244#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPD;
@@ -23117,9 +23145,9 @@
   (
     opcode  : A_VFPCLASSPD;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_zmmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_zmmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#233#234#241#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPD;
@@ -23128,6 +23156,20 @@
     code    : #232#233#234#241#250#1#102#72#22;
     flags   : [if_avx512,if_bcst8,if_tfv]
   ),
+  (
+    opcode  : A_VFPCLASSPS;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits256,ot_immediate or ot_bits8,ot_none);
+    code    : #232#241#244#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
+  (
+    opcode  : A_VFPCLASSPS;
+    ops     : 3;
+    optypes : (ot_kreg_m,ot_memory or ot_bits512,ot_immediate or ot_bits8,ot_none);
+    code    : #232#233#241#250#1#102#72#22;
+    flags   : [if_avx512,if_tfv]
+  ),
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
@@ -23145,9 +23187,9 @@
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_ymmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_ymmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#241#244#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPS;
@@ -23159,9 +23201,9 @@
   (
     opcode  : A_VFPCLASSPS;
     ops     : 3;
-    optypes : (ot_kreg_m,ot_zmmrm,ot_immediate or ot_bits8,ot_none);
+    optypes : (ot_kreg_m,ot_zmmreg,ot_immediate or ot_bits8,ot_none);
     code    : #232#233#241#250#1#102#72#22;
-    flags   : [if_avx512,if_tfv]
+    flags   : [if_avx512]
   ),
   (
     opcode  : A_VFPCLASSPS;