Browse Source

Refuse A_Jcc, A_SETcc, and A_CMOVcc without condition

Pierre Muller 2 years ago
parent
commit
e2905b8fad
2 changed files with 7 additions and 1 deletions
  1. 4 0
      compiler/x86/rax86att.pas
  2. 3 1
      compiler/x86/rax86int.pas

+ 4 - 0
compiler/x86/rax86att.pas

@@ -1035,6 +1035,10 @@ Implementation
                   if (gas_needsuffix[actopcode]=attsufINTdual) xor (suflen=2) then
                     continue;
 
+                 { We need to refuse the opcodes that require a condition }
+                 if (actopcode=A_Jcc) or (actopcode=A_SETcc) or (actopcode=A_CMOVcc) then
+                   actopcode:=A_NONE;
+
                   if actopcode<>A_NONE then
                     begin
                       if gas_needsuffix[actopcode]=attsufFPU then

+ 3 - 1
compiler/x86/rax86int.pas

@@ -207,7 +207,9 @@ Unit Rax86int;
 
          { Search opcodes }
          actopcode:=tasmop(PtrUInt(iasmops.Find(s)));
-         if actopcode<>A_NONE then
+	 { We need to exclude opcodes that require a condition suffix }
+         if (actopcode<>A_NONE) and (actopcode<>A_Jcc) and
+	    (actopcode<>A_SETcc) and (actopcode<>A_CMOVcc) then
            begin
              actasmtoken:=AS_OPCODE;
              result:=TRUE;