diff options
author | Georg Lehmann <dadschoorse@gmail.com> | 2022-04-17 21:17:18 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-07-06 09:54:54 +0000 |
commit | c9490436b637b21dcb633e8b8f5019ee70a90aff (patch) | |
tree | c2fedea9f6a78ad68648d3a1c82ae564a899c31f /src/amd/compiler/aco_register_allocation.cpp | |
parent | 599b587220bb22305d9b682546564fb70b19da6d (diff) | |
download | mesa-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.cpp | 4 |
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; |