1From 97af5a2efbe30726ce4d7c921efed6afc32a314f Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
3Date: Sun, 25 Dec 2016 13:41:19 +0100
4Subject: [PATCH] NEON autodetection segfaults: assume neon present
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9If TUNE_FEATURES contain 'neon' we can assume our machine supports it
10
11Upstream-Status: Inappropriate [embedded specific]
12
13Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
14---
15 simd-support/neon.c | 46 +---------------------------------------------
16 1 file changed, 1 insertion(+), 45 deletions(-)
17
18diff --git a/simd-support/neon.c b/simd-support/neon.c
19index 86b2cb6..8d6537e 100644
20--- a/simd-support/neon.c
21+++ b/simd-support/neon.c
22@@ -23,54 +23,10 @@
23
24 #if HAVE_NEON
25
26-/* check for an environment where signals are known to work */
27-#if defined(unix) || defined(linux)
28-  # include <signal.h>
29-  # include <setjmp.h>
30-
31-  static jmp_buf jb;
32-
33-  static void sighandler(int x)
34-  {
35-       UNUSED(x);
36-       longjmp(jb, 1);
37-  }
38-
39-  static int really_have_neon(void)
40-  {
41-       void (*oldsig)(int);
42-       oldsig = signal(SIGILL, sighandler);
43-       if (setjmp(jb)) {
44-	    signal(SIGILL, oldsig);
45-	    return 0;
46-       } else {
47-	    /* paranoia: encode the instruction in binary because the
48-	       assembler may not recognize it without -mfpu=neon */
49-	    /*asm volatile ("vand q0, q0, q0");*/
50-	    asm volatile (".long 0xf2000150");
51-	    signal(SIGILL, oldsig);
52-	    return 1;
53-       }
54-  }
55-
56-  int X(have_simd_neon)(void)
57-  {
58-       static int init = 0, res;
59-
60-       if (!init) {
61-	    res = really_have_neon();
62-	    init = 1;
63-       }
64-       return res;
65-  }
66-
67-
68-#else
69-/* don't know how to autodetect NEON; assume it is present */
70+/* autodetect NEON broken; assume it is present */
71   int X(have_simd_neon)(void)
72   {
73        return 1;
74   }
75-#endif
76
77 #endif
78--
792.5.5
80
81