[InstCombine] Added pattern for recognising the construction of packed integers. (#147414)
This patch extends the instruction combiner to simplify the construction
of a packed scalar integer from a vector type, such as:
```llvm
target datalayout = "e"
define i32 @src(<4 x i8> %v) {
%v.0 = extractelement <4 x i8> %v, i32 0
%z.0 = zext i8 %v.0 to i32
%v.1 = extractelement <4 x i8> %v, i32 1
%z.1 = zext i8 %v.1 to i32
%s.1 = shl i32 %z.1, 8
%x.1 = or i32 %z.0, %s.1
%v.2 = extractelement <4 x i8> %v, i32 2
%z.2 = zext i8 %v.2 to i32
%s.2 = shl i32 %z.2, 16
%x.2 = or i32 %x.1, %s.2
%v.3 = extractelement <4 x i8> %v, i32 3
%z.3 = zext i8 %v.3 to i32
%s.3 = shl i32 %z.3, 24
%x.3 = or i32 %x.2, %s.3
ret i32 %x.3
}
; ===============
define i32 @tgt(<4 x i8> %v) {
%x.3 = bitcast <4 x i8> %v to i32
ret i32 %x.3
}
```
Alive2 proofs (little-endian):
[YKdMeg](https://alive2.llvm.org/ce/z/YKdMeg)
Alive2 proofs (big-endian):
[vU6iKc](https://alive2.llvm.org/ce/z/vU6iKc)