florian
8cb92fd49a
* simplify real expressions involving unary minus
...
+ test
2021-09-19 23:08:32 +02:00
Pierre Muller
33ad038bbb
* Avoid some wrong error messages after initial error
...
On x86_64-openbsd, cycling with -O3 option fails due to
a wrong warning about uninitialized zeros variable in
compilation of ogbase unit
ogbase.pas(2310,41) Warning: Local variable "zeros" does not seem to be initialized
ogbase.pas(2318,39) Error: Can't evaluate constant expression
The second message is due to the fact that simplify is not
called inside nadd unit if errorcount is non-zero.
By replacing errorcount<>0 by not codegenerror,
this message disappears.
2021-09-06 19:23:56 +00:00
florian
3069d74ecc
* handle constant folding correctly for <pointer>+<ord. constant>+<ord. constant>, resolves #39332
2021-09-01 21:32:27 +02:00
Yuriy Sydorov
6a3f32ba69
* optimize tests for a single bit "(a and one_bit_mask_const) = <> one_bit_mask_const" into "(a and one_bit_mask_const) <> = 0" to enable further CPU specific optimizations.
2021-08-09 18:38:58 +03:00
florian
83ce289ea4
* last commit fixed, hopefully final fix
...
git-svn-id: trunk@48886 -
2021-03-06 15:03:33 +00:00
florian
f448603970
* improved last commit, better handling of boolean expressions
...
git-svn-id: trunk@48885 -
2021-03-06 14:55:50 +00:00
florian
62bd0068b6
* do not apply the (a and b) or (c and not(b)) into c xor ((c xor a) and b) optimziation if short boolean evaluation is used, should resolve #38576
...
* improved test
git-svn-id: trunk@48884 -
2021-03-06 14:48:15 +00:00
florian
e0a1bc6675
+ optimize (a and b) or (c and not(b)) into c xor ((c xor a) and b)
...
+ test
git-svn-id: trunk@48841 -
2021-02-28 18:20:46 +00:00
florian
272a0e3e26
+ apply excess precision also to unary minus nodes
...
* made excess precision really working
git-svn-id: trunk@48840 -
2021-02-28 10:52:11 +00:00
yury
64c586b86d
* Removed/ifdefed lots of unused variables.
...
git-svn-id: trunk@48384 -
2021-01-24 12:24:01 +00:00
florian
12adb47d65
* clean up
...
git-svn-id: trunk@48011 -
2021-01-03 15:03:27 +00:00
florian
3109005791
+ fold also (string const+(string const+string var))
...
* string tree folding code moved into level 2 opt. block
git-svn-id: trunk@47986 -
2021-01-02 22:18:38 +00:00
florian
7de94e7a1d
* properly fold string+string const+string const., resolves #38267
...
git-svn-id: trunk@47977 -
2021-01-02 17:18:54 +00:00
florian
e6037961e3
* refactored constant folding code
...
git-svn-id: trunk@47935 -
2021-01-01 21:58:12 +00:00
florian
97abf6b495
* first part of fixing #38267 : do not bail out early during constant folding
...
if the constant is 1 or -1
git-svn-id: trunk@47933 -
2021-01-01 15:26:13 +00:00
florian
4f3a21eeec
* don't do x*x -> optimziation for xtensa as it causes a recursive call in sqr(...)
...
git-svn-id: trunk@47688 -
2020-12-04 22:43:55 +00:00
florian
6380df9b42
* correctly simplify tree transforms of (a+c1+c2) if a is a pointer, resolves #37671
...
git-svn-id: trunk@47437 -
2020-11-16 21:47:19 +00:00
florian
98eab07abd
* simplified and fixed code of (v1=const1) and (v2=const2) optimization, resolves #38066
...
git-svn-id: trunk@47423 -
2020-11-15 16:17:54 +00:00
florian
ff31d95a69
* excess precision should not be applied to comp or currency
...
git-svn-id: trunk@47246 -
2020-10-28 21:37:27 +00:00
florian
13f1fb60b4
* directly copy the result of set <op> set into the left side of an assignment
...
git-svn-id: trunk@47226 -
2020-10-27 21:42:51 +00:00
Jonas Maebe
0729340817
* try_make_mul32to64: restore original node order if transformation failed
...
o this gets called by taddnode.pass_1, which caches the left/right
node types/resultdefs
git-svn-id: trunk@47158 -
2020-10-23 13:34:24 +00:00
Jonas Maebe
099134b545
* fix try_make_mul32to64() if it's called with a constant node on the
...
left (mantis #37878 )
o can happen if use_generic_mul32to64 returns false
git-svn-id: trunk@47142 -
2020-10-19 19:10:16 +00:00
florian
637976e83f
* patch by Marģers to unify internal error numbers, resolves #37888
...
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
florian
65047cecdb
+ optimize comparisons of constant pointers
...
git-svn-id: trunk@47031 -
2020-10-01 20:33:03 +00:00
florian
e124b07e86
+ evaluate typeinfo(<type1>)=/<>typeinfo(<type2>) at compile time, resolves #30260
...
git-svn-id: trunk@47008 -
2020-09-29 20:14:27 +00:00
Jonas Maebe
aa75d39ab5
* don't perform "(x=y) or (z=u)" -> "(x xor y) or (z xor u)" optimization
...
if z or u may raise exceptions (mantis #37780 )
git-svn-id: trunk@46905 -
2020-09-20 12:43:45 +00:00
yury
6878ffbf04
* In the TP mode for 16-bit CPUs uint8+uint8 is extended to sint16+sint16. This is TP compatible.
...
git-svn-id: trunk@46468 -
2020-08-17 09:25:45 +00:00
florian
18b8b9c566
* do not apply range test optimization if the variable is a string being compared against a char constants, resolves #37476
...
git-svn-id: trunk@46453 -
2020-08-15 18:29:26 +00:00
florian
d7ba09f543
* insert type casts when creating new unaryminus nodes during simplification, resolves #37508
...
git-svn-id: trunk@46309 -
2020-08-07 21:43:00 +00:00
florian
e14a3f17e6
* reverted r46220 as it is fixed now properly
...
git-svn-id: trunk@46276 -
2020-08-05 21:15:33 +00:00
yury
719220e8a4
* For 8/16 bit CPUs and TP mode, disable expansion to a larger integer type for subtract operations on unsigned integers. This is TP7 compatible.
...
git-svn-id: trunk@46233 -
2020-08-04 20:45:29 +00:00
svenbarth
c17ad509e2
* fix for Mantis #36775 : apply patch by J. Gareth Moreton
...
+ added tests
git-svn-id: trunk@46220 -
2020-08-03 21:53:29 +00:00
Jonas Maebe
346adf7f55
* replace explicit (sometimes incomplete) tests with calls to doshortbooleval()
...
* the c-style boolean evaluation of "and" is independent of short-circuit evaluation
(you always have to consider the complete values in case the first one is <> 0)
git-svn-id: trunk@45990 -
2020-08-02 14:39:50 +00:00
florian
5f118da600
* optimize a/a and a-a if fast math is on
...
git-svn-id: trunk@45630 -
2020-06-09 20:50:47 +00:00
florian
aafc22bd74
+ optimize real operations with 0 and 1 if fast math is turned on
...
git-svn-id: trunk@45627 -
2020-06-08 20:33:27 +00:00
florian
6d3b74f96e
* extended r45555 to take care of chars as well
...
git-svn-id: trunk@45565 -
2020-06-02 20:58:44 +00:00
florian
792cf056eb
* a nil node is also a constant pointer node
...
+ convert (v1=const1) and (v2=const2) into ((v1 xor const1) or (v2 xor const2))=0 if the expressions have no side effects
git-svn-id: trunk@45555 -
2020-06-01 20:50:38 +00:00
florian
7a60e044e3
* simplify constant expressions after re-ordering, resolves #37062
...
git-svn-id: trunk@45360 -
2020-05-13 20:26:04 +00:00
florian
e5e386f94a
* cosmetics
...
git-svn-id: trunk@45327 -
2020-05-10 18:41:10 +00:00
florian
ebcae70d72
* avoid unncessary conversions of constants in 64 bit ints when doing constant folding
...
git-svn-id: trunk@45326 -
2020-05-10 15:25:31 +00:00
florian
bdabf674e1
* propagate forinline
...
git-svn-id: trunk@45319 -
2020-05-09 17:36:36 +00:00
florian
43e6d84f33
* GetCopyAndTypeCheck forces correct type
...
* propagate forinline flag through simplify
git-svn-id: trunk@45213 -
2020-05-01 20:50:18 +00:00
nickysn
55254ff64b
+ set expectloc in the first pass of the addnode for small CPUs for procvardef comparisons
...
git-svn-id: branches/z80@45044 -
2020-04-23 16:05:23 +00:00
nickysn
96a714b20e
* set expectloc correctly for procvardef comparisons with nil for small CPUs
...
git-svn-id: branches/z80@45043 -
2020-04-23 15:52:22 +00:00
nickysn
073afe3735
+ set expectloc correctly for small CPUs in the first pass of the add node for classrefdefs
...
git-svn-id: branches/z80@45042 -
2020-04-23 15:48:59 +00:00
nickysn
2ee28809d8
* set expectloc correctly for small CPUs for implicit pointer object types in the first pass of the add nodes
...
git-svn-id: branches/z80@45041 -
2020-04-23 15:46:27 +00:00
nickysn
4ae5b81bff
* set expectloc correctly for enumdef comparisons on small CPUs
...
git-svn-id: branches/z80@45040 -
2020-04-23 15:31:50 +00:00
nickysn
c0ea4d826c
+ also support the 8-bit mul helpers in the generic code of nadd
...
git-svn-id: branches/z80@44990 -
2020-04-22 02:45:49 +00:00
florian
af8202be3d
* compilation for non-Xtensa targets fixed
...
git-svn-id: trunk@44543 -
2020-04-03 20:15:26 +00:00
florian
66cbee5e31
* factor out first_addfloat_soft
...
git-svn-id: trunk@44540 -
2020-04-03 20:15:24 +00:00