view gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1a.c @ 152:2b5abeee2509

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

/* { dg-do compile } */
/* { dg-options "-O3 -maltivec -mvsx" } */
/* { dg-require-effective-target lp64 } */

#define NO_WARN_X86_INTRINSICS 1
#include <x86intrin.h>

unsigned long long
test__bzhi_u64_group (unsigned long long a)
{
  /* bzhi is implemented in source as shift left then shift right
   to clear the high order bits.
   For the case where the starting index is const, the compiler
   should reduces this to a single Rotate Left Doubleword
   Immediate then Clear Left (rldicl) instruction.  */
  unsigned long long res;
  res = _bzhi_u64 (a, 8);
  res += _bzhi_u64 (a, 16);
  res += _bzhi_u64 (a, 24);
  res += _bzhi_u64 (a, 32);
  res += _bzhi_u64 (a, 40);
  res += _bzhi_u64 (a, 48);
  return (res);
}
/* the resulting assembler should have 6 X rldicl and no sld or
   srd instructions.  */

/* { dg-final { scan-assembler-times "rldicl" 6 } } */
/* { dg-final { scan-assembler-not "sld" } } */
/* { dg-final { scan-assembler-not "srd" } } */