Exemple #1
0
long double atanhl( long double x )
{
	if( x != x )	return x + x;
	
	long double fabsx = __builtin_fabsl( x );

	if( fabsx > 1.0L)
		return sqrtl( -fabsx );
	
	if( fabsx >= 0x1.0p-32 )		//sqrt( negative epsilon )
	{
		fabsx = 0.5 * log1pl( (fabsx + fabsx) / (1.0L - fabsx) );
		
	}
	else
	{
		if( x == 0.0 )
			return x;
	
		fabsx *= 0x1.0p65;
		fabsx += 0x1.0p-16382L;
		fabsx *= 0x1.0p-65;
	}

	if( x < 0 )
		fabsx = -fabsx;

	return fabsx;
}
Exemple #2
0
// CHECK-LABEL: define void @test_float_builtin_ops
void test_float_builtin_ops(float F, double D, long double LD) {
  volatile float resf;
  volatile double resd;
  volatile long double resld;

  resf = __builtin_fmodf(F,F);
  // CHECK: frem float

  resd = __builtin_fmod(D,D);
  // CHECK: frem double

  resld = __builtin_fmodl(LD,LD);
  // CHECK: frem x86_fp80

  resf = __builtin_fabsf(F);
  resd = __builtin_fabs(D);
  resld = __builtin_fabsl(LD);
  // CHECK: call float @llvm.fabs.f32(float
  // CHECK: call double @llvm.fabs.f64(double
  // CHECK: call x86_fp80 @llvm.fabs.f80(x86_fp80

  resf = __builtin_canonicalizef(F);
  resd = __builtin_canonicalize(D);
  resld = __builtin_canonicalizel(LD);
  // CHECK: call float @llvm.canonicalize.f32(float
  // CHECK: call double @llvm.canonicalize.f64(double
  // CHECK: call x86_fp80 @llvm.canonicalize.f80(x86_fp80
}
Exemple #3
0
int __fpclassify( long double x )
{
    x = __builtin_fabsl(x);
    if( EXPECT_FALSE( x == 0.0L ) )
        return FP_ZERO;
        
    if( EXPECT_FALSE( x < 0x1.0p-16382L ) )
        return FP_SUBNORMAL;
    
    if( EXPECT_TRUE( x < __builtin_infl() ) )
        return FP_NORMAL;
        
    if( EXPECT_TRUE( x == __builtin_infl() ) )
        return FP_INFINITE;

    return FP_NAN;
}
Exemple #4
0
long double coshl( long double x )
{
    static const long double overflow = 0x1.62e9bb80635d81d4p+13L;		 //ln(LDBL_MAX) + ln(2.0)
    static const long double ln2 = 0.693147180559945309417232121458176568L;                             //ln(2)
    long double fabsx = __builtin_fabsl( x );
    long double t, w;

	if( x != x )	return x + x;

    if( fabsx < __builtin_infl() )
    {
        if( fabsx < 0.5L * ln2 )
        {
			if( fabsx > 0x1.0p-1000L )	//avoid underflow, save time
				fabsx = expm1l( fabsx );
            w = 1.0L + fabsx;
            if( fabsx < 0x1.0p-67L )
                return w;
            return 1.0L + (fabsx*fabsx)/(w+w);
        }
        
        if( fabsx < 22.L )
        {
            t =  expl( fabsx );
            return 0.5L * t + 0.5L/t;
        }
        
        if( fabsx < overflow )
        {
            w = expl( 0.5L * fabsx );
            t = 0.5L * w;
            return t * w;
        }
		
		return fabsx * 0x1.0p16383L;
    }

    //Nan or Inf result
    return fabsx + fabsx;
}
Exemple #5
0
void test_long(long x) {
  (void)abs(x);  // no warning - int and long are same length for this target
  (void)labs(x);
  (void)llabs(x);

  (void)fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"
  (void)fabs(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"labs"
  (void)fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"

  (void)cabsf(x);
  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"
  (void)cabs(x);
  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"labs"
  (void)cabsl(x);
  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"

  (void)__builtin_abs(x);  // no warning - int and long are same length for
                           // this target
  (void)__builtin_labs(x);
  (void)__builtin_llabs(x);

  (void)__builtin_fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
  (void)__builtin_fabs(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_labs"
  (void)__builtin_fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"

  (void)__builtin_cabsf(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
  (void)__builtin_cabs(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_labs"
  (void)__builtin_cabsl(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_labs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
}
Exemple #6
0
void test_unsigned_long(unsigned long x) {
  (void)abs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
  (void)labs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
  (void)llabs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""

  (void)fabsf(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
  (void)fabs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
  (void)fabsl(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""

  (void)cabsf(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
  (void)cabs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
  (void)cabsl(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""

  (void)__builtin_abs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
  (void)__builtin_labs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
  (void)__builtin_llabs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""

  (void)__builtin_fabsf(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
  (void)__builtin_fabs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
  (void)__builtin_fabsl(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""

  (void)__builtin_cabsf(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
  (void)__builtin_cabs(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
  (void)__builtin_cabsl(x);
  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
  // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
}
Exemple #7
0
void test_complex_long_double(_Complex long double x) {
  (void)abs(x);
  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabsl"
  (void)labs(x);
  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
  (void)llabs(x);
  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"

  (void)fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
  (void)fabs(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
  (void)fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"

  (void)cabsf(x);
  // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
  (void)cabs(x);
  // expected-warning@-1 {{absolute value function 'cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
  // expected-note@-2 {{use function 'cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
  (void)cabsl(x);

  (void)__builtin_abs(x);
  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabsl"
  (void)__builtin_labs(x);
  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
  (void)__builtin_llabs(x);
  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"

  (void)__builtin_fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
  (void)__builtin_fabs(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
  (void)__builtin_fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"

  (void)__builtin_cabsf(x);
  // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
  (void)__builtin_cabs(x);
  // expected-warning@-1 {{absolute value function '__builtin_cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
  (void)__builtin_cabsl(x);
}
Exemple #8
0
void test_complex_float(_Complex float x) {
  (void)abs(x);
  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabsf"
  (void)labs(x);
  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsf"
  (void)llabs(x);
  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"

  (void)fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
  (void)fabs(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsf"
  (void)fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
  // expected-note@-2 {{use function 'cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"

  (void)cabsf(x);
  (void)cabs(x);
  (void)cabsl(x);

  (void)__builtin_abs(x);
  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabsf"
  (void)__builtin_labs(x);
  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsf"
  (void)__builtin_llabs(x);
  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"

  (void)__builtin_fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
  (void)__builtin_fabs(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsf"
  (void)__builtin_fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"

  (void)__builtin_cabsf(x);
  (void)__builtin_cabs(x);
  (void)__builtin_cabsl(x);
}
Exemple #9
0
void test_long_long(long long x) {
  (void)abs(x);
  // expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
  // expected-note@-2{{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"llabs"
  (void)labs(x);
  // expected-warning@-1{{absolute value function 'labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
  // expected-note@-2{{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"llabs"
  (void)llabs(x);

  (void)fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"
  (void)fabs(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"llabs"
  (void)fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"

  (void)cabsf(x);
  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"
  (void)cabs(x);
  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"llabs"
  (void)cabsl(x);
  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"

  (void)__builtin_abs(x);
  // expected-warning@-1{{absolute value function '__builtin_abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
  // expected-note@-2{{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_llabs"
  (void)__builtin_labs(x);
  // expected-warning@-1{{absolute value function '__builtin_labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
  // expected-note@-2{{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_llabs"
  (void)__builtin_llabs(x);

  (void)__builtin_fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
  (void)__builtin_fabs(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_llabs"
  (void)__builtin_fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"

  (void)__builtin_cabsf(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
  (void)__builtin_cabs(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_llabs"
  (void)__builtin_cabsl(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
  // expected-note@-2 {{use function '__builtin_llabs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
}
Exemple #10
0
void test_int(int x) {
  (void)std::abs(x);

  (void)abs(x);
  (void)labs(x);
  (void)llabs(x);

  (void)fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
  (void)fabs(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
  (void)fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"

  (void)cabsf(x);
  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
  (void)cabs(x);
  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
  (void)cabsl(x);
  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"

  (void)__builtin_abs(x);
  (void)__builtin_labs(x);
  (void)__builtin_llabs(x);

  (void)__builtin_fabsf(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
  (void)__builtin_fabs(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
  (void)__builtin_fabsl(x);
  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"

  (void)__builtin_cabsf(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
  (void)__builtin_cabs(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
  (void)__builtin_cabsl(x);
  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
  // expected-note@-2 {{use function 'std::abs' instead}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
}
Exemple #11
0
/*:::::*/
FBCALL double fb_FIXDouble( double x )
{

	return __builtin_floorl( __builtin_fabsl( x ) ) * fb_SGNDouble( x );

}
Exemple #12
0
// CHECK-LABEL: define void @test_float_builtin_ops
void test_float_builtin_ops(float F, double D, long double LD) {
  volatile float resf;
  volatile double resd;
  volatile long double resld;

  resf = __builtin_fmodf(F,F);
  // CHECK: frem float

  resd = __builtin_fmod(D,D);
  // CHECK: frem double

  resld = __builtin_fmodl(LD,LD);
  // CHECK: frem x86_fp80

  resf = __builtin_fabsf(F);
  resd = __builtin_fabs(D);
  resld = __builtin_fabsl(LD);
  // CHECK: call float @llvm.fabs.f32(float
  // CHECK: call double @llvm.fabs.f64(double
  // CHECK: call x86_fp80 @llvm.fabs.f80(x86_fp80

  resf = __builtin_canonicalizef(F);
  resd = __builtin_canonicalize(D);
  resld = __builtin_canonicalizel(LD);
  // CHECK: call float @llvm.canonicalize.f32(float
  // CHECK: call double @llvm.canonicalize.f64(double
  // CHECK: call x86_fp80 @llvm.canonicalize.f80(x86_fp80

  resf = __builtin_fminf(F, F);
  // CHECK: call float @llvm.minnum.f32

  resd = __builtin_fmin(D, D);
  // CHECK: call double @llvm.minnum.f64

  resld = __builtin_fminl(LD, LD);
  // CHECK: call x86_fp80 @llvm.minnum.f80

  resf = __builtin_fmaxf(F, F);
  // CHECK: call float @llvm.maxnum.f32

  resd = __builtin_fmax(D, D);
  // CHECK: call double @llvm.maxnum.f64

  resld = __builtin_fmaxl(LD, LD);
  // CHECK: call x86_fp80 @llvm.maxnum.f80

  resf = __builtin_fabsf(F);
  // CHECK: call float @llvm.fabs.f32

  resd = __builtin_fabs(D);
  // CHECK: call double @llvm.fabs.f64

  resld = __builtin_fabsl(LD);
  // CHECK: call x86_fp80 @llvm.fabs.f80

  resf = __builtin_copysignf(F, F);
  // CHECK: call float @llvm.copysign.f32

  resd = __builtin_copysign(D, D);
  // CHECK: call double @llvm.copysign.f64

  resld = __builtin_copysignl(LD, LD);
  // CHECK: call x86_fp80 @llvm.copysign.f80


  resf = __builtin_ceilf(F);
  // CHECK: call float @llvm.ceil.f32

  resd = __builtin_ceil(D);
  // CHECK: call double @llvm.ceil.f64

  resld = __builtin_ceill(LD);
  // CHECK: call x86_fp80 @llvm.ceil.f80

  resf = __builtin_floorf(F);
  // CHECK: call float @llvm.floor.f32

  resd = __builtin_floor(D);
  // CHECK: call double @llvm.floor.f64

  resld = __builtin_floorl(LD);
  // CHECK: call x86_fp80 @llvm.floor.f80

  resf = __builtin_truncf(F);
  // CHECK: call float @llvm.trunc.f32

  resd = __builtin_trunc(D);
  // CHECK: call double @llvm.trunc.f64

  resld = __builtin_truncl(LD);
  // CHECK: call x86_fp80 @llvm.trunc.f80

  resf = __builtin_rintf(F);
  // CHECK: call float @llvm.rint.f32

  resd = __builtin_rint(D);
  // CHECK: call double @llvm.rint.f64

  resld = __builtin_rintl(LD);
  // CHECK: call x86_fp80 @llvm.rint.f80

  resf = __builtin_nearbyintf(F);
  // CHECK: call float @llvm.nearbyint.f32

  resd = __builtin_nearbyint(D);
  // CHECK: call double @llvm.nearbyint.f64

  resld = __builtin_nearbyintl(LD);
  // CHECK: call x86_fp80 @llvm.nearbyint.f80

  resf = __builtin_roundf(F);
  // CHECK: call float @llvm.round.f32

  resd = __builtin_round(D);
  // CHECK: call double @llvm.round.f64

  resld = __builtin_roundl(LD);
  // CHECK: call x86_fp80 @llvm.round.f80

}
long double __fabsl (long double x)
{
  return __builtin_fabsl (x);
}