View Issue Details

IDProjectCategoryView StatusLast Update
0038175FPCCompilerpublic2020-12-06 18:36
ReporterChristo Crause Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038175: Xtensa [patch] ESP8266 doesn't support min/max instructions
DescriptionThe min/max intrinsic introduced in r 47693 is not supported by ESP8266 and leads to failure in compiling the rtl. Attached please find a patch that checks if the subarch supports the min/max feature before calling the min/max intrinsics.
TagsNo tags attached.
Fixed in Revision47699
FPCOldBugId
FPCTarget-
Attached Files

Activities

Christo Crause

2020-12-06 15:27

reporter  

xtensa-minmax.patch (1,946 bytes)   
diff --git a/compiler/nflw.pas b/compiler/nflw.pas
index 50afc38c62..6a465d6df2 100644
--- a/compiler/nflw.pas
+++ b/compiler/nflw.pas
@@ -302,6 +302,9 @@ implementation
     {$ifdef i8086}
       cpuinfo,
     {$endif i8086}
+    {$ifdef xtensa}
+      cpuinfo,
+    {$endif xtensa}
       cgbase,procinfo
       ;
 
@@ -1586,7 +1589,7 @@ implementation
           end;
 {$if defined(xtensa)}
         { use min/max intrinsic? }
-        if (left.nodetype in [gtn,gten,ltn,lten]) and IsSingleStatement(right,thenstmnt) and IsSingleStatement(t1,elsestmnt) and
+        if (CPUXTENSA_HAS_MINMAX in cpu_capabilities[current_settings.cputype]) and (left.nodetype in [gtn,gten,ltn,lten]) and IsSingleStatement(right,thenstmnt) and IsSingleStatement(t1,elsestmnt) and
           (thenstmnt.nodetype=assignn) and (elsestmnt.nodetype=assignn) and
           not(might_have_sideeffects(left)) and
           tassignmentnode(thenstmnt).left.isequal(tassignmentnode(elsestmnt).left) and
diff --git a/compiler/xtensa/cpuinfo.pas b/compiler/xtensa/cpuinfo.pas
index a33337580b..22ea0e9b2c 100644
--- a/compiler/xtensa/cpuinfo.pas
+++ b/compiler/xtensa/cpuinfo.pas
@@ -141,7 +141,8 @@ Const
         CPUXTENSA_HAS_BOOLEAN_OPTION,
         CPUXTENSA_HAS_MUL32HIGH,
         CPUXTENSA_HAS_DIV,
-        CPUXTENSA_HAS_LOOPS
+        CPUXTENSA_HAS_LOOPS,
+        CPUXTENSA_HAS_MINMAX
       );
 
    tfpuflags =
@@ -155,7 +156,7 @@ Const
      (
        { cpu_none     } [],
        { cpu_lx106    } [],
-       { cpu_lx6      } [CPUXTENSA_REGWINDOW, CPUXTENSA_HAS_SEXT, CPUXTENSA_HAS_NSAx, CPUXTENSA_HAS_BOOLEAN_OPTION, CPUXTENSA_HAS_MUL32HIGH, CPUXTENSA_HAS_DIV, CPUXTENSA_HAS_LOOPS]
+       { cpu_lx6      } [CPUXTENSA_REGWINDOW, CPUXTENSA_HAS_SEXT, CPUXTENSA_HAS_NSAx, CPUXTENSA_HAS_BOOLEAN_OPTION, CPUXTENSA_HAS_MUL32HIGH, CPUXTENSA_HAS_DIV, CPUXTENSA_HAS_LOOPS, CPUXTENSA_HAS_MINMAX]
      );
 
    fpu_capabilities : array[tfputype] of set of tfpuflags =
xtensa-minmax.patch (1,946 bytes)   

Florian

2020-12-06 17:38

administrator   ~0127375

Thanks, applied (I keep the xtensa specific conditions together though).

Christo Crause

2020-12-06 18:36

reporter   ~0127378

Thanks!

Issue History

Date Modified Username Field Change
2020-12-06 15:27 Christo Crause New Issue
2020-12-06 15:27 Christo Crause File Added: xtensa-minmax.patch
2020-12-06 17:38 Florian Assigned To => Florian
2020-12-06 17:38 Florian Status new => resolved
2020-12-06 17:38 Florian Resolution open => fixed
2020-12-06 17:38 Florian Fixed in Version => 3.3.1
2020-12-06 17:38 Florian Fixed in Revision => 47699
2020-12-06 17:38 Florian FPCTarget => -
2020-12-06 17:38 Florian Note Added: 0127375
2020-12-06 18:36 Christo Crause Status resolved => closed
2020-12-06 18:36 Christo Crause Note Added: 0127378