Genes linked with a greater risk of developing autism may also be associated with higher intelligence, a study suggests.