| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3" } */ |
| 3 |
|
| 4 |
double |
| 5 |
check_d_pos (double x, double y) |
| 6 |
{ |
| 7 |
return x * __builtin_copysign (1.0, y); |
| 8 |
} |
| 9 |
|
| 10 |
float |
| 11 |
check_f_pos (float x, float y) |
| 12 |
{ |
| 13 |
return x * __builtin_copysignf (1.0f, y); |
| 14 |
} |
| 15 |
|
| 16 |
long double |
| 17 |
check_l_pos (long double x, long double y) |
| 18 |
{ |
| 19 |
return x * __builtin_copysignl (1.0, y); |
| 20 |
} |
| 21 |
|
| 22 |
/* --------------- */ |
| 23 |
|
| 24 |
double |
| 25 |
check_d_neg (double x, double y) |
| 26 |
{ |
| 27 |
return x * __builtin_copysign (-1.0, y); |
| 28 |
} |
| 29 |
|
| 30 |
float |
| 31 |
check_f_neg (float x, float y) |
| 32 |
{ |
| 33 |
return x * __builtin_copysignf (-1.0f, y); |
| 34 |
} |
| 35 |
|
| 36 |
long double |
| 37 |
check_l_neg (long double x, long double y) |
| 38 |
{ |
| 39 |
return x * __builtin_copysignl (-1.0, y); |
| 40 |
} |
| 41 |
|
| 42 |
/* --------------- */ |
| 43 |
|
| 44 |
double |
| 45 |
check_d_pos_rev (double x, double y) |
| 46 |
{ |
| 47 |
return __builtin_copysign (1.0, y) * x; |
| 48 |
} |
| 49 |
|
| 50 |
float |
| 51 |
check_f_pos_rev (float x, float y) |
| 52 |
{ |
| 53 |
return __builtin_copysignf (1.0f, y) * x; |
| 54 |
} |
| 55 |
|
| 56 |
long double |
| 57 |
check_l_pos_rev (long double x, long double y) |
| 58 |
{ |
| 59 |
return __builtin_copysignl (1.0, y) * x; |
| 60 |
} |
| 61 |
|
| 62 |
/* --------------- */ |
| 63 |
|
| 64 |
double |
| 65 |
check_d_neg_rev (double x, double y) |
| 66 |
{ |
| 67 |
return __builtin_copysign (-1.0, y) * x; |
| 68 |
} |
| 69 |
|
| 70 |
float |
| 71 |
check_f_neg_rev (float x, float y) |
| 72 |
{ |
| 73 |
return __builtin_copysignf (-1.0f, y) * x; |
| 74 |
} |
| 75 |
|
| 76 |
long double |
| 77 |
check_l_neg_rev (long double x, long double y) |
| 78 |
{ |
| 79 |
return __builtin_copysignl (-1.0, y) * x; |
| 80 |
} |
| 81 |
|
| 82 |
/* { dg-final { scan-assembler-times {eor\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 8 } } */ |
| 83 |
/* { dg-final { scan-assembler-times {and\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 8 } } */ |
| 84 |
/* { dg-final { scan-assembler-not "copysign" } } */ |
| 85 |
/* { dg-final { scan-assembler-not "fmov" } } */ |
| 86 |
/* { dg-final { scan-assembler-not "\[ \t\]?orr\[ \t\]?" } } */ |
| 87 |
/* { dg-final { scan-assembler-not "\[ \t\]?fmul\[ \t\]?" } } */ |