[llvm-dev] Help Lowering floating point conditional branch to library call

vivek pandya via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 20 05:48:14 PST 2017


Hello LLVM Devs,

I am trying to lower floating point conditional  branch operation to
library call with following code:

SDValue EmitCMP(...){
  // lower condition code to target specific condition code
if (STI.useHardFlot()) {
  // if fcmp instruction is available use it
  return DAG.getNode(DummyArchISD::FCMP, dl, MVT::Glue, LHS, RHS,
                     TargetCC);
} else {
  // else generate library call
  DAG.getTargetLoweringInfo().softenSetCCOperands(DAG, MVT::f32, LHS, RHS,
                                                  CC, dl);
  return LHS;
}
}

SDValue DummyArchTargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG)
const {
SDValue Chain = Op.getOperand(0);
ISD::CondCode CC = cast<CondCodeSDNode>(Op.getOperand(1))->get();
SDValue LHS   = Op.getOperand(2);
SDValue RHS   = Op.getOperand(3);
SDValue Dest  = Op.getOperand(4);
SDLoc dl  (Op);

SDValue TargetCC;
SDValue Flag = EmitCMP(LHS, RHS, TargetCC, CC, dl, DAG);
MVT SVT = LHS.getSimpleValueType();
if (SVT != MVT::f32) {
return DAG.getNode(DummyArchISD::BR_CC, dl, Op.getValueType(),
                 Chain, Dest, TargetCC, Flag);
}
else {
return DAG.getNode(DummyArchISD::BR_CC, dl, Op.getValueType(),
                 Chain, LHS, Dest, TargetCC, Flag);
}
}

This does not give any error, but library call dose not appear in generated
assembly.

Can some one explain me what I am doing wrong here?

Sincerely,
Vivek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170220/119b382e/attachment.html>


More information about the llvm-dev mailing list