add comparison functions for ARM

llvm-svn: 81597
This commit is contained in:
Nick Kledzik 2009-09-12 01:23:48 +00:00
parent 42c1287b68
commit 9130011d5f
36 changed files with 1328 additions and 0 deletions

View File

@ -0,0 +1,22 @@
//===------- bswapdi2 - Implement bswapdi2 ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern uint64_t __bswapdi2(uint64_t);
//
// Reverse all the bytes in a 64-bit integer.
//
.globl ___bswapdi2
___bswapdi2:
rev r2, r1 // reverse bytes in high 32-bits into temp2
rev r3, r0 // reverse bytes in low 32-bit into temp3
mov r0, r2 // set low 32-bits of result to temp2
mov r1, r3 // set high 32-bits of result to temp3
bx lr

View File

@ -0,0 +1,19 @@
//===------- bswapsi2 - Implement bswapsi2 ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern uint32_t __bswapsi2(uint32_t);
//
// Reverse all the bits in a 32-bit integer.
//
.globl ___bswapsi2
___bswapsi2:
rev r0, r0 // reverse bytes in parameter and put into result register
bx lr

View File

@ -0,0 +1,26 @@
//===-- eqdf2vfp.S - Implement eqdf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __eqdf2vfp(double a, double b);
//
// Returns one iff a == b and neither is NaN.
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___eqdf2vfp
___eqdf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
moveq r0, #1 // set result register to 1 if equal
movne r0, #0
bx lr

View File

@ -0,0 +1,27 @@
//===-- eqsf2vfp.S - Implement eqsf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __eqsf2vfp(float a, float b);
//
// Returns one iff a == b and neither is NaN.
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___eqsf2vfp
___eqsf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
moveq r0, #1 // set result register to 1 if equal
movne r0, #0
bx lr

View File

@ -0,0 +1,26 @@
//===-- gedf2vfp.S - Implement gedf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __gedf2vfp(double a, double b);
//
// Returns one iff a >= b and neither is NaN.
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___gedf2vfp
___gedf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
movge r0, #1 // set result register to 1 if greater than or equal
movlt r0, #0
bx lr

View File

@ -0,0 +1,27 @@
//===-- gesf2vfp.S - Implement gesf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __gesf2vfp(float a, float b);
//
// Returns one iff a >= b and neither is NaN.
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___gesf2vfp
___gesf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
movge r0, #1 // set result register to 1 if greater than or equal
movlt r0, #0
bx lr

View File

@ -0,0 +1,26 @@
//===-- gtdf2vfp.S - Implement gtdf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern double __gtdf2vfp(double a, double b);
//
// Returns one iff a > b and neither is NaN.
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___gtdf2vfp
___gtdf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
movgt r0, #1 // set result register to 1 if equal
movle r0, #0
bx lr

View File

@ -0,0 +1,27 @@
//===-- gtsf2vfp.S - Implement gtsf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __gtsf2vfp(float a, float b);
//
// Returns one iff a > b and neither is NaN.
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___gtsf2vfp
___gtsf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
movgt r0, #1 // set result register to 1 if equal
movle r0, #0
bx lr

View File

@ -0,0 +1,26 @@
//===-- ledf2vfp.S - Implement ledf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern double __ledf2vfp(double a, double b);
//
// Returns one iff a <= b and neither is NaN.
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___ledf2vfp
___ledf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
movls r0, #1 // set result register to 1 if equal
movhi r0, #0
bx lr

View File

@ -0,0 +1,27 @@
//===-- lesf2vfp.S - Implement lesf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __lesf2vfp(float a, float b);
//
// Returns one iff a <= b and neither is NaN.
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___lesf2vfp
___lesf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
movls r0, #1 // set result register to 1 if equal
movhi r0, #0
bx lr

View File

@ -0,0 +1,26 @@
//===-- ltdf2vfp.S - Implement ltdf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern double __ltdf2vfp(double a, double b);
//
// Returns one iff a < b and neither is NaN.
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___ltdf2vfp
___ltdf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
movmi r0, #1 // set result register to 1 if equal
movpl r0, #0
bx lr

View File

@ -0,0 +1,27 @@
//===-- ltsf2vfp.S - Implement ltsf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __ltsf2vfp(float a, float b);
//
// Returns one iff a < b and neither is NaN.
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___ltsf2vfp
___ltsf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
movmi r0, #1 // set result register to 1 if equal
movpl r0, #0
bx lr

View File

@ -0,0 +1,26 @@
//===-- nedf2vfp.S - Implement nedf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern double __nedf2vfp(double a, double b);
//
// Returns zero if a and b are unequal and neither is NaN.
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___nedf2vfp
___nedf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
movne r0, #1 // set result register to 0 if unequal
moveq r0, #0
bx lr

View File

