[llvm-commits] [llvm-gcc-4.2] r54304 - in /llvm-gcc-4.2/trunk/gcc/config/arm: _fixdfdi.c _fixsfdi.c _fixunsdfdi.c _fixunssfdi.c host-arm-darwin.c libgcc-iphoneos.ver t-slibgcc-iphoneos x-darwin

Bill Wendling isanbard at gmail.com
Sat Aug 2 21:28:53 PDT 2008


Author: void
Date: Sat Aug  2 23:28:53 2008
New Revision: 54304

URL: http://llvm.org/viewvc/llvm-project?rev=54304&view=rev
Log:
Add missing ARM files. Merged in from Apple's GCC 4.2.

Added:
    llvm-gcc-4.2/trunk/gcc/config/arm/_fixdfdi.c
    llvm-gcc-4.2/trunk/gcc/config/arm/_fixsfdi.c
    llvm-gcc-4.2/trunk/gcc/config/arm/_fixunsdfdi.c
    llvm-gcc-4.2/trunk/gcc/config/arm/_fixunssfdi.c
    llvm-gcc-4.2/trunk/gcc/config/arm/host-arm-darwin.c
    llvm-gcc-4.2/trunk/gcc/config/arm/libgcc-iphoneos.ver
    llvm-gcc-4.2/trunk/gcc/config/arm/t-slibgcc-iphoneos
    llvm-gcc-4.2/trunk/gcc/config/arm/x-darwin

