Mesa (main): pan/va: Lower FADD_RSCALE.f32 to FMA_RSCALE.f32
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 21 22:55:23 UTC 2022
Module: Mesa
Branch: main
Commit: 9dd0bc92b588c37de2150b4cb9761188c3edce90
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9dd0bc92b588c37de2150b4cb9761188c3edce90
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Fri Jun 17 10:40:27 2022 -0400
pan/va: Lower FADD_RSCALE.f32 to FMA_RSCALE.f32
We generate FADD_RSCALE.f32 in our sample variables implementations. Valhall
doesn't have a dedicated FADD_RSCALE.f32 implementation, it should be aliased to
FMA_RSCALE.f32. Handle that alias in isel lowering. This will fix:
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.*
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17101>
---
src/panfrost/bifrost/valhall/test/test-lower-isel.cpp | 8 ++++++++
src/panfrost/bifrost/valhall/va_lower_isel.c | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp b/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp
index f9c3b7874f3..97ff6391750 100644
--- a/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp
+++ b/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp
@@ -125,6 +125,14 @@ TEST_F(LowerIsel, MuxInt8) {
NEGCASE(bi_mux_v4i8(b, x, y, z, BI_MUX_FP_ZERO));
}
+TEST_F(LowerIsel, FaddRscale) {
+ CASE(bi_fadd_rscale_f32_to(b, reg, x, y, z, BI_SPECIAL_NONE),
+ bi_fma_rscale_f32_to(b, reg, x, bi_imm_f32(1.0), y, z, BI_SPECIAL_NONE));
+
+ CASE(bi_fadd_rscale_f32_to(b, reg, x, y, z, BI_SPECIAL_N),
+ bi_fma_rscale_f32_to(b, reg, x, bi_imm_f32(1.0), y, z, BI_SPECIAL_N));
+}
+
TEST_F(LowerIsel, Smoke) {
NEGCASE(bi_fadd_f32_to(b, reg, reg, reg));
NEGCASE(bi_csel_s32_to(b, reg, reg, reg, reg, reg, BI_CMPF_LT));
diff --git a/src/panfrost/bifrost/valhall/va_lower_isel.c b/src/panfrost/bifrost/valhall/va_lower_isel.c
index ad54a9352ba..a43ddc582ba 100644
--- a/src/panfrost/bifrost/valhall/va_lower_isel.c
+++ b/src/panfrost/bifrost/valhall/va_lower_isel.c
@@ -111,6 +111,14 @@ va_lower_isel(bi_instr *I)
break;
+ /* FADD_RSCALE.f32(x, y, z) -> FMA_RSCALE.f32(x, 1.0, y, z) */
+ case BI_OPCODE_FADD_RSCALE_F32:
+ I->op = BI_OPCODE_FMA_RSCALE_F32;
+ I->src[3] = I->src[2];
+ I->src[2] = I->src[1];
+ I->src[1] = bi_imm_f32(1.0);
+ break;
+
default:
break;
}
More information about the mesa-commit
mailing list