Debian Codegraph @

gcc/testsuite/gdc.dg/intrinsics_reject.d

raw
1 // { dg-do compile }
2 import core.bitop;
3 import core.math;
4 import core.volatile;
5 import core.stdc.stdarg;
6
7 //////////////////////////////////////////////////////
8 // core.bitop
9
10 int function(uint) test_bsf() { return &bsf; }
11 int function(ulong) test_bsfl() { return &bsf; }
12 int function(uint) test_bsr() { return &bsr; }
13 int function(ulong) test_bsrl() { return &bsr; }
14 auto test_bt() { return &bt; }
15 // { dg-error "intrinsic function .btc. must be directly called" "" { target *-*-* } .+1 }
16 auto test_btc() { return &btc; }
17 // { dg-error "intrinsic function .btr. must be directly called" "" { target *-*-* } .+1 }
18 auto test_btr() { return &btr; }
19 // { dg-error "intrinsic function .bts. must be directly called" "" { target *-*-* } .+1 }
20 auto test_bts() { return &bts; }
21 // { dg-error "intrinsic function .byteswap. must be directly called" "" { target *-*-* } .+1 }
22 ushort function(ushort) test_byteswap() { return &byteswap; }
23 // { dg-error "intrinsic function .bswap. must be directly called" "" { target *-*-* } .+1 }
24 uint function(uint) test_bswap() { return &bswap; }
25 // { dg-error "intrinsic function .bswap. must be directly called" "" { target *-*-* } .+1 }
26 ulong function(ulong) test_bswapl() { return &bswap; }
27 int function(uint) test_popcnt() { return &popcnt; }
28 int function(ulong) test_popcntl() { return &popcnt; }
29 auto test_rol() { return &rol!ubyte; }
30 auto test_rol(uint a) { return &rol!(1, uint); }
31 auto test_ror(ushort a, uint b) { return &ror!ushort; }
32 auto test_ror(ulong a) { return &ror!(1, ulong); }
33
34 //////////////////////////////////////////////////////
35 // core.math
36
37 float function(float) test_cosf() { return &cos; }
38 double function(double) test_cos() { return &cos; }
39 real function(real) test_cosl() { return &cos; }
40 float function(float) test_sinf() { return &sin; }
41 double function(double) test_sin() { return &sin; }
42 real function(real) test_sinl() { return &sin; }
43 long function(float) test_rndtolf() { return &rndtol; }
44 long function(double) test_rndtol() { return &rndtol; }
45 long function(real) test_rndtoll() { return &rndtol; }
46 float function(float) test_sqrtf() { return &sqrt; }
47 double function(double) test_sqrt() { return &sqrt; }
48 real function(real) test_sqrtl() { return &sqrt; }
49 float function(float, int) test_ldexpf() { return &ldexp; }
50 double function(double, int) test_ldexp() { return &ldexp; }
51 real function(real, int) test_ldexpl() { return &ldexp; }
52 float function(float) test_fabsf() { return &fabs; }
53 double function(double) test_fabs() { return &fabs; }
54 real function(real) test_fabsl() { return &fabs; }
55 float function(float) test_rintf() { return &rint; }
56 double function(double) test_rint() { return &rint; }
57 real function(real) test_rintl() { return &rint; }
58
59 //////////////////////////////////////////////////////
60 // core.volatile
61
62 // { dg-error "intrinsic function .volatileLoad. must be directly called" "" { target *-*-* } .+1 }
63 ubyte function(ubyte*) test_volatileLoad8() { return &volatileLoad; }
64 // { dg-error "intrinsic function .volatileLoad. must be directly called" "" { target *-*-* } .+1 }
65 ushort function(ushort*) test_volatileLoad16() { return &volatileLoad; }
66 // { dg-error "intrinsic function .volatileLoad. must be directly called" "" { target *-*-* } .+1 }
67 uint function(uint*) test_volatileLoad32() { return &volatileLoad; }
68 // { dg-error "intrinsic function .volatileLoad. must be directly called" "" { target *-*-* } .+1 }
69 ulong function(ulong*) test_volatileLoad64() { return &volatileLoad; }
70 // { dg-error "intrinsic function .volatileStore. must be directly called" "" { target *-*-* } .+1 }
71 void function(ubyte*, ubyte) test_volatileStore8() { return &volatileStore; }
72 // { dg-error "intrinsic function .volatileStore. must be directly called" "" { target *-*-* } .+1 }
73 void function(ushort*, ushort) test_volatileStore16() { return &volatileStore; }
74 // { dg-error "intrinsic function .volatileStore. must be directly called" "" { target *-*-* } .+1 }
75 void function(uint*, uint) test_volatileStore32() { return &volatileStore; }
76 // { dg-error "intrinsic function .volatileStore. must be directly called" "" { target *-*-* } .+1 }
77 void function(ulong*, ulong) test_volatileStore64() { return &volatileStore; }
78
79 //////////////////////////////////////////////////////
80 // core.stdc.stdarg
81
82 // { dg-error "intrinsic function .va_start. must be directly called" "" { target *-*-* } .+1 }
83 auto test_va_start() { return &va_start!int; }
84 // { dg-error "built-in function .__builtin_va_end. must be directly called" "" { target *-*-* } .+1 }
85 auto test_va_end() { return &va_end; }
86 // { dg-error "built-in function .__builtin_va_copy. must be directly called" "" { target *-*-* } .+1 }
87 auto test_va_copy() { return &va_copy; }