aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ldexp.c
blob: 92bcf588b16ac7963f4f440baa2d0fa6332818c4 (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
/* { dg-do compile } */
/* { dg-additional-options "-Ofast" } */

/* { dg-final { scan-assembler-not "\tfmul\t" } } */

#define TEST(TYPE, BUILTIN, CONST, NAME)                       \
  TYPE test_##NAME##_1(TYPE a, int i)                          \
  {                                                            \
    return CONST * __builtin_##BUILTIN(a, i);                  \
  }                                                            \
  TYPE test_##NAME##_2(int i)                                  \
  {                                                            \
    return 45 * __builtin_##BUILTIN(1.0, i);                   \
  }                                                            \
  TYPE test_##NAME##_3(TYPE a, int i)                          \
  {                                                            \
    return a * __builtin_##BUILTIN(1.0, i);                    \
  }                                                            \
  TYPE test_##NAME##_4(int i)                                  \
  {                                                            \
    TYPE a = CONST;                                            \
    return a * __builtin_##BUILTIN(a, i);                      \
  }                                                            \
  TYPE test_##NAME##_5(TYPE a, int i)                          \
  {                                                            \
    TYPE t1 = a;                                               \
    return t1 * __builtin_##BUILTIN(1.0, i);                   \
  }

TEST(double, ldexp, 8.0, double_ldexp)
TEST(float, ldexpf, 8.0f, float_ldexp)
TEST(long double, ldexpl, 8.0L, long_ldexp)