コード例 #1
0
ファイル: pr70859.c プロジェクト: Caleb1994/stewieos-gcc
void
fn0 (int n)
{
  p = __builtin_alloca_with_align (n, 6); /* { dg-error "39:must be a constant integer" } */

  r += __builtin_isfinite (0); /* { dg-error "28:non-floating-point argument in call" } */
  r += __builtin_isinf (0); /* { dg-error "25:non-floating-point argument in call" } */
  r += __builtin_isinf_sign (0); /* { dg-error "30:non-floating-point argument in call" } */
  r += __builtin_isnan (0); /* { dg-error "25:non-floating-point argument in call" } */
  r += __builtin_isnormal (0); /* { dg-error "28:non-floating-point argument in call" } */
  r += __builtin_signbit (0); /* { dg-error "27:non-floating-point argument in call" } */

  r += __builtin_isgreater (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
  r += __builtin_isgreaterequal (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
  r += __builtin_isless (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
  r += __builtin_islessequal (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
  r += __builtin_islessgreater (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
  r += __builtin_isunordered (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */

  r += __builtin_fpclassify (1, 2, n, 4, 5, n); /* { dg-error "36:non-const integer argument 3 in call" } */
  r += __builtin_fpclassify (1, 2, 3, 4, 5, 6); /* { dg-error "45:non-floating-point argument in call" } */

  d = __builtin_assume_aligned (p, n, p); /* { dg-error "39:non-integer argument 3 in call" } */

  b = __builtin_add_overflow (n, *d, &r); /* { dg-error "34:argument 2 in call to function" } */
  b = __builtin_add_overflow (n, 5, d); /* { dg-error "37:argument 3 in call" } */
  b = __builtin_sub_overflow (n, *d, &r); /* { dg-error "34:argument 2 in call to function" } */
  b = __builtin_sub_overflow (n, 5, d); /* { dg-error "37:argument 3 in call" } */
  b = __builtin_mul_overflow (n, *d, &r); /* { dg-error "34:argument 2 in call to function" } */
  b = __builtin_mul_overflow (n, 5, d); /* { dg-error "37:argument 3 in call" } */
}
コード例 #2
0
ファイル: s_signbitf128.c プロジェクト: riscv/riscv-glibc
/* Once GCC >= 6.0 is required for building glibc, this implementation can
   be removed and replaced with an inclusion of ldbl-128/s_signbitl.c.  */
int
__signbitf128 (_Float128 x)
{
#if __GNUC_PREREQ (6, 0)
  return __builtin_signbit (x);
#else
  int64_t e;

  GET_FLOAT128_MSW64 (e, x);
  return e < 0;
#endif
}
コード例 #3
0
ファイル: pr35456.c プロジェクト: alpine9000/BitOS
int main()
{
    double x = -0.0;
    double y;

    y = not_fabs (x);

    if (!__builtin_signbit (y))
        abort();

    return 0;
}
コード例 #4
0
foo (float f, double d, long double ld)
{
  /* Test the generic expansion of isinf_sign.  */

  if (__builtin_isinf_sign(f)
      != (__builtin_isinf(f) ? (__builtin_signbit(f) ? -1 : 1) : 0))
    link_error (__LINE__);
  if (__builtin_isinf_sign(d)
      != (__builtin_isinf(d) ? (__builtin_signbit(d) ? -1 : 1) : 0))
    link_error (__LINE__);
  if (__builtin_isinf_sign(ld)
      != (__builtin_isinf(ld) ? (__builtin_signbit(ld) ? -1 : 1) : 0))
    link_error (__LINE__);

#ifdef __OPTIMIZE__
  /* In boolean contexts, GCC will fold the inner conditional
     expression to 1.  So isinf_sign folds to plain isinf.  */

  if ((_Bool)__builtin_isinf_sign(f) != (__builtin_isinf(f) != 0))
    link_error (__LINE__);
  if ((_Bool)__builtin_isinf_sign(d) != (__builtin_isinf(d) != 0))
    link_error (__LINE__);
  if ((_Bool)__builtin_isinf_sign(ld) != (__builtin_isinf(ld) != 0))
    link_error (__LINE__);
#endif

  if ((__builtin_isinf_sign(f) != 0) != (__builtin_isinf(f) != 0))
    link_error (__LINE__);
  if ((__builtin_isinf_sign(d) != 0) != (__builtin_isinf(d) != 0))
    link_error (__LINE__);
  if ((__builtin_isinf_sign(ld) != 0) != (__builtin_isinf(ld) != 0))
    link_error (__LINE__);

  if ((__builtin_isinf_sign(f) ? 5 : 6) != (__builtin_isinf(f) ? 5 : 6))
    link_error (__LINE__);
  if ((__builtin_isinf_sign(d) ? 5 : 6) != (__builtin_isinf(d) ? 5 : 6))
    link_error (__LINE__);
  if ((__builtin_isinf_sign(ld) ? 5 : 6) != (__builtin_isinf(ld) ? 5 : 6))
    link_error (__LINE__);
}
コード例 #5
0
ファイル: builtins-error.c プロジェクト: JamesLinus/gcc
int test3(double x)
{
  if (x ==  1) return __builtin_fpclassify(1,2,3,4,5,x,x); /* { dg-error "too many arguments" } */
  if (x ==  2) return __builtin_isfinite(x, x); /* { dg-error "too many arguments" } */
  if (x ==  3) return __builtin_isinf_sign(x, x); /* { dg-error "too many arguments" } */
  if (x ==  4) return __builtin_isinf(x, x); /* { dg-error "too many arguments" } */
  if (x ==  5) return __builtin_isnan(x, x); /* { dg-error "too many arguments" } */
  if (x ==  6) return __builtin_isnormal(x, x); /* { dg-error "too many arguments" } */
  if (x ==  7) return __builtin_isgreater(x, x, x); /* { dg-error "too many arguments" } */
  if (x ==  8) return __builtin_isgreaterequal(x, x, x); /* { dg-error "too many arguments" } */
  if (x ==  9) return __builtin_isless(x, x, x); /* { dg-error "too many arguments" } */
  if (x == 10) return __builtin_islessequal(x, x, x); /* { dg-error "too many arguments" } */
  if (x == 11) return __builtin_islessgreater(x, x, x); /* { dg-error "too many arguments" } */
  if (x == 12) return __builtin_isunordered(x, x, x); /* { dg-error "too many arguments" } */
  if (x == 13) return __builtin_signbit(x, x); /* { dg-error "too many arguments" } */
  return 0;
}
コード例 #6
0
ファイル: builtins-error.c プロジェクト: JamesLinus/gcc
int test1(struct X x)
{
  if (x.x ==  1) return __builtin_fpclassify(1,2,3,4,5,x); /* { dg-error "non-floating-point argument" } */
  if (x.x ==  2) return __builtin_isfinite(x); /* { dg-error "non-floating-point argument" } */
  if (x.x ==  3) return __builtin_isinf_sign(x); /* { dg-error "non-floating-point argument" } */
  if (x.x ==  4) return __builtin_isinf(x); /* { dg-error "non-floating-point argument" } */
  if (x.x ==  5) return __builtin_isnan(x); /* { dg-error "non-floating-point argument" } */
  if (x.x ==  6) return __builtin_isnormal(x); /* { dg-error "non-floating-point argument" } */
  if (x.x ==  7) return __builtin_isgreater(x, x); /* { dg-error "non-floating-point arguments" } */
  if (x.x ==  8) return __builtin_isgreaterequal(x, x); /* { dg-error "non-floating-point arguments" } */
  if (x.x ==  9) return __builtin_isless(x, x); /* { dg-error "non-floating-point arguments" } */
  if (x.x == 10) return __builtin_islessequal(x, x); /* { dg-error "non-floating-point arguments" } */
  if (x.x == 11) return __builtin_islessgreater(x, x); /* { dg-error "non-floating-point arguments" } */
  if (x.x == 12) return __builtin_isunordered(x, x); /* { dg-error "non-floating-point arguments" } */
  if (x.x == 13) return __builtin_signbit(x); /* { dg-error "non-floating-point argument" } */

  return 0;
}
コード例 #7
0
ファイル: signbit.hpp プロジェクト: EzoeRyou/Sprout
			inline SPROUT_CONSTEXPR bool
			builtin_signbit(FloatType x) {
				return __builtin_signbit(x);
			}
コード例 #8
0
inline bool signbit(const Y& val)
{
    return __builtin_signbit(val);
}