Commit graph

64 commits

Author SHA1 Message Date
Dale Weiler
68c2baa7c1 Mage inexact travel across constants. 2014-05-24 11:50:16 -04:00
Dale Weiler
05e20bcdda Some things. Fix testsuite as well. One test will fail (inexact). 2014-05-24 11:42:10 -04:00
Dale Weiler
bbeb2517c0 Arithmetic exception flag and a plethora of tests. 2014-05-24 10:38:02 -04:00
Dale Weiler
5dc7e62b19 Use flags instead. 2014-05-24 09:59:43 -04:00
Dale Weiler
6424ebaf98 Perliminary work on arithmetic exception handling in the constant evaluator. We can safely check for arithmetic underflow, overflow, divison by zero and inexactness now. Inexactness of expressions are propagated through the AST such that using an inexact value in a comparison will trigger a warning with -Winexact-compares. 2014-05-24 09:53:38 -04:00
Dale Weiler
9e5d02dab0 Less parens 2014-03-17 10:24:48 -04:00
Dale Weiler
827826b9f9 Remove the qcint cast. 2014-03-17 10:23:13 -04:00
Dale Weiler
b21e967581 Fix left/right shift constant fold. 2014-03-17 09:41:53 -04:00
Dale Weiler
7ffda37513 s/atanhf/atanh/ 2014-02-08 02:50:06 -05:00
Dale Weiler
24f9313952 Screw clang 2014-01-07 13:13:25 -05:00
Dale Weiler
a140b749ff Fix lshift/rshift for runtime and const-fold consistency. 2014-01-07 12:58:53 -05:00
Dale Weiler
a934e0fe4b Happy new year! 2014-01-01 06:24:16 -05:00
Dale Weiler
9b92cb0897 Simplify 2013-11-29 13:50:06 -05:00
Dale Weiler
43e9885a08 Fix fold_op_cmp 2013-11-29 13:48:03 -05:00
Dale Weiler
ac7e1a557d Fixes 2013-11-29 13:36:35 -05:00
Dale Weiler
dc48af195d Pregenerate 2.0 for const folder since it's used often 2013-11-25 13:25:29 -05:00
Dale Weiler
63c0917d24 More compiler intrinsics for math functions 2013-11-23 21:14:13 -05:00
Dale Weiler
e2bfaf8109 Implemented exp2 intrinsic 2013-11-23 07:37:26 -05:00
Wolfgang Bumiller
49bb172a09 folder: change ~ for floats too 2013-11-14 11:41:11 +01:00
Wolfgang Bumiller
f43106017f bit more concise 2013-11-12 16:28:11 +01:00
Wolfgang Bumiller
eb4486a7ac working fold_op_cmp implementation 2013-11-12 16:15:02 +01:00
Wolfgang Bumiller
1d5229ee8c vec3_not: be consistent with compile-time behavior here 2013-11-12 16:05:54 +01:00
Wolfgang Bumiller
eee7d0aac1 vec3_pbool: or, not and 2013-11-12 15:56:04 +01:00
Wolfgang Bumiller
de12a24bc9 folder: fix -fperl-logic 2013-11-12 14:39:25 +01:00
Wolfgang Bumiller
6ea88c9a3f subtracting != adding 2013-11-12 14:31:11 +01:00
Wolfgang Bumiller
de14d514f3 fix 0-x being turned into x 2013-11-06 16:57:04 +01:00
Wolfgang Bumiller
b1016c7f48 fold_binary now used instead of ast_binary_new, which calls fold_superfluous 2013-10-25 13:40:31 +02:00
Dale Weiler
8699053887 Fix handling on intrinsic folding, this closes #118. 2013-10-17 00:14:42 -04:00
Dale Weiler
eca82511c6 divVerent suggestion to use memcmp here 2013-10-14 22:40:36 -04:00
Dale Weiler
6d8d7ee923 Make divVerent happy about handling divison by zero/inf/nan and negitive versions. This code now assumes IEEE 754. 2013-10-14 22:31:37 -04:00
Dale Weiler
300fb9905b Fix fold_superfluous 2013-10-04 07:10:58 -04:00
Dale Weiler
cc69370575 Another peephole optimization which removes superfluous expressions such as (A + 0), (A - 0), (A * 1) and (A / 1). 2013-10-04 06:46:54 -04:00
Dale Weiler
15b0555546 Implement constant folding on ternary operations via fold_cond. 2013-09-26 06:51:49 -04:00
Dale Weiler
f25fff1e3d Remove debug printfs 2013-09-18 19:18:10 -04:00
Dale Weiler
e18849fa42 Generate (non_const_float * (1.0 / constant_float)) for (non_const_float / constant_float) expressions. 2013-09-18 19:15:24 -04:00
Dale Weiler
64661f54ea Implemented >< (vector cross product operator). Currently support for constants only. 2013-08-31 13:41:25 -04:00
Dale Weiler
69252071ba Prevent divide by zero for / and % operations in constant folding (previously caused compiler SIGFPE), instead "inf" is generated for both cases. This closes #124 2013-08-31 12:57:24 -04:00
Dale Weiler
a50635bcd7 intrinsic folding cleanups (and improvements.) 2013-08-30 07:12:16 -04:00
Dale Weiler
51ef277e21 Fix folding logic for conditions. 2013-08-29 00:18:48 -04:00
Dale Weiler
3b4a5667ea Constant fold intrinsics if their arguments are constant. TODO: reference count intrinsics such that they're not generated unless they're used, currently when an intrinsic can be folded-away it's marked for generation and makes it to the final output binary even though it isn't used. 2013-08-28 12:46:22 -04:00
Dale Weiler
ee428b9081 Fix fold-dce for if(0) 2013-08-28 10:39:48 -04:00
Rudolf Polzer
e50b7a2719 Support vector bitor/bitand/bitxor.
Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
2013-08-26 18:32:28 +02:00
Dale Weiler
c64005966f Remove some trailing whitespace 2013-08-17 23:43:41 +00:00
Dale Weiler
a622d5163b Rework some build stuff for better output and to enable strict prototypes 2013-08-16 03:28:02 +00:00
Dale Weiler
91c7209146 Track constant folds in opts_optimization list .. this could be handled better I assume. 2013-08-15 03:45:50 +00:00
Dale Weiler
f82097b6b8 Update deps 2013-08-14 06:12:43 +00:00
Dale Weiler
90e2e5a4ad Some typos 2013-08-14 02:07:12 +00:00
Dale Weiler
7669a99c7f increment the optimization counter for DCE'd folds, also enable -O3 for compilation. 2013-08-01 14:24:10 +00:00
Dale Weiler
db69d14995 Disable the macros to keep clang happy (just uncomment them for when more constant folding optimizations need them) 2013-08-01 07:12:21 +00:00
Dale Weiler
6f749d61b1 Added -Oconst-fold-dce (dead code elimination optimization for when constant expressions form the basis of the dead code, i.e if else with constant expression). Fixed deps and added documentation. Cleaned up folds for ir_value (can now use the same macros as the ast_value ones). 2013-08-01 07:07:59 +00:00