Skip to content
Merged
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
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11161,8 +11161,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
APFloat FrexpMant =
frexp(C->getValueAPF(), FrexpExp, APFloat::rmNearestTiesToEven);
SDValue Result0 = getConstantFP(FrexpMant, DL, VTList.VTs[0]);
SDValue Result1 =
getConstant(FrexpMant.isFinite() ? FrexpExp : 0, DL, VTList.VTs[1]);
SDValue Result1 = getSignedConstant(FrexpMant.isFinite() ? FrexpExp : 0,
DL, VTList.VTs[1]);
return getNode(ISD::MERGE_VALUES, DL, VTList, {Result0, Result1}, Flags);
}

Expand Down
16 changes: 16 additions & 0 deletions llvm/test/CodeGen/X86/llvm.frexp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,22 @@ define i32 @test_frexp_f64_i32_only_use_exp(double %a) nounwind {
ret i32 %result.0
}

define { float, i32 } @pr160981() {
; X64-LABEL: pr160981:
; X64: # %bb.0:
; X64-NEXT: movss {{.*#+}} xmm0 = [9.9999988E-1,0.0E+0,0.0E+0,0.0E+0]
; X64-NEXT: movl $-126, %eax
; X64-NEXT: retq
;
; WIN32-LABEL: pr160981:
; WIN32: # %bb.0:
; WIN32-NEXT: flds __real@3f7ffffe
; WIN32-NEXT: movl $-126, %eax
; WIN32-NEXT: retl
%ret = call { float, i32 } @llvm.frexp.f32.i32(float bitcast (i32 8388607 to float))
ret { float, i32 } %ret
}

; FIXME: Widen vector result
; define { <2 x double>, <2 x i32> } @test_frexp_v2f64_v2i32(<2 x double> %a) nounwind {
; %result = call { <2 x double>, <2 x i32> } @llvm.frexp.v2f64.v2i32(<2 x double> %a)
Expand Down