(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
fusion-p10-logadd.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */
       3  
       4  #include <altivec.h>
       5  #include <stdint.h>
       6  
       7  #define ADD(a,b) ((a)+(b))
       8  #define SUB1(a,b) ((a)-(b))
       9  #define SUB2(a,b) ((b)-(a))
      10  
      11  /* and/andc/eqv/nand/nor/or/orc/xor */
      12  #define AND(a,b) ((a)&(b))
      13  #define NAND(a,b) (~((a)&(b)))
      14  #define NOR(a,b) (~((a)|(b)))
      15  #define OR(a,b) ((a)|(b))
      16  #define TEST1(type, func)							\
      17    type func ## _add_T_     ## type (type a, type b, type c) { return ADD(func(a,b),c); } \
      18    type func ## _sub1_T_    ## type (type a, type b, type c) { return SUB1(func(a,b),c); } \
      19    type func ## _sub2_T_    ## type (type a, type b, type c) { return SUB2(func(a,b),c); } \
      20    type func ## _rev_add_T_     ## type (type a, type b, type c) { return ADD(c,func(a,b)); } \
      21    type func ## _rev_sub1_T_    ## type (type a, type b, type c) { return SUB1(c,func(a,b)); } \
      22    type func ## _rev_sub2_T_    ## type (type a, type b, type c) { return SUB2(c,func(a,b)); }
      23  #define TEST2(type, func)							\
      24    type func ## _and_T_     ## type (type a, type b, type c) { return  AND(func(a,b),c); } \
      25    type func ## _nand_T_    ## type (type a, type b, type c) { return NAND(func(a,b),c); } \
      26    type func ## _or_T_      ## type (type a, type b, type c) { return   OR(func(a,b),c); } \
      27    type func ## _nor_T_     ## type (type a, type b, type c) { return  NOR(func(a,b),c); } \
      28    type func ## _rev_and_T_     ## type (type a, type b, type c) { return  AND(c,func(a,b)); } \
      29    type func ## _rev_nand_T_    ## type (type a, type b, type c) { return NAND(c,func(a,b)); } \
      30    type func ## _rev_or_T_      ## type (type a, type b, type c) { return   OR(c,func(a,b)); } \
      31    type func ## _rev_nor_T_     ## type (type a, type b, type c) { return  NOR(c,func(a,b)); }
      32  #define TEST(type)    \
      33    TEST1(type,AND)     \
      34    TEST1(type,NAND)    \
      35    TEST1(type,NOR)     \
      36    TEST1(type,OR)      \
      37    TEST2(type,ADD)     \
      38    TEST2(type,SUB1)    \
      39    TEST2(type,SUB2)
      40  
      41  typedef vector bool char vboolchar_t;
      42  typedef vector unsigned int vuint_t;
      43  
      44  TEST(uint8_t);
      45  TEST(int8_t);
      46  TEST(uint16_t);
      47  TEST(int16_t);
      48  TEST(uint32_t);
      49  TEST(int32_t);
      50  TEST(uint64_t);
      51  TEST(int64_t);
      52  
      53  /* { dg-final { scan-assembler-times {\mfuse_add_and\M/}                           16 { target lp64 } } } */
      54  /* { dg-final { scan-assembler-times {\mfuse_add_nand\M/}                          16 { target lp64 } } } */
      55  /* { dg-final { scan-assembler-times {\mfuse_add_nor\M/}                           16 { target lp64 } } } */
      56  /* { dg-final { scan-assembler-times {\mfuse_add_or\M/}                            16 { target lp64 } } } */
      57  /* { dg-final { scan-assembler-times {\mfuse_and_add\M/}                           28 { target lp64 } } } */
      58  /* { dg-final { scan-assembler-times {\mfuse_and_rsubf\M/}                         16 { target lp64 } } } */
      59  /* { dg-final { scan-assembler-times {\mfuse_and_subf\M/}                          16 { target lp64 } } } */
      60  /* { dg-final { scan-assembler-times {\mfuse_nand_add\M/}                          16 { target lp64 } } } */
      61  /* { dg-final { scan-assembler-times {\mfuse_nand_rsubf\M/}                         4 { target lp64 } } } */
      62  /* { dg-final { scan-assembler-times {\mfuse_nand_subf\M/}                         16 { target lp64 } } } */
      63  /* { dg-final { scan-assembler-times {\mfuse_nor_add\M/}                           16 { target lp64 } } } */
      64  /* { dg-final { scan-assembler-times {\mfuse_nor_rsubf\M/}                          4 { target lp64 } } } */
      65  /* { dg-final { scan-assembler-times {\mfuse_nor_subf\M/}                          16 { target lp64 } } } */
      66  /* { dg-final { scan-assembler-times {\mfuse_or_add\M/}                            28 { target lp64 } } } */
      67  /* { dg-final { scan-assembler-times {\mfuse_or_rsubf\M/}                          16 { target lp64 } } } */
      68  /* { dg-final { scan-assembler-times {\mfuse_or_subf\M/}                           16 { target lp64 } } } */
      69  /* { dg-final { scan-assembler-times {\mfuse_subf_and\M/}                          32 { target lp64 } } } */
      70  /* { dg-final { scan-assembler-times {\mfuse_subf_nand\M/}                         32 { target lp64 } } } */
      71  /* { dg-final { scan-assembler-times {\mfuse_subf_nor\M/}                          32 { target lp64 } } } */
      72  /* { dg-final { scan-assembler-times {\mfuse_subf_or\M/}                           32 { target lp64 } } } */
      73  
      74  /* { dg-final { scan-assembler-times {\mfuse_add_and\M/}                           12 { target ilp32 } } } */
      75  /* { dg-final { scan-assembler-times {\mfuse_add_nand\M/}                          12 { target ilp32 } } } */
      76  /* { dg-final { scan-assembler-times {\mfuse_add_nor\M/}                           12 { target ilp32 } } } */
      77  /* { dg-final { scan-assembler-times {\mfuse_add_or\M/}                            12 { target ilp32 } } } */
      78  /* { dg-final { scan-assembler-times {\mfuse_and_add\M/}                           22 { target ilp32 } } } */
      79  /* { dg-final { scan-assembler-times {\mfuse_and_rsubf\M/}                         12 { target ilp32 } } } */
      80  /* { dg-final { scan-assembler-times {\mfuse_and_subf\M/}                          12 { target ilp32 } } } */
      81  /* { dg-final { scan-assembler-times {\mfuse_nand_add\M/}                          12 { target ilp32 } } } */
      82  /* { dg-final { scan-assembler-times {\mfuse_nand_rsubf\M/}                         2 { target ilp32 } } } */
      83  /* { dg-final { scan-assembler-times {\mfuse_nand_subf\M/}                         12 { target ilp32 } } } */
      84  /* { dg-final { scan-assembler-times {\mfuse_nor_add\M/}                           12 { target ilp32 } } } */
      85  /* { dg-final { scan-assembler-times {\mfuse_nor_rsubf\M/}                          2 { target ilp32 } } } */
      86  /* { dg-final { scan-assembler-times {\mfuse_nor_subf\M/}                          12 { target ilp32 } } } */
      87  /* { dg-final { scan-assembler-times {\mfuse_or_add\M/}                            22 { target ilp32 } } } */
      88  /* { dg-final { scan-assembler-times {\mfuse_or_rsubf\M/}                          12 { target ilp32 } } } */
      89  /* { dg-final { scan-assembler-times {\mfuse_or_subf\M/}                           12 { target ilp32 } } } */
      90  /* { dg-final { scan-assembler-times {\mfuse_subf_and\M/}                          24 { target ilp32 } } } */
      91  /* { dg-final { scan-assembler-times {\mfuse_subf_nand\M/}                         24 { target ilp32 } } } */
      92  /* { dg-final { scan-assembler-times {\mfuse_subf_nor\M/}                          24 { target ilp32 } } } */
      93  /* { dg-final { scan-assembler-times {\mfuse_subf_or\M/}                           24 { target ilp32 } } } */