A splitting result for compact symplectic manifolds