A reconfigurable spintronic device for quantum and classical logic