Conditionally use fma

This commit is contained in:
2021-03-26 15:57:15 +01:00
parent 7ab6f311c1
commit 75338698a4
2 changed files with 8 additions and 1 deletions

View File

@@ -131,7 +131,13 @@ impl<const M: usize, const P: usize> Matrix<Float, M, P> {
lhs[(i, 0)] * rhs[(0, j)]
};
for k in 1..N {
t = Float::mul_add(lhs[(i, k)], rhs[(k, j)], t);
cfg_if::cfg_if!(
if #[cfg(target_feature="fma")] {
t = Float::mul_add(lhs[(i, k)], rhs[(k, j)], t);
} else {
t = t + lhs[(i, k)]*rhs[(k, j)];
}
);
}
self[(i, j)] = t;
}