Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,9 @@ bool DAGTypeLegalizer::SoftenFloatOperand(SDNode *N, unsigned OpNo) {

case ISD::BITCAST: Res = SoftenFloatOp_BITCAST(N); break;
case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N); break;
case ISD::FAKE_USE:
Res = SoftenFloatOp_FAKE_USE(N);
break;
case ISD::STRICT_FP_TO_FP16:
case ISD::FP_TO_FP16: // Same as FP_ROUND for softening purposes
case ISD::FP_TO_BF16:
Expand Down Expand Up @@ -1169,6 +1172,12 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_BITCAST(SDNode *N) {
return DAG.getNode(ISD::BITCAST, SDLoc(N), N->getValueType(0), Op0);
}

SDValue DAGTypeLegalizer::SoftenFloatOp_FAKE_USE(SDNode *N) {
SDValue Op = GetSoftenedFloat(N->getOperand(1));

return DAG.getNode(ISD::FAKE_USE, SDLoc(N), MVT::Other, N->getOperand(0), Op);
}

SDValue DAGTypeLegalizer::SoftenFloatOp_FP_ROUND(SDNode *N) {
// We actually deal with the partially-softened FP_TO_FP16 node too, which
// returns an i16 so doesn't meet the constraints necessary for FP_ROUND.
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
SDValue SoftenFloatOp_Unary(SDNode *N, RTLIB::Libcall LC);
SDValue SoftenFloatOp_BITCAST(SDNode *N);
SDValue SoftenFloatOp_BR_CC(SDNode *N);
SDValue SoftenFloatOp_FAKE_USE(SDNode *N);
SDValue SoftenFloatOp_FP_ROUND(SDNode *N);
SDValue SoftenFloatOp_FP_TO_XINT(SDNode *N);
SDValue SoftenFloatOp_FP_TO_XINT_SAT(SDNode *N);
Expand Down
9 changes: 9 additions & 0 deletions llvm/test/CodeGen/AVR/intrinsics/soften-fake-use.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; RUN: llc -O0 < %s -mtriple=avr 2>&1 --stop-after=finalize-isel | FileCheck %s

;; Tests that we can soften float operands to llvm.fake.use intrinsics.

define double @idd(double %d) {
entry:
notail call void (...) @llvm.fake.use(double %d)
ret double %d
}
Loading