@ -0,0 +1,20 @@
//===-- negdf2vfp.S - Implement negdf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern double __negdf2vfp(double a, double b);
//
// Returns the negation a double precision floating point numbers using the
// Darwin calling convention where double arguments are passsed in GPR pairs.
//
.globl ___negdf2vfp
___negdf2vfp:
eor r1, r1, #-2147483648 // flip sign bit on double in r0/r1 pair
bx lr

View File

@ -0,0 +1,20 @@
//===-- negsf2vfp.S - Implement negsf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern float __negsf2vfp(float a);
//
// Returns the negation of a single precision floating point numbers using the
// Darwin calling convention where single arguments are passsed like 32-bit ints
//
.globl ___negsf2vfp
___negsf2vfp:
eor r0, r0, #-2147483648 // flip sign bit on float in r0
bx lr

View File

@ -0,0 +1,27 @@
//===-- nesf2vfp.S - Implement nesf2vfp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __nesf2vfp(float a, float b);
//
// Returns one iff a != b and neither is NaN.
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___nesf2vfp
___nesf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
movne r0, #1 // set result register to 1 if unequal
moveq r0, #0
bx lr

View File

@ -0,0 +1,26 @@
//===-- unorddf2vfp.S - Implement unorddf2vfp ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __unorddf2vfp(double a, double b);
//
// Returns one iff a or b is NaN
// Uses Darwin calling convention where double precision arguments are passsed
// like in GPR pairs.
//
.globl ___unorddf2vfp
___unorddf2vfp:
fmdrr d6, r0, r1 // load r0/r1 pair in double register
fmdrr d7, r2, r3 // load r2/r3 pair in double register
fcmpd d6, d7
fmstat
movvs r0, #1 // set result register to 1 if "overflow" (any NaNs)
movvc r0, #0
bx lr

View File

@ -0,0 +1,27 @@
//===-- unordsf2vfp.S - Implement unordsf2vfp -----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// extern int __unordsf2vfp(float a, float b);
//
// Returns one iff a or b is NaN
// Uses Darwin calling convention where single precision arguments are passsed
// like 32-bit ints
//
.globl ___unordsf2vfp
___unordsf2vfp:
fmsr s14, r0 // move from GPR 0 to float register
fmsr s15, r1 // move from GPR 1 to float register
fcmps s14, s15
fmstat
movvs r0, #1 // set result register to 1 if "overflow" (any NaNs)
movvc r0, #0
bx lr

View File

