Re: [PATCH,rs6000] Test cases for p10 fusion patterns

2021-05-19 Thread Segher Boessenkool
Hi!

On Mon, Apr 26, 2021 at 02:00:36PM -0500, acsaw...@linux.ibm.com wrote:
> This adds some test cases to make sure that the combine patterns for p10
> fusion are working.

> +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> @@ -0,0 +1,205 @@
> +/* { dg-do compile { target { powerpc*-*-* } } } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } } */

Same issues again.

> +/* Recreate with:
> +   grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' |sort -k 7,7 
> |uniq -c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times 
> \"%s\"%-*s%4d } } *%s/\n","","dg-final",$2,l,"",$1,"");}'
> + */
> +  
> +/* { dg-final { scan-assembler-times "fuse_and_and/1"
>   16 } } */

You could make the lines not wrap easy enough ;-)  (Not that it matters of
course, this is a testcase, heh.)

> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
> @@ -0,0 +1,66 @@
> +/* { dg-do compile { target { powerpc*-*-* } } } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } } */

And one more.

Okay for trunk and backport to 11 with those things looked at.  Thanks!


Segher


Re: [PATCH,rs6000] Test cases for p10 fusion patterns

2021-05-11 Thread Aaron Sawdey via Gcc-patches
Ping.

Aaron Sawdey, Ph.D. saw...@linux.ibm.com
IBM Linux on POWER Toolchain
 

