Interestingly the movie Companion, out this weekend, illustrates this case exactly. It's a thriller, not a philosophical treatise, so don't expect it to go deep into the subject, but the question of what "pain" means to an AI is definitely part of the story.