<div dir="ltr"><div>I found the bug on my end, a simple mistake with the typing of the intrinsic. Sorry for the spam.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 4:37 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm not sure what I'm missing and was hoping someone could point it out to me.</div><div><br></div><div>We'd like to use a 16 bit intrinsic to do some work on a f32. The problem with the code is that we're getting a f32 returned from the intrinsic when it should be a i16, so we are unable to pattern match. We're trying to follow along the two examples in code code in SparcISelLowering.cpp. </div><div><br></div><div>given f(x, y), it should extract the upper bits of y and x, copy the bits from y specified in the bitmask to x and then reinsert the upper bits into x and return the f32.</div><div><br></div><div>Code:</div><div><br></div><div>  SDLoc DL(Op);<br>  EVT VT = Op.getValueType();</div><div><br></div><div>  SDValue LHS = Op.getOperand(0);<br>  SDValue RHS = Op.getOperand(1);</div><div><br></div><div>  SDValue ConstMask = DAG.getConstant(0x8000, SDLoc(Op.getNode()), MVT::i16);</div><div>  SDValue y_MSB =  DAG.getTargetExtractSubreg(<wbr>TARGET::sub_even, DL, MVT::i16, RHS);<br>  SDValue x_MSB = DAG.getTargetExtractSubreg(<wbr>TARGET::sub_even, DL, MVT::i16, LHS);<br>  SDValue x_LSB = DAG.getTargetExtractSubreg(<wbr>TARGET::sub_odd, DL, MVT::i16, LHS);</div><div>  </div><div>  x_MSB = DAG.getNode(ISD::INTRINSIC_WO_<wbr>CHAIN, DL,<br>                          VT, DAG.getTargetConstant(<wbr>Intrinsic::myIntrinsic,<br>                          DL, MVT::i16), y_MSB, ConstMask);</div><div><br></div><div>  SDValue result = SDValue(DAG.getMachineNode(<wbr>TargetOpcode::IMPLICIT_DEF,<br>                              <wbr>                  DL, MVT::f32), 0);</div><div><br></div><div>  result = DAG.getTargetInsertSubreg(<wbr>TARGET::sub_even, DL, MVT::f32, result, x_MSB);<br>  result = DAG.getTargetInsertSubreg(<wbr>TARGET::sub_odd, DL, MVT::f32, result, x_LSB);</div><div><br>  return result;<br></div></div>
</blockquote></div><br></div>