> On Apr 26, 2021, at 2:00 PM, acsaw...@linux.ibm.com wrote:
> 
> From: Aaron Sawdey 
> 
> This adds some test cases to make sure that the combine patterns for p10
> fusion are working.
> 
> OK for trunk?
> 
> gcc/testsuite/ChangeLog:
>   * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
>   * gcc.target/powerpc/fusion-p10-2logical.c: New file.
> ---
> .../gcc.target/powerpc/fusion-p10-2logical.c  | 205 ++
> .../gcc.target/powerpc/fusion-p10-ldcmpi.c|  66 ++
> 2 files changed, 271 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c 
> b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> new file mode 100644
> index 000..9a205373505
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> @@ -0,0 +1,205 @@
> +/* { dg-do compile { target { powerpc*-*-* } } } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } } */
> +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
> +
> +#include 
> +#include 
> +
> +/* and/andc/eqv/nand/nor/or/orc/xor */
> +#define AND(a,b) ((a)&(b))
> +#define ANDC1(a,b) ((a)&((~b)))
> +#define ANDC2(a,b) ((~(a))&(b))
> +#define EQV(a,b) (~((a)^(b)))
> +#define NAND(a,b) (~((a)&(b)))
> +#define NOR(a,b) (~((a)|(b)))
> +#define OR(a,b) ((a)|(b))
> +#define ORC1(a,b) ((a)|((~b)))
> +#define ORC2(a,b) ((~(a))|(b))
> +#define XOR(a,b) ((a)^(b))
> +#define TEST1(type, func)
> \
> +  type func ## _and_T_ ## type (type a, type b, type c) { return 
> AND(func(a,b),c); } \
> +  type func ## _andc1_T_   ## type (type a, type b, type c) { return 
> ANDC1(func(a,b),c); } \
> +  type func ## _andc2_T_   ## type (type a, type b, type c) { return 
> ANDC2(func(a,b),c); } \
> +  type func ## _eqv_T_ ## type (type a, type b, type c) { return 
> EQV(func(a,b),c); } \
> +  type func ## _nand_T_## type (type a, type b, type c) { return 
> NAND(func(a,b),c); } \
> +  type func ## _nor_T_ ## type (type a, type b, type c) { return 
> NOR(func(a,b),c); } \
> +  type func ## _or_T_  ## type (type a, type b, type c) { return 
> OR(func(a,b),c); } \
> +  type func ## _orc1_T_## type (type a, type b, type c) { return 
> ORC1(func(a,b),c); } \
> +  type func ## _orc2_T_## type (type a, type b, type c) { return 
> ORC2(func(a,b),c); } \
> +  type func ## _xor_T_ ## type (type a, type b, type c) { return 
> XOR(func(a,b),c); } \
> +  type func ## _rev_and_T_ ## type (type a, type b, type c) { return 
> AND(c,func(a,b)); } \
> +  type func ## _rev_andc1_T_   ## type (type a, type b, type c) { return 
> ANDC1(c,func(a,b)); } \
> +  type func ## _rev_andc2_T_   ## type (type a, type b, type c) { return 
> ANDC2(c,func(a,b)); } \
> +  type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return 
> EQV(c,func(a,b)); } \
> +  type func ## _rev_nand_T_## type (type a, type b, type c) { return 
> NAND(c,func(a,b)); } \
> +  type func ## _rev_nor_T_ ## type (type a, type b, type c) { return 
> NOR(c,func(a,b)); } \
> +  type func ## _rev_or_T_  ## type (type a, type b, type c) { return 
> OR(c,func(a,b)); } \
> +  type func ## _rev_orc1_T_## type (type a, type b, type c) { return 
> ORC1(c,func(a,b)); } \
> +  type func ## _rev_orc2_T_## type (type a, type b, type c) { return 
> ORC2(c,func(a,b)); } \
> +  type func ## _rev_xor_T_ ## type (type a, type b, type c) { return 
> XOR(c,func(a,b)); }
> +#define TEST(type)\
> +  TEST1(type,AND) \
> +  TEST1(type,ANDC1)   \
> +  TEST1(type,ANDC2)   \
> +  TEST1(type,EQV) \
> +  TEST1(type,NAND)\
> +  TEST1(type,NOR) \
> +  TEST1(type,OR)  \
> +  TEST1(type,ORC1)\
> +  TEST1(type,ORC2)\
> +  TEST1(type,XOR)
> +
> +typedef vector bool char vboolchar_t;
> +typedef vector unsigned int vuint_t;
> +
> +TEST(uint8_t);
> +TEST(int8_t);
> +TEST(uint16_t);
> +TEST(int16_t);
> +TEST(uint32_t);
> +TEST(int32_t);
> +TEST(uint64_t);
> +TEST(int64_t);
> +TEST(vboolchar_t);
> +TEST(vuint_t);
> +
> +/* Recreate with:
> +   grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' |sort -k 7,7 
> |uniq -c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times 
> \"%s\"%-*s%4d } } *%s/\n","","dg-final",$2,l,"",$1,"");}'
> + */
> +  
> +/* { dg-final { scan-assembler-times "fuse_and_and/1"
>   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_and_and/2"
>   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/0"   
>   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/1"   
>   26 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/2"   
>   48 } } */
> +/* { 

Re: [PATCH,rs6000] Test cases for p10 fusion patterns

2021-04-26 Thread will schmidt via Gcc-patches
On Mon, 2021-04-26 at 14:00 -0500, acsaw...@linux.ibm.com wrote:
> From: Aaron Sawdey 
> 
> This adds some test cases to make sure that the combine patterns for p10
> fusion are working.
> 
> OK for trunk?
> 
> gcc/testsuite/ChangeLog:
>   * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
>   * gcc.target/powerpc/fusion-p10-2logical.c: New file.
> ---
>  .../gcc.target/powerpc/fusion-p10-2logical.c  | 205 ++
>  .../gcc.target/powerpc/fusion-p10-ldcmpi.c|  66 ++
>  2 files changed, 271 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
>  create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c

ok


> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c 
> b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> new file mode 100644
> index 000..9a205373505
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> @@ -0,0 +1,205 @@
> +/* { dg-do compile { target { powerpc*-*-* } } } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } } */
> +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
> +
> +#include 
> +#include 
> +
> +/* and/andc/eqv/nand/nor/or/orc/xor */
> +#define AND(a,b) ((a)&(b))
> +#define ANDC1(a,b) ((a)&((~b)))
> +#define ANDC2(a,b) ((~(a))&(b))
> +#define EQV(a,b) (~((a)^(b)))
> +#define NAND(a,b) (~((a)&(b)))
> +#define NOR(a,b) (~((a)|(b)))
> +#define OR(a,b) ((a)|(b))
> +#define ORC1(a,b) ((a)|((~b)))
> +#define ORC2(a,b) ((~(a))|(b))
> +#define XOR(a,b) ((a)^(b))
> +#define TEST1(type, func)
> \
> +  type func ## _and_T_ ## type (type a, type b, type c) { return 
> AND(func(a,b),c); } \
> +  type func ## _andc1_T_   ## type (type a, type b, type c) { return 
> ANDC1(func(a,b),c); } \
> +  type func ## _andc2_T_   ## type (type a, type b, type c) { return 
> ANDC2(func(a,b),c); } \
> +  type func ## _eqv_T_ ## type (type a, type b, type c) { return 
> EQV(func(a,b),c); } \
> +  type func ## _nand_T_## type (type a, type b, type c) { return 
> NAND(func(a,b),c); } \
> +  type func ## _nor_T_ ## type (type a, type b, type c) { return 
> NOR(func(a,b),c); } \
> +  type func ## _or_T_  ## type (type a, type b, type c) { return 
> OR(func(a,b),c); } \
> +  type func ## _orc1_T_## type (type a, type b, type c) { return 
> ORC1(func(a,b),c); } \
> +  type func ## _orc2_T_## type (type a, type b, type c) { return 
> ORC2(func(a,b),c); } \
> +  type func ## _xor_T_ ## type (type a, type b, type c) { return 
> XOR(func(a,b),c); } \
> +  type func ## _rev_and_T_ ## type (type a, type b, type c) { return 
> AND(c,func(a,b)); } \
> +  type func ## _rev_andc1_T_   ## type (type a, type b, type c) { return 
> ANDC1(c,func(a,b)); } \
> +  type func ## _rev_andc2_T_   ## type (type a, type b, type c) { return 
> ANDC2(c,func(a,b)); } \
> +  type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return 
> EQV(c,func(a,b)); } \
> +  type func ## _rev_nand_T_## type (type a, type b, type c) { return 
> NAND(c,func(a,b)); } \
> +  type func ## _rev_nor_T_ ## type (type a, type b, type c) { return 
> NOR(c,func(a,b)); } \
> +  type func ## _rev_or_T_  ## type (type a, type b, type c) { return 
> OR(c,func(a,b)); } \
> +  type func ## _rev_orc1_T_## type (type a, type b, type c) { return 
> ORC1(c,func(a,b)); } \
> +  type func ## _rev_orc2_T_## type (type a, type b, type c) { return 
> ORC2(c,func(a,b)); } \
> +  type func ## _rev_xor_T_ ## type (type a, type b, type c) { return 
> XOR(c,func(a,b)); }
> +#define TEST(type)\
> +  TEST1(type,AND) \
> +  TEST1(type,ANDC1)   \
> +  TEST1(type,ANDC2)   \
> +  TEST1(type,EQV) \
> +  TEST1(type,NAND)\
> +  TEST1(type,NOR) \
> +  TEST1(type,OR)  \
> +  TEST1(type,ORC1)\
> +  TEST1(type,ORC2)\
> +  TEST1(type,XOR)
> +
> +typedef vector bool char vboolchar_t;
> +typedef vector unsigned int vuint_t;
> +
> +TEST(uint8_t);
> +TEST(int8_t);
> +TEST(uint16_t);
> +TEST(int16_t);
> +TEST(uint32_t);
> +TEST(int32_t);
> +TEST(uint64_t);
> +TEST(int64_t);
> +TEST(vboolchar_t);
> +TEST(vuint_t);

