View Issue Details

IDProjectCategoryView StatusLast Update
0036700FPCCompilerpublic2020-02-15 21:54
ReporterJ. Gareth MoretonAssigned ToFlorian 
PrioritylowSeveritytweakReproducibilityN/A
Status resolvedResolutionfixed 
Platformx86_64OSMicrosoft WindowsOS Version10 Professional
Product Version3.3.1Product Buildr44103 
Target VersionFixed in Version3.3.1 
Summary0036700: [Patch] The simplest optimisation! (MOVSXD)
DescriptionThis patch, for x86_64, includes the 64-bit exclusive MOVSXD instruction, alongside MOVZX and MOVSX, for analysis through the OptPass1Movx routine.
Steps To ReproduceApply patch and confirm correct compilation.
Additional InformationThe inclusion of the instruction improves some instruction sequences that deal with signed values in memory being sign-extended to the CPU word size (as the language is defined to do) before being stored again after some basic operation - for example:

    movslq -360(%rbp),%rax
    addq %rdx,%rax
    movq %rax,-360(%rbp)

Becomes:

    addq %rdx,-360(%rbp)

And:

    movslq -36(%rbp),%rax
    orq $34816,%rax
    movl %eax,-36(%rbp)

Becomes:

    orl $34816,-36(%rbp)
Tagscompiler, optimizations, patch, x86, x86_64
Fixed in Revision44185
FPCOldBugId
FPCTarget-
Attached Files
  • movsxd-inclusion.patch (439 bytes)
    Index: compiler/x86_64/aoptcpu.pas
    ===================================================================
    --- compiler/x86_64/aoptcpu.pas	(revision 44163)
    +++ compiler/x86_64/aoptcpu.pas	(working copy)
    @@ -76,6 +76,7 @@
                     A_MOV:
                       Result:=OptPass1MOV(p);
                     A_MOVSX,
    +                A_MOVSXD,
                     A_MOVZX:
                       Result:=OptPass1Movx(p);
                     A_MOVAPD,
    

Activities

J. Gareth Moreton

2020-02-15 05:20

developer  

movsxd-inclusion.patch (439 bytes)
Index: compiler/x86_64/aoptcpu.pas
===================================================================
--- compiler/x86_64/aoptcpu.pas	(revision 44163)
+++ compiler/x86_64/aoptcpu.pas	(working copy)
@@ -76,6 +76,7 @@
                 A_MOV:
                   Result:=OptPass1MOV(p);
                 A_MOVSX,
+                A_MOVSXD,
                 A_MOVZX:
                   Result:=OptPass1Movx(p);
                 A_MOVAPD,

Florian

2020-02-15 21:54

administrator   ~0121113

Thanks, applied.

Issue History

Date Modified Username Field Change
2020-02-15 05:20 J. Gareth Moreton New Issue
2020-02-15 05:20 J. Gareth Moreton File Added: movsxd-inclusion.patch
2020-02-15 05:20 J. Gareth Moreton Tag Attached: patch
2020-02-15 05:20 J. Gareth Moreton Tag Attached: compiler
2020-02-15 05:20 J. Gareth Moreton Tag Attached: optimizations
2020-02-15 05:20 J. Gareth Moreton Tag Attached: x86_64
2020-02-15 05:20 J. Gareth Moreton Tag Attached: x86
2020-02-15 05:21 J. Gareth Moreton Priority normal => low
2020-02-15 05:21 J. Gareth Moreton Severity minor => tweak
2020-02-15 05:21 J. Gareth Moreton FPCTarget => -
2020-02-15 18:08 J. Gareth Moreton Summary [Patchi] The simplest optimisation! (MOVSXD) => [Patch] The simplest optimisation! (MOVSXD)
2020-02-15 21:54 Florian Assigned To => Florian
2020-02-15 21:54 Florian Status new => resolved
2020-02-15 21:54 Florian Resolution open => fixed
2020-02-15 21:54 Florian Fixed in Version => 3.3.1
2020-02-15 21:54 Florian Fixed in Revision => 44185
2020-02-15 21:54 Florian Note Added: 0121113