From e3cc64dec20832769406aa38cde83c7dd4194bf4 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Tue, 22 Apr 2014 13:33:12 -0700 Subject: [4.9] GCC 4.9.0 official release refresh Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767 --- gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60034.c | 10 + .../gcc/testsuite/gcc.target/aarch64/pr60580_1.c | 45 ++ gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60675.C | 277 +++++++++ gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60697.c | 638 +++++++++++++++++++++ .../gcc.target/aarch64/test_fp_attribute_1.c | 26 + .../gcc.target/aarch64/test_fp_attribute_2.c | 26 + 6 files changed, 1022 insertions(+) create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60034.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60580_1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60675.C create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60697.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_2.c (limited to 'gcc-4.9/gcc/testsuite/gcc.target/aarch64') diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60034.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60034.c new file mode 100644 index 000000000..ab7e7f4a3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60034.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -O" } */ + +static unsigned long global_max_fast; + +void __libc_mallopt (int param_number, int value) +{ + __asm__ __volatile__ ("# %[_SDT_A21]" :: [_SDT_A21] "nor" ((global_max_fast))); + global_max_fast = 1; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60580_1.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60580_1.c new file mode 100644 index 000000000..1adf508cf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60580_1.c @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -fomit-frame-pointer -fno-inline --save-temps" } */ + +void +func_leaf (void) +{ + int a = 0; +} + +void +func_no_leaf (void) +{ + int a = 0; + func_leaf (); +} + +void +func1 (void) +{ + int a = 0; + func_no_leaf (); +} + +/* + * This function calls XXX(), which modifies SP. This is incompatible to + * -fomit-frame-pointer generated code as SP is used to access the frame. + */ +__attribute__ ((optimize("no-omit-frame-pointer"))) +void +func2 (void) +{ + int a = 0; + func_no_leaf (); +} + +void +func3 (void) +{ + int a = 0; + func_no_leaf (); +} + +/* { dg-final { scan-assembler-times "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" 1 } } */ + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60675.C b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60675.C new file mode 100644 index 000000000..aa88cdb24 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60675.C @@ -0,0 +1,277 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c++11 -w -O2 -fPIC" } */ +namespace CLHEP { + static const double meter = 1000.*10; + static const double meter2 = meter*meter; + static const double megaelectronvolt = 1. ; + static const double gigaelectronvolt = 1.e+3; + static const double GeV = gigaelectronvolt; + static const double megavolt = megaelectronvolt; + static const double volt = 1.e-6*megavolt; + static const double tesla = volt*1.e+9/meter2; + } + using CLHEP::GeV; + using CLHEP::tesla; + namespace std { + typedef long int ptrdiff_t; + } + extern "C" { + extern double cos (double __x) throw (); + extern double sin (double __x) throw (); + extern double sqrt (double __x) throw (); + } + namespace std __attribute__ ((__visibility__ ("default"))) { + using ::cos; + using ::sin; + using ::sqrt; + template struct char_traits; + template > struct basic_ostream; + typedef basic_ostream ostream; + template struct iterator_traits { }; + template struct iterator_traits<_Tp*> { + typedef ptrdiff_t difference_type; + typedef _Tp& reference; + }; + } + namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + using std::iterator_traits; + template struct __normal_iterator { + _Iterator _M_current; + typedef iterator_traits<_Iterator> __traits_type; + typedef typename __traits_type::difference_type difference_type; + typedef typename __traits_type::reference reference; + explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) { } + reference operator*() const { + return *_M_current; + } + __normal_iterator operator+(difference_type __n) const { + return __normal_iterator(_M_current + __n); + } + }; + template struct new_allocator { + }; + } + namespace std __attribute__ ((__visibility__ ("default"))) { + template struct allocator: public __gnu_cxx::new_allocator<_Tp> { + }; + struct ios_base { }; + template struct basic_ios : public ios_base { }; + template struct basic_ostream : virtual public basic_ios<_CharT, _Traits> { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + __ostream_type& operator<<(__ostream_type& (*__pf)(__ostream_type&)) { } + __ostream_type& operator<<(const void* __p) { + return _M_insert(__p); + } + template __ostream_type& _M_insert(_ValueT __v); + }; + template inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { + } + } + typedef double G4double; + typedef int G4int; + extern __thread std::ostream *G4cout_p; + struct G4Field; + struct G4FieldManager { + inline G4Field* GetDetectorField() ; + }; + namespace CLHEP { + struct Hep3Vector { + Hep3Vector(double x, double y, double z); + inline ~Hep3Vector(); + inline double x() const; + inline double y() const; + inline double z() const; + inline double mag() const; + inline Hep3Vector cross(const Hep3Vector &) const; + double dx; + double dy; + double dz; + }; + Hep3Vector operator / (const Hep3Vector &, double a); + inline double Hep3Vector::x() const { + return dx; + } + inline double Hep3Vector::y() const { + return dy; + } + inline double Hep3Vector::z() const { + return dz; + } + inline Hep3Vector operator + (const Hep3Vector & a, const Hep3Vector & b) { } + inline Hep3Vector operator * (const Hep3Vector & p, double a) { } + inline double operator * (const Hep3Vector & a, const Hep3Vector & b) { } + inline Hep3Vector::Hep3Vector(double x1, double y1, double z1) : dx(x1), dy(y1), dz(z1) { + } + inline Hep3Vector::~Hep3Vector() { } + inline Hep3Vector Hep3Vector::cross(const Hep3Vector & p) const { + return Hep3Vector(dy*p.dz-p.dy*dz, dz*p.dx-p.dz*dx, dx*p.dy-p.dx*dy); + } + } + typedef CLHEP::Hep3Vector G4ThreeVector; + namespace std __attribute__ ((__visibility__ ("default"))) { + template > struct vector + { + typedef _Tp *pointer; + typedef __gnu_cxx::__normal_iterator iterator; + iterator begin() { } + }; + } + struct G4TransportationManager { + static G4TransportationManager* GetTransportationManager(); + inline G4FieldManager* GetFieldManager() const; + }; + struct G4ErrorMatrix { + G4ErrorMatrix(G4int p, G4int q, G4int i); + virtual ~G4ErrorMatrix(); + struct G4ErrorMatrix_row { + inline G4ErrorMatrix_row(G4ErrorMatrix&,G4int); + G4double & operator[](G4int); + G4ErrorMatrix& _a; + G4int _r; + }; + inline G4ErrorMatrix_row operator[] (G4int); + std::vector m; + G4int nrow, ncol; + }; + inline G4ErrorMatrix::G4ErrorMatrix_row G4ErrorMatrix::operator[] (G4int r) { + G4ErrorMatrix_row b(*this,r); + return b; + } + inline G4double &G4ErrorMatrix::G4ErrorMatrix_row::operator[](G4int c) { + return *(_a.m.begin()+_r*_a.ncol+c); + } + inline G4ErrorMatrix:: G4ErrorMatrix_row::G4ErrorMatrix_row(G4ErrorMatrix&a, G4int r) : _a(a) { + _r = r; + }; + struct G4DynamicParticle { + G4double GetCharge() const; + }; + struct G4Step; + struct G4Track { + const G4DynamicParticle* GetDynamicParticle() const; + const G4ThreeVector& GetPosition() const; + G4ThreeVector GetMomentum() const; + const G4Step* GetStep() const; + }; + struct G4StepPoint { + const G4ThreeVector& GetPosition() const; + G4ThreeVector GetMomentum() const; + }; + struct G4Step { + G4StepPoint* GetPreStepPoint() const; + G4double GetStepLength() const; + }; + namespace HepGeom { + template struct BasicVector3D { + T v_[3]; + BasicVector3D(T x1, T y1, T z1) { } + operator T * () { + return v_; + } + T x() const { + return v_[0]; + } + T y() const { + return v_[1]; + } + T z() const { + return v_[2]; + } + T perp2() const { } + T perp() const { + return std::sqrt(perp2()); + } + T mag2() const { } + T mag() const { + return std::sqrt(mag2()); + } + T theta() const { } + }; + inline BasicVector3D operator-(const BasicVector3D & a,const BasicVector3D & b) { } + inline BasicVector3D operator*(const BasicVector3D & v, double a) { } + template struct Point3D : public BasicVector3D { + explicit Point3D(const double * a) : BasicVector3D(a[0],a[1],a[2]) { } + Point3D(const CLHEP::Hep3Vector & v) : BasicVector3D(v.dx,v.dy,v.dz) { } + }; + } + typedef HepGeom::Point3D G4Point3D; + namespace HepGeom { + template struct Vector3D : public BasicVector3D { + Vector3D(const BasicVector3D & v) : BasicVector3D(v) { } + Vector3D(const CLHEP::Hep3Vector & v) : BasicVector3D(v.dx,v.dy,v.dz) { } + operator CLHEP::Hep3Vector () const { } + }; + } + typedef HepGeom::Vector3D G4Vector3D; + struct G4ErrorFreeTrajState +{ + virtual G4int PropagateError( const G4Track* aTrack ); + G4int PropagateErrorMSC( const G4Track* aTrack ); + }; + G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack ) { + G4double stepLengthCm = aTrack->GetStep()->GetStepLength()/10.; + G4Point3D vposPost = aTrack->GetPosition()/10.; + G4Vector3D vpPost = aTrack->GetMomentum()/GeV; + G4Point3D vposPre = aTrack->GetStep()->GetPreStepPoint()->GetPosition()/10.; + G4Vector3D vpPre = aTrack->GetStep()->GetPreStepPoint()->GetMomentum()/GeV; + G4double pPre = vpPre.mag(); + G4double pPost = vpPost.mag(); + G4double pInvPre = 1./pPre; + G4double pInvPost = 1./pPost; + G4double deltaPInv = pInvPost - pInvPre; + G4Vector3D vpPreNorm = vpPre * pInvPre; + G4Vector3D vpPostNorm = vpPost * pInvPost; + (*G4cout_p) << "G4EP: vpPreNorm " << vpPreNorm << " vpPostNorm " << vpPostNorm << std::endl; + G4double sinpPre = std::sin( vpPreNorm.theta() ); + G4double sinpPostInv = 1./std::sin( vpPreNorm.theta() ); + G4ErrorMatrix transf(5, 5, 0 ); + G4double charge = aTrack->GetDynamicParticle()->GetCharge(); + G4double h1[3], h2[3]; + G4Field* field += G4TransportationManager::GetTransportationManager()->GetFieldManager()->GetDetectorField() +; + if( charge != 0. && field ) + { + G4ThreeVector HPre = G4ThreeVector( h1[0], h1[1], h1[2] ) / tesla *10.; + G4ThreeVector HPost= G4ThreeVector( h2[0], h2[1], h2[2] ) / tesla *10.; + { + G4double pInvAver = 1./(pInvPre + pInvPost ); + G4double CFACT8 = 2.997925E-4; + G4ThreeVector vHAverNorm( (HPre*pInvPre + HPost*pInvPost ) * pInvAver * charge * CFACT8 ); + G4double HAver = vHAverNorm.mag(); + G4double pAver = (pPre+pPost)*0.5; + G4double QAver = -HAver/pAver; + G4double thetaAver = QAver * stepLengthCm; + G4double sinThetaAver = std::sin(thetaAver); + G4double cosThetaAver = std::cos(thetaAver); + G4double gamma = vHAverNorm * vpPostNorm; + G4ThreeVector AN2 = vHAverNorm.cross( vpPostNorm ); + G4double AU = 1./vpPreNorm.perp(); + G4ThreeVector vUPre( -AU*vpPreNorm.y(), AU*vpPreNorm.x(), 0. ); + G4ThreeVector vVPre( -vpPreNorm.z()*vUPre.y(), vpPreNorm.z()*vUPre.x(), vpPreNorm.x()*vUPre.y() - vpPreNorm.y()*vUPre.x() ); + AU = 1./vpPostNorm.perp(); + G4ThreeVector vUPost( -AU*vpPostNorm.y(), AU*vpPostNorm.x(), 0. ); + G4ThreeVector vVPost( -vpPostNorm.z()*vUPost.y(), vpPostNorm.z()*vUPost.x(), vpPostNorm.x()*vUPost.y() - vpPostNorm.y()*vUPost.x() ); + G4Point3D deltaPos( vposPre - vposPost ); + G4double QP = QAver * pAver; + G4double ANV = -( vHAverNorm.x()*vUPost.x() + vHAverNorm.y()*vUPost.y() ); + G4double ANU = ( vHAverNorm.x()*vVPost.x() + vHAverNorm.y()*vVPost.y() + vHAverNorm.z()*vVPost.z() ); + G4double OMcosThetaAver = 1. - cosThetaAver; + G4double TMSINT = thetaAver - sinThetaAver; + G4ThreeVector vHUPre( -vHAverNorm.z() * vUPre.y(), vHAverNorm.z() * vUPre.x(), vHAverNorm.x() * vUPre.y() - vHAverNorm.y() * vUPre.x() ); + G4ThreeVector vHVPre( vHAverNorm.y() * vVPre.z() - vHAverNorm.z() * vVPre.y(), vHAverNorm.z() * vVPre.x() - vHAverNorm.x() * vVPre.z(), vHAverNorm.x() * vVPre.y() - vHAverNorm.y() * vVPre.x() ); + transf[0][1] = -deltaPInv/thetaAver* ( TMSINT*gamma*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) + sinThetaAver*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z()) + OMcosThetaAver*(vHVPre.x()*vpPostNorm.x()+vHVPre.y()*vpPostNorm.y()+vHVPre.z()*vpPostNorm.z()) ); + transf[0][2] = -sinpPre*deltaPInv/thetaAver* ( TMSINT*gamma*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y() ) + sinThetaAver*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y() ) + OMcosThetaAver*(vHUPre.x()*vpPostNorm.x()+vHUPre.y()*vpPostNorm.y()+vHUPre.z()*vpPostNorm.z()) ); + transf[0][3] = -deltaPInv/stepLengthCm*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y() ); + transf[1][1] = cosThetaAver*(vVPre.x()*vVPost.x()+vVPre.y()*vVPost.y()+vVPre.z()*vVPost.z()) + sinThetaAver*(vHVPre.x()*vVPost.x()+vHVPre.y()*vVPost.y()+vHVPre.z()*vVPost.z()) + OMcosThetaAver*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z())* (vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z()) + ANV*( -sinThetaAver*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z()) + OMcosThetaAver*(vVPre.x()*AN2.x()+vVPre.y()*AN2.y()+vVPre.z()*AN2.z()) - TMSINT*gamma*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) ); + transf[1][2] = cosThetaAver*(vUPre.x()*vVPost.x()+vUPre.y()*vVPost.y() ) + sinThetaAver*(vHUPre.x()*vVPost.x()+vHUPre.y()*vVPost.y()+vHUPre.z()*vVPost.z()) + OMcosThetaAver*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y() )* (vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z()) + ANV*( -sinThetaAver*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y() ) + OMcosThetaAver*(vUPre.x()*AN2.x()+vUPre.y()*AN2.y() ) - TMSINT*gamma*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y() ) ); + transf[2][0] = -QP*ANU*(vpPostNorm.x()*deltaPos.x()+vpPostNorm.y()*deltaPos.y()+vpPostNorm.z()*deltaPos.z())*sinpPostInv *(1.+deltaPInv*pAver); + transf[2][3] = -QAver*ANU*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y() )*sinpPostInv; + transf[3][4] = (vVPre.x()*vUPost.x()+vVPre.y()*vUPost.y() ); + transf[4][0] = pAver*(vVPost.x()*deltaPos.x()+vVPost.y()*deltaPos.y()+vVPost.z()*deltaPos.z()) *(1.+deltaPInv*pAver); + transf[4][1] = ( sinThetaAver*(vVPre.x()*vVPost.x()+vVPre.y()*vVPost.y()+vVPre.z()*vVPost.z()) + OMcosThetaAver*(vHVPre.x()*vVPost.x()+vHVPre.y()*vVPost.y()+vHVPre.z()*vVPost.z()) + TMSINT*(vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z())* (vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) )/QAver; + transf[4][2] = ( sinThetaAver*(vUPre.x()*vVPost.x()+vUPre.y()*vVPost.y() ) + OMcosThetaAver*(vHUPre.x()*vVPost.x()+vHUPre.y()*vVPost.y()+vHUPre.z()*vVPost.z()) + TMSINT*(vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z())* (vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y() ) )*sinpPre/QAver; + } + } + PropagateErrorMSC( aTrack ); + } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60697.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60697.c new file mode 100644 index 000000000..57ccecb1d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr60697.c @@ -0,0 +1,638 @@ +/* { dg-do compile } */ +/* { dg-options "-w -O3 -mcpu=cortex-a53" } */ +typedef struct __sFILE __FILE; +typedef __FILE FILE; +typedef int atom_id; +typedef float real; +typedef real rvec[3]; +typedef real matrix[3][3]; +enum { + ebCGS,ebMOLS,ebSBLOCKS,ebNR +}; +enum { + efepNO, efepYES, efepNR +}; +enum { + esolNO, esolMNO, esolWATER, esolWATERWATER, esolNR +}; +typedef struct { + int nr; + atom_id *index; + atom_id *a; +} t_block; +enum { + F_LJ, + F_LJLR, + F_SR, + F_LR, + F_DVDL, +}; +typedef struct { + t_block excl; +} t_atoms; +typedef struct { + t_atoms atoms; + t_block blocks[ebNR]; +} t_topology; +typedef struct { +} t_nsborder; +extern FILE *debug; +typedef struct { +} t_nrnb; +typedef struct { + int nri,maxnri; + int nrj,maxnrj; + int maxlen; + int solvent; + int *gid; + int *jindex; + atom_id *jjnr; + int *nsatoms; +} t_nblist; +typedef struct { + int nrx,nry,nrz; +} t_grid; +typedef struct { +} t_commrec; +enum { eNL_VDWQQ, eNL_VDW, eNL_QQ, + eNL_VDWQQ_FREE, eNL_VDW_FREE, eNL_QQ_FREE, + eNL_VDWQQ_SOLMNO, eNL_VDW_SOLMNO, eNL_QQ_SOLMNO, + eNL_VDWQQ_WATER, eNL_QQ_WATER, + eNL_VDWQQ_WATERWATER, eNL_QQ_WATERWATER, + eNL_NR }; +typedef struct { + real rlist,rlistlong; + real rcoulomb_switch,rcoulomb; + real rvdw_switch,rvdw; + int efep; + int cg0,hcg; + int *solvent_type; + int *mno_index; + rvec *cg_cm; + t_nblist nlist_sr[eNL_NR]; + t_nblist nlist_lr[eNL_NR]; + int bTwinRange; + rvec *f_twin; + int *eg_excl; +} t_forcerec; +typedef struct { + real *chargeA,*chargeB,*chargeT; + int *bPerturbed; + int *typeA,*typeB; + unsigned short *cTC,*cENER,*cACC,*cFREEZE,*cXTC,*cVCM; +} t_mdatoms; +enum { egCOUL, egLJ, egBHAM, egLR, egLJLR, egCOUL14, egLJ14, egNR }; +typedef struct { + real *ee[egNR]; +} t_grp_ener; +typedef struct { + t_grp_ener estat; +} t_groups; +typedef unsigned long t_excl; +static void reset_nblist(t_nblist *nl) +{ + nl->nri = 0; + nl->nrj = 0; + nl->maxlen = 0; + if (nl->maxnri > 0) { + nl->gid[0] = -1; + if (nl->maxnrj > 1) { + nl->jindex[0] = 0; + nl->jindex[1] = 0; + } + } +} +static void reset_neighbor_list(t_forcerec *fr,int bLR,int eNL) +{ + reset_nblist(&(fr->nlist_lr[eNL])); +} +static void close_i_nblist(t_nblist *nlist) +{ + int nri = nlist->nri; + int len; + nlist->jindex[nri+1] = nlist->nrj; + len=nlist->nrj - nlist->jindex[nri]; + if (nlist->solvent==esolMNO) + len *= nlist->nsatoms[3*nri]; + if(len > nlist->maxlen) + nlist->maxlen = len; +} +static void close_nblist(t_nblist *nlist) +{ + if (nlist->maxnri > 0) { + int nri = nlist->nri; + if ((nlist->jindex[nri+1] > nlist->jindex[nri]) && + (nlist->gid[nri] != -1)) { + nlist->nri++; + nlist->jindex[nri+2] = nlist->nrj; + } + } +} +static void close_neighbor_list(t_forcerec *fr,int bLR,int eNL) +{ + close_nblist(&(fr->nlist_lr[eNL])); +} +static void add_j_to_nblist(t_nblist *nlist,atom_id j_atom) +{ + int nrj=nlist->nrj; + nlist->jjnr[nrj] = j_atom; + nlist->nrj ++; +} +static void put_in_list(int bHaveLJ[], + int ngid,t_mdatoms *md, + int icg,int jgid,int nj,atom_id jjcg[], + atom_id index[], + t_excl bExcl[],int shift, + t_forcerec *fr,int bLR, + int bVDWOnly,int bCoulOnly) +{ + t_nblist *vdwc,*vdw,*coul; + t_nblist *vdwc_ww=((void *)0),*coul_ww=((void *)0); + t_nblist *vdwc_free=((void *)0),*vdw_free=((void *)0),*coul_free=((void *)0); + int i,j,jcg,igid,gid,ind_ij; + atom_id jj,jj0,jj1,i_atom; + int i0,nicg,len; + int *type,*typeB; + unsigned short *cENER; + real *charge,*chargeB; + real qi,qiB,qq,rlj; + int bWater,bMNO,bFree,bFreeJ,bNotEx,*bPert; + charge = md->chargeA; + chargeB = md->chargeB; + type = md->typeA; + typeB = md->typeB; + cENER = md->cENER; + bPert = md->bPerturbed; + i0 = index[icg]; + nicg = index[icg+1]-i0; + bMNO = (fr->solvent_type[icg] == esolMNO); + if (bLR) { + if (bWater) { + vdw = &fr->nlist_lr[eNL_VDW]; + coul = &fr->nlist_lr[eNL_QQ_WATER]; + vdwc_ww = &fr->nlist_lr[eNL_VDWQQ_WATERWATER]; + } else if(bMNO) { + vdwc = &fr->nlist_lr[eNL_VDWQQ_SOLMNO]; + } + if (fr->efep != efepNO) { + vdw_free = &fr->nlist_lr[eNL_VDW_FREE]; + coul_free = &fr->nlist_lr[eNL_QQ_FREE]; + } + } + else { + if (bWater) { + } else if(bMNO) { + vdwc = &fr->nlist_sr[eNL_VDWQQ_SOLMNO]; + } + if (fr->efep != efepNO) { + vdwc_free = &fr->nlist_sr[eNL_VDWQQ_FREE]; + } + } + if (fr->efep==efepNO) { + if (bWater) { + igid = cENER[i_atom]; + gid = ((igid < jgid) ? (igid*ngid+jgid) : (jgid*ngid+igid)); + if (!bCoulOnly && !bVDWOnly) { + new_i_nblist(vdwc,bLR ? F_LJLR : F_LJ,i_atom,shift,gid,((void *)0)); + new_i_nblist(vdwc_ww,bLR ? F_LJLR : F_LJ,i_atom,shift,gid,((void *)0)); + } + if (!bCoulOnly) + new_i_nblist(vdw,bLR ? F_LJLR : F_LJ,i_atom,shift,gid,((void *)0)); + if (!bVDWOnly) { + new_i_nblist(coul,bLR ? F_LR : F_SR,i_atom,shift,gid,((void *)0)); + new_i_nblist(coul_ww,bLR ? F_LR : F_SR,i_atom,shift,gid,((void *)0)); + } + for(j=0; (jsolvent_type[jcg] == esolWATER)) { + if (bVDWOnly) + add_j_to_nblist(vdw,jj0); + else { + add_j_to_nblist(coul_ww,jj0); + add_j_to_nblist(vdwc_ww,jj0); + } + } else { + jj1 = index[jcg+1]; + if (bCoulOnly) { + for(jj=jj0; (jj 1.2e-38) + add_j_to_nblist(coul,jj); + } + } else if (bVDWOnly) { + for(jj=jj0; (jj 1.2e-38) + add_j_to_nblist(vdwc,jj); + add_j_to_nblist(vdw,jj); + } else if (fabs(charge[jj]) > 1.2e-38) + add_j_to_nblist(coul,jj); + } + } + } + } + close_i_nblist(vdw); + close_i_nblist(coul); + close_i_nblist(vdwc); + close_i_nblist(coul_ww); + close_i_nblist(vdwc_ww); + } else if (bMNO) { + igid = cENER[i_atom]; + gid = ((igid < jgid) ? (igid*ngid+jgid) : (jgid*ngid+igid)); + if (!bCoulOnly && !bVDWOnly) + new_i_nblist(vdwc,bLR ? F_LJLR : F_LJ,i_atom,shift,gid, + &(fr->mno_index[icg*3])); + if (!bCoulOnly) + new_i_nblist(vdw,bLR ? F_LR : F_SR,i_atom,shift,gid, + &(fr->mno_index[icg*3])); + if (!bVDWOnly) + new_i_nblist(coul,bLR ? F_LR : F_SR,i_atom,shift,gid, + &(fr->mno_index[icg*3])); + for(j=0; (j 1.2e-38) + add_j_to_nblist(coul,jj); + } else if (bVDWOnly) { + if (bHaveLJ[type[jj]]) + add_j_to_nblist(vdw,jj); + } else { + if (bHaveLJ[type[jj]]) { + if (fabs(charge[jj]) > 1.2e-38) + add_j_to_nblist(vdwc,jj); + add_j_to_nblist(vdw,jj); + } else if (fabs(charge[jj]) > 1.2e-38) + add_j_to_nblist(coul,jj); + } + } + close_i_nblist(vdw); + close_i_nblist(coul); + close_i_nblist(vdwc); + } + } else { + for(i=0; i 1.2e-38) + add_j_to_nblist(coul,jj); + } else if (bVDWOnly) { + if (bHaveLJ[type[jj]]) + add_j_to_nblist(vdw,jj); + } else { + if (bHaveLJ[type[jj]]) { + if (fabs(qi) > 1.2e-38 && (fabs(charge[jj]) > 1.2e-38)) + add_j_to_nblist(vdwc,jj); + add_j_to_nblist(vdw,jj); + } else if (fabs(qi) > 1.2e-38 && (fabs(charge[jj]) > 1.2e-38)) + add_j_to_nblist(coul,jj); + } + } + } + } + } + close_i_nblist(vdw); + close_i_nblist(coul); + close_i_nblist(vdwc); + } + } + } else { + for(i=0; imno_index[icg*3]) : ((void *)0)); + if (!bCoulOnly) + new_i_nblist(vdw,bLR ? F_LR : F_SR,i_atom,shift,gid, + bMNO ? &(fr->mno_index[icg*3]) : ((void *)0)); + new_i_nblist(coul,bLR ? F_LR : F_SR,i_atom,shift,gid, + bMNO ? &(fr->mno_index[icg*3]) : ((void *)0)); + new_i_nblist(vdw_free,F_DVDL,i_atom,shift,gid,((void *)0)); + new_i_nblist(coul_free,F_DVDL,i_atom,shift,gid,((void *)0)); + new_i_nblist(vdwc_free,F_DVDL,i_atom,shift,gid,((void *)0)); + if (!(bVDWOnly || (fabs(qi)<1.2e-38 && fabs(qiB)<1.2e-38)) || + !(bCoulOnly || (!bHaveLJ[type[i_atom]] && !bHaveLJ[typeB[i_atom]]))) { + for(j=0; (j 1.2e-38 && (fabs(charge[jj]) > 1.2e-38)) + add_j_to_nblist(vdwc,jj); + add_j_to_nblist(vdw,jj); + } else if (fabs(qi) > 1.2e-38 && (fabs(charge[jj]) > 1.2e-38)) + add_j_to_nblist(coul,jj); + } + } + } + } + } + } + close_i_nblist(vdw); + close_i_nblist(coul); + close_i_nblist(vdwc); + if (bWater && (i==0)) { + close_i_nblist(coul_ww); + close_i_nblist(vdwc_ww); + } + close_i_nblist(vdw_free); + close_i_nblist(coul_free); + close_i_nblist(vdwc_free); + } + } +} +static void setexcl(atom_id start,atom_id end,t_block *excl,int b, + t_excl bexcl[]) +{ + atom_id i,k; + if (b) { + for(i=start; iindex[i]; kindex[i+1]; k++) { + (bexcl)[((atom_id) (excl->a[k]))] |= (1<<((atom_id) (i-start))); + } + } + } +} +int calc_naaj(int icg,int cgtot) +{ + int naaj; + if ((cgtot % 2) == 1) { + naaj = 1+(cgtot/2); + } + else if ((cgtot % 4) == 0) { + if (icg < cgtot/2) { + if ((icg % 2) == 0) + naaj=1+(cgtot/2); + } + else { + if ((icg % 2) == 1) + naaj=1+(cgtot/2); + } + } + else { + if ((icg % 2) == 0) + naaj=1+(cgtot/2); + else + naaj=cgtot/2; + } + return naaj; +} +static void get_dx(int Nx,real gridx,real grid_x,real rc2,real x, + int *dx0,int *dx1,real *dcx2) +{ + real dcx,tmp; + int xgi,xgi0,xgi1,i; + xgi = (int)(Nx+x*grid_x)-Nx; + if (xgi < 0) { + *dx0 = 0; + *dx1 = -1; + } else if (xgi >= Nx) { + *dx0 = Nx; + *dx1 = Nx-1; + } else { + dcx2[xgi] = 0; + *dx0 = xgi; + xgi0 = xgi-1; + *dx1 = xgi; + xgi1 = xgi+1; + } + for(i=xgi0; i>=0; i--) { + dcx = (i+1)*gridx-x; + tmp = dcx*dcx; + if (tmp >= rc2) + *dx0 = i; + dcx2[i] = tmp; + } + for(i=xgi1; i= rc2) + *dx1 = i; + dcx2[i] = tmp; + } +} +static void do_longrange(FILE *log,t_commrec *cr,t_topology *top,t_forcerec *fr, + int ngid,t_mdatoms *md,int icg, + int jgid,int nlr, + atom_id lr[],t_excl bexcl[],int shift, + rvec x[],rvec box_size,t_nrnb *nrnb, + real lambda,real *dvdlambda, + t_groups *grps,int bVDWOnly,int bCoulOnly, + int bDoForces,int bHaveLJ[]) +{ + int i; + for(i=0; (inlist_lr[i].nri > fr->nlist_lr[i].maxnri-32) || bDoForces) { + close_neighbor_list(fr,1,i); + do_fnbf(log,cr,fr,x,fr->f_twin,md, + grps->estat.ee[egLJLR],grps->estat.ee[egLR],box_size, + nrnb,lambda,dvdlambda,1,i); + reset_neighbor_list(fr,1,i); + } + } + if (!bDoForces) { + put_in_list(bHaveLJ,ngid,md,icg,jgid,nlr,lr,top->blocks[ebCGS].index, + bexcl,shift,fr, + 1,bVDWOnly,bCoulOnly); + } +} +static int ns5_core(FILE *log,t_commrec *cr,t_forcerec *fr,int cg_index[], + matrix box,rvec box_size,int ngid, + t_topology *top,t_groups *grps, + t_grid *grid,rvec x[],t_excl bexcl[],int *bExcludeAlleg, + t_nrnb *nrnb,t_mdatoms *md, + real lambda,real *dvdlambda, + int bHaveLJ[]) +{ + static atom_id **nl_lr_ljc,**nl_lr_one,**nl_sr=((void *)0); + static int *nlr_ljc,*nlr_one,*nsr; + static real *dcx2=((void *)0),*dcy2=((void *)0),*dcz2=((void *)0); + t_block *cgs=&(top->blocks[ebCGS]); + unsigned short *gid=md->cENER; + int tx,ty,tz,dx,dy,dz,cj; + int dx0,dx1,dy0,dy1,dz0,dz1; + int Nx,Ny,Nz,shift=-1,j,nrj,nns,nn=-1; + real gridx,gridy,gridz,grid_x,grid_y,grid_z; + int icg=-1,iicg,cgsnr,i0,nri,naaj,min_icg,icg_naaj,jjcg,cgj0,jgid; + int bVDWOnly,bCoulOnly; + rvec xi,*cgcm; + real r2,rs2,rvdw2,rcoul2,rm2,rl2,XI,YI,ZI,dcx,dcy,dcz,tmp1,tmp2; + int *i_eg_excl; + int use_twinrange,use_two_cutoffs; + cgsnr = cgs->nr; + rs2 = ((fr->rlist)*(fr->rlist)); + if (fr->bTwinRange) { + rvdw2 = ((fr->rvdw)*(fr->rvdw)); + rcoul2 = ((fr->rcoulomb)*(fr->rcoulomb)); + } else { + } + rm2 = (((rvdw2) < (rcoul2)) ? (rvdw2) : (rcoul2) ); + rl2 = (((rvdw2) > (rcoul2)) ? (rvdw2) : (rcoul2) ); + use_twinrange = (rs2 < rm2); + use_two_cutoffs = (rm2 < rl2); + bVDWOnly = (rvdw2 > rcoul2); + bCoulOnly = !bVDWOnly; + if (nl_sr == ((void *)0)) { + (nl_sr)=save_calloc("nl_sr","ns.c",1341, (ngid),sizeof(*(nl_sr))); + (nsr)=save_calloc("nsr","ns.c",1343, (ngid),sizeof(*(nsr))); + (nlr_ljc)=save_calloc("nlr_ljc","ns.c",1344, (ngid),sizeof(*(nlr_ljc))); + (nlr_one)=save_calloc("nlr_one","ns.c",1345, (ngid),sizeof(*(nlr_one))); + if (use_twinrange) + (nl_lr_ljc)=save_calloc("nl_lr_ljc","ns.c",1349, (ngid),sizeof(*(nl_lr_ljc))); + if (use_two_cutoffs) + (nl_lr_one)=save_calloc("nl_lr_one","ns.c",1353, (ngid),sizeof(*(nl_lr_one))); + for(j=0; (jcg_cm; + Nx = grid->nrx; + Ny = grid->nry; + if (dcx2 == ((void *)0)) { + (dcx2)=save_calloc("dcx2","ns.c",1379, (Nx*2),sizeof(*(dcx2))); + (dcy2)=save_calloc("dcy2","ns.c",1380, (Ny*2),sizeof(*(dcy2))); + (dcz2)=save_calloc("dcz2","ns.c",1381, (Nz*2),sizeof(*(dcz2))); + } + gridx = box[0][0]/grid->nrx; + gridy = box[1][1]/grid->nry; + gridz = box[2][2]/grid->nrz; + grid_x = 1/gridx; + grid_y = 1/gridy; + grid_z = 1/gridz; + for(iicg=fr->cg0; (iicg < fr->hcg); iicg++) { + icg = cg_index[iicg]; + if (icg != iicg) + fatal_error(0,"icg = %d, iicg = %d, file %s, line %d",icg,iicg,"ns.c", + 1408); + if(bExcludeAlleg[icg]) + i_eg_excl = fr->eg_excl + ngid*gid[cgs->index[icg]]; + setexcl(cgs->index[icg],cgs->index[icg+1],&top->atoms.excl,1,bexcl); + naaj = calc_naaj(icg,cgsnr); + icg_naaj = icg+naaj; + for (tz=-1; tz<=1; tz++) { + ZI = cgcm[icg][2]+tz*box[2][2]; + get_dx(Nz,gridz,grid_z,rcoul2,ZI,&dz0,&dz1,dcz2); + if (dz0 > dz1) + for (ty=-1; ty<=1; ty++) { + YI = cgcm[icg][1]+ty*box[1][1]+tz*box[2][1]; + get_dx(Ny,gridy,grid_y,rcoul2,YI,&dy0,&dy1,dcy2); + for (tx=-1; tx<=1; tx++) { + get_dx(Nx,gridx,grid_x,rcoul2,XI,&dx0,&dx1,dcx2); + shift=((2*1 +1)*((2*1 +1)*((tz)+1)+(ty)+1)+(tx)+1); + for (dx=dx0; (dx<=dx1); dx++) { + for (dy=dy0; (dy<=dy1); dy++) { + for (dz=dz0; (dz<=dz1); dz++) { + if (tmp2 > dcz2[dz]) { + for (j=0; (j= icg) && (jjcg < icg_naaj)) || + ((jjcg < min_icg))) { + if (r2 < rl2) { + if (!i_eg_excl[jgid]) { + if (r2 < rs2) { + if (nsr[jgid] >= 1024) { + put_in_list(bHaveLJ,ngid,md,icg,jgid, + nsr[jgid],nl_sr[jgid], + cgs->index, bexcl, + shift,fr,0,0,0); + } + } else if (r2 < rm2) { + } else if (use_two_cutoffs) { + if (nlr_one[jgid] >= 1024) { + do_longrange(log,cr,top,fr,ngid,md,icg,jgid, + nlr_one[jgid], + nl_lr_one[jgid],bexcl,shift,x, + box_size,nrnb, + lambda,dvdlambda,grps, + bVDWOnly,bCoulOnly,0, + bHaveLJ); + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +int search_neighbours(FILE *log,t_forcerec *fr, + rvec x[],matrix box, + t_topology *top,t_groups *grps, + t_commrec *cr,t_nsborder *nsb, + t_nrnb *nrnb,t_mdatoms *md, + real lambda,real *dvdlambda) +{ + static t_grid *grid=((void *)0); + static t_excl *bexcl; + static int *bHaveLJ; + static int *cg_index=((void *)0),*slab_index=((void *)0); + static int *bExcludeAlleg; + rvec box_size; + int i,j,m,ngid; + int nsearch; + nsearch = ns5_core(log,cr,fr,cg_index,box,box_size,ngid,top,grps, + grid,x,bexcl,bExcludeAlleg,nrnb,md,lambda,dvdlambda,bHaveLJ); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_1.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_1.c new file mode 100644 index 000000000..7538250c9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -fno-omit-frame-pointer -fno-inline --save-temps" } */ + +void +leaf (void) +{ + int a = 0; +} + +__attribute__ ((optimize("omit-frame-pointer"))) +void +non_leaf_1 (void) +{ + leaf (); +} + +__attribute__ ((optimize("omit-frame-pointer"))) +void +non_leaf_2 (void) +{ + leaf (); +} + +/* { dg-final { scan-assembler-times "str\tx30, \\\[sp\\\]" 2 } } */ + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_2.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_2.c new file mode 100644 index 000000000..675091f84 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/test_fp_attribute_2.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -fomit-frame-pointer -fno-inline --save-temps" } */ + +void +leaf (void) +{ + int a = 0; +} + +__attribute__ ((optimize("no-omit-frame-pointer"))) +void +non_leaf_1 (void) +{ + leaf (); +} + +__attribute__ ((optimize("no-omit-frame-pointer"))) +void +non_leaf_2 (void) +{ + leaf (); +} + +/* { dg-final { scan-assembler-times "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" 2 } } */ + +/* { dg-final { cleanup-saved-temps } } */ -- cgit v1.2.3