| 1 |
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ |
| 2 |
/* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2" } */ |
| 3 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 4 |
/* { dg-require-effective-target ppc_cpu_supports_hw } */ |
| 5 |
|
| 6 |
/* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8 |
| 7 |
(aka, ISA 2.07) has to do modulus with divide and multiply. Make sure |
| 8 |
both clone functions are generated. |
| 9 |
|
| 10 |
Restrict ourselves to Linux, since IFUNC might not be supported in other |
| 11 |
operating systems. */ |
| 12 |
|
| 13 |
__attribute__((target_clones("cpu=power9,default"))) |
| 14 |
long mod_func (long a, long b) |
| 15 |
{ |
| 16 |
return a % b; |
| 17 |
} |
| 18 |
|
| 19 |
long mod_func_or (long a, long b, long c) |
| 20 |
{ |
| 21 |
return mod_func (a, b) | c; |
| 22 |
} |
| 23 |
|
| 24 |
/* { Fail due to RS6000_DISABLE_SCALAR_MODULO. */ |
| 25 |
/* { dg-final { scan-assembler-times {\mdivd\M} 1 { xfail *-*-* } } } */ |
| 26 |
/* { dg-final { scan-assembler-times {\mmulld\M} 1 { xfail *-*-* } } } */ |
| 27 |
/* { dg-final { scan-assembler-times {\mmodsd\M} 1 { xfail *-*-* } } } */ |