From 41b54d4a5840f2a526aede98aec8f60f15339e77 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 25 Sep 2022 14:20:15 -0400 Subject: [PATCH] agx: Allow larger indices for ld/st For memory load/store instructions, the immediate is 16-bit, not 8-bit like for ALUs. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_validate.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/asahi/compiler/agx_validate.c b/src/asahi/compiler/agx_validate.c index c5079a9eedb..fc6e5f9bec0 100644 --- a/src/asahi/compiler/agx_validate.c +++ b/src/asahi/compiler/agx_validate.c @@ -99,14 +99,18 @@ agx_validate_sources(agx_instr *I) agx_validate_assert(!src.cache); agx_validate_assert(!src.discard); - /* Immediates are encoded as 8-bit. For integers, they extend to - * 16-bit. For floating point, they are 8-bit minifloats. The 8-bit - * minifloats are a strict subset of 16-bit standard floats, so we - * treat them as such in the IR, with an implicit f16->f32 for 32-bit - * floating point operations. + bool ldst = + (I->op == AGX_OPCODE_DEVICE_LOAD) || + (I->op == AGX_OPCODE_UNIFORM_STORE); + + /* Immediates are encoded as 8-bit (16-bit for memory load/store). For + * integers, they extend to 16-bit. For floating point, they are 8-bit + * minifloats. The 8-bit minifloats are a strict subset of 16-bit + * standard floats, so we treat them as such in the IR, with an + * implicit f16->f32 for 32-bit floating point operations. */ agx_validate_assert(src.size == AGX_SIZE_16); - agx_validate_assert(src.value < 0x100); + agx_validate_assert(src.value < (1 << (ldst ? 16 : 8))); } }