(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
builtins-3.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target powerpc_altivec_ok } */
       3  /* { dg-options "-maltivec" } */
       4  
       5  #include <altivec.h>
       6  
       7  vector bool char
       8  test_eq_char (vector bool char x, vector bool char y)
       9  {
      10  	return vec_cmpeq (x, y);
      11  }
      12  
      13  vector bool short
      14  test_eq_short (vector bool short x, vector bool short y)
      15  {
      16  	return vec_cmpeq (x, y);
      17  }
      18  
      19  vector bool int
      20  test_eq_int (vector bool int x, vector bool int y)
      21  {
      22  	return vec_cmpeq (x, y);
      23  }
      24  
      25  vector signed char
      26  test_nabs_char (vector signed char x)
      27  {
      28  	return vec_nabs (x);
      29  }
      30  
      31  vector short
      32  test_nabs_short (vector short x)
      33  {
      34    return vec_nabs (x);
      35  }
      36  
      37  vector int
      38  test_nabs_int (vector int x)
      39  {
      40    return vec_nabs (x);
      41  }
      42  
      43  vector signed char
      44  test_sll_vsc_vsc_vsuc (vector signed char x, vector unsigned char y)
      45  {
      46  	return vec_sll (x, y);
      47  }
      48  
      49  vector unsigned char
      50  test_sll_vuc_vuc_vuc (vector unsigned char x, vector unsigned char y)
      51  {
      52  	return vec_sll (x, y);
      53  }
      54  
      55  vector signed int
      56  test_sll_vsi_vsi_vuc (vector signed int x, vector unsigned char y)
      57  {
      58  	return vec_sll (x, y);
      59  }
      60  
      61  vector unsigned int
      62  test_sll_vui_vui_vuc (vector unsigned int x, vector unsigned char y)
      63  {
      64  	return vec_sll (x, y);
      65  }
      66  
      67  vector pixel
      68  test_sll_vp_vp_vuc (vector pixel x, vector unsigned char y)
      69  {
      70  	return vec_sll (x, y);
      71  }
      72  
      73  vector signed short int
      74  test_sll_vssi_vssi_vuc (vector signed short x, vector unsigned char y)
      75  {
      76  	return vec_sll (x, y);
      77  }
      78  
      79  vector unsigned short int
      80  test_sll_vusi_vusi_vuc (vector unsigned short x, vector unsigned char y)
      81  {
      82  	return vec_sll (x, y);
      83  }
      84  
      85  vector signed char
      86  test_slo_vsc_vsc_vsc (vector signed char x, vector signed char y)
      87  {
      88  	return vec_slo (x, y);
      89  }
      90  
      91  vector signed char
      92  test_slo_vsc_vsc_vuc (vector signed char x, vector unsigned char y)
      93  {
      94  	return vec_slo (x, y);
      95  }
      96  
      97  vector unsigned char
      98  test_slo_vuc_vuc_vsc (vector unsigned char x, vector signed char y)
      99  {
     100  	return vec_slo (x, y);
     101  }
     102  
     103  vector unsigned char
     104  test_slo_vuc_vuc_vuc (vector unsigned char x, vector unsigned char y)
     105  {
     106  	return vec_slo (x, y);
     107  }
     108  
     109  vector signed int
     110  test_slo_vsi_vsi_vsc (vector signed int x, vector signed char y)
     111  {
     112  	return vec_slo (x, y);
     113  }
     114  
     115  vector signed int
     116  test_slo_vsi_vsi_vuc (vector signed int x, vector unsigned char y)
     117  {
     118  	return vec_slo (x, y);
     119  }
     120  
     121  vector unsigned int
     122  test_slo_vui_vui_vsc (vector unsigned int x, vector signed char y)
     123  {
     124  	return vec_slo (x, y);
     125  }
     126  
     127  vector unsigned int
     128  test_slo_vui_vui_vuc (vector unsigned int x, vector unsigned char y)
     129  {
     130  	return vec_slo (x, y);
     131  }
     132  
     133  
     134  vector pixel
     135  test_slo_vp_vp_vsc (vector pixel int x, vector signed char y)
     136  {
     137  	return vec_slo (x, y);
     138  }
     139  
     140  vector pixel
     141  test_slo_vp_vp_vuc (vector pixel int x, vector unsigned char y)
     142  {
     143  	return vec_slo (x, y);
     144  }
     145  
     146  vector signed short int
     147  test_slo_vssi_vssi_vsc (vector signed short int x, vector signed char y)
     148  {
     149  	return vec_slo (x, y);
     150  }
     151  
     152  vector signed short int
     153  test_slo_vssi_vssi_vuc (vector signed short int x, vector unsigned char y)
     154  {
     155  	return vec_slo (x, y);
     156  }
     157  
     158  vector unsigned short int
     159  test_slo_vusi_vusi_vsc (vector unsigned short int x, vector signed char y)
     160  {
     161  	return vec_slo (x, y);
     162  }
     163  
     164  vector unsigned short int
     165  test_slo_vusi_vusi_vuc (vector unsigned short int x, vector unsigned char y)
     166  {
     167  	return vec_slo (x, y);
     168  }
     169  
     170  vector float
     171  test_slo_vf_vf_vsc (vector float x, vector signed char y)
     172  {
     173  	return vec_slo (x, y);
     174  }
     175  
     176  vector float
     177  test_slo_vf_vf_vuc (vector float x, vector unsigned char y)
     178  {
     179  	return vec_slo (x, y);
     180  }
     181  
     182  vector int
     183  test_cmpb_float (vector float x, vector float y)
     184  {
     185  	return vec_cmpb (x, y);
     186  }
     187  
     188  /* Expected test results:
     189  
     190       test_eq_char              1 vcmpequb inst
     191       test_eq_short             1 vcmpequh inst
     192       test_eq_int               1 vcmpequw inst
     193       test_nabs_char            1 vsububm, 1 vminsb
     194       test_nabs_short           1 vsubuhm, 1 vminsh
     195       test_nabs_int             1 vsubuwm, 1 vminsw
     196       test_sll_vsc_vsc_vsuc     1 vsl
     197       test_sll_vuc_vuc_vuc      1 vsl
     198       test_sll_vsi_vsi_vuc      1 vsl
     199       test_sll_vui_vui_vuc      1 vsl
     200       test_sll_vp_vp_vuc        1 vsl
     201       test_sll_vssi_vssi_vuc    1 vsl
     202       test_sll_vusi_vusi_vuc    1 vsl
     203       test_slo_vsc_vsc_vsc      1 vslo
     204       test_slo_vsc_vsc_vuc      1 vslo
     205       test_slo_vuc_vuc_vsc      1 vslo
     206       test_slo_vuc_vuc_vuc      1 vslo
     207       test_slo_vsi_vsi_vsc      1 vslo
     208       test_slo_vsi_vsi_vuc      1 vslo
     209       test_slo_vui_vui_vsc      1 vslo
     210       test_slo_vui_vui_vuc      1 vslo
     211       test_slo_vp_vp_vsc        1 vslo
     212       test_slo_vp_vp_vuc        1 vslo
     213       test_slo_vssi_vssi_vsc    1 vslo
     214       test_slo_vssi_vssi_vuc    1 vslo
     215       test_slo_vusi_vusi_vsc    1 vslo
     216       test_slo_vusi_vusi_vuc    1 vslo
     217       test_slo_vf_vf_vsc        1 vslo
     218       test_slo_vf_vf_vuc        1 vslo
     219       test_cmpb_float           1 vcmpbfp */
     220  
     221  /* { dg-final { scan-assembler-times "vcmpequb" 1 } } */
     222  /* { dg-final { scan-assembler-times "vcmpequh" 1 } } */
     223  /* { dg-final { scan-assembler-times "vcmpequw" 1 } } */
     224  /* { dg-final { scan-assembler-times "vsububm"  1 } } */
     225  /* { dg-final { scan-assembler-times "vsubuhm"  1 } } */
     226  /* { dg-final { scan-assembler-times "vsubuwm"  1 } } */
     227  /* { dg-final { scan-assembler-times "vminsb"   1 } } */
     228  /* { dg-final { scan-assembler-times "vminsh"   1 } } */
     229  /* { dg-final { scan-assembler-times "vminsw"   1 } } */
     230  /* { dg-final { scan-assembler-times "vslo"    16 } } */
     231  /* { dg-final { scan-assembler-times "vcmpbfp"  1 } } */
     232  /* { dg-final { scan-assembler-times "vsl"     23 } } */