Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/clone2.c

raw
1 /* { dg-do run { target { powerpc*-*-linux* } } } */
2 /* { dg-options "-mvsx -O2" } */
3 /* { dg-require-effective-target ppc_cpu_supports_hw } */
4
5 #include <stddef.h>
6 #include <stdlib.h>
7
8 /* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8
9 (aka, ISA 2.07) has to do modulus with divide and multiply. Make sure that
10 the basic support for target_clones runs.
11
12 Restrict ourselves to Linux, since IFUNC might not be supported in other
13 operating systems. */
14
15 __attribute__((__target_clones__("cpu=power9,default")))
16 long mod_func (long a, long b)
17 {
18 return a % b;
19 }
20
21 #define X 53L
22 #define Y 7L
23 int
24 main (void)
25 {
26 if (mod_func (X, Y) != (X % Y))
27 abort ();
28
29 return 0;
30 }