Browse Source

* Tighten rules for accepting ATT suffixes, no longer accept FPU suffixes for integer instructions and vice versa. Resolves #18900.
* tb0267.pp required patching due to 'fildw' instruction at line 72, which is rejected by GAS. Before this commit, FPC was silently converting it to 'filds', so it went unnoticed. Now FPC rejects 'fildw' like GAS does.

git-svn-id: trunk@17363 -

sergei 14 years ago
parent
commit
92adf34e3f
3 changed files with 20 additions and 12 deletions
  1. 4 4
      compiler/x86/itcpugas.pas
  2. 15 7
      compiler/x86/rax86att.pas
  3. 1 1
      tests/tbs/tb0267.pp

+ 4 - 4
compiler/x86/itcpugas.pas

@@ -60,10 +60,10 @@ interface
        '','BW','BL','WL','BQ','WQ',{'LQ',}'B','W','L','S','Q','T'
      );
      att_sizesuffix : array[0..11] of topsize = (
-       S_NO,S_BW,S_BL,S_WL,S_BQ,S_WQ,{S_LQ,}S_B,S_W,S_L,S_FS,S_IQ,S_FX
+       S_NO,S_BW,S_BL,S_WL,S_BQ,S_WQ,{S_LQ,}S_B,S_W,S_L,S_NO,S_Q,S_NO
      );
      att_sizefpusuffix : array[0..11] of topsize = (
-       S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,{S_NO,}S_NO,S_NO,S_FL,S_FS,S_IQ,S_FX
+       S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,{S_NO,}S_NO,S_NO,S_FL,S_FS,S_NO,S_FX
      );
      att_sizefpuintsuffix : array[0..11] of topsize = (
        S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,{S_NO,}S_NO,S_NO,S_IL,S_IS,S_IQ,S_NO
@@ -83,10 +83,10 @@ interface
        '','BW','BL','WL','B','W','L','S','Q','T'
      );
      att_sizesuffix : array[0..9] of topsize = (
-       S_NO,S_BW,S_BL,S_WL,S_B,S_W,S_L,S_FS,S_IQ,S_FX
+       S_NO,S_BW,S_BL,S_WL,S_B,S_W,S_L,S_NO,S_NO,S_NO
      );
      att_sizefpusuffix : array[0..9] of topsize = (
-       S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_FL,S_FS,S_IQ,S_FX
+       S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_FL,S_FS,S_NO,S_FX
      );
      att_sizefpuintsuffix : array[0..9] of topsize = (
        S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_IL,S_IS,S_IQ,S_NO

+ 15 - 7
compiler/x86/rax86att.pas

@@ -798,9 +798,13 @@ Implementation
                        actopsize:=att_sizefpuintsuffix[sufidx]
                       else
                        actopsize:=att_sizesuffix[sufidx];
-                      actasmtoken:=AS_OPCODE;
-                      is_asmopcode:=TRUE;
-                      exit;
+                      { only accept suffix from the same category that the opcode belongs to }
+                      if (actopsize<>S_NO) or (suflen=0) then
+                        begin
+                          actasmtoken:=AS_OPCODE;
+                          is_asmopcode:=TRUE;
+                          exit;
+                        end;
                     end;
                 end;
               { not found, check condition opcodes }
@@ -822,10 +826,14 @@ Implementation
                             actopsize:=att_sizefpuintsuffix[sufidx]
                            else
                             actopsize:=att_sizesuffix[sufidx];
-                           actcondition:=cnd;
-                           actasmtoken:=AS_OPCODE;
-                           is_asmopcode:=TRUE;
-                           exit;
+                           { only accept suffix from the same category that the opcode belongs to }
+                           if (actopsize<>S_NO) or (suflen=0) then
+                             begin
+                               actcondition:=cnd;
+                               actasmtoken:=AS_OPCODE;
+                               is_asmopcode:=TRUE;
+                               exit;
+                             end;
                          end;
                      end;
                   end;

+ 1 - 1
tests/tbs/tb0267.pp

@@ -69,7 +69,7 @@ begin
    aw:=-4;
    bw:=45;
    asm
-     fildw aw
+     filds aw
      fstpl a
    end;
    if a<>-4.0 then