1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mtbm -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 volatile unsigned int a;
10 volatile unsigned long long b;
11 
12 int
main()13 main ()
14 {
15   if (__bextri_u32 (0xffffffffU, 0 | (0 << 8)) != 0
16       || __bextri_u32 (0xffffffffU, 64 | (16 << 8)) != 0
17       || __bextri_u32 (0x12345678U, 4 | (10 << 8)) != 0x167
18       || __bextri_u32 (0xffffffffU, 2 | (255 << 8)) != 0x3fffffff
19       || __bextri_u32 (0xdeadbeefU, 2 | (64 << 8)) != 0x37ab6fbb
20       || __bextri_u32 (0xdeadbeefU, 0 | (64 << 8)) != 0xdeadbeefU
21       || __bextri_u32 (a, 0 | (0 << 8)) != 0
22       || __bextri_u32 (a, 32 | (16 << 8)) != 0)
23     link_error ();
24 #ifdef __x86_64__
25   if (__bextri_u64 (0xffffffffffffffffUL, 0 | (0 << 8)) != 0
26       || __bextri_u64 (0xffffffffffffffffUL, 128 | (16 << 8)) != 0
27       || __bextri_u64 (0x123456789abcdef0UL, 5 | (37 << 8)) != 0x13c4d5e6f7UL
28       || __bextri_u64 (0xffffffffffffffffUL, 2 | (255 << 8)) != 0x3fffffffffffffffUL
29       || __bextri_u64 (0xdeadbeefbeefdeadU, 2 | (64 << 8)) != 0x37ab6fbbefbbf7abUL
30       || __bextri_u64 (0xdeadbeefbeefdeadU, 0 | (64 << 8)) != 0xdeadbeefbeefdeadUL
31       || __bextri_u64 (b, 0 | (0 << 8)) != 0
32       || __bextri_u64 (b, 64 | (16 << 8)) != 0)
33     link_error ();
34 #endif
35   return 0;
36 }
37