aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/xorsign.c
blob: 22c5829449d932bed08de7e453c435ade3b787b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* { dg-do compile } */
/* { dg-options "-O3" } */

double
check_d_pos (double x, double y)
{
  return x * __builtin_copysign (1.0, y);
}

float
check_f_pos (float x, float y)
{
  return x * __builtin_copysignf (1.0f, y);
}

long double
check_l_pos (long double x, long double y)
{
  return x * __builtin_copysignl (1.0, y);
}

/* --------------- */

double
check_d_neg (double x, double y)
{
  return x * __builtin_copysign (-1.0, y);
}

float
check_f_neg (float x, float y)
{
  return x * __builtin_copysignf (-1.0f, y);
}

long double
check_l_neg (long double x, long double y)
{
  return x * __builtin_copysignl (-1.0, y);
}

/* --------------- */

double
check_d_pos_rev (double x, double y)
{
  return __builtin_copysign (1.0, y) * x;
}

float
check_f_pos_rev (float x, float y)
{
  return __builtin_copysignf (1.0f, y) * x;
}

long double
check_l_pos_rev (long double x, long double y)
{
  return __builtin_copysignl (1.0, y) * x;
}

/* --------------- */

double
check_d_neg_rev (double x, double y)
{
  return __builtin_copysign (-1.0, y) * x;
}

float
check_f_neg_rev (float x, float y)
{
  return __builtin_copysignf (-1.0f, y) * x;
}

long double
check_l_neg_rev (long double x, long double y)
{
  return __builtin_copysignl (-1.0, y) * x;
}

/* { dg-final { scan-assembler "\[ \t\]?eor\[ \t\]?" } } */
/* { dg-final { scan-assembler "\[ \t\]?and\[ \t\]?" } } */
/* { dg-final { scan-assembler-not "copysign" } } */
/* { dg-final { scan-assembler-not "\[ \t\]?orr\[ \t\]?" } } */
/* { dg-final { scan-assembler-not "\[ \t\]?fmul\[ \t\]?" } } */