| 1 |
/* { dg-do compile { target { riscv64*-*-* } } } */ |
| 2 |
/* { dg-options "-march=rv64gc -mabi=lp64" } */ |
| 3 |
/* { dg-skip-if "" { *-*-* } { "-O0" } } */ |
| 4 |
|
| 5 |
unsigned |
| 6 |
foo1 (unsigned x, unsigned y, unsigned z) |
| 7 |
{ |
| 8 |
return x & (y - z); |
| 9 |
} |
| 10 |
|
| 11 |
int |
| 12 |
foo2 (int x, int y, int z) |
| 13 |
{ |
| 14 |
return x & (y - z); |
| 15 |
} |
| 16 |
|
| 17 |
unsigned |
| 18 |
foo3 (unsigned x, unsigned y, unsigned z) |
| 19 |
{ |
| 20 |
return x & (y * z); |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
foo4 (int x, int y, int z) |
| 25 |
{ |
| 26 |
return x & (y * z); |
| 27 |
} |
| 28 |
|
| 29 |
unsigned |
| 30 |
foo5 (unsigned x, unsigned y) |
| 31 |
{ |
| 32 |
return x & (y / x); |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
foo6 (int x, int y) |
| 37 |
{ |
| 38 |
return x & (y / x); |
| 39 |
} |
| 40 |
|
| 41 |
unsigned |
| 42 |
foo7 (unsigned x, unsigned y) |
| 43 |
{ |
| 44 |
return x & (y % x); |
| 45 |
} |
| 46 |
|
| 47 |
int |
| 48 |
foo8 (int x, int y) |
| 49 |
{ |
| 50 |
return x & (y % x); |
| 51 |
} |
| 52 |
|
| 53 |
int |
| 54 |
foo9 (int x) |
| 55 |
{ |
| 56 |
return x & (-x); |
| 57 |
} |
| 58 |
|
| 59 |
unsigned |
| 60 |
foo10 (unsigned x, unsigned y) |
| 61 |
{ |
| 62 |
return x & (y + x); |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
unsigned |
| 67 |
foo11 (unsigned x) |
| 68 |
{ |
| 69 |
return x & (15 + x); |
| 70 |
} |
| 71 |
|
| 72 |
/* { dg-final { scan-assembler-times {\msubw} 2 } } */ |
| 73 |
/* { dg-final { scan-assembler-times {\maddw} 1 } } */ |
| 74 |
/* { dg-final { scan-assembler-times {\maddiw} 1 } } */ |
| 75 |
/* { dg-final { scan-assembler-times {\mmulw} 2 } } */ |
| 76 |
/* { dg-final { scan-assembler-times {\mdivw} 1 } } */ |
| 77 |
/* { dg-final { scan-assembler-times {\mdivuw} 1 } } */ |
| 78 |
/* { dg-final { scan-assembler-times {\mremw} 1 } } */ |
| 79 |
/* { dg-final { scan-assembler-times {\mremuw} 1 } } */ |
| 80 |
/* { dg-final { scan-assembler-times {\mnegw} 1 } } */ |
| 81 |
/* { dg-final { scan-assembler-not {\msext\.w\M} } } */ |