diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-04-02 11:24:52 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-01-16 12:08:02 +0100 |
| commit | 6b91f6997c7debd4eaa03b8f9e222aaafa937498 (patch) | |
| tree | 35e9033a229adf02037f3be20049b0fb9b3825a6 /validation/optim | |
| parent | 030473b77d72bd6edcf9fb37e1fe8c12f96deab7 (diff) | |
| download | sparse-dev-6b91f6997c7debd4eaa03b8f9e222aaafa937498.tar.gz | |
CSE: support CSE of floating-point literal
Before the introduction of OP_SETFVAL, floating-point were
created via OP_SETVAL whose CSE is done by comparing the
pointer of the corresponding expression without any
interpretation of this pointer.
As consequence, even if two OP_SETVAL have two identical
expressions (value), in most cases the corresponding pointers
are not identical, completly inhibiting the CSE of OP_SETVALs.
Fix the CSE of floating-point literals by directly using
the value given by the new OP_SETFVAL.
Note: to respect some of the subtilities of floating-point,
the equality comparison of two literals is not done on
the floating-point value itself but bit-by-bit on its
binary representation (as such we can continue to make the
distinction between +0.0 & -0.0, handle NaNs, ...).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/cse-setfval.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/validation/optim/cse-setfval.c b/validation/optim/cse-setfval.c new file mode 100644 index 00000000..15ff67d0 --- /dev/null +++ b/validation/optim/cse-setfval.c @@ -0,0 +1,12 @@ +int ftest(double a, double b) +{ + return a == 0.125 || b == 0.125; +} + +/* + * check-name: CSE OP_SETFVAL + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-pattern(1): setfval\\. + */ |
