As detailed on D49135, this patch moves most of the opcode scalar/vector cost calculations into helper functions. This is primarily to avoid repetition in the shufflevector case for alternate opcodes, but it also demonstrates how many of the opcode groups share the same cost calculation code.
I haven't touched the ExtractValue/ExtractElement costs - these might require more work before we can use them correctly for PR30787/D28907 'copyable' cases.
Can we just use TTI->getInstructionCost(I, TargetTransformInfo::TCK_RecipThroughput); instead of this function?