[Mesa-dev] [Bug 91806] configure does not test whether assembler supports sse4.1
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Dec 7 19:02:05 PST 2015
https://bugs.freedesktop.org/show_bug.cgi?id=91806
--- Comment #4 from Jonathan Gray <jsg at openbsd.org> ---
As mentioned in the initial report I tried that. It seems the test somehow
returns 0 not 1?
configure:19269: /usr/local/bin/egcc -o conftest -msse4.1 -g -O2 -Wall -std=c99
-Werror=implicit-function-declaration -Werror=missing-prototypes -fno
-strict-aliasing -fno-math-errno -fno-trapping-math -fno-builtin-memcmp
-I/usr/local/include -I/usr/local/include/libelf -L/usr/local/lib conftest.c
>&5
conftest.c: In function 'main':
conftest.c:46:61: warning: variable 'c' set but not used
[-Wunused-but-set-variable]
__m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
^
configure:19269: $? = 0
19251 SSE41_CFLAGS="-msse4.1"
19252 case "$target_cpu" in
19253 i?86)
19254 SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
19255 ;;
19256 esac
19257 save_CFLAGS="$CFLAGS"
19258 CFLAGS="$SSE41_CFLAGS $CFLAGS"
19259 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
19260 /* end confdefs.h. */
19261
19262 #include <smmintrin.h>
19263 int main () {
19264 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
19265 c = _mm_max_epu32(a, b);
19266 return 0;
19267 }
19268 _ACEOF
19269 if ac_fn_c_try_link "$LINENO"; then :
19270 SSE41_SUPPORTED=1
19271 fi
19272 rm -f core conftest.err conftest.$ac_objext \
19273 conftest$ac_exeext conftest.$ac_ext
19274 CFLAGS="$save_CFLAGS"
19275 if test "x$SSE41_SUPPORTED" = x1; then
19276 DEFINES="$DEFINES -DUSE_SSE41"
19277 fi
19278 if test x$SSE41_SUPPORTED = x1; then
19279 SSE41_SUPPORTED_TRUE=
19280 SSE41_SUPPORTED_FALSE='#'
19281 else
19282 SSE41_SUPPORTED_TRUE='#'
19283 SSE41_SUPPORTED_FALSE=
19284 fi
19285
19286 SSE41_CFLAGS=$SSE41_CFLAGS
The if ac_fn_c_try_link "$LINENO" path is taken and SSE41_SUPPORTED is set to
1.
conftest.c has
/* confdefs.h */
#define PACKAGE_NAME "Mesa"
#define PACKAGE_TARNAME "mesa"
#define PACKAGE_VERSION "11.2.0-devel"
#define PACKAGE_STRING "Mesa 11.2.0-devel"
#define PACKAGE_BUGREPORT
"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"
#define PACKAGE_URL ""
#define PACKAGE "mesa"
#define VERSION "11.2.0-devel"
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define YYTEXT_POINTER 1
#define HAVE___BUILTIN_BSWAP32 1
#define HAVE___BUILTIN_BSWAP64 1
#define HAVE___BUILTIN_CLZ 1
#define HAVE___BUILTIN_CLZLL 1
#define HAVE___BUILTIN_CTZ 1
#define HAVE___BUILTIN_EXPECT 1
#define HAVE___BUILTIN_FFS 1
#define HAVE___BUILTIN_FFSLL 1
#define HAVE___BUILTIN_POPCOUNT 1
#define HAVE___BUILTIN_POPCOUNTLL 1
#define HAVE___BUILTIN_UNREACHABLE 1
#define HAVE_FUNC_ATTRIBUTE_CONST 1
#define HAVE_FUNC_ATTRIBUTE_FLATTEN 1
#define HAVE_FUNC_ATTRIBUTE_FORMAT 1
#define HAVE_FUNC_ATTRIBUTE_MALLOC 1
#define HAVE_FUNC_ATTRIBUTE_PACKED 1
#define HAVE_FUNC_ATTRIBUTE_PURE 1
#define HAVE_FUNC_ATTRIBUTE_UNUSED 1
#define HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT 1
/* end confdefs.h. */
#include <smmintrin.h>
int main () {
__m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
c = _mm_max_epu32(a, b);
return 0;
}
ac_fn_c_try_link seems to run
$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
/usr/local/bin/egcc -o conftest -msse4.1 -g -O2 -Wall -std=c99 -Werror=impli\
cit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing
-fno-math-errno -fno\
-trapping-math -fno-builtin-memcmp -I/usr/local/include
-/usr/local/include/libelf -L/usr/lo\
cal/lib conftest.c
And it returns 0 when run that way:
29531 sh ARGS
[0] = "/usr/local/bin/egcc"
[1] = "-o"
[2] = "conftest"
[3] = "-msse4.1"
[4] = "-g"
[5] = "-O2"
[6] = "-Wall"
[7] = "-std=c99"
[8] = "-Werror=implicit-function-declaration"
[9] = "-Werror=missing-prototypes"
[10] = "-fno-strict-aliasing"
[11] = "-fno-math-errno"
[12] = "-fno-trapping-math"
[13] = "-fno-builtin-memcmp"
[14] = "-I/usr/local/include"
[15] = "-I/usr/local/include/libelf"
[16] = "-L/usr/local/lib"
[17] = "conftest.c"
29531 egcc NAMI "/usr/libexec/ld.so"
29531 egcc RET execve 0
It turns out gcc helpfully optimises out the sse4.1 call with -O1 or greater.
$ egcc -msse4.1 -O1 conftest.c
$ echo $?
0
$ egcc -msse4.1 -O0 conftest.c
/tmp//cc6UU7Rt.s: Assembler messages:
/tmp//cc6UU7Rt.s:24: Error: no such instruction: `pinsrd $1,%eax,%xmm1'
/tmp//cc6UU7Rt.s:27: Error: no such instruction: `pinsrd $1,%eax,%xmm0'
/tmp//cc6UU7Rt.s:44: Error: no such instruction: `pinsrd $1,%eax,%xmm1'
/tmp//cc6UU7Rt.s:47: Error: no such instruction: `pinsrd $1,%eax,%xmm0'
/tmp//cc6UU7Rt.s:58: Error: no such instruction: `pmaxud %xmm1,%xmm0'
$ echo $?
1
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151208/261825be/attachment-0001.html>
More information about the mesa-dev
mailing list