Skip to content

Commit

Permalink
x86 mmx core
Browse files Browse the repository at this point in the history
  • Loading branch information
stream1972 committed Nov 13, 2008
1 parent 0333bbd commit a6788ca
Show file tree
Hide file tree
Showing 6 changed files with 547 additions and 5 deletions.
33 changes: 30 additions & 3 deletions common/core_ogr_ng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Any other distribution or use of this source violates copyright.
*/
const char *core_ogr_ng_cpp(void) {
return "@(#)$Id: core_ogr_ng.cpp,v 1.6 2008/10/27 10:14:11 oliver Exp $"; }
return "@(#)$Id: core_ogr_ng.cpp,v 1.7 2008/11/13 06:36:48 stream Exp $"; }

//#define TRACE

Expand Down Expand Up @@ -67,6 +67,7 @@ return "@(#)$Id: core_ogr_ng.cpp,v 1.6 2008/10/27 10:14:11 oliver Exp $"; }
CoreDispatchTable *ogrng64_get_dispatch_table(void);
#else
CoreDispatchTable *ogrng_get_dispatch_table_asm1(void); //B (asm #1)
CoreDispatchTable *ogrng_get_dispatch_table_mmx(void); //C (asm #2)
#endif
#elif (CLIENT_CPU == CPU_ARM)
CoreDispatchTable *ogrng_get_dispatch_table(void);
Expand Down Expand Up @@ -97,6 +98,9 @@ int InitializeCoreTable_ogr_ng(int first_time)
ogrng64_get_dispatch_table();
#else
ogrng_get_dispatch_table_asm1();
#ifdef HAVE_I64
ogrng_get_dispatch_table_mmx();
#endif
#endif
#elif (CLIENT_CPU == CPU_POWERPC) || (CLIENT_CPU == CPU_CELLBE)
ogrng_get_dispatch_table();
Expand Down Expand Up @@ -175,6 +179,7 @@ const char **corenames_for_contest_ogr_ng()
"FLEGE-64 2.0",
#else
"rt-asm-generic",
"rt-asm-mmx",
#endif
#elif (CLIENT_CPU == CPU_AMD64)
"FLEGE-64 2.0",
Expand Down Expand Up @@ -270,7 +275,18 @@ int apply_selcore_substitution_rules_ogr_ng(int cindex)
#endif

# elif (CLIENT_CPU == CPU_X86)
# if !defined(HAVE_I64) || (SIZEOF_LONG < 8) /* no 64-bit support? */
# if defined(HAVE_I64)
# if (SIZEOF_LONG < 8) /* classic x86-32 */
unsigned feature = GetProcessorFeatureFlags();
if ((feature & CPU_F_MMX) == 0 && cindex == 2) /* MMX for MMX core */
cindex = 1;
# else /* x86-64 */
# endif
# else /* No 64-bit support in compiler */
# if (SIZEOF_LONG < 8) /* classic x86-32 */
if (cindex == 2) /* mmx core requires 64-bits types */
cindex = 1;
# endif
# endif
#endif
return cindex;
Expand Down Expand Up @@ -338,7 +354,14 @@ int selcoreGetPreselectedCoreForProject_ogr_ng()
#if defined(HAVE_I64) && (SIZEOF_LONG == 8) // Need native 64-bit support
cindex = 1; /* 64-bit core */
#else
cindex = 1; /* generic asm core */
#if defined(HAVE_I64)
if (detected_flags & CPU_F_MMX)
cindex = 2; /* mmx asm core */
else
cindex = 1; /* no mmx - generic asm core */
#else
cindex = 1; /* no 64-bit support - generic asm core */
#endif
#endif
}
// ===============================================================
Expand Down Expand Up @@ -447,6 +470,10 @@ int selcoreSelectCore_ogr_ng(unsigned int threadindex, int *client_cpuP,
#else
if (coresel == 1)
unit_func.ogr = ogrng_get_dispatch_table_asm1();
#ifdef HAVE_I64
else if (coresel == 2)
unit_func.ogr = ogrng_get_dispatch_table_mmx();
#endif
else
unit_func.ogr = ogrng_get_dispatch_table();
#endif
Expand Down
4 changes: 3 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# For use in distributed.net projects only.
# Any other distribution or use of this source violates copyright.
#
# @(#)$Id: configure,v 1.319 2008/11/10 06:05:54 snake Exp $
# @(#)$Id: configure,v 1.320 2008/11/13 06:40:50 stream Exp $

# - If you wish to have the build automatically generate a .tar.gz ready
# for upload, then add TARGET_TARBALL="<os>-<cpu>-<limitations>"
Expand Down Expand Up @@ -233,8 +233,10 @@ add_sources() # $1=os, $2=arch, $3=custom
# -- nasm/ogr --
TARGET_ADDSRCS="$TARGET_ADDSRCS $OGR/ansi/ogrng-32.cpp"
TARGET_ADDSRCS="$TARGET_ADDSRCS $OGR/x86/ogrng-a.cpp"
TARGET_ADDSRCS="$TARGET_ADDSRCS $OGR/x86/ogrng-b.cpp"
TARGET_ADDSRCS="$TARGET_ADDSRCS $OGRNG_GENERAL_SRCS"
TARGET_ADDNASMS="$TARGET_ADDNASMS $OGR/x86/ogrng-a-asm-rt.asm"
TARGET_ADDNASMS="$TARGET_ADDNASMS $OGR/x86/ogrng-b-asm-rt.asm"
fi
fi # HAVE_OGR

Expand Down
2 changes: 2 additions & 0 deletions makefile.ow
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ COMMON = &
ogrng-32.obj &
ogrng-a.obj &
ogrng-a-asm-rt.obj&
ogrng-b.obj &
ogrng-b-asm-rt.obj&
!endif
!if $(OGR_P2)
core_ogr.obj &
Expand Down
4 changes: 3 additions & 1 deletion makefile.vc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# distributed.net client makefile for Microsoft Visual C++
# see http://www.distributed.net/
#
# $Id: makefile.vc,v 1.93 2008/10/26 19:14:22 jlawson Exp $
# $Id: makefile.vc,v 1.94 2008/11/13 06:40:50 stream Exp $
#

BASENAME = dnetc
Expand Down Expand Up @@ -293,6 +293,8 @@ OGRNG_OBJS = \
$(OUTPUTPATH)/ogrng-32.obj \
$(OUTPUTPATH)/ogrng-a.obj \
$(OUTPUTPATH)/ogrng-a-asm-rt.obj \
$(OUTPUTPATH)/ogrng-b.obj \
$(OUTPUTPATH)/ogrng-b-asm-rt.obj \
$(OUTPUTPATH)/ogrng_init.obj \
$(OUTPUTPATH)/ogrng_dat.obj
!else
Expand Down
Loading

0 comments on commit a6788ca

Please sign in to comment.