1 dnl as-gcc-inline-assembly.m4 0.1.0 2 3 dnl autostars m4 macro for detection of gcc inline assembly 4 5 dnl David Schleef <ds (a] schleef.org> 6 7 dnl AS_COMPILER_FLAG(ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) 8 dnl Tries to compile with the given CFLAGS. 9 dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, 10 dnl and ACTION-IF-NOT-ACCEPTED otherwise. 11 12 AC_DEFUN([AS_GCC_INLINE_ASSEMBLY], 13 [ 14 AC_MSG_CHECKING([if compiler supports gcc-style inline assembly]) 15 16 AC_TRY_COMPILE([], [ 17 #ifdef __GNUC_MINOR__ 18 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004 19 #error GCC before 3.4 has critical bugs compiling inline assembly 20 #endif 21 #endif 22 __asm__ (""::) ], [flag_ok=yes], [flag_ok=no]) 23 24 if test "X$flag_ok" = Xyes ; then 25 $1 26 true 27 else 28 $2 29 true 30 fi 31 AC_MSG_RESULT([$flag_ok]) 32 ]) 33 34 AC_DEFUN([AS_ASM_ARM_NEON], 35 [ 36 AC_MSG_CHECKING([if assembler supports NEON instructions on ARM]) 37 38 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[__asm__("vorr d0,d0,d0")])], 39 [AC_MSG_RESULT([yes]) 40 $1], 41 [AC_MSG_RESULT([no]) 42 $2]) 43 ]) 44 45 46 AC_DEFUN([AS_ASM_ARM_MEDIA], 47 [ 48 AC_MSG_CHECKING([if assembler supports ARMv6 media instructions on ARM]) 49 50 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[__asm__("shadd8 r3,r3,r3")])], 51 [AC_MSG_RESULT([yes]) 52 $1], 53 [AC_MSG_RESULT([no]) 54 $2]) 55 ]) 56 57 58 AC_DEFUN([AS_ASM_ARM_EDSP], 59 [ 60 AC_MSG_CHECKING([if assembler supports EDSP instructions on ARM]) 61 62 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[__asm__("qadd r3,r3,r3")])], 63 [AC_MSG_RESULT([yes]) 64 $1], 65 [AC_MSG_RESULT([no]) 66 $2]) 67 ]) 68