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