| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mbmi2 -fdump-tree-optimized" } */ |
| 3 |
/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */ |
| 4 |
|
| 5 |
#include <x86intrin.h> |
| 6 |
|
| 7 |
extern void link_error (void); |
| 8 |
|
| 9 |
unsigned int a; |
| 10 |
unsigned long long b; |
| 11 |
|
| 12 |
int |
| 13 |
main () |
| 14 |
{ |
| 15 |
asm volatile ("" : : "g" (&a), "g" (&b) : "memory"); |
| 16 |
if (_pdep_u32 (0xabcdef98, 0xffff0000) != 0xef980000 |
| 17 |
|| _pdep_u32 (0xabcdef98, 0xffffff00) != 0xcdef9800 |
| 18 |
|| _pdep_u32 (0xabcdef98, 0x0f0f0f0f) != 0x0e0f0908 |
| 19 |
|| _pdep_u32 (0xabcdef98, 0xff0fff0f) != 0xcd0ef908 |
| 20 |
|| _pdep_u32 (0xabcdef98, 0x000fffff) != 0xdef98 |
| 21 |
|| _pdep_u32 (a, 0xffffffff) != a) |
| 22 |
link_error (); |
| 23 |
#ifdef __x86_64__ |
| 24 |
if (_pdep_u64 (0xabcdef9876543210UL, 0xffffffff00000000UL) != 0x7654321000000000UL |
| 25 |
|| _pdep_u64 (0xabcdef9876543210UL, 0xffffffffffffff00UL) != 0xcdef987654321000UL |
| 26 |
|| _pdep_u64 (0xabcdef9876543210UL, 0x0f0f0f0f0f0f0f0fUL) != 0x0706050403020100UL |
| 27 |
|| _pdep_u64 (0xabcdef9876543210UL, 0xff0fff0fff0fff0fUL) != 0xef09870654032100UL |
| 28 |
|| _pdep_u64 (0xabcdef9876543210UL, 0x00000000000fffffUL) != 0x43210UL |
| 29 |
|| _pdep_u64 (b, 0xffffffffffffffffUL) != b) |
| 30 |
link_error (); |
| 31 |
#endif |
| 32 |
return 0; |
| 33 |
} |