Commit Graph

231 Commits

Author SHA1 Message Date
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
florian
9be3ca04ad * split FPC_HAS_INTERNAL_BSX_* defines into FPC_HAS_INTERNAL_BSF_* and FPC_HAS_INTERNAL_BSR_*
git-svn-id: trunk@22308 -
2012-09-04 12:56:18 +00:00
florian
2db4606eb0 * fix bootstrapping with 2.6.0
git-svn-id: trunk@22293 -
2012-09-03 09:16:46 +00:00
florian
ff12d63248 + generic popcnt support
git-svn-id: trunk@22290 -
2012-09-02 20:59:44 +00:00
florian
b782918434 * first draft to support the popcnt instruction, works so far for x86 with a real popcnt instruction
git-svn-id: trunk@22289 -
2012-09-02 20:59:39 +00:00
pierre
a311c53167 Replace HandleErrorFrame calls by HandleErrorAddrFrameInd where possible in common code (to allow correct backtrace for mips cpu)
git-svn-id: trunk@21900 -
2012-07-12 11:53:59 +00:00
Jonas Maebe
b42d204514 * fpc_shortstr_assign as compilerproc, forgot to commit
git-svn-id: trunk@21701 -
2012-06-25 05:06:41 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
sergei
f18767f6a8 * generic fpc_shortstr_assign: cleaned up
* align(): tweaked priority of calculation, yields better constant folding when these functions are inlined (alignment argument is a constant in most cases)

git-svn-id: trunk@20197 -
2012-01-30 09:20:43 +00:00