summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2012-02-29 20:21:30 +0000
committerrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2012-02-29 20:21:30 +0000
commite74f57e9942decc725f52795bb4d6883f58cc299 (patch)
tree5534ebeb3617d7279e81af5eebf0ac6b44a7987f
parent12077db4bf6f8e89abae5203de09dfbd2070f108 (diff)
Added units to check for __builtin_ctz() and __builtin_clz() support.
git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@137 2592e710-e01b-42a5-8df0-11608a6cc53d
-rw-r--r--MANIFEST2
-rw-r--r--mcon/U/d_built_clz.U37
-rw-r--r--mcon/U/d_built_ctz.U37
3 files changed, 76 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index e659f18..4f85e49 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -172,6 +172,8 @@ mcon/U/d_bcopy.U Do we have bcopy() or memcpy()?
mcon/U/d_bindtxtcode.U Do we have bind_textdomain_codeset()?
mcon/U/d_brokstat.U Check whether stat() macros are broken
mcon/U/d_bsdjmp.U Do we have BSD _setjmp() and _longjmp()?
+mcon/U/d_built_clz.U Is __builtin_clz() available?
+mcon/U/d_built_ctz.U Is __builtin_ctz() available?
mcon/U/d_built_memcmp.U Is __builtin_memcmp() available?
mcon/U/d_built_popcount.U Is __builtin_popcount() available?
mcon/U/d_byacc.U Is byacc available?
diff --git a/mcon/U/d_built_clz.U b/mcon/U/d_built_clz.U
new file mode 100644
index 0000000..8af83ce
--- /dev/null
+++ b/mcon/U/d_built_clz.U
@@ -0,0 +1,37 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 2012 Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?MAKE:d_built_clz: Trylink cat
+?MAKE: -pick add $@ %<
+?S:d_built_clz:
+?S: This variable conditionally defines the HAS_BUILTIN_CLZ symbol, which
+?S: indicates to the C program that __builtin_clz is available to count
+?S: leading zeroes.
+?S:.
+?C:HAS_BUILTIN_CLZ:
+?C: This symbol, if defined, indicates that the __builtin_clz routine is
+?C: available to count leading zeroes in a word.
+?C:.
+?H:#$d_built_clz HAS_BUILTIN_CLZ /**/
+?H:.
+?LINT:set d_built_clz
+: check for __builtin_clz
+$cat >try.c <<EOC
+int main(void)
+{
+ static int ret;
+ ret |= __builtin_clz(127);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=__builtin_clz
+set d_built_clz
+eval $trylink
+
diff --git a/mcon/U/d_built_ctz.U b/mcon/U/d_built_ctz.U
new file mode 100644
index 0000000..279d50f
--- /dev/null
+++ b/mcon/U/d_built_ctz.U
@@ -0,0 +1,37 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 2012 Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?MAKE:d_built_ctz: Trylink cat
+?MAKE: -pick add $@ %<
+?S:d_built_ctz:
+?S: This variable conditionally defines the HAS_BUILTIN_CTZ symbol, which
+?S: indicates to the C program that __builtin_ctz is available to count
+?S: trailing zeroes.
+?S:.
+?C:HAS_BUILTIN_CTZ:
+?C: This symbol, if defined, indicates that __builtin_ctz routine is
+?C: available to count trailing zeroes in a word.
+?C:.
+?H:#$d_built_ctz HAS_BUILTIN_CTZ /**/
+?H:.
+?LINT:set d_built_ctz
+: check for __builtin_ctz
+$cat >try.c <<EOC
+int main(void)
+{
+ static int ret;
+ ret |= __builtin_ctz(127);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=__builtin_ctz
+set d_built_ctz
+eval $trylink
+