1  /* Test the ACLE data intrinsics.  */
       2  /* { dg-do assemble } */
       3  /* { dg-additional-options "--save-temps -O1" } */
       4  /* { dg-final { check-function-bodies "**" "" "" } } */
       5  
       6  #include "arm_acle.h"
       7  
       8  /*
       9  ** test_clz:
      10  **	clz	w0, w0
      11  **	ret
      12  */
      13  
      14  unsigned int test_clz (uint32_t a)
      15  {
      16    return __clz (a);
      17  }
      18  
      19  /*
      20  ** test_clzl:
      21  **	clz	[wx]0, [wx]0
      22  **	ret
      23  */
      24  
      25  unsigned int test_clzl (unsigned long a)
      26  {
      27    return __clzl (a);
      28  }
      29  
      30  /*
      31  ** test_clzll:
      32  **	clz	x0, x0
      33  **	ret
      34  */
      35  
      36  unsigned int test_clzll (uint64_t a)
      37  {
      38    return __clzll (a);
      39  }
      40  
      41  /*
      42  ** test_cls:
      43  **	cls	w0, w0
      44  **	ret
      45  */
      46  
      47  unsigned int test_cls (uint32_t a)
      48  {
      49    return __cls (a);
      50  }
      51  
      52  /*
      53  ** test_clsl:
      54  **	cls	[wx]0, [wx]0
      55  **	ret
      56  */
      57  
      58  unsigned int test_clsl (unsigned long a)
      59  {
      60    return __clsl (a);
      61  }
      62  
      63  /*
      64  ** test_clsll:
      65  **	cls	x0, x0
      66  **	ret
      67  */
      68  
      69  unsigned int test_clsll (uint64_t a)
      70  {
      71    return __clsll (a);
      72  }
      73  
      74  /*
      75  ** test_rbit:
      76  **	rbit	w0, w0
      77  **	ret
      78  */
      79  
      80  uint32_t test_rbit (uint32_t a)
      81  {
      82    return __rbit (a);
      83  }
      84  
      85  /*
      86  ** test_rbitl:
      87  **	rbit	[wx]0, [wx]0
      88  **	ret
      89  */
      90  
      91  unsigned long test_rbitl (unsigned long a)
      92  {
      93    return __rbitl (a);
      94  }
      95  
      96  /*
      97  ** test_rbitll:
      98  **	rbit	x0, x0
      99  **	ret
     100  */
     101  
     102  uint64_t test_rbitll (uint64_t a)
     103  {
     104    return __rbitll (a);
     105  }
     106  
     107  /*
     108  ** test_rev:
     109  **	rev	w0, w0
     110  **	ret
     111  */
     112  
     113  uint32_t test_rev (uint32_t a)
     114  {
     115    return __rev (a);
     116  }
     117  
     118  /*
     119  ** test_revl:
     120  **	rev	[wx]0, [wx]0
     121  **	ret
     122  */
     123  
     124  unsigned long test_revl (unsigned long a)
     125  {
     126    return __revl (a);
     127  }
     128  
     129  /*
     130  ** test_revll:
     131  **	rev	x0, x0
     132  **	ret
     133  */
     134  
     135  uint64_t test_revll (uint64_t a)
     136  {
     137    return __revll (a);
     138  }
     139  
     140  /*
     141  ** test_rev16:
     142  **	rev16	w0, w0
     143  **	ret
     144  */
     145  
     146  uint32_t test_rev16 (uint32_t a)
     147  {
     148    return __rev16 (a);
     149  }
     150  
     151  /*
     152  ** test_rev16l:
     153  **	rev16	[wx]0, [wx]0
     154  **	ret
     155  */
     156  
     157  unsigned long test_rev16l (unsigned long a)
     158  {
     159    return __rev16l (a);
     160  }
     161  
     162  /*
     163  ** test_rev16ll:
     164  **	rev16	x0, x0
     165  **	ret
     166  */
     167  
     168  uint64_t test_rev16ll (uint64_t a)
     169  {
     170    return __rev16ll (a);
     171  }
     172  
     173  /*
     174  ** test_ror:
     175  **	ror	w0, w0, w1
     176  **	ret
     177  */
     178  
     179  uint32_t test_ror (uint32_t a, uint32_t r)
     180  {
     181    return __ror (a, r);
     182  }
     183  
     184  /*
     185  ** test_rorl:
     186  **	ror	[wx]0, [wx]0, [wx]1
     187  **	ret
     188  */
     189  
     190  unsigned long test_rorl (unsigned long a, uint32_t r)
     191  {
     192    return __rorl (a, r);
     193  }
     194  
     195  /*
     196  ** test_rorll:
     197  **	ror	x0, x0, x1
     198  **	ret
     199  */
     200  
     201  uint64_t test_rorll (uint64_t a, uint32_t r)
     202  {
     203    return __rorll (a, r);
     204  }
     205  
     206  /*
     207  ** test_revsh:
     208  **	rev16	w0, w0
     209  **	ret
     210  */
     211  
     212  int16_t test_revsh (int16_t a)
     213  {
     214    return __revsh (a);
     215  }
     216  
     217  uint32_t *g32;
     218  unsigned long *gul;
     219  uint64_t *g64;
     220  unsigned int *gui;
     221  int16_t *g16;
     222  
     223  /*
     224  ** test_clz_mem:
     225  **	...
     226  **	clz	w[0-9]+, w[0-9]+
     227  **	...
     228  **	ret
     229  */
     230  
     231  void test_clz_mem (uint32_t *a)
     232  {
     233    *gui = __clz (*a);
     234  }
     235  
     236  /*
     237  ** test_clzl_mem:
     238  **	...
     239  **	clz	[wx][0-9]+, [wx][0-9]+
     240  **	...
     241  **	ret
     242  */
     243  
     244  void test_clzl_mem (unsigned long *a)
     245  {
     246    *gui = __clzl (*a);
     247  }
     248  
     249  /*
     250  ** test_clzll_mem:
     251  **	...
     252  **	clz	x[0-9]+, x[0-9]+
     253  **	...
     254  **	ret
     255  */
     256  
     257  void test_clzll_mem (uint64_t *a)
     258  {
     259    *gui = __clzll (*a);
     260  }
     261  
     262  /*
     263  ** test_cls_mem:
     264  **	...
     265  **	cls	w[0-9]+, w[0-9]+
     266  **	...
     267  **	ret
     268  */
     269  
     270  void test_cls_mem (uint32_t *a)
     271  {
     272    *gui = __cls (*a);
     273  }
     274  
     275  /*
     276  ** test_clsl_mem:
     277  **	...
     278  **	cls	[wx][0-9]+, [wx][0-9]+
     279  **	...
     280  **	ret
     281  */
     282  
     283  void test_clsl_mem (unsigned long *a)
     284  {
     285    *gui = __clsl (*a);
     286  }
     287  
     288  /*
     289  ** test_clsll_mem:
     290  **	...
     291  **	cls	x[0-9]+, x[0-9]+
     292  **	...
     293  **	ret
     294  */
     295  
     296  void test_clsll_mem (uint64_t *a)
     297  {
     298    *gui = __clsll (*a);
     299  }
     300  
     301  /*
     302  ** test_rbit_mem:
     303  **	...
     304  **	rbit	w[0-9]+, w[0-9]+
     305  **	...
     306  **	ret
     307  */
     308  
     309  void test_rbit_mem (uint32_t *a)
     310  {
     311    *g32 = __rbit (*a);
     312  }
     313  
     314  /*
     315  ** test_rbitl_mem:
     316  **	...
     317  **	rbit	[wx][0-9]+, [wx][0-9]+
     318  **	...
     319  **	ret
     320  */
     321  
     322  void test_rbitl_mem (unsigned long *a)
     323  {
     324    *gul = __rbitl (*a);
     325  }
     326  
     327  /*
     328  ** test_rbitll_mem:
     329  **	...
     330  **	rbit	x[0-9]+, x[0-9]+
     331  **	...
     332  **	ret
     333  */
     334  
     335  void test_rbitll_mem (uint64_t *a)
     336  {
     337    *g64 = __rbitll (*a);
     338  }
     339  
     340  /*
     341  ** test_rev_mem:
     342  **	...
     343  **	rev	w[0-9]+, w[0-9]+
     344  **	...
     345  **	ret
     346  */
     347  
     348  void test_rev_mem (uint32_t *a)
     349  {
     350    *g32 = __rev (*a);
     351  }
     352  
     353  /*
     354  ** test_revl_mem:
     355  **	...
     356  **	rev	[wx][0-9]+, [wx][0-9]+
     357  **	...
     358  **	ret
     359  */
     360  
     361  void test_revl_mem (unsigned long *a)
     362  {
     363    *gul = __revl (*a);
     364  }
     365  
     366  /*
     367  ** test_revll_mem:
     368  **	...
     369  **	rev	x[0-9]+, x[0-9]+
     370  **	...
     371  **	ret
     372  */
     373  
     374  void test_revll_mem (uint64_t *a)
     375  {
     376    *g64 = __revll (*a);
     377  }
     378  
     379  /*
     380  ** test_rev16_mem:
     381  **	...
     382  **	rev16	w[0-9]+, w[0-9]+
     383  **	...
     384  **	ret
     385  */
     386  
     387  void test_rev16_mem (uint32_t *a)
     388  {
     389    *g32 = __rev16 (*a);
     390  }
     391  
     392  /*
     393  ** test_rev16l_mem:
     394  **	...
     395  **	rev16	[wx][0-9]+, [wx][0-9]+
     396  **	...
     397  **	ret
     398  */
     399  
     400  void test_rev16l_mem (unsigned long *a)
     401  {
     402    *gul = __rev16l (*a);
     403  }
     404  
     405  /*
     406  ** test_rev16ll_mem:
     407  **	...
     408  **	rev16	x[0-9]+, x[0-9]+
     409  **	...
     410  **	ret
     411  */
     412  
     413  void test_rev16ll_mem (uint64_t *a)
     414  {
     415    *g64 = __rev16ll (*a);
     416  }
     417  
     418  /*
     419  ** test_ror_mem:
     420  **	...
     421  **	ror	w[0-9]+, w[0-9]+, w[0-9]+
     422  **	...
     423  **	ret
     424  */
     425  
     426  void test_ror_mem (uint32_t *a, uint32_t *r)
     427  {
     428    *g32 = __ror (*a, *r);
     429  }
     430  
     431  /*
     432  ** test_rorl_mem:
     433  **	...
     434  **	ror	[wx][0-9]+, [wx][0-9]+, [wx][0-9]+
     435  **	...
     436  **	ret
     437  */
     438  
     439  void test_rorl_mem (unsigned long *a, uint32_t *r)
     440  {
     441    *gul = __rorl (*a, *r);
     442  }
     443  
     444  /*
     445  ** test_rorll_mem:
     446  **	...
     447  **	ror	x[0-9]+, x[0-9]+, x[0-9]+
     448  **	...
     449  **	ret
     450  */
     451  
     452  void test_rorll_mem (uint64_t *a, uint32_t *r)
     453  {
     454    *g64 = __rorll (*a, *r);
     455  }
     456  
     457  /*
     458  ** test_revsh_mem:
     459  **	...
     460  **	rev16	w[0-9]+, w[0-9]+
     461  **	...
     462  **	ret
     463  */
     464  
     465  void test_revsh_mem (int16_t *a)
     466  {
     467    *g16 = __revsh (*a);
     468  }