From ae96851db2dd9645a421bf0c83461333fccdab5d Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 2 Jul 2017 18:08:27 +0200 Subject: [PATCH] Add code generators for switch_buffer_by_offset_4x4_carry_be_S() --- ..._switch_buffer_by_offset_4x4_carry_be_S.pl | 54 +++++++++++++++++++ ..._switch_buffer_by_offset_4x4_carry_be_S.pl | 54 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 tools/code_generators/GEN_AMD_switch_buffer_by_offset_4x4_carry_be_S.pl create mode 100644 tools/code_generators/GEN_NV_switch_buffer_by_offset_4x4_carry_be_S.pl diff --git a/tools/code_generators/GEN_AMD_switch_buffer_by_offset_4x4_carry_be_S.pl b/tools/code_generators/GEN_AMD_switch_buffer_by_offset_4x4_carry_be_S.pl new file mode 100644 index 000000000..06586846d --- /dev/null +++ b/tools/code_generators/GEN_AMD_switch_buffer_by_offset_4x4_carry_be_S.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +for (my $i = 0, my $s = 0; $i < 16; $i++, $s++) +{ + printf (" case %2d:\n", $i); + for (my $j = 32 - 1; $j >= 0; $j--) + { + my $jd4 = $j / 4; + my $jm4 = $j % 4; + + my $js1d4 = ($j - $s - 1) / 4; + my $js1m4 = ($j - $s - 1) % 4; + + my $js0d4 = ($j - $s - 0) / 4; + my $js0m4 = ($j - $s - 0) % 4; + + next if (($j - $s) > 16); + + my $c1 = "w"; + my $c2 = "w"; + my $c3 = "w"; + + if ($jd4 >= 4) + { + $jd4 -= 4; + + $c1 = "c"; + } + + if ($js0d4 >= 4) + { + printf (" %s%d[%d] = amd_bytealign_S (%s%d[%d], 0, offset);\n", $c1, $jd4, $jm4, $c2, $js1d4, $js1m4); + } + elsif ((($j - $s - 1) >= 0) && (($j - $s - 0) >= 0)) + { + printf (" %s%d[%d] = amd_bytealign_S (%s%d[%d], %s%d[%d], offset);\n", $c1, $jd4, $jm4, $c2, $js1d4, $js1m4, $c3, $js0d4, $js0m4); + } + elsif (($j - $s - 0) >= 0) + { + printf (" %s%d[%d] = amd_bytealign_S ( 0, %s%d[%d], offset);\n", $c1, $jd4, $jm4, $c2, $js0d4, $js0m4); + } + else + { + printf (" %s%d[%d] = 0;\n", $c1, $jd4, $jm4); + } + } + printf ("\n"); + + printf (" break;\n"); + printf ("\n"); +} diff --git a/tools/code_generators/GEN_NV_switch_buffer_by_offset_4x4_carry_be_S.pl b/tools/code_generators/GEN_NV_switch_buffer_by_offset_4x4_carry_be_S.pl new file mode 100644 index 000000000..ac5041192 --- /dev/null +++ b/tools/code_generators/GEN_NV_switch_buffer_by_offset_4x4_carry_be_S.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +for (my $i = 0, my $s = 0; $i < 16; $i++, $s++) +{ + printf (" case %2d:\n", $i); + for (my $j = 32 - 1; $j >= 0; $j--) + { + my $jd4 = $j / 4; + my $jm4 = $j % 4; + + my $js1d4 = ($j - $s - 1) / 4; + my $js1m4 = ($j - $s - 1) % 4; + + my $js0d4 = ($j - $s - 0) / 4; + my $js0m4 = ($j - $s - 0) % 4; + + next if (($j - $s) > 16); + + my $c1 = "w"; + my $c2 = "w"; + my $c3 = "w"; + + if ($jd4 >= 4) + { + $jd4 -= 4; + + $c1 = "c"; + } + + if ($js0d4 >= 4) + { + printf (" %s%d[%d] = __byte_perm_S ( 0, %s%d[%d], selector);\n", $c1, $jd4, $jm4, $c2, $js1d4, $js1m4); + } + elsif ((($j - $s - 1) >= 0) && (($j - $s - 0) >= 0)) + { + printf (" %s%d[%d] = __byte_perm_S (%s%d[%d], %s%d[%d], selector);\n", $c1, $jd4, $jm4, $c2, $js0d4, $js0m4, $c3, $js1d4, $js1m4); + } + elsif (($j - $s - 0) >= 0) + { + printf (" %s%d[%d] = __byte_perm_S (%s%d[%d], 0, selector);\n", $c1, $jd4, $jm4, $c2, $js0d4, $js0m4); + } + else + { + printf (" %s%d[%d] = 0;\n", $c1, $jd4, $jm4); + } + } + printf ("\n"); + + printf (" break;\n"); + printf ("\n"); +}