[llvm-commits] [compiler-rt] r78403 - in /compiler-rt/trunk: ./ lib/
Edward O'Callaghan
eocallaghan at auroraux.org
Fri Aug 7 13:30:10 PDT 2009
Author: evocallaghan
Date: Fri Aug 7 15:30:09 2009
New Revision: 78403
URL: http://llvm.org/viewvc/llvm-project?rev=78403&view=rev
Log:
Code style and Readability fixes. Credit to Craig van Vliet.
Modified:
compiler-rt/trunk/CREDITS.TXT
compiler-rt/trunk/lib/absvdi2.c
compiler-rt/trunk/lib/absvsi2.c
compiler-rt/trunk/lib/absvti2.c
compiler-rt/trunk/lib/addvdi3.c
compiler-rt/trunk/lib/addvsi3.c
compiler-rt/trunk/lib/apple_versioning.c
compiler-rt/trunk/lib/ashldi3.c
compiler-rt/trunk/lib/ashlti3.c
compiler-rt/trunk/lib/ashrdi3.c
compiler-rt/trunk/lib/cmpdi2.c
compiler-rt/trunk/lib/cmpti2.c
compiler-rt/trunk/lib/ctzdi2.c
compiler-rt/trunk/lib/ctzsi2.c
compiler-rt/trunk/lib/divdc3.c
compiler-rt/trunk/lib/divdi3.c
compiler-rt/trunk/lib/divsc3.c
compiler-rt/trunk/lib/divsi3.c
compiler-rt/trunk/lib/divxc3.c
compiler-rt/trunk/lib/fixdfdi.c
compiler-rt/trunk/lib/fixdfti.c
compiler-rt/trunk/lib/fixsfdi.c
compiler-rt/trunk/lib/fixunssfti.c
compiler-rt/trunk/lib/floatdidf.c
compiler-rt/trunk/lib/floatdisf.c
compiler-rt/trunk/lib/floatdixf.c
compiler-rt/trunk/lib/floattidf.c
compiler-rt/trunk/lib/floattisf.c
compiler-rt/trunk/lib/floattixf.c
compiler-rt/trunk/lib/floatundidf.c
compiler-rt/trunk/lib/floatundisf.c
compiler-rt/trunk/lib/floatundixf.c
compiler-rt/trunk/lib/moddi3.c
compiler-rt/trunk/lib/modsi3.c
compiler-rt/trunk/lib/modti3.c
compiler-rt/trunk/lib/muldc3.c
compiler-rt/trunk/lib/muldi3.c
compiler-rt/trunk/lib/mulsc3.c
compiler-rt/trunk/lib/multi3.c
compiler-rt/trunk/lib/mulvdi3.c
compiler-rt/trunk/lib/negvti2.c
compiler-rt/trunk/lib/paritydi2.c
compiler-rt/trunk/lib/paritysi2.c
compiler-rt/trunk/lib/parityti2.c
compiler-rt/trunk/lib/popcountsi2.c
compiler-rt/trunk/lib/popcountti2.c
compiler-rt/trunk/lib/powisf2.c
compiler-rt/trunk/lib/ucmpdi2.c
compiler-rt/trunk/lib/udivdi3.c
compiler-rt/trunk/lib/udivmoddi4.c
compiler-rt/trunk/lib/udivmodti4.c
compiler-rt/trunk/lib/udivsi3.c
compiler-rt/trunk/lib/udivti3.c
compiler-rt/trunk/lib/umoddi3.c
compiler-rt/trunk/lib/umodsi3.c
Modified: compiler-rt/trunk/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CREDITS.TXT?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/CREDITS.TXT (original)
+++ compiler-rt/trunk/CREDITS.TXT Fri Aug 7 15:30:09 2009
@@ -8,6 +8,11 @@
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
+N: Craig van Vliet
+E: cvanvliet at auroraux.org
+W: http://www.auroraux.org
+D: Code style and Readability fixes.
+
N: Edward O'Callaghan
E: eocallaghan at auroraux.org
W: http://www.auroraux.org
Modified: compiler-rt/trunk/lib/absvdi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/absvdi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/absvdi2.c (original)
+++ compiler-rt/trunk/lib/absvdi2.c Fri Aug 7 15:30:09 2009
@@ -1,22 +1,23 @@
-//===-- absvdi2.c - Implement __absvdi2 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __absvdi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- absvdi2.c - Implement __absvdi2 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===
+ *
+ * This file implements __absvdi2 for the compiler_rt library.
+ *
+ *===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <stdlib.h>
-// Returns: absolute value
+/* Returns: absolute value */
-// Effects: aborts if abs(x) < 0
+/* Effects: aborts if abs(x) < 0 */
di_int
__absvdi2(di_int a)
Modified: compiler-rt/trunk/lib/absvsi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/absvsi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/absvsi2.c (original)
+++ compiler-rt/trunk/lib/absvsi2.c Fri Aug 7 15:30:09 2009
@@ -1,22 +1,23 @@
-//===-- absvsi2.c - Implement __absvsi2 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __absvsi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- absvsi2.c - Implement __absvsi2 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __absvsi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <stdlib.h>
-// Returns: absolute value
+/* Returns: absolute value */
-// Effects: aborts if abs(x) < 0
+/* Effects: aborts if abs(x) < 0 */
si_int
__absvsi2(si_int a)
Modified: compiler-rt/trunk/lib/absvti2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/absvti2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/absvti2.c (original)
+++ compiler-rt/trunk/lib/absvti2.c Fri Aug 7 15:30:09 2009
@@ -1,24 +1,25 @@
-//===-- absvti2.c - Implement __absvdi2 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __absvti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- absvti2.c - Implement __absvdi2 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __absvti2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <stdlib.h>
-// Returns: absolute value
+/* Returns: absolute value */
-// Effects: aborts if abs(x) < 0
+/* Effects: aborts if abs(x) < 0 */
ti_int
__absvti2(ti_int a)
Modified: compiler-rt/trunk/lib/addvdi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/addvdi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/addvdi3.c (original)
+++ compiler-rt/trunk/lib/addvdi3.c Fri Aug 7 15:30:09 2009
@@ -1,22 +1,23 @@
-//===-- addvdi3.c - Implement __addvdi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __addvdi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- addvdi3.c - Implement __addvdi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __addvdi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <stdlib.h>
-// Returns: a + b
+/* Returns: a + b */
-// Effects: aborts if a + b overflows
+/* Effects: aborts if a + b overflows */
di_int
__addvdi3(di_int a, di_int b)
Modified: compiler-rt/trunk/lib/addvsi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/addvsi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/addvsi3.c (original)
+++ compiler-rt/trunk/lib/addvsi3.c Fri Aug 7 15:30:09 2009
@@ -1,22 +1,23 @@
-//===-- addvsi3.c - Implement __addvsi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __addvsi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- addvsi3.c - Implement __addvsi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __addvsi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <stdlib.h>
-// Returns: a + b
+/* Returns: a + b */
-// Effects: aborts if a + b overflows
+/* Effects: aborts if a + b overflows */
si_int
__addvsi3(si_int a, si_int b)
Modified: compiler-rt/trunk/lib/apple_versioning.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/apple_versioning.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/apple_versioning.c (original)
+++ compiler-rt/trunk/lib/apple_versioning.c Fri Aug 7 15:30:09 2009
@@ -1,12 +1,12 @@
-//===-- apple_versioning.c - Adds versioning symbols for ld ---------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
+/* ===-- apple_versioning.c - Adds versioning symbols for ld ---------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ */
@@ -28,10 +28,9 @@
#endif
-//
-// Symbols in libSystem.dylib in 10.6 and later,
-// but are in libgcc_s.dylib in earlier versions
-//
+/* Symbols in libSystem.dylib in 10.6 and later,
+ * but are in libgcc_s.dylib in earlier versions
+ */
NOT_HERE_BEFORE_10_6(__absvdi2)
NOT_HERE_BEFORE_10_6(__absvsi2)
NOT_HERE_BEFORE_10_6(__absvti2)
@@ -142,5 +141,5 @@
#endif
-#endif // __APPLE__
+#endif /* __APPLE__*/
Modified: compiler-rt/trunk/lib/ashldi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ashldi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ashldi3.c (original)
+++ compiler-rt/trunk/lib/ashldi3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- ashldi3.c - Implement __ashldi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ashldi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ====-- ashldi3.c - Implement __ashldi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ashldi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a << b
+/* Returns: a << b */
-// Precondition: 0 <= b < bits_in_dword
+/* Precondition: 0 <= b < bits_in_dword */
di_int
__ashldi3(di_int a, si_int b)
@@ -24,12 +25,12 @@
dwords input;
dwords result;
input.all = a;
- if (b & bits_in_word) // bits_in_word <= b < bits_in_dword
+ if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */
{
result.low = 0;
result.high = input.low << (b - bits_in_word);
}
- else // 0 <= b < bits_in_word
+ else /* 0 <= b < bits_in_word */
{
if (b == 0)
return a;
Modified: compiler-rt/trunk/lib/ashlti3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ashlti3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ashlti3.c (original)
+++ compiler-rt/trunk/lib/ashlti3.c Fri Aug 7 15:30:09 2009
@@ -1,23 +1,24 @@
-//===-- ashlti3.c - Implement __ashlti3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ashlti3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- ashlti3.c - Implement __ashlti3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ashlti3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: a << b
+/* Returns: a << b */
-// Precondition: 0 <= b < bits_in_tword
+/* Precondition: 0 <= b < bits_in_tword */
ti_int
__ashlti3(ti_int a, si_int b)
@@ -26,12 +27,12 @@
twords input;
twords result;
input.all = a;
- if (b & bits_in_dword) // bits_in_dword <= b < bits_in_tword
+ if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */
{
result.low = 0;
result.high = input.low << (b - bits_in_dword);
}
- else // 0 <= b < bits_in_dword
+ else /* 0 <= b < bits_in_dword */
{
if (b == 0)
return a;
@@ -41,4 +42,4 @@
return result.all;
}
-#endif
+#endif /* __x86_64 */
Modified: compiler-rt/trunk/lib/ashrdi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ashrdi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ashrdi3.c (original)
+++ compiler-rt/trunk/lib/ashrdi3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- ashrdi3.c - Implement __ashrdi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ashrdi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- ashrdi3.c - Implement __ashrdi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ashrdi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: arithmetic a >> b
+/* Returns: arithmetic a >> b */
-// Precondition: 0 <= b < bits_in_dword
+/* Precondition: 0 <= b < bits_in_dword */
di_int
__ashrdi3(di_int a, si_int b)
@@ -24,13 +25,13 @@
dwords input;
dwords result;
input.all = a;
- if (b & bits_in_word) // bits_in_word <= b < bits_in_dword
+ if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */
{
- // result.high = input.high < 0 ? -1 : 0
+ /* result.high = input.high < 0 ? -1 : 0 */
result.high = input.high >> (bits_in_word - 1);
result.low = input.high >> (b - bits_in_word);
}
- else // 0 <= b < bits_in_word
+ else /* 0 <= b < bits_in_word */
{
if (b == 0)
return a;
Modified: compiler-rt/trunk/lib/cmpdi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cmpdi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/cmpdi2.c (original)
+++ compiler-rt/trunk/lib/cmpdi2.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,23 @@
-//===-- cmpdi2.c - Implement __cmpdi2 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __cmpdi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- cmpdi2.c - Implement __cmpdi2 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __cmpdi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: if (a < b) returns 0
-// if (a == b) returns 1
-// if (a > b) returns 2
+/* Returns: if (a < b) returns 0
+* if (a == b) returns 1
+* if (a > b) returns 2
+*/
si_int
__cmpdi2(di_int a, di_int b)
Modified: compiler-rt/trunk/lib/cmpti2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cmpti2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/cmpti2.c (original)
+++ compiler-rt/trunk/lib/cmpti2.c Fri Aug 7 15:30:09 2009
@@ -1,23 +1,25 @@
-//===-- cmpti2.c - Implement __cmpti2 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __cmpti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- cmpti2.c - Implement __cmpti2 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __cmpti2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: if (a < b) returns 0
-// if (a == b) returns 1
-// if (a > b) returns 2
+/* Returns: if (a < b) returns 0
+ * if (a == b) returns 1
+ * if (a > b) returns 2
+ */
si_int
__cmpti2(ti_int a, ti_int b)
Modified: compiler-rt/trunk/lib/ctzdi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ctzdi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ctzdi2.c (original)
+++ compiler-rt/trunk/lib/ctzdi2.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- ctzdi2.c - Implement __ctzdi2 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ctzdi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- ctzdi2.c - Implement __ctzdi2 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ctzdi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: the number of trailing 0-bits
+/* Returns: the number of trailing 0-bits */
-// Precondition: a != 0
+/* Precondition: a != 0 */
si_int
__ctzdi2(di_int a)
Modified: compiler-rt/trunk/lib/ctzsi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ctzsi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ctzsi2.c (original)
+++ compiler-rt/trunk/lib/ctzsi2.c Fri Aug 7 15:30:09 2009
@@ -1,54 +1,57 @@
-//===-- ctzsi2.c - Implement __ctzsi2 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ctzsi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- ctzsi2.c - Implement __ctzsi2 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ctzsi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: the number of trailing 0-bits
+/* Returns: the number of trailing 0-bits */
-// Precondition: a != 0
+/* Precondition: a != 0 */
si_int
__ctzsi2(si_int a)
{
su_int x = (su_int)a;
- si_int t = ((x & 0x0000FFFF) == 0) << 4; // if (x has no small bits) t = 16 else 0
- x >>= t; // x = [0 - 0xFFFF] + higher garbage bits
- su_int r = t; // r = [0, 16]
- // return r + ctz(x)
+ si_int t = ((x & 0x0000FFFF) == 0) << 4; /* if (x has no small bits) t = 16 else 0 */
+ x >>= t; /* x = [0 - 0xFFFF] + higher garbage bits */
+ su_int r = t; /* r = [0, 16] */
+ /* return r + ctz(x) */
t = ((x & 0x00FF) == 0) << 3;
- x >>= t; // x = [0 - 0xFF] + higher garbage bits
- r += t; // r = [0, 8, 16, 24]
- // return r + ctz(x)
+ x >>= t; /* x = [0 - 0xFF] + higher garbage bits */
+ r += t; /* r = [0, 8, 16, 24] */
+ /* return r + ctz(x) */
t = ((x & 0x0F) == 0) << 2;
- x >>= t; // x = [0 - 0xF] + higher garbage bits
- r += t; // r = [0, 4, 8, 12, 16, 20, 24, 28]
- // return r + ctz(x)
+ x >>= t; /* x = [0 - 0xF] + higher garbage bits */
+ r += t; /* r = [0, 4, 8, 12, 16, 20, 24, 28] */
+ /* return r + ctz(x) */
t = ((x & 0x3) == 0) << 1;
x >>= t;
- x &= 3; // x = [0 - 3]
- r += t; // r = [0 - 30] and is even
- // return r + ctz(x)
-// The branch-less return statement below is equivalent
-// to the following switch statement:
-// switch (x)
-// {
-// case 0:
-// return r + 2;
-// case 2:
-// return r + 1;
-// case 1:
-// case 3:
-// return r;
-// }
+ x &= 3; /* x = [0 - 3] */
+ r += t; /* r = [0 - 30] and is even */
+ /* return r + ctz(x) */
+
+/* The branch-less return statement below is equivalent
+ * to the following switch statement:
+ * switch (x)
+ * {
+ * case 0:
+ * return r + 2;
+ * case 2:
+ * return r + 1;
+ * case 1:
+ * case 3:
+ * return r;
+ * }
+ */
return r + ((2 - (x >> 1)) & -((x & 1) == 0));
}
Modified: compiler-rt/trunk/lib/divdc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divdc3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divdc3.c (original)
+++ compiler-rt/trunk/lib/divdc3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- divdc3.c - Implement __divdc3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __divdc3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- divdc3.c - Implement __divdc3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __divdc3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <math.h>
#include <complex.h>
-// Returns: the quotient of (a + ib) / (c + id)
+/* Returns: the quotient of (a + ib) / (c + id) */
double _Complex
__divdc3(double __a, double __b, double __c, double __d)
Modified: compiler-rt/trunk/lib/divdi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divdi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divdi3.c (original)
+++ compiler-rt/trunk/lib/divdi3.c Fri Aug 7 15:30:09 2009
@@ -1,30 +1,31 @@
-//===-- divdi3.c - Implement __divdi3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __divdi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- divdi3.c - Implement __divdi3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __divdi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
-// Returns: a / b
+/* Returns: a / b */
di_int
__divdi3(di_int a, di_int b)
{
const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1;
- di_int s_a = a >> bits_in_dword_m1; // s_a = a < 0 ? -1 : 0
- di_int s_b = b >> bits_in_dword_m1; // s_b = b < 0 ? -1 : 0
- a = (a ^ s_a) - s_a; // negate if s_a == -1
- b = (b ^ s_b) - s_b; // negate if s_b == -1
- s_a ^= s_b; // sign of quotient
- return (__udivmoddi4(a, b, (du_int*)0) ^ s_a) - s_a; // negate if s_a == -1
+ di_int s_a = a >> bits_in_dword_m1; /* s_a = a < 0 ? -1 : 0 */
+ di_int s_b = b >> bits_in_dword_m1; /* s_b = b < 0 ? -1 : 0 */
+ a = (a ^ s_a) - s_a; /* negate if s_a == -1 */
+ b = (b ^ s_b) - s_b; /* negate if s_b == -1 */
+ s_a ^= s_b; /*sign of quotient */
+ return (__udivmoddi4(a, b, (du_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */
}
Modified: compiler-rt/trunk/lib/divsc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divsc3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divsc3.c (original)
+++ compiler-rt/trunk/lib/divsc3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- divsc3.c - Implement __divsc3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __divsc3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- divsc3.c - Implement __divsc3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __divsc3 for the compiler_rt library.
+ *
+ *===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <math.h>
#include <complex.h>
-// Returns: the quotient of (a + ib) / (c + id)
+/* Returns: the quotient of (a + ib) / (c + id) */
float _Complex
__divsc3(float __a, float __b, float __c, float __d)
Modified: compiler-rt/trunk/lib/divsi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divsi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divsi3.c (original)
+++ compiler-rt/trunk/lib/divsi3.c Fri Aug 7 15:30:09 2009
@@ -1,30 +1,31 @@
-//===-- divsi3.c - Implement __divsi3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __divsi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- divsi3.c - Implement __divsi3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __divsi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
su_int __udivsi3(su_int n, su_int d);
-// Returns: a / b
+/* Returns: a / b */
si_int
__divsi3(si_int a, si_int b)
{
const int bits_in_word_m1 = (int)(sizeof(si_int) * CHAR_BIT) - 1;
- si_int s_a = a >> bits_in_word_m1; // s_a = a < 0 ? -1 : 0
- si_int s_b = b >> bits_in_word_m1; // s_b = b < 0 ? -1 : 0
- a = (a ^ s_a) - s_a; // negate if s_a == -1
- b = (b ^ s_b) - s_b; // negate if s_b == -1
- s_a ^= s_b; // sign of quotient
- return (__udivsi3(a, b) ^ s_a) - s_a; // negate if s_a == -1
+ si_int s_a = a >> bits_in_word_m1; /* s_a = a < 0 ? -1 : 0 */
+ si_int s_b = b >> bits_in_word_m1; /* s_b = b < 0 ? -1 : 0 */
+ a = (a ^ s_a) - s_a; /* negate if s_a == -1 */
+ b = (b ^ s_b) - s_b; /* negate if s_b == -1 */
+ s_a ^= s_b; /* sign of quotient */
+ return (__udivsi3(a, b) ^ s_a) - s_a; /* negate if s_a == -1 */
}
Modified: compiler-rt/trunk/lib/divxc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divxc3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divxc3.c (original)
+++ compiler-rt/trunk/lib/divxc3.c Fri Aug 7 15:30:09 2009
@@ -1,15 +1,15 @@
-//===-- divxc3.c - Implement __divxc3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __divxc3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- divxc3.c - Implement __divxc3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __divxc3 for the compiler_rt library.
+ *
+ */
#if !_ARCH_PPC
@@ -17,7 +17,7 @@
#include <math.h>
#include <complex.h>
-// Returns: the quotient of (a + ib) / (c + id)
+/* Returns: the quotient of (a + ib) / (c + id) */
long double _Complex
__divxc3(long double __a, long double __b, long double __c, long double __d)
Modified: compiler-rt/trunk/lib/fixdfdi.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fixdfdi.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fixdfdi.c (original)
+++ compiler-rt/trunk/lib/fixdfdi.c Fri Aug 7 15:30:09 2009
@@ -1,25 +1,27 @@
-//===-- fixdfdi.c - Implement __fixdfdi -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __fixdfdi for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- fixdfdi.c - Implement __fixdfdi -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __fixdfdi for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: convert a to a signed long long, rounding toward zero.
+/* Returns: convert a to a signed long long, rounding toward zero. */
-// Assumption: double is a IEEE 64 bit floating point type
-// su_int is a 32 bit integral type
-// value in double is representable in di_int (no range checking performed)
+/* Assumption: double is a IEEE 64 bit floating point type
+ * su_int is a 32 bit integral type
+ * value in double is representable in di_int (no range checking performed)
+ */
-// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
di_int
__fixdfdi(double a)
@@ -38,4 +40,4 @@
else
r.all >>= (52 - e);
return (r.all ^ s) - s;
-}
+}
Modified: compiler-rt/trunk/lib/fixdfti.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fixdfti.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fixdfti.c (original)
+++ compiler-rt/trunk/lib/fixdfti.c Fri Aug 7 15:30:09 2009
@@ -1,27 +1,29 @@
-//===-- fixdfti.c - Implement __fixdfti -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __fixdfti for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- fixdfti.c - Implement __fixdfti -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __fixdfti for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: convert a to a signed long long, rounding toward zero.
+/* Returns: convert a to a signed long long, rounding toward zero. */
-// Assumption: double is a IEEE 64 bit floating point type
-// su_int is a 32 bit integral type
-// value in double is representable in ti_int (no range checking performed)
+/* Assumption: double is a IEEE 64 bit floating point type
+ * su_int is a 32 bit integral type
+ * value in double is representable in ti_int (no range checking performed)
+ */
-// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
ti_int
__fixdfti(double a)
Modified: compiler-rt/trunk/lib/fixsfdi.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fixsfdi.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fixsfdi.c (original)
+++ compiler-rt/trunk/lib/fixsfdi.c Fri Aug 7 15:30:09 2009
@@ -1,25 +1,27 @@
-//===-- fixsfdi.c - Implement __fixsfdi -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __fixsfdi for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- fixsfdi.c - Implement __fixsfdi -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __fixsfdi for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: convert a to a signed long long, rounding toward zero.
+/* Returns: convert a to a signed long long, rounding toward zero. */
-// Assumption: float is a IEEE 32 bit floating point type
-// su_int is a 32 bit integral type
-// value in float is representable in di_int (no range checking performed)
+/* Assumption: float is a IEEE 32 bit floating point type
+ * su_int is a 32 bit integral type
+ * value in float is representable in di_int (no range checking performed)
+ */
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
di_int
__fixsfdi(float a)
Modified: compiler-rt/trunk/lib/fixunssfti.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fixunssfti.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fixunssfti.c (original)
+++ compiler-rt/trunk/lib/fixunssfti.c Fri Aug 7 15:30:09 2009
@@ -26,7 +26,7 @@
* (no range checking performed)
*/
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
tu_int
__fixunssfti(float a)
Modified: compiler-rt/trunk/lib/floatdidf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floatdidf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floatdidf.c (original)
+++ compiler-rt/trunk/lib/floatdidf.c Fri Aug 7 15:30:09 2009
@@ -1,29 +1,32 @@
-//===-- floatdidf.c - Implement __floatdidf -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatdidf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- floatdidf.c - Implement __floatdidf -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===
+ *
+ * This file implements __floatdidf for the compiler_rt library.
+ *
+ *===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a double, rounding toward even.
+/* Returns: convert a to a double, rounding toward even. */
-// Assumption: double is a IEEE 64 bit floating point type
-// di_int is a 64 bit integral type
+/* Assumption: double is a IEEE 64 bit floating point type
+ * di_int is a 64 bit integral type
+ */
-// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
#ifndef __SOFT_FP__
-// Support for systems that have hardware floating-point; we'll set the inexact flag
-// as a side-effect of this computation.
+/* Support for systems that have hardware floating-point; we'll set the inexact flag
+ * as a side-effect of this computation.
+ */
#include <stdint.h>
double
@@ -42,8 +45,9 @@
}
#else
-// Support for systems that don't have hardware floating-point; there are no flags to
-// set, and we don't want to code-gen to an unknown soft-float implementation.
+/* Support for systems that don't have hardware floating-point; there are no flags to
+ * set, and we don't want to code-gen to an unknown soft-float implementation.
+ */
double
__floatdidf(di_int a)
@@ -53,17 +57,18 @@
const unsigned N = sizeof(di_int) * CHAR_BIT;
const di_int s = a >> (N-1);
a = (a ^ s) - s;
- int sd = N - __builtin_clzll(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __builtin_clzll(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > DBL_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit DBL_MANT_DIG-1 bits to the right of 1
- // Q = bit DBL_MANT_DIG bits to the right of 1
- // R = "or" of all bits to the right of Q
+ /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
+ * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
+ * 12345678901234567890123456
+ * 1 = msb 1 bit
+ * P = bit DBL_MANT_DIG-1 bits to the right of 1
+ * Q = bit DBL_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case DBL_MANT_DIG + 1:
@@ -75,28 +80,28 @@
a = ((du_int)a >> (sd - (DBL_MANT_DIG+2))) |
((a & ((du_int)(-1) >> ((N + DBL_MANT_DIG+2) - sd))) != 0);
};
- // finish:
- a |= (a & 4) != 0; // Or P into R
- ++a; // round - this step may add a significant bit
- a >>= 2; // dump Q and R
- // a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits
+ /* finish: */
+ a |= (a & 4) != 0; /* Or P into R */
+ ++a; /* round - this step may add a significant bit */
+ a >>= 2; /* dump Q and R */
+ /* a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits */
if (a & ((du_int)1 << DBL_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
else
{
a <<= (DBL_MANT_DIG - sd);
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
double_bits fb;
- fb.u.high = ((su_int)s & 0x80000000) | // sign
- ((e + 1023) << 20) | // exponent
- ((su_int)(a >> 32) & 0x000FFFFF); // mantissa-high
- fb.u.low = (su_int)a; // mantissa-low
+ fb.u.high = ((su_int)s & 0x80000000) | /* sign */
+ ((e + 1023) << 20) | /* exponent */
+ ((su_int)(a >> 32) & 0x000FFFFF); /* mantissa-high */
+ fb.u.low = (su_int)a; /* mantissa-low */
return fb.f;
}
#endif
Modified: compiler-rt/trunk/lib/floatdisf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floatdisf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floatdisf.c (original)
+++ compiler-rt/trunk/lib/floatdisf.c Fri Aug 7 15:30:09 2009
@@ -1,25 +1,27 @@
-//===-- floatdisf.c - Implement __floatdisf -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatdisf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- floatdisf.c - Implement __floatdisf -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===
+ *
+ * This file implements __floatdisf for the compiler_rt library.
+ *
+ *===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a float, rounding toward even.
+/* Returns: convert a to a float, rounding toward even.*/
-// Assumption: float is a IEEE 32 bit floating point type
-// di_int is a 64 bit integral type
+/* Assumption: float is a IEEE 32 bit floating point type
+ * di_int is a 64 bit integral type
+ */
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
float
__floatdisf(di_int a)
@@ -29,17 +31,18 @@
const unsigned N = sizeof(di_int) * CHAR_BIT;
const di_int s = a >> (N-1);
a = (a ^ s) - s;
- int sd = N - __builtin_clzll(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __builtin_clzll(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > FLT_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit FLT_MANT_DIG-1 bits to the right of 1
- // Q = bit FLT_MANT_DIG bits to the right of 1
- // R = "or" of all bits to the right of Q
+ /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
+ * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
+ * 12345678901234567890123456
+ * 1 = msb 1 bit
+ * P = bit FLT_MANT_DIG-1 bits to the right of 1
+ * Q = bit FLT_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case FLT_MANT_DIG + 1:
@@ -51,26 +54,26 @@
a = ((du_int)a >> (sd - (FLT_MANT_DIG+2))) |
((a & ((du_int)(-1) >> ((N + FLT_MANT_DIG+2) - sd))) != 0);
};
- // finish:
- a |= (a & 4) != 0; // Or P into R
- ++a; // round - this step may add a significant bit
- a >>= 2; // dump Q and R
- // a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits
+ /* finish: */
+ a |= (a & 4) != 0; /* Or P into R */
+ ++a; /* round - this step may add a significant bit */
+ a >>= 2; /* dump Q and R */
+ /* a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits */
if (a & ((du_int)1 << FLT_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to FLT_MANT_DIG bits
+ /* a is now rounded to FLT_MANT_DIG bits */
}
else
{
a <<= (FLT_MANT_DIG - sd);
- // a is now rounded to FLT_MANT_DIG bits
+ /* a is now rounded to FLT_MANT_DIG bits */
}
float_bits fb;
- fb.u = ((su_int)s & 0x80000000) | // sign
- ((e + 127) << 23) | // exponent
- ((su_int)a & 0x007FFFFF); // mantissa
+ fb.u = ((su_int)s & 0x80000000) | /* sign */
+ ((e + 127) << 23) | /* exponent */
+ ((su_int)a & 0x007FFFFF); /* mantissa */
return fb.f;
}
Modified: compiler-rt/trunk/lib/floatdixf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floatdixf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floatdixf.c (original)
+++ compiler-rt/trunk/lib/floatdixf.c Fri Aug 7 15:30:09 2009
@@ -1,27 +1,30 @@
-//===-- floatdixf.c - Implement __floatdixf -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatdixf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floatdixf.c - Implement __floatdixf -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floatdixf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if !_ARCH_PPC
#include "int_lib.h"
-// Returns: convert a to a long double, rounding toward even.
+/* Returns: convert a to a long double, rounding toward even. */
-// Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
-// di_int is a 64 bit integral type
-
-// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
-// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
+ * di_int is a 64 bit integral type
+ */
+
+/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
+ * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+ */
long double
__floatdixf(di_int a)
@@ -32,11 +35,11 @@
const di_int s = a >> (N-1);
a = (a ^ s) - s;
int clz = __builtin_clzll(a);
- int e = (N - 1) - clz ; // exponent
+ int e = (N - 1) - clz ; /* exponent */
long_double_bits fb;
- fb.u.high.low = ((su_int)s & 0x00008000) | // sign
- (e + 16383); // exponent
- fb.u.low.all = a << clz; // mantissa
+ fb.u.high.low = ((su_int)s & 0x00008000) | /* sign */
+ (e + 16383); /* exponent */
+ fb.u.low.all = a << clz; /* mantissa */
return fb.f;
}
Modified: compiler-rt/trunk/lib/floattidf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floattidf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floattidf.c (original)
+++ compiler-rt/trunk/lib/floattidf.c Fri Aug 7 15:30:09 2009
@@ -1,27 +1,29 @@
-//===-- floattidf.c - Implement __floattidf -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floattidf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floattidf.c - Implement __floattidf -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floattidf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a double, rounding toward even.
+/* Returns: convert a to a double, rounding toward even.*/
-// Assumption: double is a IEEE 64 bit floating point type
-// ti_int is a 128 bit integral type
+/* Assumption: double is a IEEE 64 bit floating point type
+ * ti_int is a 128 bit integral type
+ */
-// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
si_int __clzti2(ti_int a);
@@ -33,17 +35,18 @@
const unsigned N = sizeof(ti_int) * CHAR_BIT;
const ti_int s = a >> (N-1);
a = (a ^ s) - s;
- int sd = N - __clzti2(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __clzti2(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > DBL_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit DBL_MANT_DIG-1 bits to the right of 1
- // Q = bit DBL_MANT_DIG bits to the right of 1
- // R = "or" of all bits to the right of Q
+ /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
+ * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
+ * 12345678901234567890123456
+ * 1 = msb 1 bit
+ * P = bit DBL_MANT_DIG-1 bits to the right of 1
+ * Q = bit DBL_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case DBL_MANT_DIG + 1:
@@ -55,28 +58,28 @@
a = ((tu_int)a >> (sd - (DBL_MANT_DIG+2))) |
((a & ((tu_int)(-1) >> ((N + DBL_MANT_DIG+2) - sd))) != 0);
};
- // finish:
- a |= (a & 4) != 0; // Or P into R
- ++a; // round - this step may add a significant bit
- a >>= 2; // dump Q and R
- // a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits
+ /* finish: */
+ a |= (a & 4) != 0; /* Or P into R */
+ ++a; /* round - this step may add a significant bit */
+ a >>= 2; /* dump Q and R */
+ /* a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits */
if (a & ((tu_int)1 << DBL_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
else
{
a <<= (DBL_MANT_DIG - sd);
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
double_bits fb;
- fb.u.high = ((su_int)s & 0x80000000) | // sign
- ((e + 1023) << 20) | // exponent
- ((su_int)(a >> 32) & 0x000FFFFF); // mantissa-high
- fb.u.low = (su_int)a; // mantissa-low
+ fb.u.high = ((su_int)s & 0x80000000) | /* sign */
+ ((e + 1023) << 20) | /* exponent */
+ ((su_int)(a >> 32) & 0x000FFFFF); /* mantissa-high */
+ fb.u.low = (su_int)a; /* mantissa-low */
return fb.f;
}
Modified: compiler-rt/trunk/lib/floattisf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floattisf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floattisf.c (original)
+++ compiler-rt/trunk/lib/floattisf.c Fri Aug 7 15:30:09 2009
@@ -1,27 +1,29 @@
-//===-- floattisf.c - Implement __floattisf -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floattisf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floattisf.c - Implement __floattisf -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floattisf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a float, rounding toward even.
+/* Returns: convert a to a float, rounding toward even. */
-// Assumption: float is a IEEE 32 bit floating point type
-// ti_int is a 128 bit integral type
+/* Assumption: float is a IEEE 32 bit floating point type
+ * ti_int is a 128 bit integral type
+ */
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
si_int __clzti2(ti_int a);
@@ -33,17 +35,18 @@
const unsigned N = sizeof(ti_int) * CHAR_BIT;
const ti_int s = a >> (N-1);
a = (a ^ s) - s;
- int sd = N - __clzti2(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __clzti2(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > FLT_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit FLT_MANT_DIG-1 bits to the right of 1
- // Q = bit FLT_MANT_DIG bits to the right of 1
- // R = "or" of all bits to the right of Q
+ /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
+ * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
+ * 12345678901234567890123456
+ * 1 = msb 1 bit
+ * P = bit FLT_MANT_DIG-1 bits to the right of 1
+ * Q = bit FLT_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case FLT_MANT_DIG + 1:
@@ -55,27 +58,27 @@
a = ((tu_int)a >> (sd - (FLT_MANT_DIG+2))) |
((a & ((tu_int)(-1) >> ((N + FLT_MANT_DIG+2) - sd))) != 0);
};
- // finish:
- a |= (a & 4) != 0; // Or P into R
- ++a; // round - this step may add a significant bit
- a >>= 2; // dump Q and R
- // a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits
+ /* finish: */
+ a |= (a & 4) != 0; /* Or P into R */
+ ++a; /* round - this step may add a significant bit */
+ a >>= 2; /* dump Q and R */
+ /* a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits */
if (a & ((tu_int)1 << FLT_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to FLT_MANT_DIG bits
+ /* a is now rounded to FLT_MANT_DIG bits */
}
else
{
a <<= (FLT_MANT_DIG - sd);
- // a is now rounded to FLT_MANT_DIG bits
+ /* a is now rounded to FLT_MANT_DIG bits */
}
float_bits fb;
- fb.u = ((su_int)s & 0x80000000) | // sign
- ((e + 127) << 23) | // exponent
- ((su_int)a & 0x007FFFFF); // mantissa
+ fb.u = ((su_int)s & 0x80000000) | /* sign */
+ ((e + 127) << 23) | /* exponent */
+ ((su_int)a & 0x007FFFFF); /* mantissa */
return fb.f;
}
Modified: compiler-rt/trunk/lib/floattixf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floattixf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floattixf.c (original)
+++ compiler-rt/trunk/lib/floattixf.c Fri Aug 7 15:30:09 2009
@@ -37,8 +37,8 @@
const unsigned N = sizeof(ti_int) * CHAR_BIT;
const ti_int s = a >> (N-1);
a = (a ^ s) - s;
- int sd = N - __clzti2(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __clzti2(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > LDBL_MANT_DIG)
{
/* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
@@ -48,7 +48,7 @@
* P = bit LDBL_MANT_DIG-1 bits to the right of 1
* Q = bit LDBL_MANT_DIG bits to the right of 1
* R = "or" of all bits to the right of Q
- */
+ */
switch (sd)
{
case LDBL_MANT_DIG + 1:
Modified: compiler-rt/trunk/lib/floatundidf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floatundidf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floatundidf.c (original)
+++ compiler-rt/trunk/lib/floatundidf.c Fri Aug 7 15:30:09 2009
@@ -1,29 +1,33 @@
-//===-- floatundidf.c - Implement __floatundidf ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatundidf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floatundidf.c - Implement __floatundidf ---------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floatundidf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a double, rounding toward even.
+/* Returns: convert a to a double, rounding toward even. */
-// Assumption: double is a IEEE 64 bit floating point type
-// du_int is a 64 bit integral type
+/* Assumption: double is a IEEE 64 bit floating point type
+ * du_int is a 64 bit integral type
+ */
-// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
#ifndef __SOFT_FP__
-// Support for systems that have hardware floating-point; we'll set the inexact flag
-// as a side-effect of this computation.
+/* Support for systems that have hardware floating-point; we'll set the inexact flag
+ * as a side-effect of this computation.
+ */
+
#include <stdint.h>
double
@@ -44,8 +48,9 @@
}
#else
-// Support for systems that don't have hardware floating-point; there are no flags to
-// set, and we don't want to code-gen to an unknown soft-float implementation.
+/* Support for systems that don't have hardware floating-point; there are no flags to
+ * set, and we don't want to code-gen to an unknown soft-float implementation.
+ */
double
__floatundidf(du_int a)
@@ -53,17 +58,18 @@
if (a == 0)
return 0.0;
const unsigned N = sizeof(du_int) * CHAR_BIT;
- int sd = N - __builtin_clzll(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __builtin_clzll(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > DBL_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit DBL_MANT_DIG-1 bits to the right of 1
- // Q = bit DBL_MANT_DIG bits to the right of 1
- // R = "or" of all bits to the right of Q
+ /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
+ * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
+ * 12345678901234567890123456
+ * 1 = msb 1 bit
+ * P = bit DBL_MANT_DIG-1 bits to the right of 1
+ * Q = bit DBL_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case DBL_MANT_DIG + 1:
@@ -75,27 +81,27 @@
a = (a >> (sd - (DBL_MANT_DIG+2))) |
((a & ((du_int)(-1) >> ((N + DBL_MANT_DIG+2) - sd))) != 0);
};
- // finish:
- a |= (a & 4) != 0; // Or P into R
- ++a; // round - this step may add a significant bit
- a >>= 2; // dump Q and R
- // a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits
+ /* finish: */
+ a |= (a & 4) != 0; /* Or P into R */
+ ++a; /* round - this step may add a significant bit */
+ a >>= 2; /* dump Q and R */
+ /* a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits */
if (a & ((du_int)1 << DBL_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
else
{
a <<= (DBL_MANT_DIG - sd);
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
double_bits fb;
- fb.u.high = ((e + 1023) << 20) | // exponent
- ((su_int)(a >> 32) & 0x000FFFFF); // mantissa-high
- fb.u.low = (su_int)a; // mantissa-low
+ fb.u.high = ((e + 1023) << 20) | /* exponent */
+ ((su_int)(a >> 32) & 0x000FFFFF); /* mantissa-high */
+ fb.u.low = (su_int)a; /* mantissa-low */
return fb.f;
}
#endif
Modified: compiler-rt/trunk/lib/floatundisf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floatundisf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floatundisf.c (original)
+++ compiler-rt/trunk/lib/floatundisf.c Fri Aug 7 15:30:09 2009
@@ -1,25 +1,27 @@
-//===-- floatundisf.c - Implement __floatundisf ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatundisf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- floatundisf.c - Implement __floatundisf ---------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floatundisf for the compiler_rt library.
+ *
+ *===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a float, rounding toward even.
+/* Returns: convert a to a float, rounding toward even. */
-// Assumption: float is a IEEE 32 bit floating point type
-// du_int is a 64 bit integral type
+/* Assumption: float is a IEEE 32 bit floating point type
+ * du_int is a 64 bit integral type
+ */
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
float
__floatundisf(du_int a)
@@ -27,17 +29,18 @@
if (a == 0)
return 0.0F;
const unsigned N = sizeof(du_int) * CHAR_BIT;
- int sd = N - __builtin_clzll(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __builtin_clzll(a); /* number of significant digits */
+ int e = sd - 1; /* 8 exponent */
if (sd > FLT_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit FLT_MANT_DIG-1 bits to the right of 1
- // Q = bit FLT_MANT_DIG bits to the right of 1
- // R = "or" of all bits to the right of Q
+ /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
+ * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
+ * 12345678901234567890123456
+ * 1 = msb 1 bit
+ * P = bit FLT_MANT_DIG-1 bits to the right of 1
+ * Q = bit FLT_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case FLT_MANT_DIG + 1:
@@ -49,25 +52,25 @@
a = (a >> (sd - (FLT_MANT_DIG+2))) |
((a & ((du_int)(-1) >> ((N + FLT_MANT_DIG+2) - sd))) != 0);
};
- // finish:
- a |= (a & 4) != 0; // Or P into R
- ++a; // round - this step may add a significant bit
- a >>= 2; // dump Q and R
- // a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits
+ /* finish: */
+ a |= (a & 4) != 0; /* Or P into R */
+ ++a; /* round - this step may add a significant bit */
+ a >>= 2; /* dump Q and R */
+ /* a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits */
if (a & ((du_int)1 << FLT_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to FLT_MANT_DIG bits
+ /* a is now rounded to FLT_MANT_DIG bits */
}
else
{
a <<= (FLT_MANT_DIG - sd);
- // a is now rounded to FLT_MANT_DIG bits
+ /* a is now rounded to FLT_MANT_DIG bits */
}
float_bits fb;
- fb.u = ((e + 127) << 23) | // exponent
- ((su_int)a & 0x007FFFFF); // mantissa
+ fb.u = ((e + 127) << 23) | /* exponent */
+ ((su_int)a & 0x007FFFFF); /* mantissa */
return fb.f;
}
Modified: compiler-rt/trunk/lib/floatundixf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/floatundixf.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/floatundixf.c (original)
+++ compiler-rt/trunk/lib/floatundixf.c Fri Aug 7 15:30:09 2009
@@ -1,28 +1,30 @@
-//===-- floatundixf.c - Implement __floatundixf ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatundixf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floatundixf.c - Implement __floatundixf ---------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floatundixf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if !_ARCH_PPC
#include "int_lib.h"
-// Returns: convert a to a long double, rounding toward even.
-
-// Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
-// du_int is a 64 bit integral type
-
-// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
-// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* Returns: convert a to a long double, rounding toward even. */
+/* Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
+ * du_int is a 64 bit integral type
+ */
+
+/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
+ * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+ */
long double
__floatundixf(du_int a)
{
@@ -30,11 +32,11 @@
return 0.0;
const unsigned N = sizeof(du_int) * CHAR_BIT;
int clz = __builtin_clzll(a);
- int e = (N - 1) - clz ; // exponent
+ int e = (N - 1) - clz ; /* exponent */
long_double_bits fb;
- fb.u.high.low = (e + 16383); // exponent
- fb.u.low.all = a << clz; // mantissa
+ fb.u.high.low = (e + 16383); /* exponent */
+ fb.u.low.all = a << clz; /* mantissa */
return fb.f;
}
-#endif
+#endif /* _ARCH_PPC */
Modified: compiler-rt/trunk/lib/moddi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/moddi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/moddi3.c (original)
+++ compiler-rt/trunk/lib/moddi3.c Fri Aug 7 15:30:09 2009
@@ -1,31 +1,32 @@
-//===-- moddi3.c - Implement __moddi3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __moddi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- moddi3.c - Implement __moddi3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __moddi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
-// Returns: a % b
+/* Returns: a % b */
di_int
__moddi3(di_int a, di_int b)
{
const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1;
- di_int s = b >> bits_in_dword_m1; // s = b < 0 ? -1 : 0
- b = (b ^ s) - s; // negate if s == -1
- s = a >> bits_in_dword_m1; // s = a < 0 ? -1 : 0
- a = (a ^ s) - s; // negate if s == -1
+ di_int s = b >> bits_in_dword_m1; /* s = b < 0 ? -1 : 0 */
+ b = (b ^ s) - s; /* negate if s == -1 */
+ s = a >> bits_in_dword_m1; /* s = a < 0 ? -1 : 0 */
+ a = (a ^ s) - s; /* negate if s == -1 */
di_int r;
__udivmoddi4(a, b, (du_int*)&r);
- return (r ^ s) - s; // negate if s == -1
+ return (r ^ s) - s; /* negate if s == -1 */
}
Modified: compiler-rt/trunk/lib/modsi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/modsi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/modsi3.c (original)
+++ compiler-rt/trunk/lib/modsi3.c Fri Aug 7 15:30:09 2009
@@ -1,19 +1,20 @@
-//===-- modsi3.c - Implement __modsi3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __modsi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- modsi3.c - Implement __modsi3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __modsi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a % b
+/* Returns: a % b */
si_int
__modsi3(si_int a, si_int b)
Modified: compiler-rt/trunk/lib/modti3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/modti3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/modti3.c (original)
+++ compiler-rt/trunk/lib/modti3.c Fri Aug 7 15:30:09 2009
@@ -1,15 +1,16 @@
-//===-- modti3.c - Implement __modti3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __modti3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- modti3.c - Implement __modti3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __modti3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
@@ -17,19 +18,19 @@
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
-// Returns: a % b
+/*Returns: a % b */
ti_int
__modti3(ti_int a, ti_int b)
{
const int bits_in_tword_m1 = (int)(sizeof(ti_int) * CHAR_BIT) - 1;
- ti_int s = b >> bits_in_tword_m1; // s = b < 0 ? -1 : 0
- b = (b ^ s) - s; // negate if s == -1
- s = a >> bits_in_tword_m1; // s = a < 0 ? -1 : 0
- a = (a ^ s) - s; // negate if s == -1
+ ti_int s = b >> bits_in_tword_m1; /* s = b < 0 ? -1 : 0 */
+ b = (b ^ s) - s; /* negate if s == -1 */
+ s = a >> bits_in_tword_m1; /* s = a < 0 ? -1 : 0 */
+ a = (a ^ s) - s; /* negate if s == -1 */
ti_int r;
__udivmodti4(a, b, (tu_int*)&r);
- return (r ^ s) - s; // negate if s == -1
+ return (r ^ s) - s; /* negate if s == -1 */
}
#endif
Modified: compiler-rt/trunk/lib/muldc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/muldc3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/muldc3.c (original)
+++ compiler-rt/trunk/lib/muldc3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- muldc3.c - Implement __muldc3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __muldc3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- muldc3.c - Implement __muldc3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __muldc3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <math.h>
#include <complex.h>
-// Returns: the product of a + ib and c + id
+/* Returns: the product of a + ib and c + id */
double _Complex
__muldc3(double __a, double __b, double __c, double __d)
Modified: compiler-rt/trunk/lib/muldi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/muldi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/muldi3.c (original)
+++ compiler-rt/trunk/lib/muldi3.c Fri Aug 7 15:30:09 2009
@@ -1,19 +1,20 @@
-//===-- muldi3.c - Implement __muldi3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __muldi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- muldi3.c - Implement __muldi3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __muldi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a * b
+/* Returns: a * b */
static
di_int
@@ -37,7 +38,7 @@
return r.all;
}
-// Returns: a * b
+/* Returns: a * b */
di_int
__muldi3(di_int a, di_int b)
Modified: compiler-rt/trunk/lib/mulsc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/mulsc3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/mulsc3.c (original)
+++ compiler-rt/trunk/lib/mulsc3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- mulsc3.c - Implement __mulsc3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __mulsc3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- mulsc3.c - Implement __mulsc3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __mulsc3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <math.h>
#include <complex.h>
-// Returns: the product of a + ib and c + id
+/* Returns: the product of a + ib and c + id */
float _Complex
__mulsc3(float __a, float __b, float __c, float __d)
Modified: compiler-rt/trunk/lib/multi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/multi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/multi3.c (original)
+++ compiler-rt/trunk/lib/multi3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- multi3.c - Implement __multi3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __multi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- multi3.c - Implement __multi3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+
+ * This file implements __multi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: a * b
+/* Returns: a * b */
static
ti_int
@@ -39,7 +40,7 @@
return r.all;
}
-// Returns: a * b
+/* Returns: a * b */
ti_int
__multi3(ti_int a, ti_int b)
Modified: compiler-rt/trunk/lib/mulvdi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/mulvdi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/mulvdi3.c (original)
+++ compiler-rt/trunk/lib/mulvdi3.c Fri Aug 7 15:30:09 2009
@@ -1,22 +1,23 @@
-//===-- mulvdi3.c - Implement __mulvdi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __mulvdi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- mulvdi3.c - Implement __mulvdi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __mulvdi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <stdlib.h>
-// Returns: a * b
+/* Returns: a * b */
-// Effects: aborts if a * b overflows
+/* Effects: aborts if a * b overflows */
di_int
__mulvdi3(di_int a, di_int b)
Modified: compiler-rt/trunk/lib/negvti2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/negvti2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/negvti2.c (original)
+++ compiler-rt/trunk/lib/negvti2.c Fri Aug 7 15:30:09 2009
@@ -1,24 +1,25 @@
-//===-- negvti2.c - Implement __negvti2 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __negvti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- negvti2.c - Implement __negvti2 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===
+ *
+ *This file implements __negvti2 for the compiler_rt library.
+ *
+ *===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <stdlib.h>
-// Returns: -a
+/* Returns: -a */
-// Effects: aborts if -a overflows
+/* Effects: aborts if -a overflows */
ti_int
__negvti2(ti_int a)
Modified: compiler-rt/trunk/lib/paritydi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/paritydi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/paritydi2.c (original)
+++ compiler-rt/trunk/lib/paritydi2.c Fri Aug 7 15:30:09 2009
@@ -1,19 +1,20 @@
-//===-- paritydi2.c - Implement __paritydi2 -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __paritydi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- paritydi2.c - Implement __paritydi2 -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __paritydi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: 1 if number of bits is odd else returns 0
+/* Returns: 1 if number of bits is odd else returns 0 */
si_int __paritysi2(si_int a);
Modified: compiler-rt/trunk/lib/paritysi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/paritysi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/paritysi2.c (original)
+++ compiler-rt/trunk/lib/paritysi2.c Fri Aug 7 15:30:09 2009
@@ -1,19 +1,20 @@
-//===-- paritysi2.c - Implement __paritysi2 -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __paritysi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- paritysi2.c - Implement __paritysi2 -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __paritysi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: 1 if number of bits is odd else returns 0
+/* Returns: 1 if number of bits is odd else returns 0 */
si_int
__paritysi2(si_int a)
Modified: compiler-rt/trunk/lib/parityti2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/parityti2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/parityti2.c (original)
+++ compiler-rt/trunk/lib/parityti2.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- parityti2.c - Implement __parityti2 -------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __parityti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- parityti2.c - Implement __parityti2 -------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __parityti2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: 1 if number of bits is odd else returns 0
+/* Returns: 1 if number of bits is odd else returns 0 */
si_int __paritydi2(di_int a);
Modified: compiler-rt/trunk/lib/popcountsi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/popcountsi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/popcountsi2.c (original)
+++ compiler-rt/trunk/lib/popcountsi2.c Fri Aug 7 15:30:09 2009
@@ -1,32 +1,33 @@
-//===-- popcountsi2.c - Implement __popcountsi2 ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __popcountsi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- popcountsi2.c - Implement __popcountsi2 ---------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __popcountsi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: count of 1 bits
+/* Returns: count of 1 bits */
si_int
__popcountsi2(si_int a)
{
su_int x = (su_int)a;
x = x - ((x >> 1) & 0x55555555);
- // Every 2 bits holds the sum of every pair of bits
+ /* Every 2 bits holds the sum of every pair of bits */
x = ((x >> 2) & 0x33333333) + (x & 0x33333333);
- // Every 4 bits holds the sum of every 4-set of bits (3 significant bits)
+ /* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) */
x = (x + (x >> 4)) & 0x0F0F0F0F;
- // Every 8 bits holds the sum of every 8-set of bits (4 significant bits)
+ /* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) */
x = (x + (x >> 16));
- // The lower 16 bits hold two 8 bit sums (5 significant bits).
- // Upper 16 bits are garbage
- return (x + (x >> 8)) & 0x0000003F; // (6 significant bits)
+ /* The lower 16 bits hold two 8 bit sums (5 significant bits).*/
+ /* Upper 16 bits are garbage */
+ return (x + (x >> 8)) & 0x0000003F; /* (6 significant bits) */
}
Modified: compiler-rt/trunk/lib/popcountti2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/popcountti2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/popcountti2.c (original)
+++ compiler-rt/trunk/lib/popcountti2.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- popcountti2.c - Implement __popcountti2 ----------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __popcountti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- popcountti2.c - Implement __popcountti2 ----------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __popcountti2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: count of 1 bits
+/* Returns: count of 1 bits */
si_int
__popcountti2(ti_int a)
@@ -23,21 +24,21 @@
tu_int x3 = (tu_int)a;
x3 = x3 - ((x3 >> 1) & (((tu_int)0x5555555555555555uLL << 64) |
0x5555555555555555uLL));
- // Every 2 bits holds the sum of every pair of bits (64)
+ /* Every 2 bits holds the sum of every pair of bits (64) */
x3 = ((x3 >> 2) & (((tu_int)0x3333333333333333uLL << 64) | 0x3333333333333333uLL))
+ (x3 & (((tu_int)0x3333333333333333uLL << 64) | 0x3333333333333333uLL));
- // Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (32)
+ /* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (32) */
x3 = (x3 + (x3 >> 4))
& (((tu_int)0x0F0F0F0F0F0F0F0FuLL << 64) | 0x0F0F0F0F0F0F0F0FuLL);
- // Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (16)
+ /* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (16) */
du_int x2 = (du_int)(x3 + (x3 >> 64));
- // Every 8 bits holds the sum of every 8-set of bits (5 significant bits) (8)
+ /* Every 8 bits holds the sum of every 8-set of bits (5 significant bits) (8) */
su_int x = (su_int)(x2 + (x2 >> 32));
- // Every 8 bits holds the sum of every 8-set of bits (6 significant bits) (4)
+ /* Every 8 bits holds the sum of every 8-set of bits (6 significant bits) (4) */
x = x + (x >> 16);
- // Every 8 bits holds the sum of every 8-set of bits (7 significant bits) (2)
- // Upper 16 bits are garbage
- return (x + (x >> 8)) & 0xFF; // (8 significant bits)
+ /* Every 8 bits holds the sum of every 8-set of bits (7 significant bits) (2) */
+ /* Upper 16 bits are garbage */
+ return (x + (x >> 8)) & 0xFF; /* (8 significant bits) */
}
#endif
Modified: compiler-rt/trunk/lib/powisf2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/powisf2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/powisf2.c (original)
+++ compiler-rt/trunk/lib/powisf2.c Fri Aug 7 15:30:09 2009
@@ -1,19 +1,20 @@
-//===-- powisf2.cpp - Implement __powisf2 ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __powisf2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/*===-- powisf2.cpp - Implement __powisf2 ---------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __powisf2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a ^ b
+/* Returns: a ^ b */
float
__powisf2(float a, si_int b)
Modified: compiler-rt/trunk/lib/ucmpdi2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ucmpdi2.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ucmpdi2.c (original)
+++ compiler-rt/trunk/lib/ucmpdi2.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,23 @@
-//===-- ucmpdi2.c - Implement __ucmpdi2 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ucmpdi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- ucmpdi2.c - Implement __ucmpdi2 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ucmpdi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: if (a < b) returns 0
-// if (a == b) returns 1
-// if (a > b) returns 2
+/* Returns: if (a < b) returns 0
+ * if (a == b) returns 1
+ * if (a > b) returns 2
+ */
si_int
__ucmpdi2(du_int a, du_int b)
Modified: compiler-rt/trunk/lib/udivdi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/udivdi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/udivdi3.c (original)
+++ compiler-rt/trunk/lib/udivdi3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- udivdi3.c - Implement __udivdi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __udivdi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- udivdi3.c - Implement __udivdi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __udivdi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
-// Returns: a / b
+/* Returns: a / b */
du_int
__udivdi3(du_int a, du_int b)
Modified: compiler-rt/trunk/lib/udivmoddi4.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/udivmoddi4.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/udivmoddi4.c (original)
+++ compiler-rt/trunk/lib/udivmoddi4.c Fri Aug 7 15:30:09 2009
@@ -1,22 +1,24 @@
-//===-- udivmoddi4.c - Implement __udivmoddi4 -----------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __udivmoddi4 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- udivmoddi4.c - Implement __udivmoddi4 -----------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __udivmoddi4 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Effects: if rem != 0, *rem = a % b
-// Returns: a / b
+/* Effects: if rem != 0, *rem = a % b
+ * Returns: a / b
+ */
-// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide
+/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */
du_int
__udivmoddi4(du_int a, du_int b, du_int* rem)
@@ -30,43 +32,47 @@
udwords q;
udwords r;
unsigned sr;
- // special cases, X is unknown, K != 0
+ /* special cases, X is unknown, K != 0 */
if (n.high == 0)
{
if (d.high == 0)
{
- // 0 X
- // ---
- // 0 X
+ /* 0 X
+ * ---
+ * 0 X
+ */
if (rem)
*rem = n.low % d.low;
return n.low / d.low;
}
- // 0 X
- // ---
- // K X
+ /* 0 X
+ * ---
+ * K X
+ */
if (rem)
*rem = n.low;
return 0;
}
- // n.high != 0
+ /* n.high != 0 */
if (d.low == 0)
{
if (d.high == 0)
{
- // K X
- // ---
- // 0 0
+ /* K X
+ * ---
+ * 0 0
+ */
if (rem)
*rem = n.high % d.low;
return n.high / d.low;
}
- // d.high != 0
+ /* d.high != 0 */
if (n.low == 0)
{
- // K 0
- // ---
- // K 0
+ /* K 0
+ * ---
+ * K 0
+ */
if (rem)
{
r.high = n.high % d.high;
@@ -75,10 +81,11 @@
}
return n.high / d.high;
}
- // K K
- // ---
- // K 0
- if ((d.high & (d.high - 1)) == 0) // if d is a power of 2
+ /* K K
+ * ---
+ * K 0
+ */
+ if ((d.high & (d.high - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
{
@@ -88,11 +95,12 @@
}
return n.high >> __builtin_ctz(d.high);
}
- // K K
- // ---
- // K 0
+ /* K K
+ * ---
+ * K 0
+ */
sr = __builtin_clz(d.high) - __builtin_clz(n.high);
- // 0 <= sr <= n_uword_bits - 2 or sr large
+ /* 0 <= sr <= n_uword_bits - 2 or sr large */
if (sr > n_uword_bits - 2)
{
if (rem)
@@ -100,22 +108,23 @@
return 0;
}
++sr;
- // 1 <= sr <= n_uword_bits - 1
- // q.all = n.all << (n_udword_bits - sr);
+ /* 1 <= sr <= n_uword_bits - 1 */
+ /* q.all = n.all << (n_udword_bits - sr); */
q.low = 0;
q.high = n.low << (n_uword_bits - sr);
- // r.all = n.all >> sr;
+ /* r.all = n.all >> sr; */
r.high = n.high >> sr;
r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
}
- else // d.low != 0
+ else /* d.low != 0 */
{
if (d.high == 0)
{
- // K X
- // ---
- // 0 K
- if ((d.low & (d.low - 1)) == 0) // if d is a power of 2
+ /* K X
+ * ---
+ * 0 K
+ */
+ if ((d.low & (d.low - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
*rem = n.low & (d.low - 1);
@@ -126,35 +135,37 @@
q.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
return q.all;
}
- // K X
- // ---
- // 0 K
+ /* K X
+ * ---
+ *0 K
+ */
sr = 1 + n_uword_bits + __builtin_clz(d.low) - __builtin_clz(n.high);
- // 2 <= sr <= n_udword_bits - 1
- // q.all = n.all << (n_udword_bits - sr);
- // r.all = n.all >> sr;
- // if (sr == n_uword_bits)
- // {
- // q.low = 0;
- // q.high = n.low;
- // r.high = 0;
- // r.low = n.high;
- // }
- // else if (sr < n_uword_bits) // 2 <= sr <= n_uword_bits - 1
- // {
- // q.low = 0;
- // q.high = n.low << (n_uword_bits - sr);
- // r.high = n.high >> sr;
- // r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
- // }
- // else // n_uword_bits + 1 <= sr <= n_udword_bits - 1
- // {
- // q.low = n.low << (n_udword_bits - sr);
- // q.high = (n.high << (n_udword_bits - sr)) |
- // (n.low >> (sr - n_uword_bits));
- // r.high = 0;
- // r.low = n.high >> (sr - n_uword_bits);
- // }
+ /* 2 <= sr <= n_udword_bits - 1
+ * q.all = n.all << (n_udword_bits - sr);
+ * r.all = n.all >> sr;
+ * if (sr == n_uword_bits)
+ * {
+ * q.low = 0;
+ * q.high = n.low;
+ * r.high = 0;
+ * r.low = n.high;
+ * }
+ * else if (sr < n_uword_bits) // 2 <= sr <= n_uword_bits - 1
+ * {
+ * q.low = 0;
+ * q.high = n.low << (n_uword_bits - sr);
+ * r.high = n.high >> sr;
+ * r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
+ * }
+ * else // n_uword_bits + 1 <= sr <= n_udword_bits - 1
+ * {
+ * q.low = n.low << (n_udword_bits - sr);
+ * q.high = (n.high << (n_udword_bits - sr)) |
+ * (n.low >> (sr - n_uword_bits));
+ * r.high = 0;
+ * r.low = n.high >> (sr - n_uword_bits);
+ * }
+ */
q.low = (n.low << (n_udword_bits - sr)) &
((si_int)(n_uword_bits - sr) >> (n_uword_bits-1));
q.high = ((n.low << ( n_uword_bits - sr)) &
@@ -172,11 +183,12 @@
}
else
{
- // K X
- // ---
- // K K
+ /* K X
+ * ---
+ * K K
+ */
sr = __builtin_clz(d.high) - __builtin_clz(n.high);
- // 0 <= sr <= n_uword_bits - 1 or sr large
+ /* 0 <= sr <= n_uword_bits - 1 or sr large */
if (sr > n_uword_bits - 1)
{
if (rem)
@@ -184,21 +196,22 @@
return 0;
}
++sr;
- // 1 <= sr <= n_uword_bits
- // q.all = n.all << (n_udword_bits - sr);
+ /* 1 <= sr <= n_uword_bits */
+ /* q.all = n.all << (n_udword_bits - sr); */
q.low = 0;
q.high = n.low << (n_uword_bits - sr);
- // r.all = n.all >> sr;
- // if (sr < n_uword_bits)
- // {
- // r.high = n.high >> sr;
- // r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
- // }
- // else
- // {
- // r.high = 0;
- // r.low = n.high;
- // }
+ /* r.all = n.all >> sr;
+ * if (sr < n_uword_bits)
+ * {
+ * r.high = n.high >> sr;
+ * r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
+ * }
+ * else
+ * {
+ * r.high = 0;
+ * r.low = n.high;
+ * }
+ */
r.high = (n.high >> sr) &
((si_int)(sr - n_uword_bits) >> (n_uword_bits-1));
r.low = (n.high << (n_uword_bits - sr)) |
@@ -206,25 +219,27 @@
((si_int)(sr - n_uword_bits) >> (n_uword_bits-1)));
}
}
- // Not a special case
- // q and r are initialized with:
- // q.all = n.all << (n_udword_bits - sr);
- // r.all = n.all >> sr;
- // 1 <= sr <= n_udword_bits - 1
+ /* Not a special case
+ * q and r are initialized with:
+ * q.all = n.all << (n_udword_bits - sr);
+ * r.all = n.all >> sr;
+ * 1 <= sr <= n_udword_bits - 1
+ */
su_int carry = 0;
for (; sr > 0; --sr)
{
- // r:q = ((r:q) << 1) | carry
+ /* r:q = ((r:q) << 1) | carry */
r.high = (r.high << 1) | (r.low >> (n_uword_bits - 1));
r.low = (r.low << 1) | (q.high >> (n_uword_bits - 1));
q.high = (q.high << 1) | (q.low >> (n_uword_bits - 1));
q.low = (q.low << 1) | carry;
- // carry = 0;
- // if (r.all >= d.all)
- // {
- // r.all -= d.all;
- // carry = 1;
- // }
+ /* carry = 0;
+ * if (r.all >= d.all)
+ * {
+ * r.all -= d.all;
+ * carry = 1;
+ * }
+ */
const di_int s = (di_int)(d.all - r.all - 1) >> (n_udword_bits - 1);
carry = s & 1;
r.all -= d.all & s;
Modified: compiler-rt/trunk/lib/udivmodti4.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/udivmodti4.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/udivmodti4.c (original)
+++ compiler-rt/trunk/lib/udivmodti4.c Fri Aug 7 15:30:09 2009
@@ -1,24 +1,26 @@
-//===-- udivmodti4.c - Implement __udivmodti4 -----------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __udivmodti4 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- udivmodti4.c - Implement __udivmodti4 -----------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __udivmodti4 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Effects: if rem != 0, *rem = a % b
-// Returns: a / b
+/* Effects: if rem != 0, *rem = a % b
+ * Returns: a / b
+ */
-// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide
+/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */
tu_int
__udivmodti4(tu_int a, tu_int b, tu_int* rem)
@@ -32,43 +34,47 @@
utwords q;
utwords r;
unsigned sr;
- // special cases, X is unknown, K != 0
+ /* special cases, X is unknown, K != 0 */
if (n.high == 0)
{
if (d.high == 0)
{
- // 0 X
- // ---
- // 0 X
+ /* 0 X
+ * ---
+ * 0 X
+ */
if (rem)
*rem = n.low % d.low;
return n.low / d.low;
}
- // 0 X
- // ---
- // K X
+ /* 0 X
+ * ---
+ * K X
+ */
if (rem)
*rem = n.low;
return 0;
}
- // n.high != 0
+ /* n.high != 0 */
if (d.low == 0)
{
if (d.high == 0)
{
- // K X
- // ---
- // 0 0
+ /* K X
+ * ---
+ * 0 0
+ */
if (rem)
*rem = n.high % d.low;
return n.high / d.low;
}
- // d.high != 0
+ /* d.high != 0 */
if (n.low == 0)
{
- // K 0
- // ---
- // K 0
+ /* K 0
+ * ---
+ * K 0
+ */
if (rem)
{
r.high = n.high % d.high;
@@ -77,10 +83,11 @@
}
return n.high / d.high;
}
- // K K
- // ---
- // K 0
- if ((d.high & (d.high - 1)) == 0) // if d is a power of 2
+ /* K K
+ * ---
+ * K 0
+ */
+ if ((d.high & (d.high - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
{
@@ -90,11 +97,12 @@
}
return n.high >> __builtin_ctzll(d.high);
}
- // K K
- // ---
- // K 0
+ /* K K
+ * ---
+ * K 0
+ */
sr = __builtin_clzll(d.high) - __builtin_clzll(n.high);
- // 0 <= sr <= n_udword_bits - 2 or sr large
+ /* 0 <= sr <= n_udword_bits - 2 or sr large */
if (sr > n_udword_bits - 2)
{
if (rem)
@@ -102,22 +110,23 @@
return 0;
}
++sr;
- // 1 <= sr <= n_udword_bits - 1
- // q.all = n.all << (n_utword_bits - sr);
+ /* 1 <= sr <= n_udword_bits - 1 */
+ /* q.all = n.all << (n_utword_bits - sr); */
q.low = 0;
q.high = n.low << (n_udword_bits - sr);
- // r.all = n.all >> sr;
+ /* r.all = n.all >> sr; */
r.high = n.high >> sr;
r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
}
- else // d.low != 0
+ else /* d.low != 0 */
{
if (d.high == 0)
{
- // K X
- // ---
- // 0 K
- if ((d.low & (d.low - 1)) == 0) // if d is a power of 2
+ /* K X
+ * ---
+ * 0 K
+ */
+ if ((d.low & (d.low - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
*rem = n.low & (d.low - 1);
@@ -128,36 +137,38 @@
q.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
return q.all;
}
- // K X
- // ---
- // 0 K
+ /* K X
+ * ---
+ * 0 K
+ */
sr = 1 + n_udword_bits + __builtin_clzll(d.low)
- __builtin_clzll(n.high);
- // 2 <= sr <= n_utword_bits - 1
- // q.all = n.all << (n_utword_bits - sr);
- // r.all = n.all >> sr;
- // if (sr == n_udword_bits)
- // {
- // q.low = 0;
- // q.high = n.low;
- // r.high = 0;
- // r.low = n.high;
- // }
- // else if (sr < n_udword_bits) // 2 <= sr <= n_udword_bits - 1
- // {
- // q.low = 0;
- // q.high = n.low << (n_udword_bits - sr);
- // r.high = n.high >> sr;
- // r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
- // }
- // else // n_udword_bits + 1 <= sr <= n_utword_bits - 1
- // {
- // q.low = n.low << (n_utword_bits - sr);
- // q.high = (n.high << (n_utword_bits - sr)) |
- // (n.low >> (sr - n_udword_bits));
- // r.high = 0;
- // r.low = n.high >> (sr - n_udword_bits);
- // }
+ /* 2 <= sr <= n_utword_bits - 1
+ * q.all = n.all << (n_utword_bits - sr);
+ * r.all = n.all >> sr;
+ * if (sr == n_udword_bits)
+ * {
+ * q.low = 0;
+ * q.high = n.low;
+ * r.high = 0;
+ * r.low = n.high;
+ * }
+ * else if (sr < n_udword_bits) // 2 <= sr <= n_udword_bits - 1
+ * {
+ * q.low = 0;
+ * q.high = n.low << (n_udword_bits - sr);
+ * r.high = n.high >> sr;
+ * r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
+ * }
+ * else // n_udword_bits + 1 <= sr <= n_utword_bits - 1
+ * {
+ * q.low = n.low << (n_utword_bits - sr);
+ * q.high = (n.high << (n_utword_bits - sr)) |
+ * (n.low >> (sr - n_udword_bits));
+ * r.high = 0;
+ * r.low = n.high >> (sr - n_udword_bits);
+ * }
+ */
q.low = (n.low << (n_utword_bits - sr)) &
((di_int)(int)(n_udword_bits - sr) >> (n_udword_bits-1));
q.high = ((n.low << ( n_udword_bits - sr)) &
@@ -175,11 +186,12 @@
}
else
{
- // K X
- // ---
- // K K
+ /* K X
+ * ---
+ * K K
+ */
sr = __builtin_clzll(d.high) - __builtin_clzll(n.high);
- // 0 <= sr <= n_udword_bits - 1 or sr large
+ /*0 <= sr <= n_udword_bits - 1 or sr large */
if (sr > n_udword_bits - 1)
{
if (rem)
@@ -187,21 +199,22 @@
return 0;
}
++sr;
- // 1 <= sr <= n_udword_bits
- // q.all = n.all << (n_utword_bits - sr);
+ /* 1 <= sr <= n_udword_bits */
+ /* q.all = n.all << (n_utword_bits - sr); */
q.low = 0;
q.high = n.low << (n_udword_bits - sr);
- // r.all = n.all >> sr;
- // if (sr < n_udword_bits)
- // {
- // r.high = n.high >> sr;
- // r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
- // }
- // else
- // {
- // r.high = 0;
- // r.low = n.high;
- // }
+ /* r.all = n.all >> sr;
+ * if (sr < n_udword_bits)
+ * {
+ * r.high = n.high >> sr;
+ * r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
+ * }
+ * else
+ * {
+ * r.high = 0;
+ * r.low = n.high;
+ * }
+ */
r.high = (n.high >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1));
r.low = (n.high << (n_udword_bits - sr)) |
@@ -209,25 +222,27 @@
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1)));
}
}
- // Not a special case
- // q and r are initialized with:
- // q.all = n.all << (n_utword_bits - sr);
- // r.all = n.all >> sr;
- // 1 <= sr <= n_utword_bits - 1
+ /* Not a special case
+ * q and r are initialized with:
+ * q.all = n.all << (n_utword_bits - sr);
+ * r.all = n.all >> sr;
+ * 1 <= sr <= n_utword_bits - 1
+ */
su_int carry = 0;
for (; sr > 0; --sr)
{
- // r:q = ((r:q) << 1) | carry
+ /* r:q = ((r:q) << 1) | carry */
r.high = (r.high << 1) | (r.low >> (n_udword_bits - 1));
r.low = (r.low << 1) | (q.high >> (n_udword_bits - 1));
q.high = (q.high << 1) | (q.low >> (n_udword_bits - 1));
q.low = (q.low << 1) | carry;
- // carry = 0;
- // if (r.all >= d.all)
- // {
- // r.all -= d.all;
- // carry = 1;
- // }
+ /* carry = 0;
+ * if (r.all >= d.all)
+ * {
+ * r.all -= d.all;
+ * carry = 1;
+ * }
+ */
const ti_int s = (ti_int)(d.all - r.all - 1) >> (n_utword_bits - 1);
carry = s & 1;
r.all -= d.all & s;
Modified: compiler-rt/trunk/lib/udivsi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/udivsi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/udivsi3.c (original)
+++ compiler-rt/trunk/lib/udivsi3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- udivsi3.c - Implement __udivsi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __udivsi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- udivsi3.c - Implement __udivsi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __udivsi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a / b
+/* Returns: a / b */
-// Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide
+/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */
su_int
__udivsi3(su_int n, su_int d)
@@ -24,34 +25,35 @@
su_int q;
su_int r;
unsigned sr;
- // special cases
+ /* special cases */
if (d == 0)
- return 0; // ?!
+ return 0; /* ?! */
if (n == 0)
return 0;
sr = __builtin_clz(d) - __builtin_clz(n);
- // 0 <= sr <= n_uword_bits - 1 or sr large
- if (sr > n_uword_bits - 1) // d > r
+ /* 0 <= sr <= n_uword_bits - 1 or sr large */
+ if (sr > n_uword_bits - 1) /* d > r */
return 0;
- if (sr == n_uword_bits - 1) // d == 1
+ if (sr == n_uword_bits - 1) /* d == 1 */
return n;
++sr;
- // 1 <= sr <= n_uword_bits - 1
- // Not a special case
+ /* 1 <= sr <= n_uword_bits - 1 */
+ /* Not a special case */
q = n << (n_uword_bits - sr);
r = n >> sr;
su_int carry = 0;
for (; sr > 0; --sr)
{
- // r:q = ((r:q) << 1) | carry
+ /* r:q = ((r:q) << 1) | carry */
r = (r << 1) | (q >> (n_uword_bits - 1));
q = (q << 1) | carry;
- // carry = 0;
- // if (r.all >= d.all)
- // {
- // r.all -= d.all;
- // carry = 1;
- // }
+ /* carry = 0;
+ * if (r.all >= d.all)
+ * {
+ * r.all -= d.all;
+ * carry = 1;
+ * }
+ */
const si_int s = (si_int)(d - r - 1) >> (n_uword_bits - 1);
carry = s & 1;
r -= d & s;
Modified: compiler-rt/trunk/lib/udivti3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/udivti3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/udivti3.c (original)
+++ compiler-rt/trunk/lib/udivti3.c Fri Aug 7 15:30:09 2009
@@ -1,15 +1,16 @@
-//===-- udivti3.c - Implement __udivti3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __udivti3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- udivti3.c - Implement __udivti3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __udivti3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
@@ -17,7 +18,7 @@
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
-// Returns: a / b
+/* Returns: a / b */
tu_int
__udivti3(tu_int a, tu_int b)
@@ -25,4 +26,4 @@
return __udivmodti4(a, b, 0);
}
-#endif
+#endif /* __x86_64 */
Modified: compiler-rt/trunk/lib/umoddi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/umoddi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/umoddi3.c (original)
+++ compiler-rt/trunk/lib/umoddi3.c Fri Aug 7 15:30:09 2009
@@ -1,21 +1,22 @@
-//===-- umoddi3.c - Implement __umoddi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __umoddi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- umoddi3.c - Implement __umoddi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __umoddi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
-// Returns: a % b
+/* Returns: a % b */
du_int
__umoddi3(du_int a, du_int b)
Modified: compiler-rt/trunk/lib/umodsi3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/umodsi3.c?rev=78403&r1=78402&r2=78403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/umodsi3.c (original)
+++ compiler-rt/trunk/lib/umodsi3.c Fri Aug 7 15:30:09 2009
@@ -1,19 +1,20 @@
-//===-- umodsi3.c - Implement __umodsi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __umodsi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- umodsi3.c - Implement __umodsi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __umodsi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a % b
+/* Returns: a % b */
su_int __udivsi3(su_int a, su_int b);
More information about the llvm-commits
mailing list