Commit Graph

239 Commits

Author SHA1 Message Date
Károly Balogh
45b5e9215c rtl: remove defines for v2.x compiler from the common part of the RTL. It's no longer suppported to build with that
git-svn-id: trunk@49036 -
2021-03-23 09:32:49 +00:00
florian
3072df59ff * overflow checked mul helpers do not need to check all bits either
git-svn-id: trunk@48999 -
2021-03-17 21:30:41 +00:00
svenbarth
0c316deab5 * readd SmallInt typecasts to SmallInt overload of SwapEndian
git-svn-id: trunk@46898 -
2020-09-19 17:42:04 +00:00
svenbarth
9d86fed95b * avoid range check error when using SwapEndian with 16-bit constants
+ added test

git-svn-id: trunk@46897 -
2020-09-19 17:04:17 +00:00
yury
ec10ee8218 * Improved generic implementations of fpc_mul_dword, fpc_mul_word, fpc_mul_byte to use less iterations and registers.
git-svn-id: trunk@46269 -
2020-08-05 17:58:46 +00:00
florian
828e961f3d * remove unused constants
git-svn-id: trunk@43351 -
2019-11-01 18:39:17 +00:00
Jeppe Johansen
1b698d319f - Fix bug in software overflow checking for longint's.
- AVR: Fix overflow checking for HW multiplications

git-svn-id: trunk@42531 -
2019-07-30 13:42:26 +00:00
Jeppe Johansen
67bf76c50e - Fix overflow checking in software multiplication routines. Overflow checking should also be enabled for the unsigned multiplications.
- Call FPC_Overflow instead of multiple calls to save on size.

git-svn-id: trunk@42491 -
2019-07-25 12:49:55 +00:00
florian
90557f2e62 * properly calcualte aligncount as proposed by Jeppe, should resolve #33323
git-svn-id: trunk@40449 -
2018-12-02 14:49:24 +00:00
yury
a19528efa1 * Fixed warnings.
git-svn-id: trunk@40188 -
2018-11-02 19:22:46 +00:00
florian
33463c8698 * moved align helper so it actually gets inlined
git-svn-id: trunk@40011 -
2018-10-21 20:50:21 +00:00
florian
7817102727 * patch by Christo Crause to implement 8 bit multiplications for "mul-less" avr types, resolves issue #31925
git-svn-id: trunk@37380 -
2017-10-01 20:34:44 +00:00
florian
16c9a2260d * check alignment properly in CompareDWord for 64 bit targets
git-svn-id: trunk@36656 -
2017-07-06 18:02:22 +00:00
nickysn
34113b930b * removed the checkoverflow: boolean parameter of the software mul helpers;
replaced it with a separate "_checkoverflow" version of each helper

git-svn-id: trunk@36344 -
2017-05-26 15:34:26 +00:00
nickysn
ba665e103c + added sqr(shortint) and sqr(smallint) for CPUs with 8/16-bit alu
git-svn-id: trunk@36342 -
2017-05-26 13:16:36 +00:00
nickysn
78a7445751 + added Odd(byte) and Odd(shortint) for cpus with 8-bit alu and Odd(word)/
Odd(smallint) for cpus with 8 or 16-bit alu

git-svn-id: trunk@36328 -
2017-05-25 14:42:56 +00:00
nickysn
fa645dcaf7 + added abs(smallint) and abs(shortint) for cpus with 8-bit or 16-bit alu
git-svn-id: trunk@36327 -
2017-05-25 14:14:18 +00:00
Károly Balogh
346f040a54 also try to inline 32bit SwapEndian variants, as they're still reasonably simple
git-svn-id: trunk@36304 -
2017-05-23 07:32:54 +00:00
pierre
ded1fb23a2 Improve stack trace output with -Cr option, contributed by Colin Western
git-svn-id: trunk@36134 -
2017-05-06 13:54:50 +00:00
pierre
d2d1794b40 Use HandleError instead of RunError in fpc_help_destructor, fpc_check_object and fpc_check_object_ext
git-svn-id: trunk@36113 -
2017-05-05 11:49:16 +00:00
nickysn
b14f277e8f + use rtl helpers for 64-bit shl/shr/sar/rol/ror modify in place operations, on
platforms that don't have native 64-bit implementation of the corresponding
  64-bit shift/rotate operation

