Fix build on PPC64LE

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
pull/238/head
Timothy Pearson 8 years ago
parent 47b06d3255
commit 203eda1d47

@ -451,6 +451,7 @@ LLVM:
# define POSH_CPU_PPC 1 # define POSH_CPU_PPC 1
# if !defined POSH_CPU_STRING # if !defined POSH_CPU_STRING
# if defined __powerpc64__ # if defined __powerpc64__
# define POSH_CPU_PPC64 1
# define POSH_CPU_STRING "PowerPC64" # define POSH_CPU_STRING "PowerPC64"
# else # else
# define POSH_CPU_STRING "PowerPC" # define POSH_CPU_STRING "PowerPC"

@ -166,7 +166,7 @@ NVCORE_API void NV_CDECL nvDebugPrint( const char *msg, ... ) __attribute__((for
namespace nv namespace nv
{ {
inline bool isValidPtr(const void * ptr) { inline bool isValidPtr(const void * ptr) {
#if NV_CPU_X86_64 #if NV_CPU_X86_64 || POSH_CPU_PPC64
if (ptr == NULL) return true; if (ptr == NULL) return true;
if (reinterpret_cast<uint64>(ptr) < 0x10000ULL) return false; if (reinterpret_cast<uint64>(ptr) < 0x10000ULL) return false;
if (reinterpret_cast<uint64>(ptr) >= 0x000007FFFFFEFFFFULL) return false; if (reinterpret_cast<uint64>(ptr) >= 0x000007FFFFFEFFFFULL) return false;

@ -7,6 +7,10 @@
#include "nvimage.h" #include "nvimage.h"
#include "nvcore/Debug.h" #include "nvcore/Debug.h"
#if NV_USE_ALTIVEC
#undef pixel
#endif
namespace nv namespace nv
{ {
class Color32; class Color32;

@ -489,7 +489,7 @@ nv::half_to_float( uint16 h )
} }
#if !NV_OS_IOS //ACStodoIOS some better define to choose this? #if !NV_OS_IOS && (defined(__i386__) || defined(__x86_64__))
#if NV_CC_GNUC #if NV_CC_GNUC
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)

@ -7,6 +7,10 @@
#include "nvmath.h" #include "nvmath.h"
#include "Vector.h" #include "Vector.h"
#if NV_USE_ALTIVEC
#undef vector
#endif
namespace nv namespace nv
{ {
class Matrix; class Matrix;

@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Copyright (c) 2016 Raptor Engineering, LLC
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
@ -41,7 +42,7 @@ namespace nv {
typedef SimdVector Arg; typedef SimdVector Arg;
SimdVector() {} SimdVector() {}
explicit SimdVector(float v) : vec((vector float)(v)) {} explicit SimdVector(float v) : vec(vec_splats(v)) {}
explicit SimdVector(vector float v) : vec(v) {} explicit SimdVector(vector float v) : vec(v) {}
SimdVector(const SimdVector & arg) : vec(arg.vec) {} SimdVector(const SimdVector & arg) : vec(arg.vec) {}
@ -111,7 +112,7 @@ namespace nv {
SimdVector& operator*=( Arg v ) SimdVector& operator*=( Arg v )
{ {
vec = vec_madd( vec, v.vec, ( vector float )( -0.0f ) ); vec = vec_madd( vec, v.vec, vec_splats( -0.0f ) );
return *this; return *this;
} }
}; };
@ -128,7 +129,7 @@ namespace nv {
inline SimdVector operator*( SimdVector::Arg left, SimdVector::Arg right ) inline SimdVector operator*( SimdVector::Arg left, SimdVector::Arg right )
{ {
return SimdVector( vec_madd( left.vec, right.vec, ( vector float )( -0.0f ) ) ); return SimdVector( vec_madd( left.vec, right.vec, vec_splats( -0.0f ) ) );
} }
// Returns a*b + c // Returns a*b + c
@ -149,7 +150,7 @@ namespace nv {
vector float estimate = vec_re( v.vec ); vector float estimate = vec_re( v.vec );
// one round of Newton-Rhaphson refinement // one round of Newton-Rhaphson refinement
vector float diff = vec_nmsub( estimate, v.vec, ( vector float )( 1.0f ) ); vector float diff = vec_nmsub( estimate, v.vec, vec_splats( 1.0f ) );
return SimdVector( vec_madd( diff, estimate, estimate ) ); return SimdVector( vec_madd( diff, estimate, estimate ) );
} }

@ -63,6 +63,16 @@ namespace nv {
// also utilizes a full barrier // also utilizes a full barrier
// currently treating laod like x86 - this could be wrong // currently treating laod like x86 - this could be wrong
// this is the easiest but slowest way to do this
nvCompilerReadWriteBarrier();
uint32 ret = *ptr; // replace with ldrex?
nvCompilerReadWriteBarrier();
return ret;
#elif POSH_CPU_PPC64
// need more specific cpu type for ppc64?
// also utilizes a full barrier
// currently treating load like x86 - this could be wrong
// this is the easiest but slowest way to do this // this is the easiest but slowest way to do this
nvCompilerReadWriteBarrier(); nvCompilerReadWriteBarrier();
uint32 ret = *ptr; // replace with ldrex? uint32 ret = *ptr; // replace with ldrex?
@ -87,6 +97,11 @@ namespace nv {
nvCompilerReadWriteBarrier(); nvCompilerReadWriteBarrier();
*ptr = value; //strex? *ptr = value; //strex?
nvCompilerReadWriteBarrier(); nvCompilerReadWriteBarrier();
#elif POSH_CPU_PPC64
// this is the easiest but slowest way to do this
nvCompilerReadWriteBarrier();
*ptr = value; //strex?
nvCompilerReadWriteBarrier();
#else #else
#error "Atomics not implemented." #error "Atomics not implemented."
#endif #endif

@ -29,6 +29,7 @@
#include "nvmath/SimdVector.h" #include "nvmath/SimdVector.h"
#include "nvmath/Vector.h" #include "nvmath/Vector.h"
#include "nvcore/Memory.h"
// Use SIMD version if altivec or SSE are available. // Use SIMD version if altivec or SSE are available.
#define NVTT_USE_SIMD (NV_USE_ALTIVEC || NV_USE_SSE) #define NVTT_USE_SIMD (NV_USE_ALTIVEC || NV_USE_SSE)

@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Copyright (c) 2016 Raptor Engineering, LLC
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
@ -33,7 +34,7 @@
namespace nvsquish { namespace nvsquish {
#define VEC4_CONST( X ) Vec4( ( vector float )( X ) ) #define VEC4_CONST( X ) Vec4( vec_splats( (float)X ) )
class Vec4 class Vec4
{ {
@ -105,7 +106,7 @@ public:
Vec4& operator*=( Arg v ) Vec4& operator*=( Arg v )
{ {
m_v = vec_madd( m_v, v.m_v, ( vector float )( -0.0f ) ); m_v = vec_madd( m_v, v.m_v, vec_splats( -0.0f ) );
return *this; return *this;
} }
@ -121,7 +122,7 @@ public:
friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right ) friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
{ {
return Vec4( vec_madd( left.m_v, right.m_v, ( vector float )( -0.0f ) ) ); return Vec4( vec_madd( left.m_v, right.m_v, vec_splats( -0.0f ) ) );
} }
//! Returns a*b + c //! Returns a*b + c
@ -142,7 +143,7 @@ public:
vector float estimate = vec_re( v.m_v ); vector float estimate = vec_re( v.m_v );
// one round of Newton-Rhaphson refinement // one round of Newton-Rhaphson refinement
vector float diff = vec_nmsub( estimate, v.m_v, ( vector float )( 1.0f ) ); vector float diff = vec_nmsub( estimate, v.m_v, vec_splats( 1.0f ) );
return Vec4( vec_madd( diff, estimate, estimate ) ); return Vec4( vec_madd( diff, estimate, estimate ) );
} }

Loading…
Cancel
Save