Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / sin_cos.c
blobaa71dcac6588be175a86ccfc745b0be51ada901f
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
4 /* This maps to essentially the same gimple that is generated for
5 gnat.dg/sin_cos.adb, on platforms that use the wraplf variant of
6 Ada.Numerics.Aux_Float. The value of EPSILON is not relevant to
7 the test, but the test must be there to keep the conversions in
8 different BBs long enough to trigger the problem that prevented the
9 sincos optimization, because the arguments passed to sin and cos
10 didn't get unified into a single SSA_NAME in time for sincos. */
12 #include <math.h>
14 #define EPSILON 3.4526697709225118160247802734375e-4
16 static float my_sinf(float x) {
17 return (float) sin ((double) x);
20 static float wrap_sinf(float x) {
21 if (fabs (x) < EPSILON)
22 return 0;
23 return my_sinf (x);
26 static float my_cosf(float x) {
27 return (float) cos ((double) x);
30 static float wrap_cosf(float x) {
31 if (fabs (x) < EPSILON)
32 return 1;
33 return my_cosf (x);
36 float my_sin_cos(float x, float *s, float *c) {
37 *s = wrap_sinf (x);
38 *c = wrap_cosf (x);
41 /* { dg-final { scan-assembler "sincos\|cexp" { target *-linux-gnu* *-w64-mingw* *-*-vxworks* } } } */