(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
vmlsq_laneq.c
       1  
       2  /* { dg-do run } */
       3  /* { dg-options "-O3" } */
       4  
       5  #include "arm_neon.h"
       6  
       7  extern void abort (void);
       8  
       9  void
      10  test1 ()
      11  {
      12    int16x8_t val1, val2, val3;
      13    int16x8_t result;
      14    uint64_t act, exp;
      15  
      16    val1 = vcombine_s16 (vcreate_s16 (UINT64_C (0xffff9ab680000000)),
      17  		       vcreate_s16 (UINT64_C (0x00000000ffff0000)));
      18    val2 = vcombine_s16 (vcreate_s16 (UINT64_C (0x32b77fffffff7fff)),
      19  		       vcreate_s16 (UINT64_C (0x0000ffff00007fff)));
      20    val3 = vcombine_s16 (vcreate_s16 (UINT64_C (0x7fff00007fff0000)),
      21  		       vcreate_s16 (UINT64_C (0x80007fff00000000)));
      22    result = vmlsq_laneq_s16 (val1, val2, val3, 6);
      23  
      24    act = vgetq_lane_u64 (vreinterpretq_u64_s16 (result), 0);
      25    exp = UINT64_C (0xb2b69ab5ffffffff);
      26    if (act != exp)
      27      abort ();
      28  
      29    act = vgetq_lane_u64 (vreinterpretq_u64_s16 (result), 1);
      30    exp = UINT64_C (0x00007fffffffffff);
      31    if (act != exp)
      32      abort ();
      33  }
      34  
      35  void
      36  test2 ()
      37  {
      38    int32x4_t val1, val2, val3;
      39    int32x4_t result;
      40    uint64_t exp, act;
      41  
      42    val1 = vcombine_s32 (vcreate_s32 (UINT64_C (0x00008000f46f7fff)),
      43  		       vcreate_s32 (UINT64_C (0x7fffffffffff8000)));
      44    val2 = vcombine_s32 (vcreate_s32 (UINT64_C (0x7fff7fff0e700000)),
      45  		       vcreate_s32 (UINT64_C (0xffff000080000000)));
      46    val3 = vcombine_s32 (vcreate_s32 (UINT64_C (0x00000000ffff0000)),
      47  		       vcreate_s32 (UINT64_C (0xd9edea1a8000fb28)));
      48    result = vmlsq_laneq_s32 (val1, val2, val3, 3);
      49  
      50    act = vgetq_lane_u64 (vreinterpretq_u64_s32 (result), 0);
      51    exp = UINT64_C (0xcefb6a1a1d0f7fff);
      52    if (act != exp)
      53      abort ();
      54  
      55    act = vgetq_lane_u64 (vreinterpretq_u64_s32 (result), 1);
      56    exp = UINT64_C (0x6a19ffffffff8000);
      57    if (act != exp)
      58      abort ();
      59  }
      60  
      61  void
      62  test3 ()
      63  {
      64    uint16x8_t val1, val2, val3;
      65    uint16x8_t result;
      66    uint64_t act, exp;
      67  
      68    val1 = vcombine_u16 (vcreate_u16 (UINT64_C (0x000080008000802a)),
      69  		       vcreate_u16 (UINT64_C (0x7fffffff00007fff)));
      70    val2 = vcombine_u16 (vcreate_u16 (UINT64_C (0x7fffcdf1ffff0000)),
      71  		       vcreate_u16 (UINT64_C (0xe2550000ffffffff)));
      72    val3 = vcombine_u16 (vcreate_u16 (UINT64_C (0x80007fff80000000)),
      73  		       vcreate_u16 (UINT64_C (0xbe2100007fffffff)));
      74  
      75    result = vmlsq_laneq_u16 (val1, val2, val3, 7);
      76  
      77    act = vgetq_lane_u64 (vreinterpretq_u64_u16 (result), 0);
      78    exp = UINT64_C (0x3e2115ef3e21802a);
      79    if (act != exp)
      80      abort ();
      81  
      82    act = vgetq_lane_u64 (vreinterpretq_u64_u16 (result), 1);
      83    exp = UINT64_C (0x3d0affffbe213e20);
      84    if (act != exp)
      85      abort ();
      86  }
      87  
      88  void
      89  test4 ()
      90  {
      91    uint32x4_t val1, val2, val3;
      92    uint32x4_t result;
      93    uint64_t act, exp;
      94  
      95    val1 = vcombine_u32 (vcreate_u32 (UINT64_C (0x3295fe3d7fff7fff)),
      96  		       vcreate_u32 (UINT64_C (0x7fff00007fff7fff)));
      97    val2 = vcombine_u32 (vcreate_u32 (UINT64_C (0xffff7fff7fff8000)),
      98  		       vcreate_u32 (UINT64_C (0x7fff80008000ffff)));
      99    val3 = vcombine_u32 (vcreate_u32 (UINT64_C (0x7fff7fff80008000)),
     100  		       vcreate_u32 (UINT64_C (0x0000800053ab7fff)));
     101  
     102    result = vmlsq_laneq_u32 (val1, val2, val3, 2);
     103  
     104    act = vgetq_lane_u64 (vreinterpretq_u64_u32 (result), 0);
     105    exp = UINT64_C (0x4640fe3cbffeffff);
     106    if (act != exp)
     107      abort ();
     108  
     109    act = vgetq_lane_u64 (vreinterpretq_u64_u32 (result), 1);
     110    exp = UINT64_C (0xbffe8000d3abfffe);
     111    if (act != exp)
     112      abort ();
     113  }
     114  
     115  void
     116  test5 ()
     117  {
     118    float32x4_t val1, val2, val3;
     119    float32x4_t result;
     120    float32_t act;
     121  
     122    val1 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3f49daf03ef3dc73)),
     123  		       vcreate_f32 (UINT64_C (0x3f5d467a3ef3dc73)));
     124    val2 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3d2064c83d10cd28)),
     125  		       vcreate_f32 (UINT64_C (0x3ea7d1a23d10cd28)));
     126    val3 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3f6131993edb1e04)),
     127  		       vcreate_f32 (UINT64_C (0x3f37f4bf3edb1e04)));
     128  
     129    result = vmlsq_laneq_f32 (val1, val2, val3, 0);
     130  
     131    act = vgetq_lane_f32 (result, 0);
     132    if (act != 0.46116194128990173f)
     133      abort ();
     134  
     135    act = vgetq_lane_f32 (result, 1);
     136    if (act != 0.7717385292053223f)
     137      abort ();
     138  
     139    act = vgetq_lane_f32 (result, 2);
     140    if (act != 0.46116194128990173f)
     141      abort ();
     142  
     143    act = vgetq_lane_f32 (result, 3);
     144    if (act != 0.7240825295448303f)
     145      abort ();
     146  }
     147  
     148  int
     149  main (void)
     150  {
     151    test1 ();
     152    test2 ();
     153    test3 ();
     154    test4 ();
     155    test5 ();
     156  
     157    return 0;
     158  }