Patchwork rs6000: Add testcase for ne0 stuff

login
register
mail settings
Submitter Segher Boessenkool
Date Sept. 25, 2012, 6:28 p.m.
Message ID <8fd2a4bcd9c41257bee60ccce8df4abb345e17ab.1348597520.git.segher@kernel.crashing.org>
Download mbox | patch
Permalink /patch/186876/
State New
Headers show

Comments

Segher Boessenkool - Sept. 25, 2012, 6:28 p.m.
How's this?


Segher


2012-09-25  Segher Boessenkool  <segher@kernel.crashing.org>

	gcc/testsuite/
	* gcc.target/powerpc/ppc-ne0-1.c: New.

---
 gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c |   33 ++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
David Edelsohn - Sept. 25, 2012, 8:24 p.m.
On Tue, Sep 25, 2012 at 2:28 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> How's this?
>
>
> Segher
>
>
> 2012-09-25  Segher Boessenkool  <segher@kernel.crashing.org>
>
>         gcc/testsuite/
>         * gcc.target/powerpc/ppc-ne0-1.c: New.

Okay.

Thanks, David

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
new file mode 100644
index 0000000..63c4b60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
@@ -0,0 +1,33 @@ 
+/* PR target/51274 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-isel" } */
+
+/* { dg-final { scan-assembler-times "addic" 4 } } */
+/* { dg-final { scan-assembler-times "subfe" 1 } } */
+/* { dg-final { scan-assembler-times "addze" 3 } } */
+
+long ne0(long a)
+{
+  return a != 0;
+}
+
+long plus_ne0(long a, long b)
+{
+  return (a != 0) + b;
+}
+
+void dummy(void);
+
+void cmp_plus_ne0(long a, long b)
+{
+  if ((a != 0) + b)
+    dummy();
+}
+
+long plus_ne0_cmp(long a, long b)
+{
+  a = (a != 0) + b;
+  if (a)
+    dummy();
+  return a;
+}