Added: llvm-gcc-4.2/trunk/gcc/config/arm/_fixdfdi.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/_fixdfdi.c?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/_fixdfdi.c (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/_fixdfdi.c Sat Aug  2 23:28:53 2008
@@ -0,0 +1,84 @@
+/* APPLE LOCAL file 5316398 improved float/double -> int64 functions */
+#include <stdint.h>
+
+int64_t
+__fixdfdi (double x)
+{
+  union { double d; uint64_t u; } u = {x};
+  uint64_t fabsx = u.u & 0x7fffffffffffffffULL;
+  uint32_t exp = fabsx >> 52;
+  int64_t result = 0;
+
+  /* for very large and reasonably small values, regular int converter
+     works fine */
+  if (exp >= 52U + 1023U)	/* if( |x| >= 0x1.0p52 || isnan( x ) ) */
+    {
+      /* early out for error cases |x| >= 0x1.0p63 || isnan(x) */
+      if (exp >= 1023U + 63U)
+	{
+	  /* special case for x == -0x1.0p63 */
+	  if (-0x1.0p63 == x)
+	    return 0x8000000000000000ULL;
+
+	  /* huge, Inf, NaN */
+	  result = (int32_t) x;	/* grab sign bit */
+	  result >>= 63;	/* splat it across value */
+	  /* return either 0x8000000000000000 or 0x7fffffffffffffff
+	     according to sign bit */
+	  result ^= 0x7fffffffffffffffULL;
+
+	  return result;
+	}
+
+      /* 0x1.0p52 <= |x| < 0x1.0p63 always integer, but too big. Chop
+         off some of the top. */
+      u.u &= 0xFFFFFFFF00000000ULL;	/* truncate off some low bits */
+      x -= u.d;			/* get remainder */
+
+      /* accumulate the high part into result */
+      int32_t hi = u.d * 0x1.0p-32;
+      result += (int64_t) hi << 32;
+    }
+  else
+    {				/* |x| < 0x1.0p52 */
+
+      /* early out for |x| < 0x1.0p31 -- use hardware 32-bit conversion */
+      if (exp < 1023U + 31U)
+	return (int64_t) ((int32_t) x);
+
+      /* The integer result fits in the significand, but there may be
+         some fractional bits. Value is too large to use 32-bit
+         hardware.
+
+         create a mask that covers the high 32-bit part of the number
+         and the whole integer part. */
+      uint64_t intMask = (int64_t) 0xFFF0000000000000LL >> (exp - 1023);
+
+      /* extract the full integer (round to integer in round to zero
+         rounding mode) */
+      u.u &= intMask;
+
+      /* find the fractional part */
+      double fraction = x - u.d;
+
+      /* save the integer part */
+      x = u.d;
+
+      /* set inexact as needed */
+      result = (int32_t) fraction;	/* always 0 */
+    }
+
+  /* xi is < 2**53 now and integer. Convert to integer representation. */
+  if (x < 0.0)
+    {
+      u.d = x - 0x1.0p52;
+      result -= u.u & 0x000FFFFFFFFFFFFFULL;
+    }
+  else
+    {
+      u.d = x + 0x1.0p52;
+      result += u.u & 0x000FFFFFFFFFFFFFULL;
+    }
+
+  return result;
+}

Added: llvm-gcc-4.2/trunk/gcc/config/arm/_fixsfdi.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/_fixsfdi.c?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/_fixsfdi.c (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/_fixsfdi.c Sat Aug  2 23:28:53 2008
@@ -0,0 +1,54 @@
+/* APPLE LOCAL file 5316398 improved float/double -> int64 functions */
+#include <stdint.h>
+
+int64_t
+__fixsfdi (float x)
+{
+  union { float f; uint32_t u; } u = {x};
+  uint32_t fabsx = u.u & 0x7fffffffU;
+  uint32_t exp = fabsx >> 23;
+  int64_t result = 0;
+
+  /* for small ints, overflow and NaN, the int32_t converter works fine 
+     if( |x| < 0x1.0p31f || |x| >= 1.0p64f || isnan(x) ) unsigned
+     compare */
+  if (exp - (127U + 31U) >= (63U - 31U))
+    {
+      if (exp > (127 + 31))
+	{
+	  if (x == -0x1.0p63f)
+	    return 0x8000000000000000LL;
+
+	  uint32_t r = (int32_t) x;
+	  result = (int64_t) r << 32;
+	  r = (r << 1) | (r & 1);
+	  result |= r;
+	  return result;
+	}
+
+      /* small number. Regular int32_t conversion will work fine here. */
+      result = (int32_t) x;
+      return result;
+    }
+
+  /* 0x1.0p31 <= |x| <0x1.0p64, x is always an integer in this range */
+
+  /* convert float to fixed */
+  result = (fabsx & 0x007fffffU) | 0x00800000;
+
+  /* signMask = x < 0.0f ? -1LL : 0 */
+  int64_t signMask = (int64_t) u.u << 32;
+  signMask >>= 63;
+
+  /* Calculate shift value to move fixed point to right place */
+  int32_t leftShift = exp - (127 + 23);
+
+  /* move the fixed point into place */
+  result <<= leftShift;
+
+  /* Fix sign */
+  result ^= signMask;
+  result -= signMask;
+
+  return result;
+}

Added: llvm-gcc-4.2/trunk/gcc/config/arm/_fixunsdfdi.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/_fixunsdfdi.c?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/_fixunsdfdi.c (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/_fixunsdfdi.c Sat Aug  2 23:28:53 2008
@@ -0,0 +1,64 @@
+/* APPLE LOCAL file 5316398 improved float/double -> int64 functions */
+#include <stdint.h>
+
+uint64_t
+__fixunsdfdi (double x)
+{
+  union { double d; uint64_t u; uint32_t u32[2]; } u = {x};
+  uint32_t hi = u.u >> 32;
+  uint32_t lo;
+
+  /* Early out for the common case: +0 <= x < 0x1.0p32 */
+  if (__builtin_expect (hi < 0x41f00000U, 1))
+    return (uint64_t) ((uint32_t) x);
+
+  /* 0x1.0p32 <= x < 0x1.0p64 */
+  if (__builtin_expect (hi < 0x43f00000U, 1))
+    {
+      /* if x < 0x1.0p52 */
+      if (__builtin_expect (hi < 0x43400000U, 1))
+	{
+	  if (__builtin_expect (hi < 0x43300000U, 1))
+	    {
+	      uint32_t shift = (1023 + 52) - (hi >> 20);
+	      uint32_t unitBit = 1U << shift;
+	      uint32_t fractMask = unitBit - 1;
+	      u.u32[0] = lo = (uint32_t) u.u & ~fractMask;
+	      x -= u.d;
+	      hi &= 0x000FFFFFU;
+	      hi |= 0x00100000U;
+	      lo = (lo >> shift) | (hi << (32 - shift));
+	      /* (int32_t) x is always zero here. This sets the inexact 
+	         flag. */
+	      hi = (hi >> shift) + (int32_t) x;
+	    }
+	  else
+	    {
+	      u.u &= 0x000FFFFFFFFFFFFFULL;
+	      u.u |= 0x0010000000000000ULL;
+	      return u.u;
+	    }
+	}
+      else
+	{
+	  uint32_t shift = (hi >> 20) - (1023 + 52);
+	  hi &= 0x000FFFFFU;
+	  lo = u.u;
+	  hi |= 0x00100000U;
+
+	  hi = (hi << shift) | (lo >> (32 - shift));
+	  lo = lo << shift;
+	}
+
+      /* return the result; */
+      return ((uint64_t) hi << 32) | lo;
+    }
+
+  /* x <= -0 or x >= 0x1.0p64 or x is NaN. set invalid as necessary.
+     Pin according to ARM rules. */
+  hi = x;
+
+  /* promote to 64-bits */
+  lo = (hi << 1) | (hi & 1);
+  return ((uint64_t) hi << 32) | lo;
+}

Added: llvm-gcc-4.2/trunk/gcc/config/arm/_fixunssfdi.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/_fixunssfdi.c?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/_fixunssfdi.c (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/_fixunssfdi.c Sat Aug  2 23:28:53 2008
@@ -0,0 +1,41 @@
+/* APPLE LOCAL file 5316398 improved float/double -> int64 functions */
+#include <stdint.h>
+
+uint64_t
+__fixunssfdi (float x)
+{
+  union { float f; uint32_t u; } u = {x};
+  uint32_t hi, lo;
+
+  /* early out for common small positive numbers. */
+  if (__builtin_expect (u.u < 0x4f800000U, 1))
+    return (uint64_t) ((uint32_t) x);
+
+  /* larger non-overflowing cases are all exact, so we just need to do
+     the conversion in integer code */
+  /* if( 0x1.0p32f <= x < 0x1.0p63f ) */
+  if (__builtin_expect (u.u < 0x5f800000U, 1))
+    {
+      uint32_t bits = (u.u & 0x007fffffU) | 0x00800000U;
+      uint32_t shift = (u.u >> 23) - (127 + 23);
+      if (shift < 32)
+	{
+	  hi = bits >> (32 - shift);
+	  lo = bits << shift;
+	}
+      else
+	{
+	  hi = bits << (shift - 32);
+	  lo = 0;
+	}
+      return ((uint64_t) hi << 32) | lo;
+    }
+
+  /* Overflow or NaN: convert value to unsigned int, set invalid as
+     necessary */
+  hi = x;
+
+  /* extend to 64-bits. */
+  lo = (hi << 1) | (hi & 1);
+  return ((uint64_t) hi << 32) | lo;
+}

Added: llvm-gcc-4.2/trunk/gcc/config/arm/host-arm-darwin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/host-arm-darwin.c?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/host-arm-darwin.c (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/host-arm-darwin.c Sat Aug  2 23:28:53 2008
@@ -0,0 +1,33 @@
+/* APPLE LOCAL file ARM native compiler support */
+/* arm-darwin host-specific hook definitions.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
+#include "config/host-darwin.h"
+
+/* Darwin doesn't do anything special for arm hosts; this file exists just
+   to include config/host-darwin.h.  */
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
+

Added: llvm-gcc-4.2/trunk/gcc/config/arm/libgcc-iphoneos.ver
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/libgcc-iphoneos.ver?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/libgcc-iphoneos.ver (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/libgcc-iphoneos.ver Sat Aug  2 23:28:53 2008
@@ -0,0 +1,38 @@
+# APPLE LOCAL file ARM 5681645
+GCC_4.0.1 {
+  # Thumb VFP support
+  __muldf3vfp
+  __adddf3vfp
+  __subdf3vfp
+  __divdf3vfp
+  __eqdf2vfp
+  __nedf2vfp
+  __ltdf2vfp
+  __gtdf2vfp
+  __ledf2vfp
+  __gedf2vfp
+  __unorddf2vfp
+  __fixdfsivfp
+  __fixunsdfsivfp
+  __extendsfdf2vfp
+  __truncdfsf2vfp
+  __floatsidfvfp
+  __floatunssidfvfp
+  __mulsf3vfp
+  __addsf3vfp
+  __subsf3vfp
+  __divsf3vfp
+  __eqsf2vfp
+  __nesf2vfp
+  __ltsf2vfp
+  __gtsf2vfp
+  __lesf2vfp
+  __gesf2vfp
+  __unordsf2vfp
+  __fixsfsivfp
+  __fixunssfsivfp
+  __floatsisfvfp
+  __floatunssisfvfp
+ # Miscellaneous
+  __flt_rounds
+}

Added: llvm-gcc-4.2/trunk/gcc/config/arm/t-slibgcc-iphoneos
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/t-slibgcc-iphoneos?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/t-slibgcc-iphoneos (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/t-slibgcc-iphoneos Sat Aug  2 23:28:53 2008
@@ -0,0 +1,64 @@
+# APPLE LOCAL file ARM 5681645
+# Build a shared libgcc library with the darwin linker.
+SHLIB_SOVERSION = 1
+SHLIB_VERSTRING = -compatibility_version $(SHLIB_SOVERSION) -current_version $(SHLIB_SOVERSION).0
+SHLIB_EXT = .dylib
+SHLIB_INSTALL_NAME = @shlib_base_name at .$(SHLIB_SOVERSION)$(SHLIB_EXT)
+SHLIB_SONAME = @shlib_base_name at .$(SHLIB_SOVERSION)$(SHLIB_EXT)
+SHLIB_SOLINK = @shlib_base_name at .so
+SHLIB_MAP = @shlib_map_file@
+SHLIB_OBJS = @shlib_objs@
+SHLIB_DIR = @multilib_dir@
+SHLIB_LC = -lc
+
+# Darwin only searches in /usr/lib for shared libraries, not in subdirectories,
+# so the libgcc variants have different names not different locations.
+# Note that this version is used for the loader, not the linker; the linker
+# uses the stub versions named by $(LIBGCC).
+# APPLE LOCAL begin no-libtool
+# APPLE LOCAL begin ARM dead strip libgcc_s
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
+	-Wl,-dead_strip \
+	-install_name $(slibdir)/$(SHLIB_INSTALL_NAME) \
+	-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \
+	-Wl,-exported_symbols_list,$(SHLIB_MAP) \
+	$(SHLIB_VERSTRING) \
+	@multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC)
+# APPLE LOCAL end ARM dead strip libgcc_s
+# APPLE LOCAL end no-libtool
+
+# $(slibdir) double quoted to protect it from expansion while building
+# libgcc.mk.  We want this delayed until actual install time.
+SHLIB_INSTALL = \
+	$$(mkinstalldirs) $$(DESTDIR)$$(slibdir); \
+	$(INSTALL_DATA) $(SHLIB_SONAME) \
+	  $$(DESTDIR)$$(slibdir)/$(SHLIB_SONAME)
+
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
+SHLIB_MKMAP_OPTS = -v leading_underscore=1
+SHLIB_MAPFILES += $(srcdir)/libgcc-std.ver $(srcdir)/config/arm/libgcc-iphoneos.ver
+
+# Must use a different directive for hidden visibility in assembly sources.
+ASM_HIDDEN_OP = .private_extern
+
+libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT): stmp-multilib
+	# When building multilibbed target libraries, all the required
+	# libraries are expected to exist in the multilib directory.
+	MLIBS=`$(GCC_FOR_TARGET) --print-multi-lib \
+		| sed -e 's/;.*$$//' -e '/^\.$$/d'` ; \
+	if [ -n "$$MLIBS" ] ; then \
+	  for mlib in '' $$MLIBS ; do \
+	    cp ./$${mlib}/libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT).tmp \
+	       ./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
+	  done ; \
+	  $(LIPO_FOR_TARGET) -output libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
+	    -create libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T* ; \
+	  rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T* ; \
+	else \
+	  cp ./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT).tmp \
+	     ./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) ; \
+	fi
+
+# From the point-of-view of the Makefiles, libgcc is built by the 'strip'
+# and 'lipo' commands above.
+LIBGCC=libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) stmp-multilib

Added: llvm-gcc-4.2/trunk/gcc/config/arm/x-darwin
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/x-darwin?rev=54304&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/x-darwin (added)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/x-darwin Sat Aug  2 23:28:53 2008
@@ -0,0 +1,7 @@
+ # APPLE LOCAL file ARM native compiler support
+host-arm-darwin.o : $(srcdir)/config/arm/host-arm-darwin.c \
+  $(CONFIG_H) $(SYSTEM_H) coretypes.h hosthooks.h $(HOSTHOOKS_DEF_H) \
+  config/host-darwin.h
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+XCFLAGS = -mdynamic-no-pic





More information about the llvm-commits mailing list