view gcc/testsuite/gcc.target/powerpc/vec-extractl-3.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-require-effective-target powerpc_future_hw } */
/* { dg-options "-mdejagnu-cpu=future" } */

#include <altivec.h>

extern void abort (void);

int
main (int argc, char *argv [])
{
  vector unsigned short source_a = { 0, 2, 4, 6, 8, 10, 12, 14 };
  vector unsigned short source_b = { 16, 18, 20, 22, 24, 26, 28, 30 };

  vector unsigned long long int result_1 = { 0, 14 };
  vector unsigned long long int result_2 = { 0, 16 };
  vector unsigned long long int result_3 = { 0, 24 };
  vector unsigned long long int result_4 = { 0, 12 };

  if (!vec_all_eq (vec_extractl (source_a, source_b, 14), result_1))
    abort ();
  if (!vec_all_eq (vec_extractl (source_a, source_b, 16), result_2))
    abort ();
  if (!vec_all_eq (vec_extractl (source_b, source_a, 8), result_3))
    abort ();
  if (!vec_all_eq (vec_extractl (source_b, source_a, 28), result_4))
    abort ();

  return 0;
}