summaryrefslogtreecommitdiff
path: root/src/amd/compiler/aco_register_allocation.cpp
diff options
context:
space:
mode:
authorGeorg Lehmann <dadschoorse@gmail.com>2022-04-17 21:17:18 +0200
committerMarge Bot <emma+marge@anholt.net>2022-07-06 09:54:54 +0000
commitc9490436b637b21dcb633e8b8f5019ee70a90aff (patch)
treec2fedea9f6a78ad68648d3a1c82ae564a899c31f /src/amd/compiler/aco_register_allocation.cpp
parent599b587220bb22305d9b682546564fb70b19da6d (diff)
downloadmesa-c9490436b637b21dcb633e8b8f5019ee70a90aff.tar.gz
aco/ra: Static assert that changing instruction type to VOP2 is valid.
It's not obvious that this is correct. Signed-off-by: Georg Lehmann <dadschoorse@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15999>
Diffstat (limited to 'src/amd/compiler/aco_register_allocation.cpp')
-rw-r--r--src/amd/compiler/aco_register_allocation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 6193e4bf600..922c5b849e5 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -2695,6 +2695,10 @@ register_allocation(Program* program, std::vector<IDSet>& live_out_per_block, ra
use_vop2 = false;
}
if (use_vop2) {
+ static_assert(sizeof(VOP2_instruction) <= sizeof(VOP3_instruction),
+ "Invalid direct instruction cast.");
+ static_assert(sizeof(VOP2_instruction) <= sizeof(VOP3P_instruction),
+ "Invalid direct instruction cast.");
instr->format = Format::VOP2;
switch (instr->opcode) {
case aco_opcode::v_mad_f32: instr->opcode = aco_opcode::v_mac_f32; break;