[llvm-commits] [compiler-rt] r81809 - in /compiler-rt/trunk: lib/arm/ test/Unit/
Nick Kledzik
kledzik at apple.com
Mon Sep 14 16:26:56 PDT 2009
Author: kledzik
Date: Mon Sep 14 18:26:56 2009
New Revision: 81809
URL: http://llvm.org/viewvc/llvm-project?rev=81809&view=rev
Log:
add conversion functions and test cases for ARM
Added:
compiler-rt/trunk/lib/arm/extendsfdf2vfp.S
compiler-rt/trunk/lib/arm/fixdfsivfp.S
compiler-rt/trunk/lib/arm/fixsfsivfp.S
compiler-rt/trunk/lib/arm/fixunsdfsivfp.S
compiler-rt/trunk/lib/arm/fixunssfsivfp.S
compiler-rt/trunk/lib/arm/floatsidfvfp.S
compiler-rt/trunk/lib/arm/floatsisfvfp.S
compiler-rt/trunk/lib/arm/floatunssidfvfp.S
compiler-rt/trunk/lib/arm/floatunssisfvfp.S
compiler-rt/trunk/lib/arm/truncdfsf2vfp.S
compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c
compiler-rt/trunk/test/Unit/fixdfsivfp_test.c
compiler-rt/trunk/test/Unit/fixsfsivfp_test.c
compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c
compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c
compiler-rt/trunk/test/Unit/floatsidfvfp_test.c
compiler-rt/trunk/test/Unit/floatsisfvfp_test.c
compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c
compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c
compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c
Added: compiler-rt/trunk/lib/arm/extendsfdf2vfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/extendsfdf2vfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/extendsfdf2vfp.S (added)
+++ compiler-rt/trunk/lib/arm/extendsfdf2vfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- extendsfdf2vfp.S - Implement extendsfdf2vfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern double __extendsfdf2vfp(float a);
+//
+// Converts single precision float to double precision result.
+// Uses Darwin calling convention where a single precision parameter is
+// passed in a GPR and a double precision result is returned in R0/R1 pair.
+//
+ .globl ___extendsfdf2vfp
+___extendsfdf2vfp:
+ fmsr s15, r0 // load float register from R0
+ fcvtds d7, s15 // convert single to double
+ fmrrd r0, r1, d7 // return result in r0/r1 pair
+ bx lr
Added: compiler-rt/trunk/lib/arm/fixdfsivfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixdfsivfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/fixdfsivfp.S (added)
+++ compiler-rt/trunk/lib/arm/fixdfsivfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- fixdfsivfp.S - Implement fixdfsivfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern int __fixdfsivfp(double a);
+//
+// Converts double precision float to a 32-bit int rounding towards zero.
+// Uses Darwin calling convention where a double precision parameter is
+// passed in GPR register pair.
+//
+ .globl ___fixdfsivfp
+___fixdfsivfp:
+ fmdrr d7, r0, r1 // load double register from R0/R1
+ ftosizd s15, d7 // convert double to 32-bit int into s15
+ fmrs r0, s15 // move s15 to result register
+ bx lr
Added: compiler-rt/trunk/lib/arm/fixsfsivfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixsfsivfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/fixsfsivfp.S (added)
+++ compiler-rt/trunk/lib/arm/fixsfsivfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- fixsfsivfp.S - Implement fixsfsivfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern int __fixsfsivfp(float a);
+//
+// Converts single precision float to a 32-bit int rounding towards zero.
+// Uses Darwin calling convention where a single precision parameter is
+// passed in a GPR..
+//
+ .globl ___fixsfsivfp
+___fixsfsivfp:
+ fmsr s15, r0 // load float register from R0
+ ftosizs s15, s15 // convert single to 32-bit int into s15
+ fmrs r0, s15 // move s15 to result register
+ bx lr
Added: compiler-rt/trunk/lib/arm/fixunsdfsivfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixunsdfsivfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/fixunsdfsivfp.S (added)
+++ compiler-rt/trunk/lib/arm/fixunsdfsivfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,24 @@
+//===-- fixunsdfsivfp.S - Implement fixunsdfsivfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern unsigned int __fixunsdfsivfp(double a);
+//
+// Converts double precision float to a 32-bit unsigned int rounding towards
+// zero. All negative values become zero.
+// Uses Darwin calling convention where a double precision parameter is
+// passed in GPR register pair.
+//
+ .globl ___fixunsdfsivfp
+___fixunsdfsivfp:
+ fmdrr d7, r0, r1 // load double register from R0/R1
+ ftouizd s15, d7 // convert double to 32-bit int into s15
+ fmrs r0, s15 // move s15 to result register
+ bx lr
Added: compiler-rt/trunk/lib/arm/fixunssfsivfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/fixunssfsivfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/fixunssfsivfp.S (added)
+++ compiler-rt/trunk/lib/arm/fixunssfsivfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,24 @@
+//===-- fixunssfsivfp.S - Implement fixunssfsivfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern unsigned int __fixunssfsivfp(float a);
+//
+// Converts single precision float to a 32-bit unsigned int rounding towards
+// zero. All negative values become zero.
+// Uses Darwin calling convention where a single precision parameter is
+// passed in a GPR..
+//
+ .globl ___fixunssfsivfp
+___fixunssfsivfp:
+ fmsr s15, r0 // load float register from R0
+ ftouizs s15, s15 // convert single to 32-bit unsigned into s15
+ fmrs r0, s15 // move s15 to result register
+ bx lr
Added: compiler-rt/trunk/lib/arm/floatsidfvfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatsidfvfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/floatsidfvfp.S (added)
+++ compiler-rt/trunk/lib/arm/floatsidfvfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- floatsidfvfp.S - Implement floatsidfvfp ---------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern double __floatsidfvfp(int a);
+//
+// Converts a 32-bit int to a double precision float.
+// Uses Darwin calling convention where a double precision result is
+// return in GPR register pair.
+//
+ .globl ___floatsidfvfp
+___floatsidfvfp:
+ fmsr s15, r0 // move int to float register s15
+ fsitod d7, s15 // convert 32-bit int in s15 to double in d7
+ fmrrd r0, r1, d7 // move d7 to result register pair r0/r1
+ bx lr
Added: compiler-rt/trunk/lib/arm/floatsisfvfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatsisfvfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/floatsisfvfp.S (added)
+++ compiler-rt/trunk/lib/arm/floatsisfvfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- floatsisfvfp.S - Implement floatsisfvfp ---------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern float __floatsisfvfp(int a);
+//
+// Converts single precision float to a 32-bit int rounding towards zero.
+// Uses Darwin calling convention where a single precision result is
+// return in a GPR..
+//
+ .globl ___floatsisfvfp
+___floatsisfvfp:
+ fmsr s15, r0 // move int to float register s15
+ fsitos s15, s15 // convert 32-bit int in s15 to float in s15
+ fmrs r0, s15 // move s15 to result register
+ bx lr
Added: compiler-rt/trunk/lib/arm/floatunssidfvfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatunssidfvfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/floatunssidfvfp.S (added)
+++ compiler-rt/trunk/lib/arm/floatunssidfvfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- floatunssidfvfp.S - Implement floatunssidfvfp ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern double __floatunssidfvfp(unsigned int a);
+//
+// Converts a 32-bit int to a double precision float.
+// Uses Darwin calling convention where a double precision result is
+// return in GPR register pair.
+//
+ .globl ___floatunssidfvfp
+___floatunssidfvfp:
+ fmsr s15, r0 // move int to float register s15
+ fuitod d7, s15 // convert 32-bit int in s15 to double in d7
+ fmrrd r0, r1, d7 // move d7 to result register pair r0/r1
+ bx lr
Added: compiler-rt/trunk/lib/arm/floatunssisfvfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/floatunssisfvfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/floatunssisfvfp.S (added)
+++ compiler-rt/trunk/lib/arm/floatunssisfvfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- floatunssisfvfp.S - Implement floatunssisfvfp ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern float __floatunssisfvfp(unsigned int a);
+//
+// Converts single precision float to a 32-bit int rounding towards zero.
+// Uses Darwin calling convention where a single precision result is
+// return in a GPR..
+//
+ .globl ___floatunssisfvfp
+___floatunssisfvfp:
+ fmsr s15, r0 // move int to float register s15
+ fuitos s15, s15 // convert 32-bit int in s15 to float in s15
+ fmrs r0, s15 // move s15 to result register
+ bx lr
Added: compiler-rt/trunk/lib/arm/truncdfsf2vfp.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/truncdfsf2vfp.S?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/truncdfsf2vfp.S (added)
+++ compiler-rt/trunk/lib/arm/truncdfsf2vfp.S Mon Sep 14 18:26:56 2009
@@ -0,0 +1,23 @@
+//===-- truncdfsf2vfp.S - Implement truncdfsf2vfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+//
+// extern float __truncdfsf2vfp(double a);
+//
+// Converts double precision float to signle precision result.
+// Uses Darwin calling convention where a double precision parameter is
+// passed in a R0/R1 pair and a signle precision result is returned in R0.
+//
+ .globl ___truncdfsf2vfp
+___truncdfsf2vfp:
+ fmdrr d7, r0, r1 // load double from r0/r1 pair
+ fcvtsd s15, d7 // convert double to single (trucate precision)
+ fmrs r0, s15 // return result in r0
+ bx lr
Added: compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/extebdsfdf2vfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,46 @@
+//===-- extendsfdf2vfp_test.c - Test __extendsfdf2vfp ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __extendsfdf2vfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern double __extendsfdf2vfp(float a);
+
+#if __arm__
+int test__extendsfdf2vfp(float a)
+{
+ double actual = __extendsfdf2vfp(a);
+ double expected = a;
+ if (actual != expected)
+ printf("error in test__extendsfdf2vfp(%f) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__extendsfdf2vfp(0.0))
+ return 1;
+ if (test__extendsfdf2vfp(1.0))
+ return 1;
+ if (test__extendsfdf2vfp(-1.0))
+ return 1;
+ if (test__extendsfdf2vfp(3.1415926535))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/fixdfsivfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixdfsivfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/fixdfsivfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/fixdfsivfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- fixdfsivfp_test.c - Test __fixdfsivfp -----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixdfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern int __fixdfsivfp(double a);
+
+#if __arm__
+int test__fixdfsivfp(double a)
+{
+ int actual = __fixdfsivfp(a);
+ int expected = a;
+ if (actual != expected)
+ printf("error in test__fixdfsivfp(%f) = %d, expected %d\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixdfsivfp(0.0))
+ return 1;
+ if (test__fixdfsivfp(1.0))
+ return 1;
+ if (test__fixdfsivfp(-1.0))
+ return 1;
+ if (test__fixdfsivfp(2147483647))
+ return 1;
+ if (test__fixdfsivfp(-2147483648.0))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/fixsfsivfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixsfsivfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/fixsfsivfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/fixsfsivfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,50 @@
+//===-- fixsfsivfp_test.c - Test __fixsfsivfp -----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixsfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern int __fixsfsivfp(float a);
+
+#if __arm__
+int test__fixsfsivfp(float a)
+{
+ int actual = __fixsfsivfp(a);
+ int expected = a;
+ if (actual != expected)
+ printf("error in test__fixsfsivfp(%f) = %u, expected %u\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixsfsivfp(0.0))
+ return 1;
+ if (test__fixsfsivfp(1.0))
+ return 1;
+ if (test__fixsfsivfp(-1.0))
+ return 1;
+ if (test__fixsfsivfp(2147483647.0))
+ return 1;
+ if (test__fixsfsivfp(-2147483648.0))
+ return 1;
+ if (test__fixsfsivfp(65536.0))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/fixunsdfsivfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- fixunsdfsivfp_test.c - Test __fixunsdfsivfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixunsdfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern unsigned int __fixunsdfsivfp(double a);
+
+#if __arm__
+int test__fixunsdfsivfp(double a)
+{
+ unsigned int actual = __fixunsdfsivfp(a);
+ unsigned int expected = a;
+ if (actual != expected)
+ printf("error in test__fixunsdfsivfp(%f) = %u, expected %u\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixunsdfsivfp(0.0))
+ return 1;
+ if (test__fixunsdfsivfp(1.0))
+ return 1;
+ if (test__fixunsdfsivfp(-1.0))
+ return 1;
+ if (test__fixunsdfsivfp(4294967295.0))
+ return 1;
+ if (test__fixunsdfsivfp(65536.0))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/fixunssfsivfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- fixunssfsivfp_test.c - Test __fixunssfsivfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixunssfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern unsigned int __fixunssfsivfp(float a);
+
+#if __arm__
+int test__fixunssfsivfp(float a)
+{
+ unsigned int actual = __fixunssfsivfp(a);
+ unsigned int expected = a;
+ if (actual != expected)
+ printf("error in test__fixunssfsivfp(%f) = %u, expected %u\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixunssfsivfp(0.0))
+ return 1;
+ if (test__fixunssfsivfp(1.0))
+ return 1;
+ if (test__fixunssfsivfp(-1.0))
+ return 1;
+ if (test__fixunssfsivfp(4294967295.0))
+ return 1;
+ if (test__fixunssfsivfp(65536.0))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/floatsidfvfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatsidfvfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/floatsidfvfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/floatsidfvfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- floatsidfvfp_test.c - Test __floatsidfvfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatsidfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern double __floatsidfvfp(int a);
+
+#if __arm__
+int test__floatsidfvfp(int a)
+{
+ double actual = __floatsidfvfp(a);
+ double expected = a;
+ if (actual != expected)
+ printf("error in test__ floatsidfvfp(%d) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatsidfvfp(0))
+ return 1;
+ if (test__floatsidfvfp(1))
+ return 1;
+ if (test__floatsidfvfp(-1))
+ return 1;
+ if (test__floatsidfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatsidfvfp(0x80000000))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/floatsisfvfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatsisfvfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/floatsisfvfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/floatsisfvfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- floatsisfvfp_test.c - Test __floatsisfvfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatsisfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern float __floatsisfvfp(int a);
+
+#if __arm__
+int test__floatsisfvfp(int a)
+{
+ float actual = __floatsisfvfp(a);
+ float expected = a;
+ if (actual != expected)
+ printf("error in test__floatsisfvfp(%d) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatsisfvfp(0))
+ return 1;
+ if (test__floatsisfvfp(1))
+ return 1;
+ if (test__floatsisfvfp(-1))
+ return 1;
+ if (test__floatsisfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatsisfvfp(0x80000000))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/floatunssidfvfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatunssidfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern double __floatunssidfvfp(unsigned int a);
+
+#if __arm__
+int test__floatunssidfvfp(unsigned int a)
+{
+ double actual = __floatunssidfvfp(a);
+ double expected = a;
+ if (actual != expected)
+ printf("error in test__floatunssidfvfp(%u) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatunssidfvfp(0))
+ return 1;
+ if (test__floatunssidfvfp(1))
+ return 1;
+ if (test__floatunssidfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatunssidfvfp(0x80000000))
+ return 1;
+ if (test__floatunssidfvfp(0xFFFFFFFF))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/floatunssisfvfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- floatunssisfvfp_test.c - Test __floatunssisfvfp -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatunssisfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern float __floatunssisfvfp(unsigned int a);
+
+#if __arm__
+int test__floatunssisfvfp(unsigned int a)
+{
+ float actual = __floatunssisfvfp(a);
+ float expected = a;
+ if (actual != expected)
+ printf("error in test__floatunssisfvfp(%u) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatunssisfvfp(0))
+ return 1;
+ if (test__floatunssisfvfp(1))
+ return 1;
+ if (test__floatunssisfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatunssisfvfp(0x80000000))
+ return 1;
+ if (test__floatunssisfvfp(0xFFFFFFFF))
+ return 1;
+#endif
+ return 0;
+}
Added: compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c?rev=81809&view=auto
==============================================================================
--- compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c (added)
+++ compiler-rt/trunk/test/Unit/truncdfsf2vfp_test.c Mon Sep 14 18:26:56 2009
@@ -0,0 +1,48 @@
+//===-- truncdfsf2vfp_test.c - Test __truncdfsf2vfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __truncdfsf2vfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern float __truncdfsf2vfp(double a);
+
+#if __arm__
+int test__truncdfsf2vfp(double a)
+{
+ float actual = __truncdfsf2vfp(a);
+ float expected = a;
+ if (actual != expected)
+ printf("error in test__truncdfsf2vfp(%f) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__truncdfsf2vfp(0.0))
+ return 1;
+ if (test__truncdfsf2vfp(1.0))
+ return 1;
+ if (test__truncdfsf2vfp(-1.0))
+ return 1;
+ if (test__truncdfsf2vfp(3.1415926535))
+ return 1;
+ if (test__truncdfsf2vfp(123.456))
+ return 1;
+#endif
+ return 0;
+}
More information about the llvm-commits
mailing list