Samsung to cut chip output to ride out downturn; shares rally