1  /* Verify that overloaded built-ins for vec_orc and vec_nand with char
       2   * inputs produce the right results.  These intrinsics (vec_orc,
       3   * vec_nand) were added as part of ISA 2.07 (P8).  */
       4  
       5  /* { dg-do compile } */
       6  /* { dg-require-effective-target powerpc_p8vector_ok } */
       7  /* { dg-options "-mpower8-vector -O1" } */
       8  
       9  #include <altivec.h>
      10  
      11  vector signed char
      12  test1_orc (vector bool char x, vector signed char y)
      13  {
      14    vector signed char *foo;
      15    *foo += vec_orc (x, y);
      16    return *foo;
      17  }
      18  
      19  vector signed char
      20  test1_nand (vector bool char x, vector signed char y)
      21  {
      22    vector signed char *foo;
      23    *foo += vec_nand (x, y);
      24    return *foo;
      25  }
      26  
      27  vector signed char
      28  test2_orc (vector signed char x, vector bool char y)
      29  {
      30    vector signed char *foo;
      31    *foo += vec_orc (x, y);
      32    return *foo;
      33  }
      34  
      35  vector signed char
      36  test2_nand (vector signed char x, vector bool char y)
      37  {
      38    vector signed char *foo;
      39    *foo += vec_nand (x, y);
      40    return *foo;
      41  }
      42  
      43  vector signed char
      44  test3_orc (vector signed char x, vector signed char y)
      45  {
      46    vector signed char *foo;
      47    *foo += vec_orc (x, y);
      48    return *foo;
      49  }
      50  
      51  vector signed char
      52  test3_nand (vector signed char x, vector signed char y)
      53  {
      54    vector signed char *foo;
      55    *foo += vec_nand (x, y);
      56    return *foo;
      57  }
      58  
      59  vector unsigned char
      60  test4_orc (vector bool char x, vector unsigned char y)
      61  {
      62    vector unsigned char *foo;
      63    *foo += vec_orc (x, y);
      64    return *foo;
      65  }
      66  
      67  vector unsigned char
      68  test4_nand (vector bool char x, vector unsigned char y)
      69  {
      70    vector unsigned char *foo;
      71    *foo += vec_nand (x, y);
      72    return *foo;
      73  }
      74  
      75  vector unsigned char
      76  test5_orc (vector unsigned char x, vector bool char y)
      77  {
      78    vector unsigned char *foo;
      79    *foo += vec_orc (x, y);
      80    return *foo;
      81  }
      82  
      83  vector unsigned char
      84  test5_nand (vector unsigned char x, vector bool char y)
      85  {
      86    vector unsigned char *foo;
      87    *foo += vec_nand (x, y);
      88    return *foo;
      89  }
      90  
      91  vector unsigned char
      92  test6_orc (vector unsigned char x, vector unsigned char y)
      93  {
      94    vector unsigned char *foo;
      95    *foo += vec_orc (x, y);
      96    return *foo;
      97  }
      98  
      99  vector unsigned char
     100  test6_nand (vector unsigned char x, vector unsigned char y)
     101  {
     102    vector unsigned char *foo;
     103    *foo += vec_nand (x, y);
     104    return *foo;
     105  }
     106  
     107  /* { dg-final { scan-assembler-times {\mxxlnand\M} 3 } } */
     108  /* { dg-final { scan-assembler-times {\mxxlorc\M} 6 } } */