LLVM IR question

Is there an easy straightforward way to concatenate to types into a single larger type?

Such as from i8 i8 to i16?

Zero-extend both to i16, shift one left by 8, then or. Same for all other integer scalar types.

There isn't any operator to do that, except maybe for some target-specific intrinsics.


This works too:

%1 = insertelement <2 x i8> undef, i8 %src0, 0
%2 = insertelement <2 x i8> %1, i8 %src1, 1
%3 = bitcast <2 x i8> %2 to i16

Not sure if one way is better than the other.