Re: Clang as default compiler November 4th
On Thu, Sep 13, 2012 at 06:25:37PM +0200, Stefan Farfeleder wrote: > On Thu, Sep 13, 2012 at 09:10:24AM -0700, Steve Kargl wrote: > > clang -O2 -pipe -march=opteron -O0 -lm test-cexp.c -o test-cexp > > test-cexp.c:49:14: warning: pragma STDC FENV_ACCESS ON is not supported, > > ignoring pragma [-Wunknown-pragmas] > > #pragma STDC FENV_ACCESSON > > [...] > > > So, clang does not support "#pragma STDC FENV_ACCESS ON". > > That (IMHO) is a show stopper for clang as the default compiler, > > because at least msun/src/e_sqrtl.c uses this pragma. > > Neither does gcc, AFAIK (http://gcc.gnu.org/c99status.html). It just > silently ignores the pragma. > Hmmm, indeed, you are correct. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678 I seems to have mis-remembered a patch that went into newer gcc. -- Steve ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"
Re: Clang as default compiler November 4th
On Thu, Sep 13, 2012 at 09:10:24AM -0700, Steve Kargl wrote: > clang -O2 -pipe -march=opteron -O0 -lm test-cexp.c -o test-cexp > test-cexp.c:49:14: warning: pragma STDC FENV_ACCESS ON is not supported, > ignoring pragma [-Wunknown-pragmas] > #pragma STDC FENV_ACCESSON [...] > So, clang does not support "#pragma STDC FENV_ACCESS ON". > That (IMHO) is a show stopper for clang as the default compiler, > because at least msun/src/e_sqrtl.c uses this pragma. Neither does gcc, AFAIK (http://gcc.gnu.org/c99status.html). It just silently ignores the pragma. Stefan ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"
Re: Clang as default compiler November 4th
On Thu, Sep 13, 2012 at 09:32:12AM -0600, Ian Lepore wrote: > On Wed, 2012-09-12 at 19:08 -0700, Steve Kargl wrote: > > In regards to my initial post in this thread, I was just trying > > to assess whether any benchmarks have been performed on FreeBSD > > for floating point generated by clang. Other than the limited > > testing that I've done, it appears that the answer is 'no'. > > > > We have src/tools/tests/testfloat and src/tools/regression/lib/msun. I > know nothing about the former (just noticed it for the first time). The > latter I think is a set of correctness tests rather than performance > tests. It's quite clear that the clang proponent have not tried to run src/tools/regression/lib/msun. % setenv CC clang % make |& grep warning | wc -l 1354 % make clean % make |& tee make.log % head -20 make.log clang -O2 -pipe -march=opteron -O0 -lm test-cexp.c -o test-cexp test-cexp.c:49:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] #pragma STDC FENV_ACCESSON ^ test-cexp.c:183:2: warning: expression result unused [-Wunused-value] testall(0.0, 1.0, ALL_STD_EXCEPT, 0, 1); ^~~ test-cexp.c:98:7: note: expanded from macro 'testall' test(cexp, x, result, exceptmask, excepts, checksign); \ ^ test-cexp.c:87:11: note: expanded from macro 'test' assert(((func), fetestexcept(exceptmask) == (excepts)));\ ^ /usr/include/assert.h:54:21: note: expanded from macro 'assert' #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ ^ test-cexp.c:183:2: warning: expression result unused [-Wunused-value] testall(0.0, 1.0, ALL_STD_EXCEPT, 0, 1); ^~~ test-cexp.c:99:7: note: expanded from macro 'testall' % tail -20 make.log test-trig.c:69:11: note: expanded from macro 'test' assert(((func), fetestexcept(exceptmask) == (excepts)));\ ^ /usr/include/assert.h:54:21: note: expanded from macro 'assert' #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ ^ 74 warnings generated. clang -O2 -pipe -march=opteron -O0 -lm test-fenv.c -o test-fenv test-fenv.c:82:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] #pragma STDC FENV_ACCESS ON ^ 1 warning generated. for p in test-cexp test-conj test-csqrt test-ctrig test-exponential test-fma test-fmaxmin test-ilogb test-invtrig test-logarithm test-lrint test-lround test-nan test-nearbyint test-next test-rem test-trig test-fenv; do /usr/src/tools/regression/lib/msun/$p; done Assertion failed: (((cexp), fetestexcept((0x04 | 0x20 | 0x01 | 0x08 | 0x10)) == (0))), function test_nan, file test-cexp.c, line 211. 1..7 ok 1 - cexp zero Abort trap (core dumped) *** [tests] Error code 134 Stop in /usr/src/tools/regression/lib/msun. So, clang does not support "#pragma STDC FENV_ACCESS ON". That (IMHO) is a show stopper for clang as the default compiler, because at least msun/src/e_sqrtl.c uses this pragma. -- Steve ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"
Re: Clang as default compiler November 4th
On Wed, 2012-09-12 at 19:08 -0700, Steve Kargl wrote: > In regards to my initial post in this thread, I was just trying > to assess whether any benchmarks have been performed on FreeBSD > for floating point generated by clang. Other than the limited > testing that I've done, it appears that the answer is 'no'. > We have src/tools/tests/testfloat and src/tools/regression/lib/msun. I know nothing about the former (just noticed it for the first time). The latter I think is a set of correctness tests rather than performance tests. -- Ian ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"
Re: improving bootstrapping of WITH_CLANG_IS_CC
you send to wrong address, "\"freebsd-toolch...@freebsd.orgo\":" On 2012/09/13 01:38, Brooks Davis wrote: On Wed, Sep 12, 2012 at 10:01:14AM -0500, Brooks Davis wrote: On Wed, Sep 12, 2012 at 09:49:51PM +0900, Yamaya Takashi wrote: In Makefile.inc1, both WMAKECOMPILER_TYPE and WMAKE_COMPILER_TYPE exist. It's maybe bug. It is. I'm not actually sure why it didn't result in more invocations of gcc in my test. I'm testing a fix now. Here's a fixed version. Thank you for the review! -- Brooks Index: share/mk/Makefile === --- share/mk/Makefile (revision 240210) +++ share/mk/Makefile (working copy) @@ -3,7 +3,8 @@ FILES= bsd.README FILES+= bsd.arch.inc.mk -FILES+=bsd.compat.mk bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.dtrace.mk +FILES+=bsd.compat.mk bsd.compiler.mk bsd.cpu.mk +FILES+=bsd.dep.mk bsd.doc.mk bsd.dtrace.mk FILES+= bsd.endian.mk FILES+= bsd.files.mk bsd.crunchgen.mk bsd.incs.mk bsd.info.mk bsd.init.mk FILES+= bsd.kmod.mk Index: share/mk/bsd.compiler.mk === --- share/mk/bsd.compiler.mk(revision 0) +++ share/mk/bsd.compiler.mk(working copy) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +.if !defined(COMPILER_TYPE) +. if ${CC:T:Mgcc} == "gcc" +COMPILER_TYPE:=gcc +. elif ${CC:T:Mclang} == "clang" +COMPILER_TYPE:=clang +. else +_COMPILER_VERSION != ${CC} --version +. if ${_COMPILER_VERSION:Mgcc} == "gcc" +COMPILER_TYPE:=gcc +. elif ${_COMPILER_VERSION:M\(GCC\)} == "(GCC)" +COMPILER_TYPE:=gcc +. elif ${_COMPILER_VERSION:Mclang} == "clang" +COMPILER_TYPE:=clang +. else +.error Unable to determing compiler type for ${CC} +. endif +. endif +.endif Index: share/mk/bsd.sys.mk === --- share/mk/bsd.sys.mk (revision 240210) +++ share/mk/bsd.sys.mk (working copy) @@ -8,6 +8,8 @@ # for GCC: http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Warning-Options.html +.include + # the default is gnu99 for now CSTD?=gnu99 @@ -28,8 +30,8 @@ .if defined(WARNS) .if ${WARNS} >= 1 CWARNFLAGS+= -Wsystem-headers -.if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && \ -${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang)) +.if !defined(NO_WERROR) && (${COMPILER_TYPE} != "clang" \ +|| !defined(NO_WERROR.clang)) CWARNFLAGS+= -Werror .endif # !NO_WERROR && (!CLANG || !NO_WERROR.clang) .endif # WARNS >= 1 @@ -43,8 +45,8 @@ .if ${WARNS} >= 4 CWARNFLAGS+= -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow\ -Wunused-parameter -.if !defined(NO_WCAST_ALIGN) && ((${MK_CLANG_IS_CC} == "no" && \ -${CC:T:Mclang} != "clang") || !defined(NO_WCAST_ALIGN.clang)) +.if !defined(NO_WCAST_ALIGN) && (${COMPILER_TYPE} != "clang" \ +|| !defined(NO_WCAST_ALIGN.clang)) CWARNFLAGS+= -Wcast-align .endif # !NO_WCAST_ALIGN && (!CLANG || !NO_WCAST_ALIGN.clang) .endif # WARNS >= 4 @@ -61,8 +63,7 @@ CWARNFLAGS+= -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. -.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && \ -!defined(EARLY_BUILD) +.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) .if ${WARNS} <= 6 CWARNFLAGS+= -Wno-empty-body -Wno-string-plus-int .endif # WARNS <= 6 @@ -89,20 +90,18 @@ .if ${WFORMAT} > 0 #CWARNFLAGS+= -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args -.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && \ -!defined(EARLY_BUILD) +.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) .if ${WARNS} <= 3 CWARNFLAGS+= -Wno-format-nonliteral .endif # WARNS <= 3 .endif # CLANG -.if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && \ -${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang)) +.if !defined(NO_WERROR) && (${COMPILER_TYPE} != "clang" \ +|| !defined(NO_WERROR.clang)) CWARNFLAGS+= -Werror .endif # !NO_WERROR && (!CLANG || !NO_WERROR.clang) .endif # WFORMAT > 0 .endif # WFORMAT -.if defined(NO_WFORMAT) || ((${MK_CLANG_IS_CC} != "no" || \ -${CC:T:Mclang} == "clang") && defined(NO_WFORMAT.clang)) +.if defined(NO_WFORMAT) || (${COMPILER_TYPE} == "clang" && defined(NO_WFORMAT.clang)) CWARNFLAGS+= -Wno-format .endif # NO_WFORMAT || (CLANG && NO_WFORMAT.clang) .endif # !NO_WARNS @@ -111,8 +110,7 @@ CWARNFLAGS+= -Wno-unknown-pragmas .endif # IGNORE_PRAGMA -.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && \ -!defined(EARLY_BUILD) +.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) CLANG_NO_IAS= -no-integrated-as CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\ -mllvm -enable-load-pre=false -mllvm -sim