Commit Graph

525 Commits

Author SHA1 Message Date
Michaël Van Canneyt
3eee2d8ff3 * Do not insert a widestring <-> ansistring conversion node when checking for (un)equal empty string. 2023-07-22 08:26:22 +00:00
Sven/Sarah Barth
c994b5efe8 * fix #39447: when checking whether the parameters are valid for pointer arithmetic check the *correct* parameter for being valid pointer-like type (I'd say that this was a copy&paste mistake...)
+ added test
2023-06-30 17:42:39 +02:00
Nikolay Nikolov
8cd6606970 + support nil comparison of WebAssembly reference types (externref and funcref) 2023-06-11 07:17:04 +03:00
florian
64319dc019 * PopCount takes care only of the bit pattern, so take the uvalue to avoid an internal error, resolves #40190 2023-03-17 22:30:36 +01:00
J. Gareth "Curious Kit" Moreton
c4899b5dc0 * Dead code in TAddNode.Simplify has been stripped 2023-02-28 20:56:38 +00:00
J. Gareth "Curious Kit" Moreton
487ca08cf3 * In TAddNode.Simplify, commutative operations now ensure integer constant operands go on the right for simplicity 2023-02-28 20:56:38 +00:00
J. Gareth "Curious Kit" Moreton
a5702d89e8 * More complex uses of the pruning methods in TAddNode.Simplify 2023-02-21 20:44:02 +00:00
J. Gareth "Curious Kit" Moreton
9d8fd6d55e * TAddNode.Simplify now uses pruning methods 2023-02-21 20:44:02 +00:00
florian
09b435cdab * transform a/a only into 1 if fastmath is on 2023-01-29 13:49:33 +01:00
florian
789031a6e6 * compile float*2 as float+float if possible as proposed by Rika, resolves #40116 2023-01-22 20:07:40 +01:00
florian
30e0df384d * second part of #40041 fixed
+ tests
2022-12-22 22:41:39 +01:00
florian
e0fef23d77 * properly transform a+const1-const2 into a+const1+(-const2), resolves #40041 2022-12-21 22:34:46 +01:00
Sven/Sarah Barth
7a34677b2a * as long as the type passed into a TypeInfo() is not an undefined or error def the resulting value will always be constant at compile time, so it can be compared to another then no matter if typenode or not
+ added tests
2022-12-02 17:47:15 +01:00
florian
1700516721 * cleanup 2022-11-26 23:27:02 +01:00
florian
247423400f * create muln with create instead of create_internal when converting "n - n mod const)" so pass1 works properly, resolves #40004 2022-11-24 22:43:27 +01:00
Pierre Muller
84be45f55d Fix compilation failure of RTL with -Co option for x86_64-linux target 2022-11-24 17:01:37 +00:00
Pierre Muller
1a19fe1f03 Use correct class typecast for commit ba4cee279b 2022-11-23 08:43:28 +01:00
florian
0ba4cee279 * convert n-n mod const into n div const*const, resolves #39615 2022-11-22 22:41:58 +01:00
florian
f6a8b045c2 * cosmetics 2022-11-21 22:10:29 +01:00
Sven/Sarah Barth
02aac653d2 * optimize shortstring concatenations if they're on the right side of an assignment to directly use the left side instead of a temporary 2022-10-09 13:56:52 +02:00
Sven/Sarah Barth
32261a0f6d * fix copy/paste typo in comments 2022-10-09 13:56:52 +02:00
florian
ad7cc0e69d * handle <dyn.array>+[] (and swapped) correctly, resolves #39919 2022-10-05 22:48:21 +02:00
Jonas Maebe
a6c7ed5e61 vector support: use vector result types
Set the result of a vector add node to a vector type.

Ensure that that these vector types are still asignment-compatible with
regular array types (may want to change this when we expose vector types),
and don't remove type conversions from vector types to array types (so the
code generator pass can still rely on the resultdef being a vector type)
2022-09-16 11:21:04 +02:00
Jonas Maebe
cb96acefc9 vector support: check supported type during parsing already
Avoids internalerrors at the code generation stage when using an unsupported
type
2022-09-16 11:21:04 +02:00
florian
f9a4631adf * don't switch a+/-/sqr(b) into an fma statement if b is too complex 2022-08-27 21:22:16 +02:00
florian
f6b5c513bb * patch by Rika: makes #39786 work on more setups, resolves #39786 2022-07-07 23:00:47 +02:00
florian
fcb5531fbc * convert a+/-const1-/const2 in into a+/-(-const1)+(-const2) to enable further optimizations, resolves #39782 2022-07-01 23:04:50 +02:00
florian
95dfccbb5e * do not optimize away +0.0 if no fastmath is passed as -0.0+(+0.0)=+0.0 2022-06-25 21:39:57 +02:00
florian
94665a40d7 * optimize a-const1-const2 when const1 and const2 are real constants and fast math is on, part of fixing #39782 2022-06-17 23:39:17 +02:00
Jonas Maebe
573f2c20d7 taddnode.cmp_of_disjunct_ranges: fortify in case of programs with errors
Fixes compilation of webtbf/tw3116 with a compiler compiled with -Cr
2022-05-29 13:33:27 +02:00
Sergey Larin
60c967f255 Optimized the comparison of a widestring variable with '' 2022-04-27 21:12:47 +00:00
Sergey Larin
35db2b2da3 Fixed optimization Length(W)=0 -> (Pointer(W)=nil) or (PLongword(Pointer(W)-4)^=0) for WideString 2022-04-27 21:12:47 +00:00
florian
81c8078735 * reorder string expressions with parentheses so fpc_*_concat_multi can be used efficiently, resolved #39479 2022-02-21 23:09:16 +01:00
florian
f21f7f0f50 * handle result type of unsigned ordinal operations in ISO/Extpas mode similiar to TP, solves
#37875
2022-01-28 22:48:50 +01:00
florian
e132ae2fee * last commit was not correct, fixed 2021-11-27 00:28:57 +01:00
florian
bf5f37b14a * fix conditional statement as pointed out by Sergey Larin 2021-11-26 22:27:19 +01:00
florian
6404478ea4 * cleanup of VER3_0 defines 2021-11-17 22:19:57 +01:00
florian
292be9029e * when converting a*a into sqr(a), set the result type correctly
* removefloatupcasts takes care of cs_excessprecision, resolves #39012
2021-11-07 21:54:25 +01:00
florian
5a617cd108 + fold real constants c1,c2 for v+c1+c2 or c1+(c2+v) (+ being either + or *) as well if fastmath is enabled 2021-10-31 17:38:08 +01:00
florian
ff3acfb8cd * cleanup of 2.7.0 defines 2021-10-31 13:20:28 +01:00
florian
08050086b9 * keep type when removing "1*", resolves #38840 2021-10-17 22:23:49 +02:00
florian
00d4a6889d * add no internal flag when folding constants in taddnode.simplify, resolves #39308 2021-10-12 22:59:45 +02:00
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