* [PATCH] simplify float-to-float casts that doesn't change size
@ 2017-02-16 2:58 Luc Van Oostenryck
2017-02-16 12:41 ` Christopher Li
0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-02-16 2:58 UTC (permalink / raw)
To: linux-sparse; +Cc: Christopher Li, Luc Van Oostenryck
---
simplify.c | 2 ++
validation/optim/fpcast-nop.c | 15 +++++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 validation/optim/fpcast-nop.c
diff --git a/simplify.c b/simplify.c
index 2a1f0b200..3085c39f4 100644
--- a/simplify.c
+++ b/simplify.c
@@ -895,6 +895,8 @@ static int simplify_cast(struct instruction *insn)
int op = (orig_type->ctype.modifiers & MOD_SIGNED) ? OP_SCAST : OP_CAST;
if (insn->opcode == op)
goto simplify;
+ if (insn->opcode == OP_FPCAST && is_float_type(orig_type))
+ goto simplify;
}
return 0;
diff --git a/validation/optim/fpcast-nop.c b/validation/optim/fpcast-nop.c
new file mode 100644
index 000000000..c2e7ba87f
--- /dev/null
+++ b/validation/optim/fpcast-nop.c
@@ -0,0 +1,15 @@
+static float foof( float a) { return ( float) a; }
+static double food(double a) { return (double) a; }
+static long double fool(long double a) { return (long double) a; }
+
+/*
+ * check-name: fpcast-nop
+ * check-description:
+ * Verify that unneeded casts between same-type
+ * floats are also optimized away.
+ *
+ * check-command: test-linearize $file
+ * check-output-ignore
+ *
+ * check-output-excludes: fpcast\\.
+ */
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] simplify float-to-float casts that doesn't change size
2017-02-16 2:58 [PATCH] simplify float-to-float casts that doesn't change size Luc Van Oostenryck
@ 2017-02-16 12:41 ` Christopher Li
2017-02-16 13:53 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: Christopher Li @ 2017-02-16 12:41 UTC (permalink / raw)
To: Luc Van Oostenryck; +Cc: Linux-Sparse
On Thu, Feb 16, 2017 at 10:58 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> ---
> simplify.c | 2 ++
> validation/optim/fpcast-nop.c | 15 +++++++++++++++
> 2 files changed, 17 insertions(+)
> create mode 100644 validation/optim/fpcast-nop.c
>
Can you add a SOB line?
Thanks
Chris
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] simplify float-to-float casts that doesn't change size
2017-02-16 12:41 ` Christopher Li
@ 2017-02-16 13:53 ` Luc Van Oostenryck
0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-02-16 13:53 UTC (permalink / raw)
To: Christopher Li; +Cc: Linux-Sparse
On Thu, Feb 16, 2017 at 08:41:17PM +0800, Christopher Li wrote:
> On Thu, Feb 16, 2017 at 10:58 AM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > ---
> > simplify.c | 2 ++
> > validation/optim/fpcast-nop.c | 15 +++++++++++++++
> > 2 files changed, 17 insertions(+)
> > create mode 100644 validation/optim/fpcast-nop.c
> >
>
> Can you add a SOB line?
Of course.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-16 13:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 2:58 [PATCH] simplify float-to-float casts that doesn't change size Luc Van Oostenryck
2017-02-16 12:41 ` Christopher Li
2017-02-16 13:53 ` Luc Van Oostenryck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.