\documentclass{article}
\usepackage{amsthm}
\newtheorem{thm}{asdf}[section]
\newtheorem{thmp}{asdf}
\newtheorem{thmpp}{asdf}
\renewcommand\thethmp{\thethm\ensuremath'}
\renewcommand\thethmpp{\thethm\ensuremath{''}}

\begin{document}

\section{test}

\begin{thm}\label{asdf1}
11111
\end{thm}
ref the asdf \ref{asdf1}.
\begin{thmp}\label{asdf1a}
11111p
\end{thmp}
ref the asdf \ref{asdf1a}.
\begin{thmpp}\label{asdf1b}
11111pp
\end{thmpp}
ref the asdf \ref{asdf1b}.
\begin{thm}\label{asdfx}
22222
\end{thm}
ref the asdf \ref{asdfx}.
\begin{thm}\label{asdfy}
33333
\end{thm}
ref the asdf \ref{asdfy}.
\begin{thmp}\label{asdfz}
33333p
\end{thmp}
ref the asdf \ref{asdfz}.
\begin{thmpp}\label{asdfasdf}
33333pp
\end{thmpp}
ref the asdf \ref{asdfasdf}.
\begin{thm}\label{asdffdsa}
44444
\end{thm}
ref the asdf \ref{asdffdsa}.

\end{document}