Browse Source

Fix generation of i8086 CPU code, as BTR/BTS instructions require at least 386 CPU

Pierre Muller 1 year ago
parent
commit
9056ab8025
1 changed files with 10 additions and 1 deletions
  1. 10 1
      compiler/x86/hlcgx86.pas

+ 10 - 1
compiler/x86/hlcgx86.pas

@@ -52,6 +52,9 @@ implementation
     globals,systems,
     aasmbase,
     cgutils,
+{$ifdef I8086}
+    cpuinfo,
+{$endif I8086}
     cpubase,aasmcpu;
 
 { thlcgx86 }
@@ -104,7 +107,13 @@ implementation
     const
       bit_set_clr_instr: array[boolean] of tasmop = (A_BTR,A_BTS);
     begin
-      list.concat(taicpu.op_reg_reg(bit_set_clr_instr[doset],S_NO,bitnumber,dest));
+{$ifdef I8086}
+      { BTR/BTS is only supportd by 80386 CPU or later }
+      if current_settings.cputype < cpu_386 then
+	inherited
+      else
+{$endif I8086}
+        list.concat(taicpu.op_reg_reg(bit_set_clr_instr[doset],S_NO,bitnumber,dest));
     end;