I am trying to emulate in software in my SIMD processor back end vector types with elements i32 using the native vector types with i16 (for example: v64i32 with v128i16).
For example, when I want to add 2 v64i32 I use first a getNode(ISD::BITCAST, ...) to typecast the operands of add. But this does not seem to work - I tried to get inspired from http://llvm.org/docs/doxygen/html/X86ISelLowering_8cpp_source.html. When I use that instruction I get an error saying "Cannot select [...] v128i16 = bitcast txy", where txy is of type t64i32.
So I tried to declare at the beginning of the ISelLowering class:
setOperationAction(ISD::BITCAST, MVT::v64i32, Expand /* or Promote */);
AddPromotedToType (ISD::BITCAST, MVT::v64i32, MVT::v128i16); // and also MVT::v128i16, MVT::v64i32
This eventually led to replacing during Instruction selection the
v128i16 = bitcast t52
v128i16,ch = load<LD256[FixedStack3]> t110, FrameIndex:i64<3>, undef:i64
but the load<LD256[FixedStack3]> operation is not really good for me.
Can somebody help me? I need a simple bitcast operation that just changes the type of the vector SDNode without any further complication, if possible.