View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0033693 | FPC | RTL | public | 2018-05-05 13:57 | 2020-01-21 10:27 |
Reporter | J. Gareth Moreton | Assigned To | |||
Priority | low | Severity | tweak | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Platform | Win64 | OS | Microsoft Windows | ||
Product Version | 3.1.1 | ||||
Fixed in Version | 3.1.1 | ||||
Summary | 0033693: [Patch] Optimised/Fixed "Int" function | ||||
Description | As initially touched upon in 0033635, the Int as well as the Frac function was faulty when it came to handling values whose magnitude was larger than 2^63 (too large for an Int64), causing a crash. The Frac function already implements an inlined and rearranged version of this proposed Int function, and this completes the set by providing robust code that is also small and very fast to execute. | ||||
Steps To Reproduce | Run the supplied "inttest.pp" file to compare timings and correctness, then apply the patch to merge the new Int function into the RTL. | ||||
Additional Information | Find attached inttest.log for a sample run of the timings. If compiled under Linux, the timings are not shown or calculated. | ||||
Tags | 64-bit, rtl | ||||
Fixed in Revision | 38993 | ||||
FPCOldBugId | 0 | ||||
FPCTarget | - | ||||
Attached Files |
|
related to | 0033635 | closed | Broken frac function |
|
IntFix.patch (836 bytes)
Index: rtl/x86_64/math.inc =================================================================== --- rtl/x86_64/math.inc (revision 38904) +++ rtl/x86_64/math.inc (working copy) @@ -356,6 +356,21 @@ {$else FPC_HAS_TYPE_EXTENDED} + {$ifndef FPC_SYSTEM_HAS_INT} + {$define FPC_SYSTEM_HAS_INT} + function fpc_int_real( d: ValReal) : ValReal;compilerproc; assembler; nostackframe; + asm + movq %xmm0, %rax + shr $48, %rax + and $0x7ff0,%ax + cmp $0x4330,%ax + jge .L0 + cvttsd2si %xmm0, %rax + cvtsi2sd %rax, %xmm0 + .L0: + end; + {$endif FPC_SYSTEM_HAS_INT} + {$ifndef FPC_SYSTEM_HAS_TRUNC} {$define FPC_SYSTEM_HAS_TRUNC} function fpc_trunc_real(d : ValReal) : int64;compilerproc; assembler; nostackframe; |
|
|
|
|
|
(Fixed link in description) |
|
Thank you for your contribution! |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-05-05 13:57 | J. Gareth Moreton | New Issue | |
2018-05-05 13:57 | J. Gareth Moreton | Status | new => assigned |
2018-05-05 13:57 | J. Gareth Moreton | Assigned To | => Sven Barth |
2018-05-05 13:57 | J. Gareth Moreton | File Added: IntFix.patch | |
2018-05-05 13:57 | J. Gareth Moreton | File Added: inttest.pp | |
2018-05-05 13:58 | J. Gareth Moreton | File Added: inttest.log | |
2018-05-05 13:58 | J. Gareth Moreton | Relationship added | related to 0033635 |
2018-05-05 14:00 | J. Gareth Moreton | Note Added: 0108147 | |
2018-05-05 14:00 | J. Gareth Moreton | Description Updated | View Revisions |
2018-05-05 14:31 | J. Gareth Moreton | Tag Attached: 64-bit | |
2018-05-05 14:31 | J. Gareth Moreton | Tag Attached: rtl | |
2018-05-11 02:42 | J. Gareth Moreton | Priority | normal => low |
2018-05-11 02:42 | J. Gareth Moreton | Severity | minor => tweak |
2018-05-14 23:09 | Sven Barth | Fixed in Revision | => 38993 |
2018-05-14 23:09 | Sven Barth | Note Added: 0108299 | |
2018-05-14 23:09 | Sven Barth | Status | assigned => resolved |
2018-05-14 23:09 | Sven Barth | Fixed in Version | => 3.1.1 |
2018-05-14 23:09 | Sven Barth | Resolution | open => fixed |
2018-05-14 23:09 | Sven Barth | Target Version | 3.1.1 => |
2020-01-21 10:27 | J. Gareth Moreton | Assigned To | Sven Barth => |
2020-01-21 10:27 | J. Gareth Moreton | Status | resolved => closed |
2020-01-21 10:27 | J. Gareth Moreton | FPCTarget | => - |