Jonas Maebe
0b246f3dbd
* converted Boolean8 to an internal type, and mapped Boolean to the
...
new internal pasbool1(type) (part of mantis #34411 )
o apply the _Bool x86-64 parameter passing rules only to pasbool1
git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +00:00
florian
96e92527e9
* constant folding of not must check if the deftype is really an orddef, resolves #33696
...
git-svn-id: trunk@39406 -
2018-07-07 14:17:41 +00:00
svenbarth
9b45f58c0b
+ add flags that allow checking for overloads with isbinaryoverloaded() and isunaryoverloaded() without modifying the passed in node or even checking for normally non-overloadable operators
...
git-svn-id: trunk@39258 -
2018-06-20 19:53:34 +00:00
florian
71e71ad267
* fix currency division on non x86 32 bit targets
...
* disable fix for #33439 during bootstrapping with 3.0.x, as 3.0.x cannot compile the currency division without the fix above
git-svn-id: trunk@38558 -
2018-03-17 22:44:44 +00:00
florian
8c5606b41d
+ support mmx shifting
...
git-svn-id: trunk@38367 -
2018-02-27 21:40:12 +00:00
nickysn
b41762d1bf
+ perform the optimization in tmoddivnode.firstoptimize also for div/mod by
...
negative powers of 2 as well
git-svn-id: trunk@36930 -
2017-08-17 15:56:20 +00:00
nickysn
910e1eccc8
* set the bit mask, used for modulus by power-of-2 in a way, that is independent
...
from the sign of the divisor (so that negative powers of 2 can be supported as
well in the future)
git-svn-id: trunk@36928 -
2017-08-17 15:19:37 +00:00
nickysn
ee79ff3635
* improved the optimization of signed modulus by power-of-2, so it uses less
...
operations. Previously generated code:
sign:=sar(left,sizeof(left)*8-1);
result:=((((left xor sign)-sign) and right) xor sign)-sign;
New code:
mask:=sar(left,sizeof(left)*8-1) and ((1 shl power)-1);
result:=((left+mask) and right)-mask;
git-svn-id: trunk@36847 -
2017-08-04 16:20:50 +00:00
nickysn
a1928859b3
* in the optimization of signed division by power-of-2 constant in
...
tmoddivnode.firstoptimize, replaced tordconstnode(right).value-1 with
tcgint((qword(1) shl power)-1), so that it becomes independent from the sign
of right, so that in the future, we can also apply this optimization for
negative power-of-2 divisors as well (only a unary minus node would have to
be inserted in this case).
git-svn-id: trunk@36845 -
2017-08-04 15:50:33 +00:00
nickysn
277026ffd4
* perform the high level signed division by power-of-2 optimization for all
...
int types, larger than the ALU of the CPU, instead of just for 64-bit ints on
32-bit or smaller CPUs.
git-svn-id: trunk@36842 -
2017-08-04 14:34:42 +00:00
nickysn
b9fdca6f49
+ better high level optimization for 64-bit signed division by 2 on 32-bit and
...
lower CPUs. Instead of the (sar(temp,sizeof(temp)*8-1) and 1) expression, use
the equivalent, but simpler (temp shr (sizeof(temp)*8-1))
git-svn-id: trunk@36839 -
2017-08-04 13:51:51 +00:00
nickysn
ee4c82f5f5
* in the high level optimization of signed division by power-of-2 constant, set
...
shiftval to left.resultdef.size*8-1, instead of 31, so that it shifts by 15 or
7 on 16-bit and 8-bit CPUs, when the integer type is small.
git-svn-id: trunk@36820 -
2017-08-03 16:02:27 +00:00
nickysn
efc5e339d0
* use an enum instead of integer constants to represent inline numbers
...
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
their enum name, instead of number
git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf
* removed unused units
...
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
nickysn
de1e0c405e
+ optimize '0 shl x' and '0 shr x' to 0
...
git-svn-id: trunk@36041 -
2017-05-01 18:16:38 +00:00
yury
0f9876effb
* Fixed a memory leak when div is replaced by shift.
...
git-svn-id: trunk@35540 -
2017-03-07 11:11:18 +00:00
pierre
1e5883b6d1
Avoid overflow error for single MinValue in rtl syshelph.inc for x86_64 CPU
...
git-svn-id: trunk@33012 -
2016-01-28 14:20:51 +00:00
Jonas Maebe
ed03286be5
* simplify "div -1" to unaryminusn, not just for performance reasons but
...
also because "div -1" is not handled correctly by the div-to-mul/shift
transformation on x86 (mantis #28702 )
git-svn-id: trunk@32619 -
2015-12-08 15:57:07 +00:00
yury
432248cbf1
* Removed lot of unused vars.
...
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +00:00
Jonas Maebe
fbacf9682f
* rename WinCE softfp compilerproc names to lowercase, needed since r31404
...
(mantis #28598 )
git-svn-id: trunk@31478 -
2015-09-02 09:54:02 +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
florian
36e79a874e
* when creating code for an iso mod operator, use create_internal for the helper nodes
...
to avoid unnecessary warnings
git-svn-id: trunk@30270 -
2015-03-21 22:57:19 +00:00
sergei
5f2821ee5f
* Moved handling of emulated floating point negation into new virtual method tcgunaryminusnode.second_float_emulated. Also changed it into simple flipping of the sign bit, which is how it is defined by IEEE 754, and already done for ARM targets. Relevant ARM-specific parts can now be removed, and m68k code gets significantly better without further efforts.
...
git-svn-id: trunk@28528 -
2014-08-27 21:16:30 +00:00
sergei
c184d9740c
+ Implemented target-independent optimization of signed "mod 2**N" as
...
"sign:=left sar sizeof(left)*8-1; result:=(((left xor sign)-sign) and 2**N-1) xor sign)-sign;"
This solution yields larger code than one suggested by Mantis #21152 , however its speed on i386 is approximately the same, and it is also suitable for all operand sizes, all powers of two and all targets.
git-svn-id: trunk@27891 -
2014-06-07 22:19:10 +00:00
nickysn
a47ab44ec8
* unified the 8-bit and 16-bit alu handling in tshlshrnode.pass_typecheck
...
git-svn-id: trunk@27642 -
2014-04-23 12:53:31 +00:00
nickysn
7d8fb1833f
* 16-bit alu handling in tshlshrnode.pass_typecheck simplified via the use of
...
get_common_intdef
git-svn-id: trunk@27641 -
2014-04-23 12:43:48 +00:00
nickysn
a17797f3ca
* tshlshrnode.simplify: in the case of 16-bit or 8-bit shl/shr, AND the right
...
side constant with 31 (instead of 15 or 7), because that's how the 16-bit and
8-bit x86 shl/shr instructions behave (even on 16-bit CPUs like 286). The
change does not affect 32-bit and 64-bit platforms, because there the shift
is always done in at least 32 bits.
git-svn-id: trunk@27638 -
2014-04-23 00:23:27 +00:00
nickysn
aa3f450832
* 8/16-bit alu fixes in tnotnode.simplify
...
git-svn-id: trunk@27636 -
2014-04-22 22:04:31 +00:00
svenbarth
e85075de7f
Fix for Mantis #25604 .
...
nmat.pas:
* correctly disable type checks if one of the arguments for MOD, DIV, SHR, SHL, NOT, -X and +X is a generic type parameter
+ added tests
git-svn-id: trunk@27535 -
2014-04-11 16:43:53 +00:00
florian
6e1bf4d040
* properly simplify not(<const. cbool>), resolves #25255
...
git-svn-id: trunk@26803 -
2014-02-16 20:20:58 +00:00
florian
cd235d8409
+ simplify shl/shr x, if (x mod bitsizeof(left))=0
...
git-svn-id: trunk@26628 -
2014-01-30 17:34:33 +00:00
florian
27f6fd1c2c
* use new shl/shr constant folding (of r26295) only if forinline is set
...
* explicitly simplify tree after constant propagation
git-svn-id: trunk@26311 -
2013-12-29 14:09:03 +00:00
florian
89663e499b
* fold shifting of constants equally to cpus
...
* test adapted, e.g. 1 shl 63 needs now an explicit cast to qword for the one: qword(1) shl 63
git-svn-id: trunk@26295 -
2013-12-28 20:19:35 +00:00
sergei
6a08ca3f0b
* tmoddivnode.firstoptimize improvements/fixes:
...
* Fixed misplaced parentheses, which were preventing optimization of "unsigned mod power_of_two" into "and" expressions.
* Handling "signed div power_of_two": properly delete the temp node, removes warnings when compiled with "-dEXTDEBUG". This however requires another temp node for storing the result.
* Replaced direct calls to "fpc_sarint64" with inline nodes (in_sar_x_y), allowing target-specific optimizations to take place.
git-svn-id: trunk@25877 -
2013-10-28 15:55:13 +00:00
nickysn
1312fd72f2
* tmoddivnode.pass_typecheck: in the case of unsigned div/mod positive_const, check also the upper bound of the const, so it doesn't get truncated
...
git-svn-id: branches/i8086@24247 -
2013-04-14 21:56:32 +00:00
nickysn
70a0d2989c
* fixed tmoddivnode.pass_typecheck on 64-bit CPUs; I was wrong about uint64 div uint64 producing int64 on 64-bit CPUs; this fixes make cycle on e.g. x86_64
...
git-svn-id: branches/i8086@24226 -
2013-04-11 19:51:01 +00:00
nickysn
7a15fd0444
* in the case of (uint8 div/mod small_positive_const), convert the const to unsigned, so that we don't do a 16-bit division on 8-bit CPUs
...
git-svn-id: branches/i8086@24209 -
2013-04-08 18:08:10 +00:00
nickysn
3558766390
* first attempt to simplify tmoddivnode.pass_typecheck handling of all cpu native int sizes
...
git-svn-id: branches/i8086@24208 -
2013-04-08 17:11:33 +00:00
nickysn
0dcbb4f1cc
* refactored tunaryplusnode.pass_typecheck as well
...
git-svn-id: branches/i8086@24185 -
2013-04-07 16:50:30 +00:00
nickysn
a3117beb12
* refactored tunaryminusnode.pass_typecheck to handle all native int sizes generically, without ifdefs
...
git-svn-id: branches/i8086@24184 -
2013-04-07 16:45:52 +00:00
nickysn
b79569ed2f
* Borland Pascal compatibility for 16-bit CPUs: int16 shl int32 now produces int32; this fixes writeln(longint) on the i8086-msdos target
...
git-svn-id: branches/i8086@24011 -
2013-03-26 00:59:04 +00:00
nickysn
a9640ad9c6
+ insert type conversion for the div result when cpuneedsdiv32helper is used
...
git-svn-id: branches/i8086@23879 -
2013-03-16 23:12:39 +00:00
nickysn
1dbca4c403
* 16-bit ALU fixes in tmoddivnode.pass_typecheck
...
git-svn-id: branches/i8086@23878 -
2013-03-16 22:50:09 +00:00
nickysn
edc382aa76
* 16-bit ALU fixes in tshlshrnode.pass_typecheck
...
git-svn-id: branches/i8086@23817 -
2013-03-13 18:00:28 +00:00
nickysn
4ac508a2b9
fixed bug in tunaryplusnode.pass_typecheck introduced in my previous commit r23737
...
git-svn-id: branches/i8086@23744 -
2013-03-09 14:05:09 +00:00
nickysn
63ac46c74c
16-bit ALU fixes in tunaryminusnode.pass_typecheck and tunaryplusnode.pass_typecheck
...
git-svn-id: branches/i8086@23743 -
2013-03-09 13:24:42 +00:00
florian
8e5bd14e3a
* overleft newline fix
...
git-svn-id: trunk@23110 -
2012-12-03 21:56:01 +00:00
sergei
12ad6704f6
- Removed a number of unused variables, reduces noise at compilation.
...
git-svn-id: trunk@22880 -
2012-10-30 11:55:59 +00:00
florian
5e1e42ec2b
* fixes support for cpus with cpunodefaultint for unary minus nodes
...
git-svn-id: trunk@22838 -
2012-10-23 20:27:07 +00:00
Jonas Maebe
9e0184884e
* correctly change the signdness information of tordconstnodes that are
...
simplified via typeconvnode (corrects resultdef of "qword(1) shl 33",
mantis #22133 )
* simplify shl/shr nodes after their resultdef has been set, so the
resultdef used during simplify is set (fixes same expression as above
when it is calculated by an inline function)
git-svn-id: trunk@21394 -
2012-05-26 13:31:23 +00:00