Skip to content

Commit

Permalink
#14604: Optimize Blackhole muladd negation
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-TT committed Feb 25, 2025
1 parent da9272b commit 6c3e71d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion binutils
5 changes: 2 additions & 3 deletions include/blackhole/sfpi_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ sfpi_inline __vCond vFloat::operator>=(const float x) const { return __vCond(__v

sfpi_inline vFloat vFloat::operator-=(const vFloat a)
{
__rvtt_vec_t neg1 = __builtin_rvtt_sfpassignlreg(vConstNeg1.get());
assign(__builtin_rvtt_sfpmad(neg1, a.get(), v, SFPMAD_MOD1_OFFSET_NONE));
return v;
*this += -a;
return *this;
}

sfpi_inline vFloat::vFloat(const __vDReg dreg)
Expand Down
5 changes: 2 additions & 3 deletions include/grayskull/sfpi_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ sfpi_inline __vCond vFloat::operator>=(const float x) const { return __vCond(__v

sfpi_inline vFloat vFloat::operator-=(const vFloat a)
{
__rvtt_vec_t neg1 = __builtin_rvtt_sfpassignlreg(vConstNeg1.get());
assign(__builtin_rvtt_sfpmad(neg1, a.get(), v, SFPMAD_MOD1_OFFSET_NONE));
return v;
*this += -a;
return *this;
}

sfpi_inline vFloat::vFloat(const __vDReg dreg)
Expand Down
3 changes: 1 addition & 2 deletions include/sfpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,7 @@ sfpi_inline vFloat fp_mul(const vFloat a, const vFloat b)

sfpi_inline vFloat fp_sub(const vFloat a, const vFloat b)
{
__rvtt_vec_t neg1 = __builtin_rvtt_sfpassignlreg(vConstNeg1.get());
return __builtin_rvtt_sfpmad(neg1, b.get(), a.get(), 0);
return a + -b;
}

}
Expand Down
5 changes: 2 additions & 3 deletions include/wormhole/sfpi_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ sfpi_inline __vCond vFloat::operator>=(const float x) const { return __vCond(__v

sfpi_inline vFloat vFloat::operator-=(const vFloat a)
{
__rvtt_vec_t neg1 = __builtin_rvtt_sfpassignlreg(vConstNeg1.get());
assign(__builtin_rvtt_sfpmad(neg1, a.get(), v, SFPMAD_MOD1_OFFSET_NONE));
return v;
*this += -a;
return *this;
}

sfpi_inline vFloat::vFloat(const __vDReg dreg)
Expand Down

0 comments on commit 6c3e71d

Please sign in to comment.