git-svn-id: trunk@35787 -
2017-04-13 15:24:32 +00:00
florian
86f0b59095 * avoid conversion to larger type in Align
git-svn-id: trunk@34940 -
2016-11-20 19:02:53 +00:00
pierre
b9e6938519 Correct behavior: if VMT becomes NIL, RTE 219 must be generated as this happens if EXPVMT is not an ancestor of starting VMT
git-svn-id: trunk@34197 -
2016-07-24 06:13:46 +00:00
svenbarth
59303c5113 Fix -CR after the recent VMT changes.
* tobjectvmt: parent needs to be ppointer for 3.1.1
* fpc_check_object_ext: correctly determine parent VMT

git-svn-id: trunk@34194 -
2016-07-23 16:42:15 +00:00
florian
2b082d88a6 * generic implementation of fpc_pchar_length uses IndexByte instead of a simple while loop
git-svn-id: trunk@33490 -
2016-04-12 18:11:27 +00:00
florian
91c59cb512 * fix Fill* code for CPUs with 8 Bit ALU
git-svn-id: trunk@32645 -
2015-12-12 15:49:51 +00:00
nickysn
db7b743139 * yet another longint replaced with objpasint in fpc_shortstr_compare_equal
git-svn-id: trunk@32098 -
2015-10-19 16:53:40 +00:00
nickysn
b561b3c2ba * use objpasint (generates better code on 16-bit and 8-bit cpus) instead of
longint in several generic shortstr helpers

git-svn-id: trunk@32097 -
2015-10-19 16:36:12 +00:00
florian
590ec0f3e6 * more procedures excluded to avoid internalerrors on avr after the trgobj.conservative fix
git-svn-id: trunk@31440 -
2015-08-28 18:49:07 +00:00
florian
ba1297b1ab + provide also 8 and 16 bit div/mod helper
* tmoddivnode.first_moddivint does not force a 32 bit helper, the used helper depends now on the resultdef type set by tmoddivnode.pass_typecheck

git-svn-id: trunk@31195 -
2015-07-05 20:16:50 +00:00
Jonas Maebe
b4033efc00 * fixed typo in comment
git-svn-id: trunk@30079 -
2015-03-02 21:45:43 +00:00
Jonas Maebe
ff020a3be4 + "Utf8CodePointLen(pansichar,MaxLookAhead,IncludeCombiningDiacriticalMarks):
sizeint"  function that returns:
   <0: invalid sequence detected after processing "-result" bytes
   0:  incomplete (may still be valid if MaxLookAhead is increased)
   >0: sequence of result bytes forms a codepoint (+ combining diacritical
       marks if that parameter was true)

git-svn-id: trunk@30047 -
2015-03-01 17:12:17 +00:00
Károly Balogh
05e72f52c6 a slightly better generic implementation for SwapEndian() 32 bit and 64 bit ints
git-svn-id: trunk@28614 -
2014-09-07 23:19:57 +00:00
sergei
98332db7fe * Improved generic implementations of Bsf/Bsr. Existing ones were just ugly, BsfQword/BsrQWord producing total of 15 inline expansions 5 levels down and bloating into just a little less than a kilobyte of code (on MIPS). Now it is at most 3 expansions and 21 instructions (84 bytes), 16 and 32 bit routines are branchless.
git-svn-id: trunk@28575 -
2014-09-01 16:00:33 +00:00
sergei
217ab9879c * Enabled internal handling of Abs(longint) for all targets. It has been implemented in cross-platform way ages ago (see tcginlinenode.second_abs_long), but not enabled on MIPS,SPARC and m68k.
- RTL: removed MIPS,SPARC and m68k-specific implementations of Abs(longint), and marked the generic one as  required for bootstrapping purposes only.

git-svn-id: trunk@27857 -
2014-06-05 10:35:51 +00:00
nickysn
48c5d9d213 * tobjectvmt.size and .msize in the rtl changed to sizeuint, because ptruint is
not the correct size type in the VMT in i8086 far data memory models