@ -0,0 +1,42 @@
//===-- bswapdi2_test.c - Test __bswapdi2 ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __bswapdi2 for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern uint64_t __bswapdi2(uint64_t);
#if __arm__
int test__bswapdi2(uint64_t a, uint64_t expected)
{
uint64_t actual = __bswapdi2(a);
if (actual != expected)
printf("error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\n",
a, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__bswapdi2(0x123456789ABCDEF0LL, 0xF0DEBC9A78563412LL))
return 1;
if (test__bswapdi2(0x0000000100000002LL, 0x0200000001000000LL))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,42 @@
//===-- bswapsi2_test.c - Test __bswapsi2 ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __bswapsi2 for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern uint32_t __bswapsi2(uint32_t);
#if __arm__
int test__bswapsi2(uint32_t a, uint32_t expected)
{
uint32_t actual = __bswapsi2(a);
if (actual != expected)
printf("error in test__bswapsi2(0x%0X) = 0x%0X, expected 0x%0X\n",
a, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__bswapsi2(0x12345678, 0x78563412))
return 1;
if (test__bswapsi2(0x00000001, 0x01000000))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,53 @@
//===-- eqdf2vfp_test.c - Test __eqdf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __eqdf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __eqdf2vfp(double a, double b);
#if __arm__
int test__eqdf2vfp(double a, double b)
{
int actual = __eqdf2vfp(a, b);
int expected = (a == b) ? 1 : 0;
if (actual != expected)
printf("error in __eqdf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__eqdf2vfp(0.0, 0.0))
return 1;
if (test__eqdf2vfp(1.0, 1.0))
return 1;
if (test__eqdf2vfp(0.0, 1.0))
return 1;
if (test__eqdf2vfp(-1.0, -1.0))
return 1;
if (test__eqdf2vfp(-1.0, 0.0))
return 1;
if (test__eqdf2vfp(HUGE_VAL, 1.0))
return 1;
if (test__eqdf2vfp(1.0, HUGE_VAL))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,49 @@
//===-- eqsf2vfp_test.c - Test __eqsf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __eqsf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __eqsf2vfp(float a, float b);
#if __arm__
int test__eqsf2vfp(float a, float b)
{
int actual = __eqsf2vfp(a, b);
int expected = (a == b) ? 1 : 0;
if (actual != expected)
printf("error in __eqsf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__eqsf2vfp(0.0, 0.0))
return 1;
if (test__eqsf2vfp(1.0, 1.0))
return 1;
if (test__eqsf2vfp(-1.0, -1.0))
return 1;
if (test__eqsf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__eqsf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- gedf2vfp_test.c - Test __gedf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __gedf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __gedf2vfp(double a, double b);
#if __arm__
int test__gedf2vfp(double a, double b)
{
int actual = __gedf2vfp(a, b);
int expected = (a >= b) ? 1 : 0;
if (actual != expected)
printf("error in __gedf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__gedf2vfp(0.0, 0.0))
return 1;
if (test__gedf2vfp(1.0, 0.0))
return 1;
if (test__gedf2vfp(-1.0, -2.0))
return 1;
if (test__gedf2vfp(-2.0, -1.0))
return 1;
if (test__gedf2vfp(HUGE_VAL, 1.0))
return 1;
if (test__gedf2vfp(1.0, HUGE_VAL))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- gesf2vfp_test.c - Test __gesf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __gesf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __gesf2vfp(float a, float b);
#if __arm__
int test__gesf2vfp(float a, float b)
{
int actual = __gesf2vfp(a, b);
int expected = (a >= b) ? 1 : 0;
if (actual != expected)
printf("error in __gesf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__gesf2vfp(0.0, 0.0))
return 1;
if (test__gesf2vfp(1.1, 1.0))
return 1;
if (test__gesf2vfp(-1.0, -2.0))
return 1;
if (test__gesf2vfp(-2.0, -1.0))
return 1;
if (test__gesf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__gesf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- gtdf2vfp_test.c - Test __gtdf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __gtdf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __gtdf2vfp(double a, double b);
#if __arm__
int test__gtdf2vfp(double a, double b)
{
int actual = __gtdf2vfp(a, b);
int expected = (a > b) ? 1 : 0;
if (actual != expected)
printf("error in __gtdf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__gtdf2vfp(0.0, 0.0))
return 1;
if (test__gtdf2vfp(1.0, 0.0))
return 1;
if (test__gtdf2vfp(-1.0, -2.0))
return 1;
if (test__gtdf2vfp(-2.0, -1.0))
return 1;
if (test__gtdf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__gtdf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- gtsf2vfp_test.c - Test __gtsf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __gtsf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __gtsf2vfp(float a, float b);
#if __arm__
int test__gtsf2vfp(float a, float b)
{
int actual = __gtsf2vfp(a, b);
int expected = (a > b) ? 1 : 0;
if (actual != expected)
printf("error in __gtsf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__gtsf2vfp(0.0, 0.0))
return 1;
if (test__gtsf2vfp(1.0, 0.0))
return 1;
if (test__gtsf2vfp(-1.0, -2.0))
return 1;
if (test__gtsf2vfp(-2.0, -1.0))
return 1;
if (test__gtsf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__gtsf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- ledf2vfp_test.c - Test __ledf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __ledf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __ledf2vfp(double a, double b);
#if __arm__
int test__ledf2vfp(double a, double b)
{
int actual = __ledf2vfp(a, b);
int expected = (a <= b) ? 1 : 0;
if (actual != expected)
printf("error in __ledf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__ledf2vfp(0.0, 0.0))
return 1;
if (test__ledf2vfp(1.0, 1.0))
return 1;
if (test__ledf2vfp(-1.0, -2.0))
return 1;
if (test__ledf2vfp(-2.0, -1.0))
return 1;
if (test__ledf2vfp(HUGE_VAL, 1.0))
return 1;
if (test__ledf2vfp(1.0, HUGE_VAL))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- lesf2vfp_test.c - Test __lesf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __lesf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __lesf2vfp(float a, float b);
#if __arm__
int test__lesf2vfp(float a, float b)
{
int actual = __lesf2vfp(a, b);
int expected = (a <= b) ? 1 : 0;
if (actual != expected)
printf("error in __lesf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__lesf2vfp(0.0, 0.0))
return 1;
if (test__lesf2vfp(1.0, 1.0))
return 1;
if (test__lesf2vfp(-1.0, -2.0))
return 1;
if (test__lesf2vfp(-2.0, -1.0))
return 1;
if (test__lesf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__lesf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,49 @@
//===-- ltdf2vfp_test.c - Test __ltdf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __ltdf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __ltdf2vfp(double a, double b);
#if __arm__
int test__ltdf2vfp(double a, double b)
{
int actual = __ltdf2vfp(a, b);
int expected = (a < b) ? 1 : 0;
if (actual != expected)
printf("error in __ltdf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__ltdf2vfp(0.0, 0.0))
return 1;
if (test__ltdf2vfp(1.0, 1.0))
return 1;
if (test__ltdf2vfp(-1.0, -1.0))
return 1;
if (test__ltdf2vfp(HUGE_VAL, 1.0))
return 1;
if (test__ltdf2vfp(1.0, HUGE_VAL))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,51 @@
//===-- ltsf2vfp_test.c - Test __ltsf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __ltsf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __ltsf2vfp(float a, float b);
#if __arm__
int test__ltsf2vfp(float a, float b)
{
int actual = __ltsf2vfp(a, b);
int expected = (a < b) ? 1 : 0;
if (actual != expected)
printf("error in __ltsf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__ltsf2vfp(0.0, 0.0))
return 1;
if (test__ltsf2vfp(-1.0, 1.0))
return 1;
if (test__ltsf2vfp(-1.0, -2.0))
return 1;
if (test__ltsf2vfp(-2.0, -1.0))
return 1;
if (test__ltsf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__ltsf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,49 @@
//===-- nedf2vfp_test.c - Test __nedf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __nedf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __nedf2vfp(double a, double b);
#if __arm__
int test__nedf2vfp(double a, double b)
{
int actual = __nedf2vfp(a, b);
int expected = (a != b) ? 1 : 0;
if (actual != expected)
printf("error in __nedf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__nedf2vfp(0.0, 0.0))
return 1;
if (test__nedf2vfp(1.0, 1.0))
return 1;
if (test__nedf2vfp(-1.0, -1.0))
return 1;
if (test__nedf2vfp(HUGE_VAL, 1.0))
return 1;
if (test__nedf2vfp(1.0, HUGE_VAL))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,46 @@
//===-- negdf2vfp_test.c - Test __negdf2vfp -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __negdf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
extern double __negdf2vfp(double a);
#if __arm__
int test__negdf2vfp(double a)
{
double actual = __negdf2vfp(a);
double expected = -a;
if (actual != expected)
printf("error in test__negdf2vfp(%f) = %f, expected %f\n",
a, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__negdf2vfp(1.0))
return 1;
if (test__negdf2vfp(HUGE_VALF))
return 1;
if (test__negdf2vfp(0.0))
return 1;
if (test__negdf2vfp(-1.0))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,46 @@
//===-- negsf2vfp_test.c - Test __negsf2vfp -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __negsf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
extern float __negsf2vfp(float a);
#if __arm__
int test__negsf2vfp(float a)
{
float actual = __negsf2vfp(a);
float expected = -a;
if (actual != expected)
printf("error in test__negsf2vfp(%f) = %f, expected %f\n",
a, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__negsf2vfp(1.0))
return 1;
if (test__negsf2vfp(HUGE_VALF))
return 1;
if (test__negsf2vfp(0.0))
return 1;
if (test__negsf2vfp(-1.0))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,49 @@
//===-- nesf2vfp_test.c - Test __nesf2vfp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __nesf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __nesf2vfp(float a, float b);
#if __arm__
int test__nesf2vfp(float a, float b)
{
int actual = __nesf2vfp(a, b);
int expected = (a != b) ? 1 : 0;
if (actual != expected)
printf("error in __nesf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__nesf2vfp(0.0, 0.0))
return 1;
if (test__nesf2vfp(1.0, 1.0))
return 1;
if (test__nesf2vfp(-1.0, -1.0))
return 1;
if (test__nesf2vfp(HUGE_VALF, 1.0))
return 1;
if (test__nesf2vfp(1.0, HUGE_VALF))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,47 @@
//===-- unorddf2vfp_test.c - Test __unorddf2vfp ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __unorddf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __unorddf2vfp(double a, double b);
#if __arm__
int test__unorddf2vfp(double a, double b)
{
int actual = __unorddf2vfp(a, b);
int expected = (isnan(a) || isnan(b)) ? 1 : 0;
if (actual != expected)
printf("error in __unorddf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__unorddf2vfp(0.0, NAN))
return 1;
if (test__unorddf2vfp(NAN, 1.0))
return 1;
if (test__unorddf2vfp(NAN, NAN))
return 1;
if (test__unorddf2vfp(1.0, 1.0))
return 1;
#endif
return 0;
}

View File

@ -0,0 +1,47 @@
//===-- unordsf2vfp_test.c - Test __unordsf2vfp ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __unordsf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __unordsf2vfp(float a, float b);
#if __arm__
int test__unordsf2vfp(float a, float b)
{
int actual = __unordsf2vfp(a, b);
int expected = (isnan(a) || isnan(b)) ? 1 : 0;
if (actual != expected)
printf("error in __unordsf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__unordsf2vfp(0.0, NAN))
return 1;
if (test__unordsf2vfp(NAN, 1.0))
return 1;
if (test__unordsf2vfp(NAN, NAN))
return 1;
if (test__unordsf2vfp(1.0, 1.0))
return 1;
#endif
return 0;
}