Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -5488,10 +5488,11 @@ case Intrinsic::gcread: case Intrinsic::gcwrite: llvm_unreachable("GC failed to lower gcread/gcwrite intrinsics!"); - case Intrinsic::flt_rounds: - setValue(&I, DAG.getNode(ISD::FLT_ROUNDS_, sdl, MVT::i32)); + case Intrinsic::flt_rounds: { + EVT Ty = TLI.getTypeToExpandTo(*Context, MVT::i32); + setValue(&I, DAG.getNode(ISD::FLT_ROUNDS_, sdl, Ty)); return nullptr; - + } case Intrinsic::expect: { // Just replace __builtin_expect(exp, c) with EXP. setValue(&I, getValue(I.getArgOperand(0))); Index: test/CodeGen/MSP430/flt_rounds.ll =================================================================== --- /dev/null +++ test/CodeGen/MSP430/flt_rounds.ll @@ -0,0 +1,10 @@ +; RUN: llc -verify-machineinstrs < %s -march=msp430 + +define i16 @foo() { +entry: + %0 = call i32 @llvm.flt.rounds() + %1 = trunc i32 %0 to i16 + ret i16 %1 +} + +declare i32 @llvm.flt.rounds() nounwind