diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2020-04-06 17:13:52 +0100 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-04-22 13:25:17 +0000 |
commit | 2ab45f41e08a3892138a1e9b20552621b4e18682 (patch) | |
tree | fb109f696119ffbbaa0600729f3d53a6cb3fab5f /src/amd/compiler/aco_opcodes.py | |
parent | 83fdb1ed3dd13228bcb761a4a4532b67a24a682b (diff) |
aco: implement sub-dword swaps
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4469>
Diffstat (limited to 'src/amd/compiler/aco_opcodes.py')
-rw-r--r-- | src/amd/compiler/aco_opcodes.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/amd/compiler/aco_opcodes.py b/src/amd/compiler/aco_opcodes.py index 3fb755f0c7c..bb777eb0d51 100644 --- a/src/amd/compiler/aco_opcodes.py +++ b/src/amd/compiler/aco_opcodes.py @@ -149,6 +149,15 @@ class Format(Enum): def get_builder_field_decls(self): return [('%s %s=%s' % (f[0], f[1], f[2]) if f[2] != None else '%s %s' % (f[0], f[1])) for f in self.get_builder_fields()] + def get_builder_initialization(self, num_operands): + res = '' + if self == Format.SDWA: + for i in range(min(num_operands, 2)): + res += f'instr->sel[{i}] = op{i}.op.bytes() == 2 ? sdwa_uword : (op{i}.op.bytes() == 1 ? sdwa_ubyte : sdwa_udword);\n' + res += 'instr->dst_sel = def0.bytes() == 2 ? sdwa_uword : (def0.bytes() == 1 ? sdwa_ubyte : sdwa_udword);\n' + res += 'instr->dst_preserve = true;' + return res + class Opcode(object): """Class that represents all the information we have about the opcode |