view gcc/testsuite/gcc.target/i386/avx2-pr94460.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 2b5abeee2509
children
line wrap: on
line source

/* PR target/94460 */
/* { dg-do run { target { avx2 && int128 } } } */
/* { dg-options "-O2 -mavx2" } */

#include <x86intrin.h>
#include "avx2-check.h"

typedef __int128 v2ti __attribute__ ((__vector_size__ (32)));

static inline v2ti
foo (__v16hi b)
{
  return (v2ti) _mm256_hsub_epi16 ((__m256i) b, (__m256i) b);
}

static inline v2ti
bar (__v8si b)
{
  return (v2ti) _mm256_hsub_epi32 ((__m256i) b, (__m256i) b);
}

static void
avx2_test (void)
{
  v2ti x = foo ((__v16hi) { 1 });
  if (x[0] != ((__int128)1 << 64 | 1) || x[1] != 0)
    abort ();
  x = bar ((__v8si) { 1 });
  if (x[0] != ((__int128)1 << 64 | 1) || x[1] != 0)
    abort ();
}