  We investigate the possible occurrence of the highly-elongated shapes near
the yrast line in $^{40}$Ca and $^{41}$Ca at high spins on the basis of the
nuclear energy-density functional method. Not only the superdeformed (SD) yrast
configuration but the yrare configurations on top of the SD band are described
by solving the cranked Skyme-Kohn-Sham equation in the three-dimensional
coordinate-space representation. It is suggested that some of the excited SD
bands undergo band crossings and develop to the hyperdeformation (HD) beyond $J
\simeq 25 \hbar$ in $^{40}$Ca. We find that the change of triaxiality in
response to rotation plays a decisive role for the shape evolution towards HD,
and that this is governed by the signature quantum number of the last occupied
orbital at low spins. This mechanism can be verified in an experimental
observation of the positive-parity SD yrast signature-partner bands in
$^{41}$Ca, one of which ($\alpha=+1/2$) undergoes crossings with the HD band
while the other ($\alpha=-1/2$) shows the smooth evolution from the collective
rotation at low spins to the non-collective rotation with oblate shape at the
termination.