ok

> +
> +/* Recreate with:
> +   grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' |sort -k 7,7 
> |uniq -c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times 
> \"%s\"%-*s%4d } } *%s/\n","","dg-final",$2,l,"",$1,"");}'
> + */

nice, ok.


> +  
> +/* { dg-final { scan-assembler-times "fuse_and_and/1"
>   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_and_and/2"
>   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/0"   
>   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/1"   
>   26 } } */





> diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c 
> b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
> new file mode 

[PATCH,rs6000] Test cases for p10 fusion patterns

2021-04-26 Thread acsawdey--- via Gcc-patches
From: Aaron Sawdey 

This adds some test cases to make sure that the combine patterns for p10
fusion are working.

OK for trunk?

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
* gcc.target/powerpc/fusion-p10-2logical.c: New file.
---
 .../gcc.target/powerpc/fusion-p10-2logical.c  | 205 ++
 .../gcc.target/powerpc/fusion-p10-ldcmpi.c|  66 ++
 2 files changed, 271 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c

diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c 
b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
new file mode 100644
index 000..9a205373505
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
@@ -0,0 +1,205 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
+
+#include 
+#include 
+
+/* and/andc/eqv/nand/nor/or/orc/xor */
+#define AND(a,b) ((a)&(b))
+#define ANDC1(a,b) ((a)&((~b)))
+#define ANDC2(a,b) ((~(a))&(b))
+#define EQV(a,b) (~((a)^(b)))
+#define NAND(a,b) (~((a)&(b)))
+#define NOR(a,b) (~((a)|(b)))
+#define OR(a,b) ((a)|(b))
+#define ORC1(a,b) ((a)|((~b)))
+#define ORC2(a,b) ((~(a))|(b))
+#define XOR(a,b) ((a)^(b))
+#define TEST1(type, func)  
\
+  type func ## _and_T_ ## type (type a, type b, type c) { return 
AND(func(a,b),c); } \
+  type func ## _andc1_T_   ## type (type a, type b, type c) { return 
ANDC1(func(a,b),c); } \
+  type func ## _andc2_T_   ## type (type a, type b, type c) { return 
ANDC2(func(a,b),c); } \
+  type func ## _eqv_T_ ## type (type a, type b, type c) { return 
EQV(func(a,b),c); } \
+  type func ## _nand_T_## type (type a, type b, type c) { return 
NAND(func(a,b),c); } \
+  type func ## _nor_T_ ## type (type a, type b, type c) { return 
NOR(func(a,b),c); } \
+  type func ## _or_T_  ## type (type a, type b, type c) { return 
OR(func(a,b),c); } \
+  type func ## _orc1_T_## type (type a, type b, type c) { return 
ORC1(func(a,b),c); } \
+  type func ## _orc2_T_## type (type a, type b, type c) { return 
ORC2(func(a,b),c); } \
+  type func ## _xor_T_ ## type (type a, type b, type c) { return 
XOR(func(a,b),c); } \
+  type func ## _rev_and_T_ ## type (type a, type b, type c) { return 
AND(c,func(a,b)); } \
+  type func ## _rev_andc1_T_   ## type (type a, type b, type c) { return 
ANDC1(c,func(a,b)); } \
+  type func ## _rev_andc2_T_   ## type (type a, type b, type c) { return 
ANDC2(c,func(a,b)); } \
+  type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return 
EQV(c,func(a,b)); } \
+  type func ## _rev_nand_T_## type (type a, type b, type c) { return 
NAND(c,func(a,b)); } \
+  type func ## _rev_nor_T_ ## type (type a, type b, type c) { return 
NOR(c,func(a,b)); } \
+  type func ## _rev_or_T_  ## type (type a, type b, type c) { return 
OR(c,func(a,b)); } \
+  type func ## _rev_orc1_T_## type (type a, type b, type c) { return 
ORC1(c,func(a,b)); } \
+  type func ## _rev_orc2_T_## type (type a, type b, type c) { return 
ORC2(c,func(a,b)); } \
+  type func ## _rev_xor_T_ ## type (type a, type b, type c) { return 
XOR(c,func(a,b)); }
+#define TEST(type)\
+  TEST1(type,AND) \
+  TEST1(type,ANDC1)   \
+  TEST1(type,ANDC2)   \
+  TEST1(type,EQV) \
+  TEST1(type,NAND)\
+  TEST1(type,NOR) \
+  TEST1(type,OR)  \
+  TEST1(type,ORC1)\
+  TEST1(type,ORC2)\
+  TEST1(type,XOR)
+
+typedef vector bool char vboolchar_t;
+typedef vector unsigned int vuint_t;
+
+TEST(uint8_t);
+TEST(int8_t);
+TEST(uint16_t);
+TEST(int16_t);
+TEST(uint32_t);
+TEST(int32_t);
+TEST(uint64_t);
+TEST(int64_t);
+TEST(vboolchar_t);
+TEST(vuint_t);
+
+/* Recreate with:
+   grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' |sort -k 7,7 |uniq 
-c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times \"%s\"%-*s   
 %4d } } *%s/\n","","dg-final",$2,l,"",$1,"");}'
+ */
+  
+/* { dg-final { scan-assembler-times "fuse_and_and/1"  
16 } } */
+/* { dg-final { scan-assembler-times "fuse_and_and/2"  
16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/0" 
16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/1" 
26 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/2" 
48 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/3" 
 6 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_or/0"  
16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_or/1"  
16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_or/2"  
32 } } */
+/* { dg-final { 

Re: [PATCH,rs6000] Test cases for p10 fusion patterns

2021-01-18 Thread Aaron Sawdey via Gcc-patches
Ping.

Aaron Sawdey, Ph.D. saw...@linux.ibm.com
IBM Linux on POWER Toolchain
 

> On Jan 3, 2021, at 2:44 PM, Aaron Sawdey  wrote:
> 
> Ping.
> 
> Aaron Sawdey, Ph.D. saw...@linux.ibm.com
> IBM Linux on POWER Toolchain
> 
> 
>> On Dec 11, 2020, at 1:53 PM, acsaw...@linux.ibm.com wrote:
>> 
>> From: Aaron Sawdey 
>> 
>> This adds some test cases to make sure that the combine patterns for p10
>> fusion are working.
>> 
>> These test cases pass on power10. OK for trunk after the 2 previous patches
>> for the fusion patterns go in?
>> 
>> Thanks!
>>  Aaron
>> 
>> gcc/testsuite/ChangeLog:
>>  * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
>>  * gcc.target/powerpc/fusion-p10-2logical.c: New file.
>> ---
>> .../gcc.target/powerpc/fusion-p10-2logical.c  | 201 ++
>> .../gcc.target/powerpc/fusion-p10-ldcmpi.c|  66 ++
>> 2 files changed, 267 insertions(+)
>> create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
>> create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
>> 
>> diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c 
>> b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
>> new file mode 100644
>> index 000..cfe8f6c679a
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
>> @@ -0,0 +1,201 @@
>> +/* { dg-do compile { target { powerpc*-*-* } } } */
>> +/* { dg-skip-if "" { powerpc*-*-darwin* } } */
>> +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
>> +
>> +#include 
>> +#include 
>> +
>> +/* and/andc/eqv/nand/nor/or/orc/xor */
>> +#define AND(a,b) ((a)&(b))
>> +#define ANDC1(a,b) ((a)&((~b)))
>> +#define ANDC2(a,b) ((~(a))&(b))
>> +#define EQV(a,b) (~((a)^(b)))
>> +#define NAND(a,b) (~((a)&(b)))
>> +#define NOR(a,b) (~((a)|(b)))
>> +#define OR(a,b) ((a)|(b))
>> +#define ORC1(a,b) ((a)|((~b)))
>> +#define ORC2(a,b) ((~(a))|(b))
>> +#define XOR(a,b) ((a)^(b))
>> +#define TEST1(type, func)   
>> \
>> +  type func ## _and_T_ ## type (type a, type b, type c) { return 
>> AND(func(a,b),c); } \
>> +  type func ## _andc1_T_   ## type (type a, type b, type c) { return 
>> ANDC1(func(a,b),c); } \
>> +  type func ## _andc2_T_   ## type (type a, type b, type c) { return 
>> ANDC2(func(a,b),c); } \
>> +  type func ## _eqv_T_ ## type (type a, type b, type c) { return 
>> EQV(func(a,b),c); } \
>> +  type func ## _nand_T_## type (type a, type b, type c) { return 
>> NAND(func(a,b),c); } \
>> +  type func ## _nor_T_ ## type (type a, type b, type c) { return 
>> NOR(func(a,b),c); } \
>> +  type func ## _or_T_  ## type (type a, type b, type c) { return 
>> OR(func(a,b),c); } \
>> +  type func ## _orc1_T_## type (type a, type b, type c) { return 
>> ORC1(func(a,b),c); } \
>> +  type func ## _orc2_T_## type (type a, type b, type c) { return 
>> ORC2(func(a,b),c); } \
>> +  type func ## _xor_T_ ## type (type a, type b, type c) { return 
>> XOR(func(a,b),c); } \
>> +  type func ## _rev_and_T_ ## type (type a, type b, type c) { return 
>> AND(c,func(a,b)); } \
>> +  type func ## _rev_andc1_T_   ## type (type a, type b, type c) { return 
>> ANDC1(c,func(a,b)); } \
>> +  type func ## _rev_andc2_T_   ## type (type a, type b, type c) { return 
>> ANDC2(c,func(a,b)); } \
>> +  type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return 
>> EQV(c,func(a,b)); } \
>> +  type func ## _rev_nand_T_## type (type a, type b, type c) { return 
>> NAND(c,func(a,b)); } \
>> +  type func ## _rev_nor_T_ ## type (type a, type b, type c) { return 
>> NOR(c,func(a,b)); } \
>> +  type func ## _rev_or_T_  ## type (type a, type b, type c) { return 
>> OR(c,func(a,b)); } \
>> +  type func ## _rev_orc1_T_## type (type a, type b, type c) { return 
>> ORC1(c,func(a,b)); } \
>> +  type func ## _rev_orc2_T_## type (type a, type b, type c) { return 
>> ORC2(c,func(a,b)); } \
>> +  type func ## _rev_xor_T_ ## type (type a, type b, type c) { return 
>> XOR(c,func(a,b)); }
>> +#define TEST(type)\
>> +  TEST1(type,AND) \
>> +  TEST1(type,ANDC1)   \
>> +  TEST1(type,ANDC2)   \
>> +  TEST1(type,EQV) \
>> +  TEST1(type,NAND)\
>> +  TEST1(type,NOR) \
>> +  TEST1(type,OR)  \
>> +  TEST1(type,ORC1)\
>> +  TEST1(type,ORC2)\
>> +  TEST1(type,XOR)
>> +
>> +typedef vector bool char vboolchar_t;
>> +typedef vector unsigned int vuint_t;
>> +
>> +TEST(uint8_t);
>> +TEST(int8_t);
>> +TEST(uint16_t);
>> +TEST(int16_t);
>> +TEST(uint32_t);
>> +TEST(int32_t);
>> +TEST(uint64_t);
>> +TEST(int64_t);
>> +TEST(vboolchar_t);
>> +TEST(vuint_t);
>> +  
>> +/* { dg-final { scan-assembler-times "fuse_and_and/0"16 } } */
>> +/* { dg-final { scan-assembler-times "fuse_and_and/2"16 } } */
>> +/* { dg-final { scan-assembler-times "fuse_andc_and/0"   48 } } */
>> +/* { dg-final { scan-assembler-times "fuse_andc_and/1"   16 } } */
>> +/* { dg-final { scan-assembler-times "fuse_andc_and/2"   

Re: [PATCH,rs6000] Test cases for p10 fusion patterns

2021-01-03 Thread Aaron Sawdey via Gcc-patches
Ping.

Aaron Sawdey, Ph.D. saw...@linux.ibm.com
IBM Linux on POWER Toolchain
 

> On Dec 11, 2020, at 1:53 PM, acsaw...@linux.ibm.com wrote:
> 
> From: Aaron Sawdey 
> 
> This adds some test cases to make sure that the combine patterns for p10
> fusion are working.
> 
> These test cases pass on power10. OK for trunk after the 2 previous patches
> for the fusion patterns go in?
> 
> Thanks!
>   Aaron
> 
> gcc/testsuite/ChangeLog:
>   * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
>   * gcc.target/powerpc/fusion-p10-2logical.c: New file.
> ---
> .../gcc.target/powerpc/fusion-p10-2logical.c  | 201 ++
> .../gcc.target/powerpc/fusion-p10-ldcmpi.c|  66 ++
> 2 files changed, 267 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c 
> b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> new file mode 100644
> index 000..cfe8f6c679a
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
> @@ -0,0 +1,201 @@
> +/* { dg-do compile { target { powerpc*-*-* } } } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } } */
> +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
> +
> +#include 
> +#include 
> +
> +/* and/andc/eqv/nand/nor/or/orc/xor */
> +#define AND(a,b) ((a)&(b))
> +#define ANDC1(a,b) ((a)&((~b)))
> +#define ANDC2(a,b) ((~(a))&(b))
> +#define EQV(a,b) (~((a)^(b)))
> +#define NAND(a,b) (~((a)&(b)))
> +#define NOR(a,b) (~((a)|(b)))
> +#define OR(a,b) ((a)|(b))
> +#define ORC1(a,b) ((a)|((~b)))
> +#define ORC2(a,b) ((~(a))|(b))
> +#define XOR(a,b) ((a)^(b))
> +#define TEST1(type, func)
> \
> +  type func ## _and_T_ ## type (type a, type b, type c) { return 
> AND(func(a,b),c); } \
> +  type func ## _andc1_T_   ## type (type a, type b, type c) { return 
> ANDC1(func(a,b),c); } \
> +  type func ## _andc2_T_   ## type (type a, type b, type c) { return 
> ANDC2(func(a,b),c); } \
> +  type func ## _eqv_T_ ## type (type a, type b, type c) { return 
> EQV(func(a,b),c); } \
> +  type func ## _nand_T_## type (type a, type b, type c) { return 
> NAND(func(a,b),c); } \
> +  type func ## _nor_T_ ## type (type a, type b, type c) { return 
> NOR(func(a,b),c); } \
> +  type func ## _or_T_  ## type (type a, type b, type c) { return 
> OR(func(a,b),c); } \
> +  type func ## _orc1_T_## type (type a, type b, type c) { return 
> ORC1(func(a,b),c); } \
> +  type func ## _orc2_T_## type (type a, type b, type c) { return 
> ORC2(func(a,b),c); } \
> +  type func ## _xor_T_ ## type (type a, type b, type c) { return 
> XOR(func(a,b),c); } \
> +  type func ## _rev_and_T_ ## type (type a, type b, type c) { return 
> AND(c,func(a,b)); } \
> +  type func ## _rev_andc1_T_   ## type (type a, type b, type c) { return 
> ANDC1(c,func(a,b)); } \
> +  type func ## _rev_andc2_T_   ## type (type a, type b, type c) { return 
> ANDC2(c,func(a,b)); } \
> +  type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return 
> EQV(c,func(a,b)); } \
> +  type func ## _rev_nand_T_## type (type a, type b, type c) { return 
> NAND(c,func(a,b)); } \
> +  type func ## _rev_nor_T_ ## type (type a, type b, type c) { return 
> NOR(c,func(a,b)); } \
> +  type func ## _rev_or_T_  ## type (type a, type b, type c) { return 
> OR(c,func(a,b)); } \
> +  type func ## _rev_orc1_T_## type (type a, type b, type c) { return 
> ORC1(c,func(a,b)); } \
> +  type func ## _rev_orc2_T_## type (type a, type b, type c) { return 
> ORC2(c,func(a,b)); } \
> +  type func ## _rev_xor_T_ ## type (type a, type b, type c) { return 
> XOR(c,func(a,b)); }
> +#define TEST(type)\
> +  TEST1(type,AND) \
> +  TEST1(type,ANDC1)   \
> +  TEST1(type,ANDC2)   \
> +  TEST1(type,EQV) \
> +  TEST1(type,NAND)\
> +  TEST1(type,NOR) \
> +  TEST1(type,OR)  \
> +  TEST1(type,ORC1)\
> +  TEST1(type,ORC2)\
> +  TEST1(type,XOR)
> +
> +typedef vector bool char vboolchar_t;
> +typedef vector unsigned int vuint_t;
> +
> +TEST(uint8_t);
> +TEST(int8_t);
> +TEST(uint16_t);
> +TEST(int16_t);
> +TEST(uint32_t);
> +TEST(int32_t);
> +TEST(uint64_t);
> +TEST(int64_t);
> +TEST(vboolchar_t);
> +TEST(vuint_t);
> +  
> +/* { dg-final { scan-assembler-times "fuse_and_and/0"16 } } */
> +/* { dg-final { scan-assembler-times "fuse_and_and/2"16 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/0"   48 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/1"   16 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/2"   26 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_and/3"6 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_or/0"32 } } */
> +/* { dg-final { scan-assembler-times "fuse_andc_or/1"16 } } */
> +/* { dg-final { 

[PATCH,rs6000] Test cases for p10 fusion patterns

2020-12-11 Thread acsawdey--- via Gcc-patches
From: Aaron Sawdey 

This adds some test cases to make sure that the combine patterns for p10
fusion are working.

These test cases pass on power10. OK for trunk after the 2 previous patches
for the fusion patterns go in?

Thanks!
   Aaron

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
* gcc.target/powerpc/fusion-p10-2logical.c: New file.
---
 .../gcc.target/powerpc/fusion-p10-2logical.c  | 201 ++
 .../gcc.target/powerpc/fusion-p10-ldcmpi.c|  66 ++
 2 files changed, 267 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c

diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c 
b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
new file mode 100644
index 000..cfe8f6c679a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c
@@ -0,0 +1,201 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
+
+#include 
+#include 
+
+/* and/andc/eqv/nand/nor/or/orc/xor */
+#define AND(a,b) ((a)&(b))
+#define ANDC1(a,b) ((a)&((~b)))
+#define ANDC2(a,b) ((~(a))&(b))
+#define EQV(a,b) (~((a)^(b)))
+#define NAND(a,b) (~((a)&(b)))
+#define NOR(a,b) (~((a)|(b)))
+#define OR(a,b) ((a)|(b))
+#define ORC1(a,b) ((a)|((~b)))
+#define ORC2(a,b) ((~(a))|(b))
+#define XOR(a,b) ((a)^(b))
+#define TEST1(type, func)  
\
+  type func ## _and_T_ ## type (type a, type b, type c) { return 
AND(func(a,b),c); } \
+  type func ## _andc1_T_   ## type (type a, type b, type c) { return 
ANDC1(func(a,b),c); } \
+  type func ## _andc2_T_   ## type (type a, type b, type c) { return 
ANDC2(func(a,b),c); } \
+  type func ## _eqv_T_ ## type (type a, type b, type c) { return 
EQV(func(a,b),c); } \
+  type func ## _nand_T_## type (type a, type b, type c) { return 
NAND(func(a,b),c); } \
+  type func ## _nor_T_ ## type (type a, type b, type c) { return 
NOR(func(a,b),c); } \
+  type func ## _or_T_  ## type (type a, type b, type c) { return 
OR(func(a,b),c); } \
+  type func ## _orc1_T_## type (type a, type b, type c) { return 
ORC1(func(a,b),c); } \
+  type func ## _orc2_T_## type (type a, type b, type c) { return 
ORC2(func(a,b),c); } \
+  type func ## _xor_T_ ## type (type a, type b, type c) { return 
XOR(func(a,b),c); } \
+  type func ## _rev_and_T_ ## type (type a, type b, type c) { return 
AND(c,func(a,b)); } \
+  type func ## _rev_andc1_T_   ## type (type a, type b, type c) { return 
ANDC1(c,func(a,b)); } \
+  type func ## _rev_andc2_T_   ## type (type a, type b, type c) { return 
ANDC2(c,func(a,b)); } \
+  type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return 
EQV(c,func(a,b)); } \
+  type func ## _rev_nand_T_## type (type a, type b, type c) { return 
NAND(c,func(a,b)); } \
+  type func ## _rev_nor_T_ ## type (type a, type b, type c) { return 
NOR(c,func(a,b)); } \
+  type func ## _rev_or_T_  ## type (type a, type b, type c) { return 
OR(c,func(a,b)); } \
+  type func ## _rev_orc1_T_## type (type a, type b, type c) { return 
ORC1(c,func(a,b)); } \
+  type func ## _rev_orc2_T_## type (type a, type b, type c) { return 
ORC2(c,func(a,b)); } \
+  type func ## _rev_xor_T_ ## type (type a, type b, type c) { return 
XOR(c,func(a,b)); }
+#define TEST(type)\
+  TEST1(type,AND) \
+  TEST1(type,ANDC1)   \
+  TEST1(type,ANDC2)   \
+  TEST1(type,EQV) \
+  TEST1(type,NAND)\
+  TEST1(type,NOR) \
+  TEST1(type,OR)  \
+  TEST1(type,ORC1)\
+  TEST1(type,ORC2)\
+  TEST1(type,XOR)
+
+typedef vector bool char vboolchar_t;
+typedef vector unsigned int vuint_t;
+
+TEST(uint8_t);
+TEST(int8_t);
+TEST(uint16_t);
+TEST(int16_t);
+TEST(uint32_t);
+TEST(int32_t);
+TEST(uint64_t);
+TEST(int64_t);
+TEST(vboolchar_t);
+TEST(vuint_t);
+  
+/* { dg-final { scan-assembler-times "fuse_and_and/0"16 } } */
+/* { dg-final { scan-assembler-times "fuse_and_and/2"16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/0"   48 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/1"   16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/2"   26 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_and/3"6 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_or/0"32 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_or/1"16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_or/2"16 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_orc/0"   48 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_orc/1"8 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_orc/2"8 } } */
+/* { dg-final { scan-assembler-times "fuse_andc_xor/0"   32 } } */
+/* { dg-final { scan-assembler-times