change the place of if statements in regiser form

Change-Id: Ia4a6c358cb348566d9fd2f806317121c73b4cde1