From 2c7635ab638fa763714e71d466b2359cb7e1c96a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 30 Oct 2024 11:59:14 -0400 Subject: [PATCH] agx: add tests for sign/zero-extend propagate Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/test/test-optimizer.cpp | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/asahi/compiler/test/test-optimizer.cpp b/src/asahi/compiler/test/test-optimizer.cpp index 5d3bf8a3f0c..ae3bd336902 100644 --- a/src/asahi/compiler/test/test-optimizer.cpp +++ b/src/asahi/compiler/test/test-optimizer.cpp @@ -232,6 +232,39 @@ TEST_F(Optimizer, Copyprop) agx_fmul_to(b, out, wx, wy)); } +TEST_F(Optimizer, SourceZeroExtend) +{ + CASE32( + { + agx_index t = agx_temp(b->shader, AGX_SIZE_32); + agx_mov_to(b, t, hy); + agx_ffs_to(b, out, t); + }, + agx_ffs_to(b, out, hy)); +} + +TEST_F(Optimizer, AddSourceZeroExtend) +{ + CASE32( + { + agx_index t = agx_temp(b->shader, AGX_SIZE_32); + agx_mov_to(b, t, hy); + agx_iadd_to(b, out, wx, t, 1); + }, + agx_iadd_to(b, out, wx, agx_abs(hy), 1)); +} + +TEST_F(Optimizer, AddSourceSignExtend) +{ + CASE32( + { + agx_index t = agx_temp(b->shader, AGX_SIZE_32); + agx_signext_to(b, t, hy); + agx_iadd_to(b, out, wx, t, 1); + }, + agx_iadd_to(b, out, wx, hy, 1)); +} + TEST_F(Optimizer, SubInlineImmediate) { CASE16(agx_iadd_to(b, out, hx, agx_mov_imm(b, 16, -2), 0),