(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
builtins-3-p8.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target powerpc_p8vector_ok } */
       3  /* { dg-options "-maltivec -mdejagnu-cpu=power8" } */
       4  
       5  #include <altivec.h>
       6  
       7  vector bool long long
       8  test_eq_long_long (vector bool long long x, vector bool long long y)
       9  {
      10  	return vec_cmpeq (x, y);
      11  }
      12  
      13  vector unsigned char
      14  test_vsi_packs_vusi_vusi (vector unsigned short x,
      15                            vector unsigned short y)
      16  {
      17    return vec_packs (x, y);
      18  }
      19  
      20  vector signed char
      21  test_vsi_packs_vssi_vssi (vector signed short x,
      22                            vector signed short y)
      23  {
      24    return vec_packs (x, y);
      25  }
      26  
      27  vector signed short int
      28  test_vsi_packs_vsi_vsi (vector signed int x,
      29  			vector signed int y)
      30  {
      31    return vec_packs (x, y);
      32  }
      33  
      34  vector unsigned short int
      35  test_vsi_packs_vui_vui (vector unsigned int x,
      36  			vector unsigned int y)
      37  {
      38    return vec_packs (x, y);
      39  }
      40  
      41  vector signed int
      42  test_vsi_packs_vsll_vsll (vector signed long long x,
      43                            vector signed long long y)
      44  {
      45    return vec_packs (x, y);
      46  }
      47  
      48  vector unsigned int
      49  test_vui_packs_vull_vull (vector unsigned long long x,
      50                            vector unsigned long long y)
      51  {
      52    return vec_packs (x, y);
      53  }
      54  
      55  vector unsigned char
      56  test_vsi_packsu_vssi_vssi (vector signed short x,
      57  			   vector signed short y)
      58  {
      59    return vec_packsu (x, y);
      60  }
      61  
      62  vector unsigned char
      63  test_vsi_packsu_vusi_vusi (vector unsigned short x,
      64  			   vector unsigned short y)
      65  {
      66    return vec_packsu (x, y);
      67  }
      68  
      69  vector unsigned int
      70  test_vsi_packsu_vsll_vsll (vector signed long long x,
      71  			   vector signed long long y)
      72  {
      73    return vec_packsu (x, y);
      74  }
      75  
      76  vector unsigned int
      77  test_vsi_packsu_vull_vull (vector unsigned long long x,
      78  			   vector unsigned long long y)
      79  {
      80    return vec_packsu (x, y);
      81  }
      82  
      83  vector unsigned short int
      84  test_vsi_packsu_vsi_vsi (vector signed int x,
      85  			 vector signed int y)
      86  {
      87    return vec_packsu (x, y);
      88  }
      89  
      90  vector unsigned short int
      91  test_vsi_packsu_vui_vui (vector unsigned int x,
      92  			 vector unsigned int y)
      93  {
      94    return vec_packsu (x, y);
      95  }
      96  
      97  vector unsigned char
      98  test_unsigned_char_popcnt_signed_char (vector signed char x)
      99  {
     100  	return vec_popcnt (x);
     101  }
     102  
     103  vector unsigned char
     104  test_unsigned_char_popcnt_unsigned_char (vector unsigned char x)
     105  {
     106  	return vec_popcnt (x);
     107  }
     108  
     109  vector unsigned short
     110  test_unsigned_short_popcnt_signed_short (vector short x)
     111  {
     112  	return vec_popcnt (x);
     113  }
     114  
     115  vector unsigned short
     116  test_unsigned_short_popcnt_unsigned_short (vector unsigned short x)
     117  {
     118  	return vec_popcnt (x);
     119  }
     120  
     121  vector unsigned int
     122  test_unsigned_int_popcnt_signed_int (vector int x)
     123  {
     124  	return vec_popcnt (x);
     125  }
     126  
     127  vector unsigned int
     128  test_unsigned_int_popcnt_unsigned_int (vector unsigned x)
     129  {
     130     return vec_popcnt (x);
     131  }
     132  
     133  vector unsigned long long
     134  test_unsigned_long_lont_popcnt_signed_long (vector long long x)
     135  {
     136  	return vec_popcnt (x);
     137  }
     138  
     139  vector unsigned long long
     140  test_unsigned_long_long_popcnt_unsigned_long (vector unsigned long long x)
     141  {
     142  	return vec_popcnt (x);
     143  }
     144  
     145  vector signed short
     146  test_vss_mradds_vss_vss (vector signed short x, vector signed short y,
     147                           vector signed short z)
     148  {
     149  	return vec_mradds (x, y, z);
     150  }
     151  
     152  vector signed long long
     153  test_vsll_mule_vsi_vsi (vector signed int x, vector signed int y)
     154  {
     155  	return vec_mule (x, y);
     156  }
     157  
     158  vector unsigned long long
     159  test_vull_mule_vui_vui (vector unsigned int x, vector unsigned int y)
     160  {
     161  	return vec_mule (x, y);
     162  }
     163  
     164  vector signed long long
     165  test_vsll_mulo_vsi_vsi (vector signed int x, vector signed int y)
     166  {
     167  	return vec_mulo (x, y);
     168  }
     169  
     170  vector unsigned long long
     171  test_vull_mulo_vui_vui (vector unsigned int x, vector unsigned int y)
     172  {
     173  	return vec_mulo (x, y);
     174  }
     175  
     176  vector signed char
     177  test_neg_char (vector signed char x)
     178  {
     179  	return vec_neg (x);
     180  }
     181  
     182  vector short
     183  test_neg_short (vector short x)
     184  {
     185  	return vec_neg (x);
     186  }
     187  
     188  vector int
     189  test_neg_int (vector int x)
     190  {
     191  	return vec_neg (x);
     192  }
     193  
     194  vector float
     195  test_neg_float (vector float x)
     196  {
     197  	return vec_neg (x);
     198  }
     199  
     200  vector double
     201  test_neg_double (vector double x)
     202  {
     203  	return vec_neg (x);
     204  }
     205  
     206  
     207  /* Expected test results:
     208  
     209       test_eq_long_long                         1 vcmpequd inst
     210       test_vsi_packs_vsll_vsll                  1 vpksdss
     211       test_vui_packs_vull_vull                  1 vpkudus
     212       test_vui_packs_vssi_vssi                  1 vpkshss
     213       test_vsi_packsu_vssi_vssi                 1 vpkshus
     214       test_vsi_packsu_vsll_vsll                 1 vpksdus
     215       test_vsi_packsu_vull_vull                 1 vpkudus
     216       test_unsigned_char_popcnt_signed_char     1 vpopcntb
     217       test_unsigned_char_popcnt_unsigned_char   1 vpopcntb
     218       test_unsigned_short_popcnt_signed_short   1 vpopcnth
     219       test_unsigned_short_popcnt_unsigned_short 1 vpopcnth
     220       test_unsigned_int_popcnt_signed_int       2 vpopcntw
     221       test_unsigned_int_popcnt_unsigned_int     1 vpopcntd
     222       test_unsigned_long_long_popcnt_unsigned_long 1 vpopcntd
     223       test_vss_mradds_vss_vsss                  1 vmhraddshs
     224       test_vsll_mulo_vsi_vsi                    1 vmulosw
     225       test_vull_mulo_vui_vui                    1 vmulouw
     226       test_vsll_mule_vsi_vsi                    1 vmulesw
     227       test_vull_mule_vui_vui                    1 vmuleuw
     228       test_neg_char                             1 vspltisw, 1 vsububm
     229       test_neg_short                            1 vspltisw, 1 vsubuhm
     230       test_neg_int                              1 vspltisw, 1 vsubuwm
     231       test_neg_float                            1 xvnegsp
     232       test_neg_float                            1 xvnegdp
     233   */
     234  
     235  /* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
     236  /* { dg-final { scan-assembler-times "vpksdss"  1 } } */
     237  /* { dg-final { scan-assembler-times "vpkudus"  2 } } */  
     238  /* { dg-final { scan-assembler-times "vpkuhus"  2 } } */
     239  /* { dg-final { scan-assembler-times "vpkshss"  1 } } */  
     240  /* { dg-final { scan-assembler-times "vpkshus"  1 } } */  
     241  /* { dg-final { scan-assembler-times "vpksdus"  1 } } */  
     242  /* { dg-final { scan-assembler-times "vpkuwus"  2 } } */  
     243  /* { dg-final { scan-assembler-times "vpopcntb" 2 } } */
     244  /* { dg-final { scan-assembler-times "vpopcnth" 2 } } */
     245  /* { dg-final { scan-assembler-times "vpopcntw" 2 } } */
     246  /* { dg-final { scan-assembler-times "vpopcntd" 2 } } */
     247  /* { dg-final { scan-assembler-times "vmhraddshs"  1 } } */
     248  /* { dg-final { scan-assembler-times "vmulosw"  1 } } */
     249  /* { dg-final { scan-assembler-times "vmulouw"  1 } } */
     250  /* { dg-final { scan-assembler-times "vmulesw"  1 } } */
     251  /* { dg-final { scan-assembler-times "vmuleuw"  1 } } */
     252  /* { dg-final { scan-assembler-times "vspltisw" 3 } } */
     253  /* { dg-final { scan-assembler-times "vsububm"  1 } } */
     254  /* { dg-final { scan-assembler-times "vsubuhm"  1 } } */
     255  /* { dg-final { scan-assembler-times "vsubuwm"  1 } } */
     256  /* { dg-final { scan-assembler-times "xvnegsp"  1 } } */
     257  /* { dg-final { scan-assembler-times "xvnegdp"  1 } } */
     258