summaryrefslogtreecommitdiff
path: root/libgcc/config/arc/divtab-arc700.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-12 15:23:33 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-12 15:23:33 +0000
commit9456798d72d0e81a2a553287f436dcb05cff175a (patch)
tree1e80106d0c4f828b72deb6e782c20d788c0dd818 /libgcc/config/arc/divtab-arc700.c
parente89aee4174fe58eaba553027558144a0f423960c (diff)
downloadgcc-9456798d72d0e81a2a553287f436dcb05cff175a.tar.gz
[./]
2013-11-12 Basile Starynkevitch <basile@starynkevitch.net> {{merge with trunk GCC 4.9 svn rev 204695; previous trunk merge was 202773; very unstable...}} [gcc/] 2013-11-11 Basile Starynkevitch <basile@starynkevitch.net> {{merge with trunk GCC 4.9 svn rev 204695; very unstable}} * melt-runtime.h (MELT_VERSION_STRING): Bump to "1.0.1+". * melt-run.proto.h: Update copyright years. include tree-cfg.h instead of tree-flow.h for GCC 4.9. * melt-runtime.cc: Include tree-cfg.h not tree-flow.h for GCC 4.9. (meltgc_walk_gimple_seq): Fatal error with GCC 4.9 since the walk_use_def_chains function disappeared from GCC... * melt/xtramelt-ana-gimple.melt (walk_gimple_seq) (walk_gimple_seq_unique_tree): issue some #warning-s for GCC 4.9 because walk_use_def_chains function disappeared from GCC... * melt/xtramelt-probe.melt (probe_docmd): Issue an error since currently the MELT probe is not usable with GCC 4.9.... git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@204705 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/config/arc/divtab-arc700.c')
-rw-r--r--libgcc/config/arc/divtab-arc700.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/libgcc/config/arc/divtab-arc700.c b/libgcc/config/arc/divtab-arc700.c
new file mode 100644
index 00000000000..dba0b4e3928
--- /dev/null
+++ b/libgcc/config/arc/divtab-arc700.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2004, 2006, 2007-2013 Free Software Foundation, Inc.
+ Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
+ on behalf of Synopsys Inc.
+
+This file 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 3, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+This file 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 this program; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+/* Calculate division table for ARC700 integer division
+ Contributed by Joern Rennecke
+ joern.rennecke@arc.com */
+
+#include <stdio.h>
+#include <math.h>
+
+int
+main ()
+{
+ int i, j;
+ unsigned x;
+ double q, r, err, max_err = -1;
+
+ puts("/* This table has been generated by divtab-arc700.c. */");
+ puts("\
+/* 1/512 .. 1/256, normalized. There is a leading 1 in bit 31.\n\
+ For powers of two, we list unnormalized numbers instead. The values\n\
+ for powers of 2 are loaded, but not used. The value for 1 is actually\n\
+ the first instruction after .Lmuldiv. */\n\
+ .balign 4");
+ puts (".Ldivtab:\n");
+ for (i = 256; i >= 2; --i)
+ {
+ j = i < 0 ? -i : i;
+ if (j & (j-1))
+ while (j < 128)
+ j += j;
+ else
+ /* Power of two. */
+ j *= 128;
+ q = 4.*(1<<30)*128/j;
+ r = ceil (q);
+ printf ("\t.long\t0x%X\n", (unsigned) r);
+ err = r - q;
+ if (err > max_err)
+ max_err = err;
+ }
+#if 0
+ printf ("\t/* maximum error: %f */\n", max_err);
+#endif
+ exit (0);
+}