[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9471 - in gnuradio/trunk: . config gnuradio-core/src/
From: |
eb |
Subject: |
[Commit-gnuradio] r9471 - in gnuradio/trunk: . config gnuradio-core/src/lib/filter |
Date: |
Sun, 31 Aug 2008 15:35:49 -0600 (MDT) |
Author: eb
Date: 2008-08-31 15:35:48 -0600 (Sun, 31 Aug 2008)
New Revision: 9471
Added:
gnuradio/trunk/gnuradio-core/src/lib/filter/gr_vec_types.h
Modified:
gnuradio/trunk/config/gr_set_md_cpu.m4
gnuradio/trunk/configure.ac
gnuradio/trunk/gnuradio-core/src/lib/filter/Makefile.am
gnuradio/trunk/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c
gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.c
gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.h
gnuradio/trunk/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
Log:
fix for ticket:268, vector not always a context sensitive keywork
Modified: gnuradio/trunk/config/gr_set_md_cpu.m4
===================================================================
--- gnuradio/trunk/config/gr_set_md_cpu.m4 2008-08-31 20:48:15 UTC (rev
9470)
+++ gnuradio/trunk/config/gr_set_md_cpu.m4 2008-08-31 21:35:48 UTC (rev
9471)
@@ -19,20 +19,39 @@
dnl Boston, MA 02110-1301, USA.
dnl
+AC_DEFUN([_TRY_ADD_ALTIVEC],
+[
+ LF_CHECK_CC_FLAG([-mabi=altivec -maltivec])
+ LF_CHECK_CXX_FLAG([-mabi=altivec -maltivec])
+])
+
AC_DEFUN([GR_SET_MD_CPU],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_WITH(md-cpu,
- [ --with-md-cpu=ARCH set machine dependent speedups (auto)],
+ AC_HELP_STRING([--with-md-cpu=ARCH],[set machine dependent speedups
(auto)]),
[cf_with_md_cpu="$withval"],
[cf_with_md_cpu="$host_cpu"])
- AC_MSG_CHECKING([for machine dependent speedups])
case "$cf_with_md_cpu" in
x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;;
x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;;
powerpc*) MD_CPU=powerpc ;;
*) MD_CPU=generic ;;
esac
+
+ AC_ARG_ENABLE(altivec,
+ AC_HELP_STRING([--enable-altivec],[enable altivec on PowerPC (yes)]),
+ [ if test $MD_CPU = powerpc; then
+ case "$enableval" in
+ (no) MD_CPU=generic ;;
+ (yes) _TRY_ADD_ALTIVEC ;;
+ (*) AC_MSG_ERROR([Invalid argument ($enableval) to
--enable-altivec]) ;;
+ esac
+ fi],
+ [ if test $MD_CPU = powerpc; then _TRY_ADD_ALTIVEC fi])
+
+
+ AC_MSG_CHECKING([for machine dependent speedups])
AC_MSG_RESULT($MD_CPU)
AC_SUBST(MD_CPU)
AC_SUBST(MD_SUBCPU)
Modified: gnuradio/trunk/configure.ac
===================================================================
--- gnuradio/trunk/configure.ac 2008-08-31 20:48:15 UTC (rev 9470)
+++ gnuradio/trunk/configure.ac 2008-08-31 21:35:48 UTC (rev 9471)
@@ -137,6 +137,7 @@
AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(windows.h)
+AC_CHECK_HEADERS(vec_types.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
Modified: gnuradio/trunk/gnuradio-core/src/lib/filter/Makefile.am
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/filter/Makefile.am 2008-08-31
20:48:15 UTC (rev 9470)
+++ gnuradio/trunk/gnuradio-core/src/lib/filter/Makefile.am 2008-08-31
21:35:48 UTC (rev 9471)
@@ -283,6 +283,7 @@
gr_single_pole_iir.h \
gr_single_pole_iir_filter_ff.h \
gr_single_pole_iir_filter_cc.h \
+ gr_vec_types.h \
gri_goertzel.h \
gri_iir.h \
gri_mmse_fir_interpolator.h \
Modified: gnuradio/trunk/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c
2008-08-31 20:48:15 UTC (rev 9470)
+++ gnuradio/trunk/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c
2008-08-31 21:35:48 UTC (rev 9471)
@@ -61,8 +61,8 @@
float
dotprod_fff_altivec(const float *_a, const float *_b, size_t n)
{
- const vector float *a = (const vector float *) _a;
- const vector float *b = (const vector float *) _b;
+ const vec_float4 *a = (const vec_float4 *) _a;
+ const vec_float4 *b = (const vec_float4 *) _b;
static const size_t UNROLL_CNT = 4;
@@ -73,15 +73,15 @@
// printf("n = %zd, loop_cnt = %zd, nleft = %zd\n", n, loop_cnt, nleft);
// Used with vperm to build a* from p*
- vector unsigned char lvsl_a = vec_lvsl(0, _a);
+ vec_uchar16 lvsl_a = vec_lvsl(0, _a);
- vector float p0, p1, p2, p3;
- vector float a0, a1, a2, a3;
- vector float b0, b1, b2, b3;
- vector float acc0 = {0, 0, 0, 0};
- vector float acc1 = {0, 0, 0, 0};
- vector float acc2 = {0, 0, 0, 0};
- vector float acc3 = {0, 0, 0, 0};
+ vec_float4 p0, p1, p2, p3;
+ vec_float4 a0, a1, a2, a3;
+ vec_float4 b0, b1, b2, b3;
+ vec_float4 acc0 = {0, 0, 0, 0};
+ vec_float4 acc1 = {0, 0, 0, 0};
+ vec_float4 acc2 = {0, 0, 0, 0};
+ vec_float4 acc3 = {0, 0, 0, 0};
// wind in
Modified: gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.c
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.c 2008-08-31
20:48:15 UTC (rev 9470)
+++ gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.c 2008-08-31
21:35:48 UTC (rev 9471)
@@ -22,7 +22,7 @@
#include <gr_altivec.h>
void
-gr_print_vector_float(FILE *fp, vector float v)
+gr_print_vector_float(FILE *fp, vec_float4 v)
{
union v_float_u u;
u.v = v;
@@ -30,7 +30,7 @@
}
void
-gr_pvf(FILE *fp, const char *label, vector float v)
+gr_pvf(FILE *fp, const char *label, vec_float4 v)
{
fprintf(fp, "%s = ", label);
gr_print_vector_float(fp, v);
Modified: gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.h
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.h 2008-08-31
20:48:15 UTC (rev 9470)
+++ gnuradio/trunk/gnuradio-core/src/lib/filter/gr_altivec.h 2008-08-31
21:35:48 UTC (rev 9471)
@@ -21,7 +21,25 @@
#ifndef INCLUDED_GR_ALTIVEC_H
#define INCLUDED_GR_ALTIVEC_H
+/*
+ * N.B., always use "vec_float4" et al. instead of "vector float" to
+ * ensure portability across the various powerpc compilers. Some of
+ * them treat "vector" as a context specific keyword, some don't.
+ * Avoid the problem by always using the defines in vec_types.h
+ * (included below)
+ */
+
#include <altivec.h>
+#undef bool // repair namespace pollution
+#undef vector // repair namespace pollution
+
+#ifdef HAVE_VEC_TYPES_H
+#include <vec_types.h> // use system version if we've got it
+#else
+#include <gr_vec_types.h> // fall back to our local copy
+#endif
+#undef qword // repair namespace pollution
+
#include <stddef.h>
#include <stdio.h>
@@ -29,23 +47,23 @@
extern "C" {
#endif
-#define VS sizeof(vector float)
-#define FLOATS_PER_VEC (sizeof(vector float)/sizeof(float))
+#define VS sizeof(vec_float4)
+#define FLOATS_PER_VEC (sizeof(vec_float4)/sizeof(float))
union v_float_u {
- vector float v;
+ vec_float4 v;
float f[FLOATS_PER_VEC];
};
-void gr_print_vector_float(FILE *fp, vector float v);
-void gr_pvf(FILE *fp, const char *label, vector float v);
+void gr_print_vector_float(FILE *fp, vec_float4 v);
+void gr_pvf(FILE *fp, const char *label, vec_float4 v);
static inline float
-horizontal_add_f(vector float v)
+horizontal_add_f(vec_float4 v)
{
union v_float_u u;
- vector float t0 = vec_add(v, vec_sld(v, v, 8));
- vector float t1 = vec_add(t0, vec_sld(t0, t0, 4));
+ vec_float4 t0 = vec_add(v, vec_sld(v, v, 8));
+ vec_float4 t1 = vec_add(t0, vec_sld(t0, t0, 4));
u.v = t1;
return u.f[0];
}
Modified: gnuradio/trunk/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
2008-08-31 20:48:15 UTC (rev 9470)
+++ gnuradio/trunk/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
2008-08-31 21:35:48 UTC (rev 9471)
@@ -62,7 +62,7 @@
d_aligned_taps = 0;
}
void *p;
- int r = posix_memalign(&p, sizeof(vector float), d_naligned_taps *
sizeof(d_aligned_taps[0]));
+ int r = posix_memalign(&p, sizeof(vec_float4), d_naligned_taps *
sizeof(d_aligned_taps[0]));
if (r != 0){
throw std::bad_alloc();
}
Added: gnuradio/trunk/gnuradio-core/src/lib/filter/gr_vec_types.h
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/filter/gr_vec_types.h
(rev 0)
+++ gnuradio/trunk/gnuradio-core/src/lib/filter/gr_vec_types.h 2008-08-31
21:35:48 UTC (rev 9471)
@@ -0,0 +1,54 @@
+/* Cell single token vector types
+ Copyright (C) 2007 Free Software Foundation, 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 2 of the License, or (at your option)
+ any later version.
+
+ 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 file; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* As a special exception, if you include this header file into source files
+ compiled by GCC, this header file does not by itself cause the resulting
+ executable to be covered by the GNU General Public License. This exception
+ does not however invalidate any other reasons why the executable file might
be
+ covered by the GNU General Public License. */
+
+/* Single token vector data types for the PowerPC SIMD/Vector Multi-media
+ eXtension */
+
+#ifndef _VEC_TYPES_H_
+#define _VEC_TYPES_H_ 1
+
+#define qword __vector unsigned char
+
+#define vec_uchar16 __vector unsigned char
+#define vec_char16 __vector signed char
+#define vec_bchar16 __vector bool char
+
+#define vec_ushort8 __vector unsigned short
+#define vec_short8 __vector signed short
+#define vec_bshort8 __vector bool short
+
+#define vec_pixel8 __vector pixel
+
+#define vec_uint4 __vector unsigned int
+#define vec_int4 __vector signed int
+#define vec_bint4 __vector bool int
+
+#define vec_float4 __vector float
+
+#define vec_ullong2 __vector bool char
+#define vec_llong2 __vector bool short
+
+#define vec_double2 __vector bool int
+
+#endif /* _VEC_TYPES_H_ */
Property changes on: gnuradio/trunk/gnuradio-core/src/lib/filter/gr_vec_types.h
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9471 - in gnuradio/trunk: . config gnuradio-core/src/lib/filter,
eb <=