1 /* { dg-do run } */
2 /* { dg-require-effective-target arm_thumb2_ok } */
3 /* { dg-additional-options "-mthumb -O2 --save-temps" } */
4
5 extern void abort (void);
6
7 #define N 16
8
9 float a_f[N] = {-0.1f, -3.2f, -6.3f, -9.4f,
10 -12.5f, -15.6f, -18.7f, -21.8f,
11 24.9f, 27.1f, 30.2f, 33.3f,
12 36.4f, 39.5f, 42.6f, 45.7f};
13
14 float b_f[N] = {-1.2f, 3.4f, -5.6f, 7.8f,
15 -9.0f, 1.0f, -2.0f, 3.0f,
16 -4.0f, -5.0f, 6.0f, 7.0f,
17 -8.0f, -9.0f, 10.0f, 11.0f};
18
19 float c_f[N] = {-0.1f, 3.2f, -6.3f, 9.4f,
20 -12.5f, 15.6f, -18.7f, 21.8f,
21 -24.9f, -27.1f, 30.2f, 33.3f,
22 -36.4f, -39.5f, 42.6f, 45.7f};
23
24 double a_d[N] = {-0.1, -3.2, -6.3, -9.4,
25 -12.5, -15.6, -18.7, -21.8,
26 24.9, 27.1, 30.2, 33.3,
27 36.4, 39.5, 42.6, 45.7};
28
29 double b_d[N] = {-1.2, 3.4, -5.6, 7.8,
30 -9.0, 1.0, -2.0, 3.0,
31 -4.0, -5.0, 6.0, 7.0,
32 -8.0, -9.0, 10.0, 11.0};
33
34 double c_d[N] = {-0.1, 3.2, -6.3, 9.4,
35 -12.5, 15.6, -18.7, 21.8,
36 -24.9, -27.1, 30.2, 33.3,
37 -36.4, -39.5, 42.6, 45.7};
38
39 int
main(int argc,char ** argv)40 main (int argc, char **argv)
41 {
42 int index = 0;
43
44 /* { dg-final { scan-assembler-times "bfi" 2 { target arm_softfloat } } } */
45 /* { dg-final { scan-assembler-times "lsr" 1 { target arm_softfloat } } } */
46 for (index; index < N; index++)
47 {
48 if (__builtin_copysignf (a_f[index], b_f[index]) != c_f[index])
49 abort();
50 }
51
52 for (index = 0; index < N; index++)
53 {
54 if (__builtin_copysign (a_d[index], b_d[index]) != c_d[index])
55 abort();
56 }
57
58 return 0;
59 }
60
61