[med-svn] [jellyfish] 02/03: Replace asm statements by C code to increase portability; enabling Architecture any

Andreas Tille tille at debian.org
Fri Aug 25 12:03:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository jellyfish.

commit b3a7ae53a59d7275372b59f0db99027f8b1f8c45
Author: Andreas Tille <tille at debian.org>
Date:   Fri Aug 25 13:58:32 2017 +0200

    Replace asm statements by C code to increase portability; enabling Architecture any
---
 debian/changelog                 |  2 +
 debian/control                   | 12 +++---
 debian/patches/portability.patch | 84 ++++++++++++++++++++++++++++++++++++++++
 debian/patches/series            |  1 +
 4 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ba59f1c..04efe37 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ jellyfish (2.2.6-2) UNRELEASED; urgency=medium
     Closes: #872262
   * Enable full hardening
     Closes: #865608
+  * Replace asm statements by C code to increase portability
+    Closes: #871697
 
  -- Andreas Tille <tille at debian.org>  Fri, 25 Aug 2017 13:44:29 +0200
 
diff --git a/debian/control b/debian/control
index 04ef438..c42ab3a 100644
--- a/debian/control
+++ b/debian/control
@@ -25,7 +25,7 @@ Vcs-Git: https://anonscm.debian.org/git/debian-med/jellyfish.git
 Homepage: http://www.cbcb.umd.edu/software/jellyfish/
 
 Package: jellyfish
-Architecture: any-amd64
+Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends},
          libjellyfish-2.0-2 (= ${binary:Version})
@@ -45,7 +45,7 @@ Description: count k-mers in DNA sequences
  format using the "jellyfish dump" command.
 
 Package: libjellyfish-2.0-2
-Architecture: any-amd64
+Architecture: any
 Section: libs
 Depends: ${shlibs:Depends},
          ${misc:Depends}
@@ -68,7 +68,7 @@ Description: count k-mers in DNA sequences (dynamic library of jellyfish)
  jellyfish is linked to.
 
 Package: libjellyfish-2.0-dev
-Architecture: any-amd64
+Architecture: any
 Section: libdevel
 Depends: ${misc:Depends},
          libjellyfish-2.0-2 (= ${binary:Version})
@@ -91,7 +91,7 @@ Description: count k-mers in DNA sequences (development files of jellyfish)
  header files)
 
 Package: python3-dna-jellyfish
-Architecture: any-amd64
+Architecture: any
 Section: python
 Depends: ${python3:Depends},
          ${misc:Depends},
@@ -114,7 +114,7 @@ Description: count k-mers in DNA sequences (Python bindings of jellyfish)
  This package contains the Python bindings of jellyfish.
 
 Package: libjellyfish-perl
-Architecture: any-amd64
+Architecture: any
 Section: perl
 Depends: ${perl:Depends},
          ${misc:Depends},
@@ -137,7 +137,7 @@ Description: count k-mers in DNA sequences (Perl bindings of jellyfish)
  This package contains the Perl bindings of jellyfish.
 
 Package: jellyfish-examples
-Architecture: any-amd64
+Architecture: all
 Depends: jellyfish,
          ${shlibs:Depends},
          ${misc:Depends}
diff --git a/debian/patches/portability.patch b/debian/patches/portability.patch
new file mode 100644
index 0000000..a0a585f
--- /dev/null
+++ b/debian/patches/portability.patch
@@ -0,0 +1,84 @@
+Author: Edmund Grimley Evans <edmund.grimley.evans at gmail.com>
+Last-Update: Thu, 10 Aug 2017 18:27:02 UTC
+Bug-Debian: https://bugs.debian.org/871697
+Description: Replace asm statements by C code to increase portability
+
+--- a/include/jellyfish/rectangular_binary_matrix.hpp
++++ b/include/jellyfish/rectangular_binary_matrix.hpp
+@@ -276,13 +276,20 @@ namespace jellyfish {
+ // #pragma GCC diagnostic pop
+ 
+     // i is the lower 2 bits of x, and an index into the smear array. Compute res ^= smear[i] & p[j].
++#ifdef __x86_64__
+ #define AND_XOR(off)                                                    \
+     asm("movdqa (%[s],%[i]), %[load]\n\t"                               \
+         "pand " off "(%[p]),%[load]\n\t"                                \
+         "pxor %[load],%[acc]\n\t"                                       \
+         : [acc]"=&x"(acc)                                               \
+         : "[acc]"(acc),  [i]"r"(i), [p]"r"(p), [s]"r"(smear), [load]"x"(load))
+-
++#else
++#define AND_XOR(off) do {                                               \
++        xmm_t a = { smear[i / 8], smear[i / 8 + 1] };                   \
++        xmm_t b = { p[(off) / 8], p[(off) / 8 + 1] };                   \
++        acc ^= a & b;                                                   \
++    } while (0)
++#endif
+ 
+     uint64_t i, j = 0, x = 0;
+     for(unsigned int w = 0; w < nb_words(); ++w) {
+@@ -294,16 +301,16 @@ namespace jellyfish {
+       }
+       for( ; j > 7; j -= 8, p -= 8) {
+         i = (x & (uint64_t)0x3) << 4;
+-        AND_XOR("0x30");
++        AND_XOR(0x30);
+         x >>= 2;
+         i = (x & (uint64_t)0x3) << 4;
+-        AND_XOR("0x20");
++        AND_XOR(0x20);
+         x >>= 2;
+         i = (x & (uint64_t)0x3) << 4;
+-        AND_XOR("0x10");
++        AND_XOR(0x10);
+         x >>= 2;
+         i = (x & (uint64_t)0x3) << 4;
+-        AND_XOR("");
++        AND_XOR(0);
+         x >>= 2;
+       }
+     }
+@@ -313,18 +320,19 @@ namespace jellyfish {
+     switch(j) {
+     case 6:
+       i = (x & (uint64_t)0x3) << 4;
+-      AND_XOR("0x20");
++      AND_XOR(0x20);
+       x >>= 2;
+     case 4:
+       i = (x & (uint64_t)0x3) << 4;
+-      AND_XOR("0x10");
++      AND_XOR(0x10);
+       x >>= 2;
+     case 2:
+       i = (x & (uint64_t)0x3) << 4;
+-      AND_XOR("");
++      AND_XOR(0);
+     }
+ 
+     // Get result out
++#ifdef __x86_64__
+     uint64_t res1, res2;
+     asm("movd %[acc], %[res1]\n\t"
+         "psrldq $8, %[acc]\n\t"
+@@ -332,6 +340,10 @@ namespace jellyfish {
+         : [res1]"=r"(res1), [res2]"=r"(res2)
+         : [acc]"x"(acc));
+     return res1 ^ res2;
++#else
++    return acc[0] ^ acc[1];
++#endif
++
+   }
+ #endif // HAVE_SSE
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 5987fe7..19cbb40 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ modern-g++
 spelling
 rename-python-module-to-dna_jellyfish.patch 
 gcc-7.patch
+portability.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/jellyfish.git



More information about the debian-med-commit mailing list