Debian Codegraph @

gcc/testsuite/gcc.target/i386/x86gprintrin-4.c

raw
1 /* Same as x86gprintrin-3.c, except converted to use #pragma GCC option. */
2 /* { dg-do compile } */
3 /* { dg-options "-O0 -Werror-implicit-function-declaration -march=x86-64 -mno-sse -mno-mmx" } */
4 /* { dg-add-options bind_pic_locally } */
5
6 /* Test that the intrinsics in <x86gprintrin.h> compile without optimization.
7 All of them are defined as inline functions that reference the proper
8 builtin functions.
9
10 Defining away "extern" and "__inline" results in all of them being
11 compiled as proper functions. */
12
13 #define extern
14 #define __inline
15
16 #define _CONCAT(x,y) x ## y
17
18 #define test_0(func, type, imm) \
19 type _CONCAT(_0,func) (int const I) \
20 { return func (imm); }
21
22 #define test_1(func, type, op1_type) \
23 type _CONCAT(_1,func) (op1_type A) \
24 { return func (A); }
25
26 #define test_1r(func, type, op1_type, imm) \
27 type _CONCAT(_1r,func) (op1_type A, int const I) \
28 { return func (imm, A); }
29
30 #define test_2(func, type, op1_type, op2_type) \
31 type _CONCAT(_2,func) (op1_type A, op2_type B) \
32 { return func (A, B); }
33
34 #ifndef DIFFERENT_PRAGMAS
35 #ifdef __x86_64__
36 #pragma GCC target ("adx,bmi,bmi2,cmpccxadd,fsgsbase,fxsr,hreset,lwp,lzcnt,popcnt,prefetchi,raoint,rdrnd,rdseed,tbm,rtm,serialize,tsxldtrk,uintr,usermsr,xsaveopt")
37 #else
38 #pragma GCC target ("adx,bmi,bmi2,fsgsbase,fxsr,hreset,lwp,lzcnt,popcnt,raoint,rdrnd,rdseed,tbm,rtm,serialize,tsxldtrk,xsaveopt")
39 #endif
40 #endif
41
42 /* popcnintrin.h (POPCNT). */
43 #ifdef DIFFERENT_PRAGMAS
44 #pragma GCC target ("popcnt")
45 #endif
46 #include <popcntintrin.h>
47
48 /* x86intrin.h (LWP/BMI/BMI2/TBM/LZCNT). */
49 #ifdef DIFFERENT_PRAGMAS
50 #ifdef __x86_64__
51 #pragma GCC target ("lwp,bmi,bmi2,tbm,lzcnt,usermsr")
52 #else
53 #pragma GCC target ("lwp,bmi,bmi2,tbm,lzcnt")
54 #endif
55 #endif
56 #include <x86gprintrin.h>
57
58 /* usermsrintrin.h */
59 #ifdef __x86_64__
60 test_0 (_urdmsr, unsigned long long, 1)
61 test_1 (_urdmsr, unsigned long long, unsigned long long)
62 test_1r (_uwrmsr, void, unsigned long long, 1)
63 test_2 (_uwrmsr, void, unsigned long long, unsigned long long)
64 #endif