File: ax_check_arm_neon.m4

package info (click to toggle)
spandsp 0.0.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 15,796 kB
  • sloc: ansic: 123,211; xml: 13,229; sh: 12,189; cpp: 1,521; makefile: 1,097
file content (59 lines) | stat: -rw-r--r-- 1,732 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# @synopsis AX_CHECK_ARM_NEON
#
# Does the machine support the ARM NEON instruction set?
# @version 1.01   Feb 11 2013
# @author Steve Underwood
#
# Permission to use, copy, modify, distribute, and sell this file for any 
# purpose is hereby granted without fee, provided that the above copyright 
# and this permission notice appear in all copies.  No representations are
# made about the suitability of this software for any purpose.  It is 
# provided "as is" without express or implied warranty.

AC_DEFUN([AX_CHECK_ARM_NEON],
[AC_CACHE_CHECK([if $1 supports the ARM NEON instructions set], 
    ac_cv_symbol_arm_neon,

[# Initialize to unknown
ac_cv_symbol_arm_neon="no"

case "${ax_cv_c_compiler_vendor}" in
gnu)
    save_CFLAGS="${CFLAGS}"
    CFLAGS="${CFLAGS} -mfpu=neon -mfloat-abi=hard"
    AC_RUN_IFELSE(
        [AC_LANG_PROGRAM(
            [
                #include <inttypes.h>
                #include <arm_neon.h>

                int32x4_t testfunc(int16_t *a, int16_t *b)
                {
                    return vmull_s16(vld1_s16(a), vld1_s16(b));
                }
            ],
            [
                volatile int32x4_t z;
                int16_t x[[8]];
                int16_t y[[8]];
                z = testfunc(x, y);
            ]
        )],

        [AC_MSG_RESULT([yes])
         COMP_VENDOR_CFLAGS="-mfpu=neon $COMP_VENDOR_CFLAGS"
         COMP_VENDOR_CXXFLAGS="-mfpu=neon $COMP_VENDOR_CXXFLAGS"
         ac_cv_symbol_arm_neon="yes"],

        [AC_MSG_RESULT([no])],

        dnl Assume "no" if cross-compiling
        [AC_MSG_RESULT([no])]
    )
    CFLAGS="${save_CFLAGS}"
    ;;

esac])
AS_IF([test AS_VAR_GET(ac_cv_symbol_arm_neon) = yes], [$2], [$3])[]dnl
]) # AX_CHECK_ARM_NEON