Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using v_mul_legacy in normalize with more conditions #2863

Merged
merged 1 commit into from
Dec 5, 2023
Merged
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 lgc/builder/ArithBuilder.cpp
Original file line number Diff line number Diff line change
@@ -836,8 +836,8 @@ Value *BuilderImpl::CreateNormalizeVector(Value *x, const Twine &instName) {
Value *result = nullptr;
if (x->getType()->getScalarType()->isFloatTy()) {
// Make sure a FP32 zero vector is normalized to a FP32 zero vector, rather than NaNs.
if (!getFastMathFlags().noSignedZeros()) {
// When NSZ is not specified, we avoid using fmul_legacy since the sign of the input is dropped.
if (!getFastMathFlags().noSignedZeros() || !getFastMathFlags().noInfs() || !getFastMathFlags().noNaNs()) {
// When NSZ, NoInfs, or NoNaNs is not specified, we avoid using fmul_legacy since it is not IEEE compliant.
auto zero = ConstantFP::get(getFloatTy(), 0.0);
auto isZeroDot = CreateFCmpOEQ(dot, zero);
rsq = CreateSelect(isZeroDot, zero, rsq);