Skip to content

Commit

Permalink
[MIPS] Fix miscompiles consecutive half operations
Browse files Browse the repository at this point in the history
Use softPromoteHalf legalization for fp16 rather than PromoteFloat.

Fix #97975.
  • Loading branch information
yingopq committed Sep 27, 2024
1 parent 9b5a303 commit a618b49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions llvm/lib/Target/Mips/MipsISelLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ class TargetRegisterClass;
return ABI.IsN64() ? Mips::A1_64 : Mips::A1;
}

bool softPromoteHalfType() const override { return true; }

bool isJumpTableRelative() const override {
return getTargetMachine().isPositionIndependent();
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/Mips/fp16-promote.ll
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ define <4 x float> @test_vec_fpext_float(ptr %p) #0 {
; CHECK-LIBCALL-LABEL: test_vec_fpext_double:
; CHECK-LIBCALL: %call16(__gnu_h2f_ieee)
; CHECK-LIBCALL: %call16(__gnu_h2f_ieee)
; CHECK-LIBCALL: %call16(__gnu_h2f_ieee)
; CHECK-LIBCALL: cvt.d.s
; CHECK-LIBCALL: %call16(__gnu_h2f_ieee)
; CHECK-LIBCALL: cvt.d.s
; CHECK-LIBCALL: cvt.d.s
; CHECK-LIBCALL: %call16(__gnu_h2f_ieee)
Expand Down

0 comments on commit a618b49

Please sign in to comment.