git-svn-id: trunk@27685 -
2014-04-28 15:19:11 +00:00
nickysn
e471a7dd2c * use ObjpasInt, instead of nativeint in fpc_div_dword and fpc_mod_dword
git-svn-id: trunk@27236 -
2014-03-23 13:09:22 +00:00
sergei
94a045aa3d * Moved declarations of TFPURoundingMode,TFPUExceptionMask and TFPUPrecisionMode to System unit. Declarations in Math unit changed to aliases.
* Changed type of softfloat_exception_mask and softfloat_exception_flags to TFPUExceptionMask, softfloat_rounding_mode to TFPURoundingMode.
- Cleaned out numerous conversions happening when getting/setting exception mask and rounding mode.

git-svn-id: trunk@27215 -
2014-03-20 22:44:46 +00:00
sergei
a1dfaa54dd * Fixed exception handling in constructors of TP-style objects to correctly handle cases of statically allocated objects (must call destructor but do not free memory) and objects without destructor (must free memory if it was allocated dynamically).
+ Test extended.

git-svn-id: trunk@26676 -
2014-02-05 18:19:13 +00:00
sergei
1626667374 * Object helper routines review/improvement for alignment-sensitive targets:
- Replaced duplicate local declarations of pvmt/tvmt with pobjectvmt/tobjectvmt
    (name change needed because tvmt is already used for class-style VMTs)
  - Removed 'packed' attribute from tobjectvmt, since it is always aligned.
  * Use appropriate typecasts to generate aligned memory accesses where possible.

git-svn-id: trunk@26659 -
2014-02-03 01:18:19 +00:00
nickysn
48edf78003 * make BSR/BSF return byte, instead of cardinal on 16/8-bit targets
git-svn-id: trunk@26591 -
2014-01-26 19:56:31 +00:00
nickysn
5c8aa6e5b0 * fpc_mul_integer and fpc_mul_longint: fallback directly to the unsigned
multiplication routine in case overflow checking is not used

git-svn-id: trunk@26524 -
2014-01-19 23:06:34 +00:00
nickysn
d4e01637e7 * use nativeint, instead of longint in fpc_div_dword and fpc_mod_dword, because
it produces more efficient code on 16-bit and 8-bit platforms.

git-svn-id: trunk@26351 -
2014-01-01 20:46:28 +00:00
florian
be3749301f * fix possible issues due to new behaviour of constant shifting
git-svn-id: trunk@26310 -
2013-12-29 12:21:25 +00:00
sergei
690995fa12 * RTL: fixed some warnings when compiling for x86_64:
* x86_64/x86_64.inc: IsMultithread is a LongBool, not Boolean -> fixed assembler instruction suffixes
  * inc/generic.inc: cast Sizeof() to unsigned, so that combining it with unsigned operands does not cause promotion to larger signed type.
  + win64/seh64.inc: explicit typecast and missing function result assignment.
  + inc/genmath.inc: explicit typecasts.

git-svn-id: trunk@25384 -
2013-08-29 07:52:38 +00:00
nickysn
7e18ac90e5 * the 'len' argument of fpc_shortstr_assign changed to smallint on 16-bit cpus, because getintparaloc allocates 16-bit ints on i8086
git-svn-id: branches/i8086@24258 -
2013-04-16 08:25:54 +00:00
paul
431ce7afc8 rtl: remove unused variables
git-svn-id: trunk@23275 -
2013-01-01 16:31:31 +00:00
florian
57ee96ef86 * compilation on non x86 fixed
git-svn-id: trunk@22330 -
2012-09-05 18:49:48 +00:00
florian
8818b58e5d * Bsf/Bsr on x86 handle now correctly 0 as argument, resolves #22783
* generic Bsf implementations handle now correctly 0 as argument
* test extended

git-svn-id: trunk@22327 -
2012-09-05 13:51:45 +00:00
florian
bc47125943 * use BsrDWord in software mod/div
* use a for loop instead of an until loop so code generation is potentially better

git-svn-id: trunk@22318 -
2012-09-04 18:58:20 +00:00