http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57071
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-26 07:07:22 UTC --- As James Van Buskirk pointed out, the algorithm will fail if k < 0. Thus, he suggests, which gives the expected result: 1 - ISHFT(IAND(K,1),1)