Asda has posted losses of nearly £1bn after the struggling supermarket was hit by a sales decline and a botched IT upgrade.