diff options
Diffstat (limited to 'gcc-4.4.3/gcc/testsuite')
175 files changed, 4279 insertions, 107 deletions
diff --git a/gcc-4.4.3/gcc/testsuite/ChangeLog.ix86 b/gcc-4.4.3/gcc/testsuite/ChangeLog.ix86 new file mode 100644 index 000000000..5718e1d92 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/ChangeLog.ix86 @@ -0,0 +1,56 @@ +2010-08-13 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2010-02-26 H.J. Lu <hongjiu.lu@intel.com> + + PR testsuite/37074: + * gcc.dg/torture/stackalign/stackalign.exp: Add -mno-mmx to x86. + +2010-06-22 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2010-06-21 H.J. Lu <hongjiu.lu@intel.com> + + PR target/44615 + * gcc.target/i386/sse2-vec-2a.c: New. + +2009-10-30 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline: + 2009-10-30 H.J. Lu <hongjiu.lu@intel.com> + + PR target/40838 + * gcc.target/i386/incoming-6.c: New. + * gcc.target/i386/incoming-7.c: Likewise. + * gcc.target/i386/incoming-8.c: Likewise. + * gcc.target/i386/incoming-9.c: Likewise. + * gcc.target/i386/incoming-10.c: Likewise. + * gcc.target/i386/incoming-11.c: Likewise. + * gcc.target/i386/incoming-12.c: Likewise. + * gcc.target/i386/incoming-13.c: Likewise. + * gcc.target/i386/incoming-14.c: Likewise. + * gcc.target/i386/incoming-15.c: Likewise. + * gcc.target/i386/pr37843-4.c: Likewise. + +2009-05-21 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline: + 2009-05-21 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.target/i386/movbe-1.c: New. + * gcc.target/i386/movbe-2.c: Likewise. + +2009-03-27 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline: + 2009-03-27 H.J. Lu <hongjiu.lu@intel.com> + + PR target/39472 + * gcc.target/x86_64/abi/callabi/func-2a.c: New. + * gcc.target/x86_64/abi/callabi/func-2b.c: Likewise. + * gcc.target/x86_64/abi/callabi/func-indirect-2a.c: Likewise. + * gcc.target/x86_64/abi/callabi/func-indirect-2b.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-4a.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-4b.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-5a.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-5b.c: Likewise. diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/abi/forced.C b/gcc-4.4.3/gcc/testsuite/g++.dg/abi/forced.C index 7a9c35964..f846732c3 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/abi/forced.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/abi/forced.C @@ -1,6 +1,8 @@ // This test only applies to glibc (NPTL) targets. // { dg-do run { target *-*-linux* } } // { dg-options "-pthread" } +// Does not work on a QEMU set-up because of the status wrapper. +//{ dg-require-effective-target unwrapped } #include <pthread.h> #include <cxxabi.h> diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C new file mode 100644 index 000000000..e0ef7f71c --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-g -O0 -dA" } + +struct C { // { dg-function-on-line {_ZN1CC[12]Ev} } + virtual void + foo() {} // { dg-function-on-line _ZN1C3fooEv } +}; +static C dummy; + +int +main (void) +{ // { dg-function-on-line main } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C new file mode 100644 index 000000000..f23efef13 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C @@ -0,0 +1,20 @@ +// Contributed by Cary Coutant <ccoutant@google.com> +// Origin: PR debug/41063 +// { dg-do compile } + +struct A { + virtual void run(); +}; + +void test() { + struct B : public A { + void run() { + struct C : public A { + C() { } + B *b_; + }; + C c; + } + }; + B b; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C new file mode 100644 index 000000000..ecfb71323 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C @@ -0,0 +1,43 @@ +// Origin: PR 44641 +// { dg-do compile } +// { dg-options "-g -O0 -dA" } + +template <class A> struct MisplacedDbg; +template<class T> struct MisplacedDbg<T*>; +struct Full; +template<> struct MisplacedDbg<Full>; + +struct Arg; +typedef MisplacedDbg<Arg> Typedef1; +typedef MisplacedDbg<Arg*> Typedef2; +typedef MisplacedDbg<Full> Typedef3; + +template<typename T> struct Base { + virtual ~Base() { + } +}; + +template <> +struct MisplacedDbg<Full> + : public Base<int> +{ // { dg-function-on-line {_ZN12MisplacedDbgI4FullEC[12]Ev} } + // { dg-function-on-line {_ZN12MisplacedDbgI4FullED0Ev} { target *-*-* } 23 } +}; + +template <class T> +struct MisplacedDbg<T*> + : public Base<int> +{ // { dg-function-on-line {_ZN12MisplacedDbgIP3ArgEC[12]Ev} } + // { dg-function-on-line {_ZN12MisplacedDbgIP3ArgED0Ev} { target *-*-* } 30 } +}; + +template <class A> +struct MisplacedDbg + : public Base<int> +{ // { dg-function-on-line {_ZN12MisplacedDbgI3ArgEC[12]Ev} } + // { dg-function-on-line {_ZN12MisplacedDbgI3ArgED0Ev} { target *-*-* } 37 } +}; + +static MisplacedDbg<Arg> static_var1; +static MisplacedDbg<Arg*> static_var2; +static MisplacedDbg<Full> static_var3; diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C new file mode 100644 index 000000000..dfc983b17 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C @@ -0,0 +1,18 @@ +// Origin: PR 46527 +// { dg-do compile } +// { dg-options "-g -O0 -dA" } + +template <typename T> struct Struct { + double defined_later(); +}; +struct WrapperStruct { + Struct<double> ClassInstantiated; +}; +template <typename T> double +Struct<T>::defined_later() // { dg-function-on-line {_ZN6StructIdE13defined_laterEv} } +{ + return 1; +} +void InstantiateMethod() { + Struct<double>().defined_later(); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/init/pr42556.C b/gcc-4.4.3/gcc/testsuite/g++.dg/init/pr42556.C new file mode 100644 index 000000000..27370af79 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/init/pr42556.C @@ -0,0 +1,10 @@ +// { dg-do compile } +// { dg-options "-fdump-tree-gimple" } + +void foo (int a, int b, int c, int d) +{ + int v[4] = {a, b, c, d}; +} + +// { dg-final { scan-tree-dump-not "v = {}" "gimple" } } +// { dg-final { cleanup-tree-dump "gimple" } } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/ipa/ipa-cp-1.C b/gcc-4.4.3/gcc/testsuite/g++.dg/ipa/ipa-cp-1.C new file mode 100644 index 000000000..954097655 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/ipa/ipa-cp-1.C @@ -0,0 +1,309 @@ +/* Test for segfault during updating of jump function in + interprocedural constant propagation (b/3124518). */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +namespace std __attribute__ ((__visibility__ ("default"))) { + template<class _CharT> + struct char_traits; +} +typedef long int ptrdiff_t; +typedef long unsigned int size_t; +namespace std __attribute__ ((__visibility__ ("default"))) { + void __throw_bad_cast(void) __attribute__((__noreturn__)); + typedef ptrdiff_t streamsize; + template<> struct char_traits<char> + { + typedef char char_type; + static size_t length(const char_type* __s) { + } + }; +} +extern "C++" { + namespace std { + class exception { + }; + } + void operator delete(void*) throw(); +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template<typename _Tp> + class new_allocator { + public: + typedef size_t size_type; + typedef _Tp* pointer; + template<typename _Tp1> + struct rebind { + typedef new_allocator<_Tp1> other; + }; + void deallocate(pointer __p, size_type) { + ::operator delete(__p); + } + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _Tp> + class allocator + : public __gnu_cxx::new_allocator<_Tp> { + }; + template<typename _CharT, typename _Traits = char_traits<_CharT> > + class basic_ostream; + template<typename _CharT, typename _Traits = char_traits<_CharT> > + class basic_fstream; + typedef basic_ostream<char> ostream; + typedef basic_fstream<char> fstream; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template<typename _CharT, typename _Traits, typename _Alloc> + class __sso_string_base; + template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT>, template <typename, typename, typename> class _Base = __sso_string_base> + class __versa_string; + template<typename _CharT, typename _Traits, typename _Alloc> + struct __vstring_utility { + typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; + template<typename _Alloc1> + struct _Alloc_hider + : public _Alloc1 { + _Alloc_hider(_CharT* __ptr) + : _Alloc1(), _M_p(__ptr) { + } + _CharT* _M_p; + }; + }; + template<typename _CharT, typename _Traits, typename _Alloc> + class __sso_string_base + : protected __vstring_utility<_CharT, _Traits, _Alloc> { + public: + typedef _Traits traits_type; + typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; + typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; + typedef typename _CharT_alloc_type::size_type size_type; + private: + typename _Util_Base::template _Alloc_hider<_CharT_alloc_type> + _M_dataplus; + enum { + _S_local_capacity = 15 }; + union { + _CharT _M_local_data[_S_local_capacity + 1]; + size_type _M_allocated_capacity; + }; + bool _M_is_local() const { + } + void _M_dispose() { + if (!_M_is_local()) _M_destroy(_M_allocated_capacity); + } + void _M_destroy(size_type __size) throw() { + _M_get_allocator().deallocate(_M_data(), __size + 1); + } + public: + size_type _M_max_size() const { + } + _CharT* _M_data() const { + return _M_dataplus._M_p; + } + __sso_string_base() + : _M_dataplus(_M_local_data) { + } + __sso_string_base(const __sso_string_base& __rcs); + template<typename _InputIterator> + __sso_string_base(_InputIterator __beg, _InputIterator __end, const _Alloc& __a); + ~__sso_string_base() { + _M_dispose(); + } + _CharT_alloc_type& _M_get_allocator() { + } + }; + template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> + class __versa_string + : private _Base<_CharT, _Traits, _Alloc> { + typedef _Base<_CharT, _Traits, _Alloc> __vstring_base; + typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type; + public: + typedef _Traits traits_type; + typedef typename _CharT_alloc_type::size_type size_type; + static const size_type npos = static_cast<size_type>(-1); + public: + __versa_string() + : __vstring_base() { + } + __versa_string(const _CharT* __s, const _Alloc& __a = _Alloc()) + : __vstring_base(__s, __s ? __s + traits_type::length(__s) + : __s + npos, __a) { + } + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> + inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str) { + } +} +template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT> > +class basic_string + : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> { +public: + typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> __base; + inline basic_string() + : __base() { + } + basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) + : __base(__s, __a) { + } +}; +typedef basic_string<char> string; +namespace std __attribute__ ((__visibility__ ("default"))) { + class locale { + class facet; + }; + class locale::facet { + }; + class ios_base { + }; + struct ctype_base { + }; + template<typename _CharT> + class __ctype_abstract_base + : public locale::facet, public ctype_base { + }; + template<typename _CharT> + class ctype + : public __ctype_abstract_base<_CharT> { + public: + typedef char char_type; + mutable char _M_widen_ok; + mutable char _M_widen[1 + static_cast<unsigned char>(-1)]; + char_type widen(char __c) const { + if (_M_widen_ok) return _M_widen[static_cast<unsigned char>(__c)]; + this->_M_widen_init(); + return this->do_widen(__c); + } + virtual char_type do_widen(char __c) const { + } + void _M_widen_init() const; + }; + template<typename _Facet> + inline const _Facet& __check_facet(const _Facet* __f) { + if (!__f) __throw_bad_cast(); + } + template<typename _CharT, typename _Traits> + class basic_ios + : public ios_base { + public: + typedef _CharT char_type; + typedef ctype<_CharT> __ctype_type; + const __ctype_type* _M_ctype; + bool eof() const { + } + char_type widen(char __c) const { + return __check_facet(_M_ctype).widen(__c); + } + }; + template<typename _CharT, typename _Traits> class basic_ostream + : virtual public basic_ios<_CharT, _Traits> + { + public: + typedef _CharT char_type; + typedef basic_ostream<_CharT, _Traits> __ostream_type; + __ostream_type& operator<<(__ostream_type& (*__pf)(__ostream_type&)) { + } + __ostream_type& put(char_type __c); + }; + template<typename _CharT, typename _Traits> + inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { + return flush(__os.put(__os.widen('\n'))); + } + template<typename _CharT, typename _Traits> + inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) { + } +} +using std::endl; +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _CharT, typename _Traits> class basic_istream + : virtual public basic_ios<_CharT, _Traits> + { + public: + typedef _CharT char_type; + typedef basic_istream<_CharT, _Traits> __istream_type; + virtual ~basic_istream() { + } + __istream_type& getline(char_type* __s, streamsize __n, char_type __delim); + __istream_type& getline(char_type* __s, streamsize __n) { + return this->getline(__s, __n, this->widen('\n')); + } + }; + template<typename _CharT, typename _Traits> + class basic_iostream + : public basic_istream<_CharT, _Traits>, public basic_ostream<_CharT, _Traits> { + }; +} +using std::ostream; +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _CharT, typename _Traits> + class basic_fstream + : public basic_iostream<_CharT, _Traits> { + }; +} +namespace FooNamespace { + class ExceptionLocation { + public: + ExceptionLocation(const string& filename = string(), const string& funcName = string()) throw() + : functionName(funcName) { + } + private: + string fileName; + string functionName; + }; + class Exception { + public: + Exception() throw(); + Exception(const string& errorText, const unsigned long& errorId = 0) throw(); + Exception& addLocation(const ExceptionLocation& location) throw(); + }; + class FooError + : public FooNamespace::Exception { + public: + FooError() throw() + : FooNamespace::Exception() { + } + FooError(string a, unsigned long b = 0) throw() + : FooNamespace::Exception(a, b) { + }; + }; + class EndOfFile + : public FooNamespace::FooError { + public: + EndOfFile() throw() + : FooNamespace::FooError() { + } + EndOfFile(string a, unsigned long b = 0) throw() + : FooNamespace::FooError(a, b) { + }; + }; + class FooTextStream : public std::fstream { + public: + inline void Fubar(const bool expectEOF = false ) throw(EndOfFile, FooError, FooNamespace::Exception) { + try { + const int MAX_LINE_LENGTH = 256; + char templine[MAX_LINE_LENGTH + 1]; + getline(templine, MAX_LINE_LENGTH); + EndOfFile err(""); + } + catch(std::exception &e) { + if (expectEOF) { + EndOfFile err(""); + err.addLocation(FooNamespace::ExceptionLocation("", "")); + throw err; + } + } + }; + }; + class BarHeader { + virtual void dump(std::ostream& s) const { + s << endl; + } + virtual void DoIt(std::fstream& s); + }; + void BarHeader::DoIt(std::fstream& ffs) { + FooTextStream* buz = 0; + buz->Fubar(); + } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig5.C b/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig5.C index 139e3b866..6ecc25daa 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig5.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig5.C @@ -8,39 +8,39 @@ namespace N { struct A {}; - void One (...); // { dg-error "conflict with" "" } - void (*Two) (...); // { dg-error "not a function" "" } - namespace Three {} // { dg-error "lookup finds|not a function" "" } + void One (...); + void (*Two) (...); + namespace Three {} } namespace M { struct B {}; - struct One {}; // { dg-error "lookup finds|not a function" "" } - void (*Two) (...); // { dg-error "conflict with" "" } - void Three (...); // { dg-error "conflict with" "" } + struct One {}; + void (*Two) (...); + void Three (...); } namespace O { struct C {}; - void Two (...); // { dg-error "conflict with" "" } + void Two (...); } void g (N::A *a, M::B *b, O::C *c) { One (a); // ok - One (b); // { dg-error "in call to" "" } - One (a, b); // { dg-error "in call to" "" } + One (a, b); // ok + One (b); // { dg-error "not declared" } - Two (a); // ok - Two (a, a); // ok - Two (b); // ok Two (c); // ok - Two (a, b); // { dg-error "in call to" "" } - Two (a, c); // { dg-error "in call to" "" } + Two (a, c); // ok + Two (a); // { dg-error "not declared" } + Two (a, a); // error masked by earlier error + Two (b); // error masked by earlier error + Two (a, b); // error masked by earlier error - Three (a); // { dg-error "in call to" "" } Three (b); // ok - Three (a, b); // { dg-error "in call to" "" } + Three (a, b); // ok + Three (a); // { dg-error "not declared" } } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig6.C b/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig6.C new file mode 100644 index 000000000..9fdf771e0 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/lookup/koenig6.C @@ -0,0 +1,18 @@ +// PR c++/17365 +// ADL should not find B::N. + +namespace A +{ + namespace B + { + template <typename T> struct N {int n_;}; + } + template <typename T> int N( T p ) { return p->n_; } + template <typename T> void f( T p ) { N(p); } // #1 +} +int main() +{ + A::B::N<int> n; + A::f(&n); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn10.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn10.C new file mode 100644 index 000000000..dcd5d2776 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn10.C @@ -0,0 +1,54 @@ +/* The purpose of this test is to check if the attributes of the clone + correctly shadow the parent function. In this case, function "dispatch" + is cloned but is a static function. The other file, "mversn10a.C" also + has a dispatch function that is cloned. So, if the attributes of the + clone are not correct the linker will complain. */ + +/* { dg-do run } */ +/* { dg-additional-sources "mversn10a.C" } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */ + +static int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +static int foo () +{ + return 0; +} + +static int bar () +{ + return 1; +} + +static int __attribute__ ((noinline)) +dispatch () +{ + __builtin_dispatch (featureTest, (void *)foo, (void *)bar); + return 0; +} + +int +fn1 () +{ + for (int i = 0; i < 1000; i++) + dispatch (); + return 0; +} + +extern int fn2 (); + +int __attribute__ ((hot)) +main () +{ + fn1 (); + fn2 (); + return 0; +} + +/* { dg-final { scan-tree-dump "dispatchv_clone_0" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "dispatchv_clone_1" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn10a.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn10a.C new file mode 100644 index 000000000..f762cf649 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn10a.C @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */ + +static int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +static int foo () +{ + return 0; +} + +static int bar () +{ + return 1; +} + +static int __attribute__ ((noinline)) +dispatch () +{ + __builtin_dispatch (featureTest, (void *)foo, (void *)bar); + return 0; +} + +int +fn2 () +{ + for (int i = 0; i < 1000; i++) + dispatch (); + return 0; +} + +/* { dg-final { scan-tree-dump "dispatchv_clone_0" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "dispatchv_clone_1" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C new file mode 100644 index 000000000..b21b9a36f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C @@ -0,0 +1,43 @@ +/* Check if everything is fine if the versioned functions are static + member functions. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +int __attribute__ ((version_selector)) +featureTest() +{ + return 1;; +} + +class TestClass +{ + public: + static int foo () + { + return 0; + } + + static int bar () + { + return 1; + } + + int dispatch () + { + int a = __builtin_dispatch (featureTest, + (void*)(&TestClass::foo), + (void*)(&TestClass::bar)); + int b = __builtin_dispatch (featureTest, + (void*)(&TestClass::bar), + (void*)(&TestClass::foo)); + return a * b; + } +}; + +int +main () +{ + TestClass c1; + return c1.dispatch (); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn14.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn14.C new file mode 100644 index 000000000..dcf6f19fa --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn14.C @@ -0,0 +1,26 @@ +/* Check if everything is fine when the feature test body is in a different + module that does not have a __builtin-dispatch". Requires mversn14a.C. */ + +/* { dg-do run } */ +/* { dg-additional-sources "mversn14a.C" } */ +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +int __attribute__ ((version_selector)) +featureTest (); + +int +foo () +{ + return 0; +} + +int +bar () +{ + return 1; +} + +int main () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *)bar); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn14a.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn14a.C new file mode 100644 index 000000000..513c5a402 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn14a.C @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn16.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn16.C new file mode 100644 index 000000000..90e2fc28f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn16.C @@ -0,0 +1,39 @@ +/* dispatch is cloned. Make sure the double is returned to main correctly. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */ + +#include "assert.h" + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +static int foo () +{ + return 0; +} + +static int bar () +{ + return 1; +} + +double +dispatch () +{ + __builtin_dispatch (featureTest, (void *)foo, (void *)bar); + return 2.536; +} + +int main () +{ + double d = dispatch (); + assert (d == 2.536); + return 0; +} + +/* { dg-final { scan-tree-dump "dispatchv_clone" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn8.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn8.C new file mode 100644 index 000000000..4e4168a87 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn8.C @@ -0,0 +1,44 @@ +/* Call the caller of __builtin_dispatch indirectly. Specify the + feature test function as a function pointer. Make sure cloning + still happens. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int __attribute__ ((cold)) +foo () +{ + return 0; +} + +int __attribute__ ((cold)) +bar () +{ + return 1; +} + +int +dispatch () +{ + int (*funcp)() = featureTest; + int ret = __builtin_dispatch (funcp, (void *)foo, (void *)bar); + return ret; +} + +int main (int argc, char **argv) +{ + int (*ptr)() = dispatch; + return (*ptr)(); +} + +/* { dg-final { scan-tree-dump "dispatchv_clone_0" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "dispatchv_clone_1" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "main_clone_0" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "main_clone_1" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn9.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn9.C new file mode 100644 index 000000000..d884d6f28 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn9.C @@ -0,0 +1,31 @@ +/* Two __builtin_dispatch calls in different basic blocks. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int +foo () +{ + return 0; +} + +int +bar () +{ + return 1; +} + +int main (int argc, char **argv) +{ + if (argc) + return __builtin_dispatch (featureTest, (void *)foo, (void *)bar); + else + return (__builtin_dispatch (featureTest, (void *)bar, (void *)foo) - 1); +} + diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-5.C b/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-5.C new file mode 100644 index 000000000..25a70b7df --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-5.C @@ -0,0 +1,16 @@ +// Origin: PR c++/42758 +// { dg-do compile } + +template<class T> struct less {}; + +template<class T, typename U = less<T> > struct set {}; + +struct int_less_than {}; + +void assert_fail (const char*); + +int f(const set<int, int_less_than>&) +{ + assert_fail (__PRETTY_FUNCTION__); + +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-7.C b/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-7.C new file mode 100644 index 000000000..d5bc892c0 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-7.C @@ -0,0 +1,19 @@ +// Origin: PR c++/42336 +// { dg-options "-std=c++0x -O2 -g" } +// { dg-do compile } + +struct X { + void func() {} +}; + +template<typename T, void (X::*P)() = &T::func> +void b(T) {} + +int main() { + b(X()); /* line 9 */ + X().func(); + + return 0; +} + + diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-8.C b/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-8.C new file mode 100644 index 000000000..c260431d5 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/other/crash-8.C @@ -0,0 +1,109 @@ +// Origin: PR c++/42797 +// { dg-options "-g -O2 -std=c++0x" } + +template<typename _Tp, _Tp __v> struct integral_constant { + static const _Tp value = __v; +}; + +template<typename _Tp> _Tp declval(); + +template<typename _Tp, typename... _Args> +class __is_constructible_helper { +}; + +template<typename _Tp, typename _Arg> +class __is_constructible_helper<_Tp, _Arg> { + + template<typename _Tp1, typename _Arg1> + static decltype(static_cast<_Tp1>(declval<_Arg1>()), char()) __test(int); +public: + static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1; +}; + +template<typename _Tp, typename... _Args> +struct is_constructible : public integral_constant<bool,__is_constructible_helper<_Tp, _Args...>::__value> { }; + +template<bool, typename _Tp = void> +struct enable_if { }; + +template<typename _Tp> +struct enable_if<true, _Tp> { + typedef _Tp type; +}; + +template<class _T1, class _T2> struct pair { + _T1 first; + _T2 second; + + template<class _U2, class = typename enable_if<is_constructible<_T2, _U2&&>::value>::type> + pair(const _T1& __x, _U2&& __y) : first(__x), + second(__y) { } +}; + +namespace __gnu_cxx { +template<typename _Tp> +class new_allocator { +public: + new_allocator() throw() { } + new_allocator(const new_allocator&) throw() { } +}; +} + +template<typename _Tp> +class allocator: public __gnu_cxx::new_allocator<_Tp> { +public: + + template<typename _Tp1> + struct rebind { + typedef allocator<_Tp1> other; + }; +}; + + +template<typename _Tp, typename _Alloc> struct _Vector_base { + typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; + + struct _Vector_impl : public _Tp_alloc_type { + _Vector_impl() + { } + }; +public: + + _Vector_impl _M_impl; +}; + +template<typename _Tp, typename _Alloc = allocator<_Tp> > +class vector : protected _Vector_base<_Tp, _Alloc> { + typedef _Alloc allocator_type; +public: + vector() { } + explicit vector(int, const allocator_type& __a = allocator_type()) + { + } +}; + + +template <typename _Key, typename _Tp> +class map { + typedef _Key key_type; + typedef _Tp mapped_type; + typedef pair<const _Key, _Tp> value_type; +public: + + void insert(const value_type& __x) + { + } + + mapped_type& operator[](const key_type& __k) { + insert(value_type(__k, mapped_type())); + } + +}; + +struct Foo { + Foo() {} template<typename Tp> Foo(Tp *p) {} }; +void foo() { + map <int, vector<Foo>> the_map; + the_map[1] = vector<Foo>(); +} + diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/template/crash56.C b/gcc-4.4.3/gcc/testsuite/g++.dg/template/crash56.C index 1efa3500d..03bddf42a 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/template/crash56.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/template/crash56.C @@ -7,10 +7,10 @@ namespace N { - struct A { A (A*); }; // { dg-error "lookup finds" "" } + struct A { A (A*); }; } template<typename T> void g (N::A *p) { - (void) A (p); // { dg-error "in call" "" } + (void) A (p); // { dg-message "" "" } } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/template/defarg13.C b/gcc-4.4.3/gcc/testsuite/g++.dg/template/defarg13.C new file mode 100644 index 000000000..ba2980bfa --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/template/defarg13.C @@ -0,0 +1,19 @@ +// PR c++/14912 +// Bug: We were instantiating A<B> in order to compare it to the matching +// argument for C<B,B>, which fails. + +template <class T> +struct A +{ + typedef typename T::F F; +}; + +struct B { }; + +template <class T, class U = typename A<T>::F > +struct C +{ + typename T::F f; // { dg-error "no type" } +}; + +C<B, B> c; // { dg-message "instantiated" } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/template/error39.C b/gcc-4.4.3/gcc/testsuite/g++.dg/template/error39.C new file mode 100644 index 000000000..49faa3654 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/template/error39.C @@ -0,0 +1,11 @@ +// PR c++/14912 + +template <class T, int N=0, int X=1> +struct A +{ +}; + +void foo(void) +{ + A<void> a = 0; // { dg-error "A<void>" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_common.h b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_common.h index 192c84e84..a21af97fe 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_common.h +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_common.h @@ -27,6 +27,11 @@ #define SHARED_LOCKS_REQUIRED(...) \ __attribute__ ((shared_locks_required(__VA_ARGS__))) #define NO_THREAD_SAFETY_ANALYSIS __attribute__ ((no_thread_safety_analysis)) +#define IGNORE_READS_BEGIN __attribute__ ((ignore_reads_begin)) +#define IGNORE_READS_END __attribute__ ((ignore_reads_end)) +#define IGNORE_WRITES_BEGIN __attribute__ ((ignore_writes_begin)) +#define IGNORE_WRITES_END __attribute__ ((ignore_writes_end)) +#define UNPROTECTED_READ __attribute__ ((unprotected_read)) #else @@ -48,6 +53,11 @@ #define EXCLUSIVE_LOCKS_REQUIRED(...) #define SHARED_LOCKS_REQUIRED(...) #define NO_THREAD_SAFETY_ANALYSIS +#define IGNORE_READS_BEGIN +#define IGNORE_READS_END +#define IGNORE_WRITES_BEGIN +#define IGNORE_WRITES_END +#define UNPROTECTED_READ #endif // defined(__GNUC__) && defined(__SUPPORT_TS_ANNOTATION__) @@ -81,4 +91,41 @@ class SCOPED_LOCKABLE ReleasableMutexLock { void Release() UNLOCK_FUNCTION(); }; +void AnnotateIgnoreReadsBegin(const char *file, int line) IGNORE_READS_BEGIN; +void AnnotateIgnoreReadsEnd(const char *file, int line) IGNORE_READS_END; +void AnnotateIgnoreWritesBegin(const char *file, int line) IGNORE_WRITES_BEGIN; +void AnnotateIgnoreWritesEnd(const char *file, int line) IGNORE_WRITES_END; + +#define ANNOTATE_IGNORE_READS_BEGIN() \ + AnnotateIgnoreReadsBegin(__FILE__, __LINE__) + +#define ANNOTATE_IGNORE_READS_END() \ + AnnotateIgnoreReadsEnd(__FILE__, __LINE__) + +#define ANNOTATE_IGNORE_WRITES_BEGIN() \ + AnnotateIgnoreWritesBegin(__FILE__, __LINE__) + +#define ANNOTATE_IGNORE_WRITES_END() \ + AnnotateIgnoreWritesEnd(__FILE__, __LINE__) + +#define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \ + do { \ + ANNOTATE_IGNORE_READS_BEGIN(); \ + ANNOTATE_IGNORE_WRITES_BEGIN(); \ + }while(0) \ + +#define ANNOTATE_IGNORE_READS_AND_WRITES_END() \ + do { \ + ANNOTATE_IGNORE_WRITES_END(); \ + ANNOTATE_IGNORE_READS_END(); \ + }while(0) \ + +template <class T> +inline T ANNOTATE_UNPROTECTED_READ(const T &x) UNPROTECTED_READ { + ANNOTATE_IGNORE_READS_BEGIN(); + T res = x; + ANNOTATE_IGNORE_READS_END(); + return res; +} + #endif // THREAD_ANNOT_COMMON_H diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-50.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-50.C new file mode 100644 index 000000000..e1e24c18e --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-50.C @@ -0,0 +1,22 @@ +// Test the support for allowing non-const but non-modifying methods to be +// protected by reader locks. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include <map> +#include "thread_annot_common.h" + +typedef std::map<int, int> MyMapType; + +Mutex mu; +MyMapType MyMap GUARDED_BY(mu); + +int foo(int key) { + ReaderMutexLock l(&mu); + MyMapType::const_iterator iter = MyMap.find(key); + if (iter != MyMap.end()) { + return iter->second; + } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-51.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-51.C new file mode 100644 index 000000000..400c81e82 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-51.C @@ -0,0 +1,44 @@ +// Test the support for allowing non-const but non-modifying methods to be +// protected by reader locks. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +class Foo { + public: + int GetVal1(int a) const { + return a + val1; + } + + int GetVal1(int a) { + return a + val1; + } + + int GetVal1(int a, float b) { + return a + b + val1; + } + + int GetVal2(int a) { + return a + val2; + } + + int GetVal2(float a) { + return val2; + } + + + private: + int val1; + int val2; +}; + +Mutex mu; +Foo foo GUARDED_BY(mu); + +int main() { + mu.ReaderLock(); + int x = foo.GetVal1(3); // should not warn + int y = foo.GetVal2(3); // { dg-warning "Writing to variable" } + mu.Unlock(); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-52.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-52.C new file mode 100644 index 000000000..5535034b0 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-52.C @@ -0,0 +1,39 @@ +// Test the support for use of point_to_guarded{_by} on smart/scoped pointers. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +template<class T> +class scoped_ptr { + public: + typedef T element_type; + + explicit scoped_ptr(T * p = 0); + ~scoped_ptr(); + + void reset(T * p = 0); + + T & operator*() const; + T * operator->() const; + T * get() const; +}; + +class Foo { + public: + int x; +}; + +Mutex mu1, mu2; +scoped_ptr<int> a PT_GUARDED_BY(mu1); +scoped_ptr<Foo> b GUARDED_BY(mu2) PT_GUARDED_VAR; + +main() +{ + *a = 5; // { dg-warning "Access to memory location pointed to" } + a.reset(); + b->x = 3 + *a; // { dg-warning "Reading variable" } +} + +// { dg-warning "Access to memory location pointed to by variable 'b'" "" { target *-*-* } 35 } +// { dg-warning "Access to memory location pointed to by variable 'a'" "" { target *-*-* } 35 } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-53.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-53.C new file mode 100644 index 000000000..0c03d77d9 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-53.C @@ -0,0 +1,40 @@ +// Test the support for use of point_to_guarded{_by} on smart/scoped pointers. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +template<class T> +class scoped_ptr { + public: + typedef T element_type; + + explicit scoped_ptr(T * p = 0); + ~scoped_ptr(); + + void reset(T * p = 0); + + T & operator*() const; + T * operator->() const; + T * get() const; +}; + +class Foo { + public: + int x; +}; + +Mutex mu1, mu2; +scoped_ptr<int> a PT_GUARDED_BY(mu1); +scoped_ptr<Foo> b GUARDED_BY(mu2) PT_GUARDED_VAR; + +main() +{ + MutexLock l1(&mu1); + MutexLock l2(&mu2); + *a = 5; + a.reset(); + b->x = 3 + *a; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-54.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-54.C new file mode 100644 index 000000000..e90652407 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-54.C @@ -0,0 +1,35 @@ +// Test the handling of the annotations with function parameters. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +class Base { + private: + Mutex mu1_; + + public: + Mutex *mutable_mu() LOCK_RETURNED(mu1_) { return &mu1_; } +}; + +class Foo { + public: + Mutex mu2_; + void Test1(Mutex* mu) const EXCLUSIVE_LOCKS_REQUIRED(mu, mu2_); + void Test2(Mutex* mu) const LOCKS_EXCLUDED(mu); +}; + +class Bar : public Base { + private: + Foo foo_; + + public: + void Test3(); +}; + +void Bar::Test3() { + mutable_mu()->Lock(); + foo_.Test1(mutable_mu()); // { dg-warning "Calling function" } + foo_.Test2(mutable_mu()); // { dg-warning "Cannot call function" } + mutable_mu()->Unlock(); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-55.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-55.C new file mode 100644 index 000000000..10a12d43e --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-55.C @@ -0,0 +1,38 @@ +// Test the handling of the annotations with function parameters. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +class Base { + private: + Mutex mu1_; + + public: + Mutex *mutable_mu() LOCK_RETURNED(mu1_) { return &mu1_; } +}; + +class Foo { + public: + Mutex mu2_; + void Test1(Mutex* mu) const EXCLUSIVE_LOCKS_REQUIRED(mu, mu2_); + void Test2(Mutex* mu) const LOCKS_EXCLUDED(mu); +}; + +class Bar : public Base { + private: + Foo foo_; + + public: + void Test3(); +}; + +void Bar::Test3() { + MutexLock l(&foo_.mu2_); + mutable_mu()->Lock(); + foo_.Test1(mutable_mu()); + mutable_mu()->Unlock(); + foo_.Test2(mutable_mu()); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-56.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-56.C new file mode 100644 index 000000000..71221eb5f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-56.C @@ -0,0 +1,36 @@ +// Test the handling of a method with lock annotations accessed through a +// smart/scoped pointer. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +template<class T> +class scoped_ptr { + public: + typedef T element_type; + + explicit scoped_ptr(T * p = 0); + ~scoped_ptr(); + + void reset(T * p = 0); + + T & operator*() const; + T * operator->() const; + T * get() const; +}; + +class LOCKABLE Foo { + public: + Mutex *mutex_; + int x; + int GetValue() EXCLUSIVE_LOCKS_REQUIRED(mutex); +}; + +scoped_ptr<Foo> b; + +main() +{ + int a; + a = b->GetValue(); // { dg-warning "Calling function 'GetValue' requires" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-57.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-57.C new file mode 100644 index 000000000..a12150436 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-57.C @@ -0,0 +1,22 @@ +// Test handling of arguments passed to reference parameters. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +struct Foo { + int a; +}; + +void func1(Foo &f); + +void func2(Foo *f); + +Mutex mu; + +Foo foo GUARDED_BY(mu); + +main() { + func1(foo); // { dg-warning "Reading variable 'foo' requires lock" } + func2(&foo); // should not warn +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-58.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-58.C new file mode 100644 index 000000000..858e63558 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-58.C @@ -0,0 +1,32 @@ +// Test handling of arguments passed to reference parameters. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include <string> +#include "thread_annot_common.h" + +class Base { + public: + Base() {} + protected: + Mutex* mutex() const LOCK_RETURNED(mutex_) { return &mutex_; } + private: + mutable Mutex mutex_; +}; + +class Subclass : public Base { + public: + Subclass() {} + + void ClearValue() { SetValueLocked(0); } + std::string GetValue() const; + + private: + void SetValueLocked(std::string value) { value_ = value; } + + std::string value_ GUARDED_BY(mutex_); +}; + +std::string Subclass::GetValue() const { + return value_; // { dg-warning "Reading variable 'value_' requires lock" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-59.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-59.C new file mode 100644 index 000000000..158c940e2 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-59.C @@ -0,0 +1,34 @@ +// Test handling of additional (finer-grained) escape hatche attributes. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +Mutex *mu1, *mu2; + +struct Foo { + int a GUARDED_BY(mu1); +}; + +int x GUARDED_BY(mu1) = 1; +int y GUARDED_BY(mu2); + +main() { + int z; + Foo w; + ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); + y = x + 1; + x = y; + ANNOTATE_IGNORE_READS_AND_WRITES_END(); + + z = ANNOTATE_UNPROTECTED_READ(w.a) + 1; + if (z > 1) { + ANNOTATE_IGNORE_READS_BEGIN(); + z = x + 2; + } + else { + ANNOTATE_IGNORE_READS_BEGIN(); + z = x + 1; + } + z = y; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-60.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-60.C new file mode 100644 index 000000000..099aa8290 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-60.C @@ -0,0 +1,37 @@ +// Test handling of additional (finer-grained) escape hatche attributes. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +Mutex *mu1, *mu2; + +struct Foo { + int a GUARDED_BY(mu1); +}; + +int x GUARDED_BY(mu1) = 1; +int y GUARDED_BY(mu2); + +main() { + int z; + Foo w; + ANNOTATE_IGNORE_READS_BEGIN(); + y = x + 1; // { dg-warning "Writing to variable 'y' requires lock" } + x = y; // { dg-warning "Writing to variable 'x' requires lock" } + ANNOTATE_IGNORE_READS_END(); + ANNOTATE_IGNORE_WRITES_BEGIN(); + y = x + 1; // { dg-warning "Reading variable 'x' requires lock" } + x = y; // { dg-warning "Reading variable 'y' requires lock" } + ANNOTATE_IGNORE_WRITES_END(); + + z = w.a + 1; // { dg-warning "Reading variable 'w.a' requires lock" } + if (z > 1) { + z = x + 2; // { dg-warning "Reading variable 'x' requires lock" } + } + else { + ANNOTATE_IGNORE_READS_BEGIN(); + z = x + 1; + } + z = y; // { dg-warning "Reading variable 'y' requires lock" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-61.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-61.C new file mode 100644 index 000000000..11f6308eb --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-61.C @@ -0,0 +1,15 @@ +// Test the fix for a bug introduced by the support of pass-by-reference +// paramters. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +struct Foo { Foo & operator<< (bool) {} }; +struct Bar { Foo & func () {} }; +struct Bas { void operator& (Foo &) {} }; +void mumble() +{ + Bas() & Bar().func() << "" << ""; + Bas() & Bar().func() << ""; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-62.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-62.C new file mode 100644 index 000000000..95f318699 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-62.C @@ -0,0 +1,18 @@ +// Test the support for allowing non-const but non-modifying overloaded +// operator to be protected by reader locks. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include <vector> +#include "thread_annot_common.h" + +Mutex mu; + +std::vector<int> counts GUARDED_BY(mu); + +int foo(int key) { + ReaderMutexLock l(&mu); + return counts[key]; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-65.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-65.C new file mode 100644 index 000000000..d129fc94c --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-65.C @@ -0,0 +1,30 @@ +// Test the fix for a bug in the support of allowing reader locks for +// non-const, non-modifying overload functions. (We didn't handle the builtin +// properly.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +enum MyFlags { + Zero, + One, + Two, + Three, + Four, + Five, + Six, + Seven, + Eight, + Nine +}; + +inline MyFlags +operator|(MyFlags a, MyFlags b) +{ + return MyFlags(static_cast<int>(a) | static_cast<int>(b)); +} + +inline MyFlags& +operator|=(MyFlags& a, MyFlags b) +{ + return a = a | b; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-66.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-66.C new file mode 100644 index 000000000..c341973e7 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-66.C @@ -0,0 +1,35 @@ +// Test annotations on out-of-line definitions of member functions where the +// annotations refer to locks that are also data members in the class. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +Mutex mu; + +class Foo { + public: + int method1(int i); + int data GUARDED_BY(mu1); + Mutex *mu1; + Mutex *mu2; +}; + +int Foo::method1(int i) SHARED_LOCKS_REQUIRED(mu1, mu, mu2) +{ + return data + i; +} + +main() +{ + Foo a; + + MutexLock l(a.mu2); + a.mu1->Lock(); + mu.Lock(); + a.method1(1); + mu.Unlock(); + a.mu1->Unlock(); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-67.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-67.C new file mode 100644 index 000000000..be228ec20 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-67.C @@ -0,0 +1,32 @@ +// Test annotations on out-of-line definitions of member functions where the +// annotations refer to locks that are also data members in the class. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +Mutex mu; + +class Foo { + public: + int method1(int i); + int data GUARDED_BY(mu1); + Mutex *mu1; + Mutex *mu2; +}; + +int Foo::method1(int i) SHARED_LOCKS_REQUIRED(mu1, mu, mu2, mu3) +{ + return data + i; +} + +main() +{ + Foo a; + + a.method1(1); // { dg-warning "Calling function 'method1' requires lock" } +} + +// { dg-warning "Calling function 'method1' requires lock 'mu'" { target *-*-* } 27 } +// { dg-warning "Calling function 'method1' requires lock 'a.mu2'" { target *-*-* } 27 } +// { dg-warning "Calling function 'method1' requires lock 'mu3'" { target *-*-* } 27 } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-68.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-68.C new file mode 100644 index 000000000..95e8d6908 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-68.C @@ -0,0 +1,34 @@ +// Test a fix to a bug in the delayed name binding with nested template +// instantiation. We use a stack to make sure a name is not resolved to an +// inner context. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +template <typename T> +class Bar { + Mutex mu_; +}; + +template <typename T> +class Foo { + public: + void func(T x) { + MutexLock l(&mu_); + count_ = x; + } + + private: + T count_ GUARDED_BY(mu_); + Bar<T> bar_; + Mutex mu_; +}; + +int main() +{ + Foo<int> *foo; + foo->func(5); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-69.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-69.C new file mode 100644 index 000000000..478e8b273 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-69.C @@ -0,0 +1,31 @@ +// Test a fix to a bug in the delayed name binding with nested template +// instantiation. We use a stack to make sure a name is not resolved to an +// inner context. +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +template <typename T> +class Bar { + Mutex mu_; +}; + +template <typename T> +class Foo { + public: + void func(T x) { + count_ = x; // { dg-warning "Writing to variable 'count_' requires lock" } + } + + private: + T count_ GUARDED_BY(mu_); + Bar<T> bar_; + Mutex mu_; +}; + +int main() +{ + Foo<int> *foo; + foo->func(5); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-70.C b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-70.C new file mode 100644 index 000000000..782d13af4 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-70.C @@ -0,0 +1,38 @@ +// Test a fix to a bug when handling calls to virtual functions that are +// annotated with LOCK/UNLOCK_FUNCTION. More specifically, the bug happens +// when we tried to assert the function decl of a gimple call statement +// returned by gimple_call_fndecl is non-NULL, which is not true when the call +// is a virtual function call. Instead, we should either get the function decl +// through the reference object, or (as is the fix) simply pass the function +// decl that we have extracted earlier all the way to +// handle_lock_primitive_attrs where the assertion fails. +// +// This is a good test case. (i.e. There should be no error/warning/ICE +// triggered.) +// +// { dg-do compile } +// { dg-options "-Wthread-safety -O" } + +#include "thread_annot_common.h" + +class Base { + protected: + virtual void Lock() EXCLUSIVE_LOCK_FUNCTION(mu_) { mu_.Lock(); } + virtual void Unlock() UNLOCK_FUNCTION(mu_) { mu_.Unlock(); } + Mutex mu_; +}; + +class Child: public Base { + int a; + public: + void func1() { + Lock(); + a += 1; + Unlock(); + } +}; + +main() { + Child c; + c.func1(); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn11.C b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn11.C new file mode 100644 index 000000000..a5416dbf2 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn11.C @@ -0,0 +1,40 @@ +/* Check if parameters are passed correctly to the versioned function. */ + +/* { dg-do run } */ + +#include <stdio.h> +#include <assert.h> + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int __attribute__ ((noinline)) +foo (int n1, double n2, char n3) +{ + assert (n1 == 10); + assert (n2 == 20.0); + assert (n3 == 'c'); + return n1; +} + + +int __attribute__ ((noinline)) +bar (int n1, double n2, char n3) +{ + assert (n1 == 10); + assert (n2 == 20.0); + assert (n3 == 'c'); + return 0; +} + +int main () +{ + int a = __builtin_dispatch (featureTest, (void *)foo, (void *)bar, + 10, 20.0, 'c'); + int b = __builtin_dispatch (featureTest, (void *)bar, (void *)foo, + 10, 20.0, 'c'); + return a * b; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5.C b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5.C new file mode 100644 index 000000000..a596d01f4 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5.C @@ -0,0 +1,28 @@ +/* Check that global inline feature test functions are correctly handled. This + test case also needs mversn5a.c. extern_func calls foo and returns 0.*/ + +/* { dg-do run } */ +/* { dg-additional-sources "mversn5a.C" } */ + +#include "mversn5.h" + +extern int extern_func (); + +int foo () +{ + return 0; +} + +int bar () +{ + return 1; +} + +int __attribute__ ((cold)) +main () +{ + int a = 1, b = 1; + a = extern_func (); + b = __builtin_dispatch (featureTest, (void *)bar, (void *) foo); + return a * b; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5.h b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5.h new file mode 100644 index 000000000..253d3ff6d --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5.h @@ -0,0 +1,5 @@ +inline int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5a.C b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5a.C new file mode 100644 index 000000000..4c8a6804c --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/torture/mversn5a.C @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +#include "mversn5.h" + +extern int foo (); +extern int bar (); + + +int extern_func () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *) bar); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn13.C b/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn13.C new file mode 100644 index 000000000..3a7a543db --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn13.C @@ -0,0 +1,37 @@ +/* Make sure -fprofile-generate and -fprofile-use work fine. */ + +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +static int glob = 0; +int __attribute__ ((version_selector)) +featureTest () +{ + return glob; +} + +int bar (int i) +{ + if (i > 500) + return 2 * i; + return 3 * i; +} + +int foo (int i) +{ + bar (i); +} + +int +dispatch () +{ + int ret = 0; + for (int i = 0; i < 1000; i++) + ret += __builtin_dispatch (featureTest, (void *)foo, (void *)bar, i); + return ret; +} + +int main () +{ + int val = dispatch (); + return val > 10000000; +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn15.C b/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn15.C new file mode 100644 index 000000000..dfab1bdf3 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn15.C @@ -0,0 +1,23 @@ +/* Make sure LIPO works correctly. dispatch is defined in mversn15a.C. It either + calls foo or bar and both returns 1. So, the value of ret is always 1000. + After cross-module inlining, main must return 0. */ + +/* { dg-additional-sources "mversn15a.C" } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fripa -fdump-tree-final_cleanup" } */ + +extern int foo (); +extern int bar (); +extern int dispatch (); + +int +main () +{ + int ret = 0; + for (int i = 1; i <= 1000; i++) + ret += dispatch (); + return ret - 1000; +} + +/* { dg-final-use { scan-tree-dump "main_clone" "final_cleanup" } } */ +/* { dg-final-use { scan-tree-dump "return 0" "final_cleanup" } } */ +/* { dg-final-use { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn15a.C b/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn15a.C new file mode 100644 index 000000000..79e7b630a --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/tree-prof/mversn15a.C @@ -0,0 +1,26 @@ +/* { dg-options "-O2 -fclone-hot-version-paths -fripa" } */ +/* { dg-additional-sources "mversn15.C" } */ + +#include <stdio.h> + +inline int + __attribute__ ((version_selector)) +featureTest() +{ + return 1; +} + +int foo () +{ + return 1; +} + +int bar () +{ + return 1; +} + +int dispatch () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *)bar); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/uninit-pred-3_a.C b/gcc-4.4.3/gcc/testsuite/g++.dg/uninit-pred-3_a.C new file mode 100644 index 000000000..910140790 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/uninit-pred-3_a.C @@ -0,0 +1,77 @@ +/* { dg-do compile } */ +/* { dg-options "-Wuninitialized -O2" } */ + +/* Multiple initialization paths. */ + +typedef long long int64; +void incr (); +bool is_valid (int); +int get_time (); + +class A +{ +public: + A (); + ~A () { + if (I) delete I; + } + +private: + int* I; +}; + +bool get_url (A *); +bool get_url2 (A *); + +class M { + + public: + __attribute__ ((always_inline)) + bool GetC (int *c) { + + A details_str; + /* Intialization path 1 */ + if (get_url (&details_str)) + { + *c = get_time (); + return true; + } + + /* insert dtor calls (inlined) into following return paths */ + A tmp_str; + + /* Intializtion path 2 */ + if (get_url2 (&details_str)) + { + *c = get_time (); + return true; + } + + return false; + } + + void do_sth(); + void do_sth2(); + + void P (int64 t) + { + int cc; + if (!GetC (&cc)) /* return flag checked properly */ + return; + + if (cc <= 0) /* { dg-bogus "uninitialized" "uninitialized variable warning" } */ + { + this->do_sth(); + return; + } + + do_sth2(); + } +}; + +M* m; +void test(int x) +{ + m = new M; + m->P(x); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/uninit-pred-3_b.C b/gcc-4.4.3/gcc/testsuite/g++.dg/uninit-pred-3_b.C new file mode 100644 index 000000000..cfe2113bb --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/uninit-pred-3_b.C @@ -0,0 +1,87 @@ +/* { dg-do compile } */ +/* { dg-options "-Wuninitialized -O2" } */ + +/* Multiple initialization paths. */ + +typedef long long int64; +void incr (); +bool is_valid (int); +int get_time (); + +class A +{ +public: + A (); + ~A () { + if (I) delete I; + } + +private: + int* I; +}; + +bool get_url (A *); +bool get_url2 (A *); +bool get_url3 (A *); + +class M { + + public: + __attribute__ ((always_inline)) + bool GetC (int *c) { + + A details_str; + + /* Initialization path 1 */ + if (get_url (&details_str)) + { + *c = get_time (); + return true; + } + + /* Destructor call before return*/ + A tmp_str; + + /* Initialization path 2 */ + if (get_url2 (&details_str)) + { + *c = get_time (); + return true; + } + + /* Fail to initialize in this path but + still returns true */ + if (get_url2 (&details_str)) + { + /* Fail to initialize *c */ + return true; + } + + return false; + } + + void do_sth(); + void do_sth2(); + + void P (int64 t) + { + int cc; /* { dg-excess-errors "note: 'cc' was declared here" } */ + if (!GetC (&cc)) + return; + + if (cc <= 0) /* { dg-warning "uninitialized" "uninitialized variable warning" } */ + { + this->do_sth(); + return; + } + + do_sth2(); + } +}; + +M* m; +void test(int x) +{ + m = new M; + m->P(x); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnonnull-1.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnonnull-1.C new file mode 100644 index 000000000..837c6d6d8 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnonnull-1.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-Wnonnull" } + +#include <stddef.h> + +class Foo { + char *name; + public: + void func1(const int *ptr) __attribute__((nonnull(2))) {} + Foo(char *str) __attribute__((nonnull)) : name(str) {} +}; + +void Bar() { + Foo foo(NULL); // { dg-warning "null argument where non-null required" } + foo.func1(NULL); // { dg-warning "null argument where non-null required" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-1.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-1.C index 561482914..511f091f2 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-1.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-1.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-Wnull-conversion" } +// { dg-options "-Wconversion-null" } #include <stddef.h> diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C index eb5f8b0c1..92a87d1e7 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-Wnull-conversion" } +// { dg-options "-Wconversion-null" } #include <stddef.h> diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-1.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-1.C index 6538d68d0..f15280501 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-1.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-1.C @@ -40,8 +40,8 @@ int func() *f = *f; // { dg-warning "assigned to itself" } bar1->b_ = bar1->b_; // { dg-warning "assigned to itself" } bar2.c_ = bar2.c_; // { dg-warning "assigned to itself" } - local_foo = local_foo; // { dg-warning "assigned to itself" } - foo = foo; // { dg-warning "assigned to itself" } + local_foo = local_foo; + foo = foo; foo.setA(5); bar_array[3].c_ = bar_array[3].c_; // { dg-warning "assigned to itself" } bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-warning "assigned to itself" } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-2.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-2.C index c221787cf..35c3d8476 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-2.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-2.C @@ -18,9 +18,9 @@ template<typename T> T DoSomething(T y) { T a[5], *p; Bar<T> b; - b.x = b.x; // { dg-warning "assigned to itself" } - *p = *p; // { dg-warning "assigned to itself" } - a[2] = a[2]; // { dg-warning "assigned to itself" } + b.x = b.x; + *p = *p; + a[2] = a[2]; return *p; } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-3.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-3.C index ce6bec191..bc5732de9 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-3.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-3.C @@ -27,7 +27,7 @@ class Bar { template <class T> void func(T t) { ::testing::Bar(1) = ::testing::Foo(); // used to trigger a segfault - ::testing::Foo() = ::testing::Foo(); // { dg-warning "assigned to itself" } + ::testing::Foo() = ::testing::Foo(); } main() { diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-4.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-4.C index 465aadc3a..abe96b55d 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-4.C +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-4.C @@ -43,6 +43,6 @@ int func() bar_array[x+g].b_ = bar_array[x+g].b_ / 1; // should not warn x += 0; y -= 0; - foo = foo; // { dg-warning "assigned to itself" } + foo = foo; foo.operator=(foo); // should not warn } diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-5.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-5.C new file mode 100644 index 000000000..20df214dd --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-5.C @@ -0,0 +1,38 @@ +// Test -Wself-assign does not warn on self-assignment of non-POD variables. +// { dg-do compile } +// { dg-options "-Wself-assign" } + +template<typename T> +class Foo { + private: + T a_; + public: + Foo() : a_(a_) {} // { dg-warning "assigned to itself" } + void Set() { a_ = a_; } +}; + +struct Bar { + int b_; + int c_; + void operator=(Bar& rhs) { + this->b_ = rhs.b_; + this->c_ = rhs.c_; + } +}; + +template <typename T> +void func() { + T a; + a = a; +} + +main() +{ + Foo<Bar> foo; + Bar *bar1, bar2; + func<int>(); + foo = foo; + bar2 = bar2; + bar1 = bar1; // { dg-warning "assigned to itself" } + bar2.b_ = bar2.b_; // { dg-warning "assigned to itself" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-1.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-1.C new file mode 100644 index 000000000..6f9dfb73c --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-1.C @@ -0,0 +1,54 @@ +// Test the self-assignemnt detection and warning. +// { dg-do compile } +// { dg-options "-Wself-assign -Wself-assign-non-pod" } + +class Foo { + private: + int a_; + + public: + Foo() : a_(a_) {} // { dg-warning "assigned to itself" } + + void setA(int a) { + a_ = a_; // { dg-warning "assigned to itself" } + } + + void operator=(Foo& rhs) { + this->a_ = rhs.a_; + } +}; + +struct Bar { + int b_; + int c_; +}; + +int g = g; // { dg-warning "assigned to itself" } +Foo foo = foo; // { dg-warning "assigned to itself" } + +int func() +{ + Bar *bar1, bar2; + Foo local_foo; + int x = x; // { dg-warning "assigned to itself" } + static int y = y; // { dg-warning "assigned to itself" } + float *f; + Bar bar_array[5]; + char n; + int overflow; + + *f = *f; // { dg-warning "assigned to itself" } + bar1->b_ = bar1->b_; // { dg-warning "assigned to itself" } + bar2.c_ = bar2.c_; // { dg-warning "assigned to itself" } + local_foo = local_foo; // { dg-warning "assigned to itself" } + foo = foo; // { dg-warning "assigned to itself" } + foo.setA(5); + bar_array[3].c_ = bar_array[3].c_; // { dg-warning "assigned to itself" } + bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-warning "assigned to itself" } + y = x; + x = y; + x += 0; // should not warn + y -= 0; // should not warn + x /= x; // should not warn + y *= y; // should not warn +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-2.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-2.C new file mode 100644 index 000000000..b31b57534 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-2.C @@ -0,0 +1,31 @@ +// Test the handling of expressions that depend on template parameters in +// self-assignemnt detection. +// { dg-do compile } +// { dg-options "-Wself-assign -Wself-assign-non-pod" } + +template<typename T> +struct Bar { + T x; + Bar operator++(int) { + Bar tmp = *this; + ++x; + tmp = tmp; // { dg-warning "assigned to itself" } + return tmp; + } +}; + +template<typename T> +T DoSomething(T y) { + T a[5], *p; + Bar<T> b; + b.x = b.x; // { dg-warning "assigned to itself" } + *p = *p; // { dg-warning "assigned to itself" } + a[2] = a[2]; // { dg-warning "assigned to itself" } + return *p; +} + +main() { + Bar<int> bar; + bar++; + DoSomething(5); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-3.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-3.C new file mode 100644 index 000000000..4c37f5764 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-3.C @@ -0,0 +1,35 @@ +// Test how operands_equal_p handles a NULL operand. +// { dg-do compile } +// { dg-options "-Wself-assign -Wself-assign-non-pod" } + +#include <cstdio> + +namespace testing { + +class Foo { + int f; + public: + Foo() { printf("Construct Foo\n"); } +}; + +class Bar { + int b; + public: + Bar(int x) { printf("Construct Bar\n"); } + + void operator=(const Foo& foo) { + printf("Assign Foo to Bar\n"); + } +}; + +} + +template <class T> +void func(T t) { + ::testing::Bar(1) = ::testing::Foo(); // used to trigger a segfault + ::testing::Foo() = ::testing::Foo(); // { dg-warning "assigned to itself" } +} + +main() { + func(2); +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-4.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-4.C new file mode 100644 index 000000000..86db4e3c6 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-4.C @@ -0,0 +1,48 @@ +// Test how self-assignment detection handles constant-folding happening +// when parsing the RHS or the initializer. +// { dg-do compile } +// { dg-options "-Wself-assign -Wself-assign-non-pod" } + +class Foo { + private: + int a_; + + public: + Foo() : a_(a_+0) {} // should not warn + + void setA(int a) { + a_ = a_ + 0; // should not warn + } + + void operator=(Foo& rhs) { + this->a_ = rhs.a_; + } +}; + +struct Bar { + int b_; + float c_; +}; + +int g = g * 1; // should not warn + +int func() +{ + Bar *bar1, bar2; + Foo foo; + int x = x - 0; // should not warn + static int y = y / 1; // should not warn + float *f; + Bar bar_array[5]; + + *f = *f / 1; // should not warn + bar1->b_ = bar1->b_ * 1; // should not warn + bar2.c_ = bar2.c_ - 0; // should not warn + foo.setA(5); + bar_array[3].c_ = bar_array[3].c_ * 1; // should not warn + bar_array[x+g].b_ = bar_array[x+g].b_ / 1; // should not warn + x += 0; + y -= 0; + foo = foo; // { dg-warning "assigned to itself" } + foo.operator=(foo); // should not warn +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-5.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-5.C new file mode 100644 index 000000000..898ddecd7 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/Wself-assign-non-pod-5.C @@ -0,0 +1,38 @@ +// Test -Wself-assign and -Wself-assign-non-pod. +// { dg-do compile } +// { dg-options "-Wself-assign -Wself-assign-non-pod" } + +template<typename T> +class Foo { + private: + T a_; + public: + Foo() : a_(a_) {} // { dg-warning "assigned to itself" } + void Set() { a_ = a_; } // { dg-warning "assigned to itself" } +}; + +struct Bar { + int b_; + int c_; + void operator=(Bar& rhs) { + this->b_ = rhs.b_; + this->c_ = rhs.c_; + } +}; + +template <typename T> +void func() { + T a; + a = a; // { dg-warning "assigned to itself" } +} + +main() +{ + Foo<Bar> foo; + Bar *bar1, bar2; + func<int>(); + foo = foo; // { dg-warning "assigned to itself" } + bar2 = bar2; // { dg-warning "assigned to itself" } + bar1 = bar1; // { dg-warning "assigned to itself" } + bar2.b_ = bar2.b_; // { dg-warning "assigned to itself" } +} diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/warn/nonnull2.C b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/nonnull2.C new file mode 100644 index 000000000..03006b1b2 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/warn/nonnull2.C @@ -0,0 +1,14 @@ +// Test that "nonnull" attribute should not be applied to 'this' pointer. +// { dg-do compile } + +#define NULL 0 + +class Foo { + public: + void method1(const int *ptr) __attribute__((nonnull(1, 2))); // { dg-warning "nonnull argument references 'this' pointer" } + void method2(int *ptr1, int a, int *ptr2) __attribute__((nonnull(2, 3, 4))); // { dg-error "nonnull argument references non-pointer operand" } + static void func3(int *ptr) __attribute__((nonnull(1))); // should not warn + Foo(char *str) __attribute__((nonnull())) {} +}; + +int func4(int *ptr1, int a) __attribute__((nonnull(1))); // should not warn diff --git a/gcc-4.4.3/gcc/testsuite/g++.old-deja/g++.ns/koenig5.C b/gcc-4.4.3/gcc/testsuite/g++.old-deja/g++.ns/koenig5.C index d84fc8dbf..33061ad0b 100644 --- a/gcc-4.4.3/gcc/testsuite/g++.old-deja/g++.ns/koenig5.C +++ b/gcc-4.4.3/gcc/testsuite/g++.old-deja/g++.ns/koenig5.C @@ -1,5 +1,5 @@ // { dg-do assemble } -// To find function pointers in Koenig lookup is ok as long as we only find one. +// Function pointers are ignored in Koenig lookup. (DR 218) namespace A{ void foo(); struct X{}; @@ -14,5 +14,5 @@ void g() foo(new X); // ok -- DR 218 says that we find the global // foo variable first, and therefore do not // perform argument-dependent lookup. - bar(new X); // ok + bar(new X); // { dg-error "not declared" } } diff --git a/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr22379.c b/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr22379.c index fae84a0af..13c41dd58 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr22379.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr22379.c @@ -2,7 +2,7 @@ void __add_entropy_words(void); void __wake_up(void); void SHATransform(void); static inline __attribute__((always_inline)) void add_entropy_words(void){} -void extract_entropy(void); +void __attribute__((noinline)) extract_entropy(void); static inline __attribute__((always_inline)) void xfer_secondary_pool(void) { extract_entropy(); diff --git a/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr42632.c b/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr42632.c index a6778537a..e2f7d1022 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr42632.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.c-torture/compile/pr42632.c @@ -8,7 +8,7 @@ int pskb_trim(void) { return __pskb_trim(); } -int ___pskb_trim(void) +inline __attribute__((noinline)) int ___pskb_trim(void) { pskb_trim(); return 0; diff --git a/gcc-4.4.3/gcc/testsuite/gcc.c-torture/execute/pr44575.c b/gcc-4.4.3/gcc/testsuite/gcc.c-torture/execute/pr44575.c new file mode 100644 index 000000000..62a7d7800 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.c-torture/execute/pr44575.c @@ -0,0 +1,49 @@ +/* PR target/44575 */ + +#include <stdarg.h> + +int fails = 0; +struct S { float a[3]; }; +struct S a[5]; + +void +check (int z, ...) +{ + struct S arg, *p; + va_list ap; + int j = 0, k = 0; + int i; + va_start (ap, z); + for (i = 2; i < 4; ++i) + { + p = 0; + j++; + k += 2; + switch ((z << 4) | i) + { + case 0x12: + case 0x13: + p = &a[2]; + arg = va_arg (ap, struct S); + break; + default: + ++fails; + break; + } + if (p && p->a[2] != arg.a[2]) + ++fails; + if (fails) + break; + } + va_end (ap); +} + +int +main () +{ + a[2].a[2] = -49026; + check (1, a[2], a[2]); + if (fails) + abort (); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline2.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline2.c index c65df24ea..3e5e2a3fd 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline2.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline2.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-Winline -O2" } */ -inline __attribute__ ((always_inline)) void t(void); /* { dg-message "sorry\[^\n\]*body not available" "" } */ +inline __attribute__ ((always_inline)) void t(void); /* { dg-message "error\[^\n\]*body not available" "" } */ void q(void) { - t(); /* { dg-message "sorry\[^\n\]*called from here" "" } */ + t(); /* { dg-message "error\[^\n\]*called from here" "" } */ } diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline3.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline3.c index 97c80aa52..d754d7194 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline3.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline3.c @@ -2,10 +2,10 @@ /* { dg-options "-Winline -O2" } */ int do_something_evil (void); inline __attribute__ ((always_inline)) void -q2(void) /* { dg-message "sorry\[^\n\]*recursive" "" } */ +q2(void) /* { dg-message "error\[^\n\]*recursive" "" } */ { if (do_something_evil ()) return; - q2(); /* { dg-message "sorry\[^\n\]*called from here" "" } */ + q2(); /* { dg-message "error\[^\n\]*called from here" "" } */ q2(); /* With -O2 we don't warn here, it is eliminated by tail recursion. */ } diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline4.c new file mode 100644 index 000000000..723ff97ac --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/always_inline4.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* If f3() is inlined the impossible-to-resolve situation of a cycle + of always_inlined functions is created in the call graph. This + test tests whether this condition is detected and avoided. */ + +inline void f1(int); +inline void f2(int); +inline void f3(int); + +inline void __attribute__((__always_inline__)) f1(int a) { + f3(a); + f3(a); +} + +inline void __attribute__((__always_inline__)) f2(int a) { + f1(a); +} + +inline void f3(int a) { + f2(a); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/autopar/reduc-1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/autopar/reduc-1.c index ac08d3d2e..1cafaecd2 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/autopar/reduc-1.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/autopar/reduc-1.c @@ -12,7 +12,7 @@ unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; /* Reduction of unsigned-int. */ -void main1 (unsigned int x, unsigned int max_result, unsigned int min_result) +void __attribute__((noinline)) main1 (unsigned int x, unsigned int max_result, unsigned int min_result) { int i; unsigned int udiff = 2; diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/builtin-apply2.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/builtin-apply2.c index bc49a6458..a303e3ddb 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/builtin-apply2.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/builtin-apply2.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { "arm*-*-*" } { "-mfloat-abi=hard" } { "" } } */ /* PR target/12503 */ /* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/ipa/ipa-4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/ipa/ipa-4.c index 9f716f139..02efb7b4e 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/ipa/ipa-4.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/ipa/ipa-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp --param inline-address-not-taken-function-emit-probability=100 --param inline-function-size-adjustment=0" } */ /* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ #include <stdio.h> diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn2.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn2.c new file mode 100644 index 000000000..7cfb0718b --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn2.c @@ -0,0 +1,47 @@ +/* This checks if cloning works correctly. Since dispatch and fn1 are hot, they + should be cloned. main should not be cloned.*/ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int __attribute__ ((cold)) +foo () +{ + return 0; +} + +int __attribute__ ((cold)) +bar () +{ + return 1; +} + +int __attribute__ ((hot)) +dispatch () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *) bar); +} +int __attribute__ ((hot)) +fn1 () +{ + return dispatch (); +} + +int __attribute__ ((cold)) +main () +{ + return fn1 (); +} + +/* { dg-final { scan-tree-dump "fn1_clone_1" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "dispatch_clone_0" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump "dispatch_clone_1" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump-not "main_clone_0" "final_cleanup" } } */ +/* { dg-final { scan-tree-dump-not "main_clone_1" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn3.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn3.c new file mode 100644 index 000000000..5085aa924 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn3.c @@ -0,0 +1,30 @@ +/* Simple check if parameters are passed correctly. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int __attribute__ ((cold)) +foo (int a) +{ + if (a == 1729) + return 0; + return 1; +} + +int __attribute__ ((cold)) +bar (int a) +{ + return 1; +} + +int __attribute__ ((cold)) +main () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *) bar, 1729); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4.c new file mode 100644 index 000000000..cd916c981 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4.c @@ -0,0 +1,29 @@ +/* Check that static feature test functions are correctly handled. This + test case also needs mversn4a.c. extern_func calls foo and returns 0.*/ + +/* { dg-do run } */ +/* { dg-additional-sources "mversn4a.c" } */ +/* { dg-options "-O2" } */ + +#include "mversn4.h" + +extern int extern_func (); + +int foo () +{ + return 0; +} + +int bar () +{ + return 1; +} + +int __attribute__ ((cold)) +main () +{ + int a = 1, b = 1; + a = extern_func (); + b = __builtin_dispatch (featureTest, (void *)bar, (void *) foo); + return a * b; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4.h b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4.h new file mode 100644 index 000000000..37067d37f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4.h @@ -0,0 +1,5 @@ +static int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4a.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4a.c new file mode 100644 index 000000000..92d4f1240 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn4a.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "mversn4.h" + +extern int foo (); +extern int bar (); + + +int extern_func () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *) bar); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn6.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn6.c new file mode 100644 index 000000000..e83e35165 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn6.c @@ -0,0 +1,29 @@ +/* Check that __builtin_dispatch gets converted and the executable runs fine. + when featureTest () is not marked with "version_selector". foo should be + called and return 0. Cloning and Hoisting is also done. */ +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +int +featureTest () +{ + return 1; +} + +int __attribute__ ((cold)) +foo () +{ + return 0; +} + +int __attribute__ ((cold)) +bar () +{ + return 1; +} + +int __attribute__ ((cold)) +main () +{ + return __builtin_dispatch (featureTest, (void *)foo, (void *) bar); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn7.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn7.c new file mode 100644 index 000000000..f56331cf0 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/mversn7.c @@ -0,0 +1,45 @@ +/* This test checks if cloning and dispatching works correctly with + a motivating example. The function problem calculates the sum of + numbers from 1 to 10 in two different ways. Hence, after cloning + both clones should return 55, which means main returns 0 if function + "problem" gets inlined. + This example also shows the benefits of function + unswitching. Without cloning, the loop will be done. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int foo (int i) +{ + return i; +} + +int bar (int i) +{ + return (11 - i); +} + +/* This calculates the sum of numbers from 1 to 10 in 2 different ways. */ +int problem () +{ + int ret = 0; + int j = 1; + for (j = 1; j<=10; j++) + ret += __builtin_dispatch (featureTest, (void *)foo, (void *)bar, j); + return ret; +} + +int main () +{ + return problem() - 55; +} + + +/* { dg-final { scan-tree-dump "return 55" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/nrv6.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/nrv6.c new file mode 100644 index 000000000..0fde6b3e4 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/nrv6.c @@ -0,0 +1,22 @@ +/* Verify that changing to -O0 after a candidate for NRV optimization + does not cause ICE. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct A { + int i; +}; + +struct A foo (int i) +{ + struct A a; + a.i = i; + return a; +} + +#pragma GCC optimize("-O0") + +int test(void) +{ + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay1.c new file mode 100644 index 000000000..a87dfa415 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay1.c @@ -0,0 +1,70 @@ +/* Check that store sinking does not break stack overlay */ +/* { dg-do run } */ +/* { dg-options "-O2 -fearly-stack-alloc" } */ + +extern void abort (void); + +struct a; + +typedef void (*func_t)(struct a*); + +struct a { + func_t impl; +}; + +struct b { + struct a base; +}; + +void +a_impl (struct a *const this) +{ + abort(); +} + +void +b_impl (struct a * const this) +{ +} + +void __attribute__((noinline)) +a_interface (struct a * const this) +{ + this->impl(this); +} + +int +main(int argc, char **argv) +{ + { + struct b obj1; + +L1: + if (argc > 400) + return 0; + obj1.base.impl = b_impl; + +L2: + a_interface (&obj1.base); + obj1.base.impl = b_impl; + obj1.base.impl = a_impl; + if (argc > 200) + return 0; + } + { + struct b obj2; + obj2.base.impl = a_impl; + +L3: + obj2.base.impl = b_impl; + if (argc > 100) + return 0; + +L4: + a_interface (&obj2.base); + obj2.base.impl = b_impl; + obj2.base.impl = a_impl; + } + + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay2.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay2.c new file mode 100644 index 000000000..acd30282f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fearly-stack-alloc -fstack-protector -fno-strict-aliasing -fdump-tree-stack-overlay" } */ +void bar (char *); +void bar2 (int *); +void foo () + { + { + char a[100]; + bar (a); + } + { + int a[100]; + bar2 (a); + } + } + +/* { dg-final { scan-tree-dump "Number of partitions = 2" "stack-overlay" } } */ +/* { dg-final { cleanup-tree-dump "stack-overlay" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay3.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay3.c new file mode 100644 index 000000000..c7218f4f2 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay3.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fearly-stack-alloc -fno-strict-aliasing -fdump-tree-stack-overlay" } */ +void bar (char *); +void bar2 (int *); +void foo () + { + { + char a[100]; + bar (a); + } + { + int a[100]; + bar2 (a); + } + } + +/* { dg-final { scan-tree-dump "Number of partitions = 1" "stack-overlay" } } */ +/* { dg-final { cleanup-tree-dump "stack-overlay" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay4.c new file mode 100644 index 000000000..8dfc49946 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay4.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fearly-stack-alloc -fno-strict-aliasing -fdump-tree-stack-overlay" } */ +union U { + int a; + float b; +}; +struct A { + union U u1; + char a[100]; +}; +void bar (struct A *); +void foo () + { + { + struct A a; + bar (&a); + } + { + struct A a; + bar (&a); + } + } + +/* { dg-final { scan-tree-dump "Number of partitions = 1" "stack-overlay" } } */ +/* { dg-final { cleanup-tree-dump "stack-overlay" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay5.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay5.c new file mode 100644 index 000000000..a815f23f3 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/overlay5.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fearly-stack-alloc -fno-strict-aliasing -fdump-tree-stack-overlay" } */ +void bar( char *); +int foo() +{ + int i=0; + { + char a[8192]; + bar(a); + i += a[0]; + } + { + char a[8192]; + char b[32]; + bar(a); + i += a[0]; + bar(b); + i += a[0]; + } + return i; +} +/* { dg-final { scan-tree-dump "Number of partitions = 2" "stack-overlay" } } */ +/* { dg-final { scan-tree-dump "size 8192" "stack-overlay" } } */ +/* { dg-final { scan-tree-dump "size 32" "stack-overlay" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/pr43564.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/pr43564.c new file mode 100644 index 000000000..39e0f3ac3 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/pr43564.c @@ -0,0 +1,16 @@ +/* { dg-options "-O0" } */ +/* { dg-do compile } */ + +static inline __attribute__ ((__always_inline__)) +unsigned __clz (unsigned input) +{ + unsigned output; + __asm__ __volatile__ ("clz %0, %1":"=r" (output):"r" (input)); +} +__attribute__ ((optimize ("O2"))) +void foo () +{ + unsigned a; + unsigned b; + a = __clz (b); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-1.c index 4521ace9e..0941db704 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-1.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-1.c @@ -5,7 +5,7 @@ Contributed by Hans-Peter Nilsson <hp@bitrange.com> */ /* { dg-do run } */ -/* { dg-options "-O2 -foptimize-sibling-calls" } */ +/* { dg-options "-O2 -foptimize-sibling-calls -fno-inline" } */ /* The option -foptimize-sibling-calls is the default, but serves as marker. Self-recursion tail calls are optimized for all targets, diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-2.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-2.c index 4c226c496..b5ca942ef 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-2.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-2.c @@ -5,7 +5,7 @@ Contributed by Hans-Peter Nilsson <hp@bitrange.com> */ /* { dg-do run } */ -/* { dg-options "-O2 -foptimize-sibling-calls" } */ +/* { dg-options "-O2 -foptimize-sibling-calls -fno-inline" } */ /* The option -foptimize-sibling-calls is the default, but serves as marker. Self-recursion tail calls are optimized for all targets, diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-3.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-3.c index e085bfbc7..51f1b0b92 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-3.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-3.c @@ -28,7 +28,7 @@ extern void exit (int); static ATTR void recurser_void1 (int); static ATTR void recurser_void2 (int); -extern void track (int); +static ATTR void track (int); int main () { @@ -66,7 +66,7 @@ recurser_void2 (int n) void *trackpoint; -void +static void __attribute__((noinline)) ATTR track (int n) { char stackpos[1]; diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-4.c index 11b09d079..cd185d47b 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-4.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-4.c @@ -28,7 +28,7 @@ extern void exit (int); static ATTR void recurser_void1 (void); static ATTR void recurser_void2 (void); -extern void track (void); +static ATTR void track (void); int n = 0; int main () @@ -67,7 +67,7 @@ recurser_void2 (void) void *trackpoint; -void +static void __attribute__((noinline)) ATTR track () { char stackpos[1]; diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-6.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-6.c index 6f2f21881..24e5ae7af 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-6.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/sibcall-6.c @@ -27,7 +27,7 @@ main () exit (0); } -int +int __attribute__((noinline)) bar (b) int b; { @@ -37,7 +37,7 @@ bar (b) abort (); } -int +int __attribute__((noinline)) foo (f) int f; { diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c new file mode 100644 index 000000000..bd024065c --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c @@ -0,0 +1,31 @@ +/* Check that __builtin_dispatch gets converted and the executable runs fine. + Since featureTest () returns 1, foo should be called and return 0. Cloning + and Hoisting is not even turned on here. */ +/* { dg-do run } */ + +int __attribute__ ((version_selector)) +featureTest () +{ + return 1; +} + +int __attribute__ ((cold)) +foo () +{ + return 0; +} + +int __attribute__ ((cold)) +bar () +{ + return 1; +} + +int __attribute__ ((cold)) +main () +{ + int a, b; + a = __builtin_dispatch (featureTest, (void *)foo, (void *) bar); + b = __builtin_dispatch (featureTest, (void *)bar, (void *) foo); + return a * b; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c index 8b0ff4aff..28dc6106d 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-4.c @@ -1,6 +1,5 @@ /* PR tree-optimization/20076 */ /* { dg-do run } */ -/* { dg-xfail-run-if "b/2070963" { { i?86-*-* x86_64-*-* } && { ilp32 } } { "*" } { "" } } */ extern void abort (void); diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp index 3574e4dc8..ef45dbe4d 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp @@ -28,6 +28,7 @@ set additional_flags "" if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then { lappend additional_flags "-mstackrealign" lappend additional_flags "-mpreferred-stack-boundary=5" + lappend additional_flags "-mno-mmx" } dg-init diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-1.c new file mode 100644 index 000000000..ff93852c3 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-1.c @@ -0,0 +1,14 @@ +/* { dg-options "-lm -ffvpt -ffvpt-functions=log,exp,pow,sqrt -O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ + +#define VAL 1.0 + +#include "ffvpt-pro.h" + +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(exp\\) to constant value: 1.000000 in main \\(use 2.718282\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(pow\\) with constant argument \\(1.000000\\) optimized in main: \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(log\\) to constant value: 1.000000 in main \\(use 0.000000\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(sqrt\\) to constant value: 1.000000 in main \\(use 1.000000\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ + +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-2.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-2.c new file mode 100644 index 000000000..17da95071 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-2.c @@ -0,0 +1,14 @@ +/* { dg-options "-lm -ffvpt -ffvpt-functions=log,exp,pow,sqrt -O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ + +#define VAL (1.0/0.0) + +#include "ffvpt-pro.h" + +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(exp\\) to constant value: inf in main \\(use inf\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Math call \\(pow\\) with constant argument" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(log\\) to constant value: inf in main \\(use inf\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(sqrt\\) to constant value: inf in main \\(use inf\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ + +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-3.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-3.c new file mode 100644 index 000000000..5f2a57d31 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-3.c @@ -0,0 +1,14 @@ +/* { dg-options "-lm -ffvpt -ffvpt-functions=log,exp,pow,sqrt -O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ + +#define VAL (-1.0/0.0) + +#include "ffvpt-pro.h" + +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(exp\\) to constant value: -inf in main \\(use 0.000000\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Math call \\(pow\\) with constant argument optimized" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(log\\) to constant value: -inf in main \\(use -?nan\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(sqrt\\) to constant value: -inf in main \\(use -?nan\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ + +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-4.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-4.c new file mode 100644 index 000000000..653a485c2 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro-4.c @@ -0,0 +1,13 @@ +/* { dg-options "-lm -ffvpt -ffvpt-functions=log,exp,pow,sqrt -O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ + +#define VAL (0.0 / 0.0) /* NAN */ + +#include "ffvpt-pro.h" + +/* { dg-final-use { scan-tree-dump "Math call \\(exp\\) to constant value: nan in main \\(use nan\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Math call \\(pow\\) with constant argument optimized" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(log\\) to constant value: nan in main \\(use nan\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "Math call \\(sqrt\\) to constant value: nan in main \\(use nan\\) \\(count:1000, all:1000\\)" "tree_profile"} } */ + +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro.h b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro.h new file mode 100644 index 000000000..182bc48d8 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/ffvpt-pro.h @@ -0,0 +1,17 @@ +#include <math.h> + +double d = VAL; +double s = 0.0; + +int main (void) +{ + int i; + for (i = 0; i < 1000; i++) + { + s += exp(d); + s += pow(d, d); + s += log(d); + s += sqrt(d); + } + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c index 8d7c87919..bd1e2c645 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized --param inline-address-not-taken-function-emit-probability=100 --param inline-function-size-adjustment=0" } */ int a; int b[100]; void abort (void); diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/alias_bug.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/alias_bug.c new file mode 100644 index 000000000..64fef2787 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/alias_bug.c @@ -0,0 +1,61 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-optimized" } */ + +typedef unsigned u32; +typedef unsigned short u16; +typedef unsigned char u8; +struct biosregs { + union { + struct { + u32 edi; + u32 esi; + u32 ebp; + u32 _esp; + u32 ebx; + u32 edx; + u32 ecx; + u32 eax; + u32 _fsgs; + u32 _dses; + u32 eflags; + }; + struct { + u16 di, hdi; + u16 si, hsi; + u16 bp, hbp; + u16 _sp, _hsp; + u16 bx, hbx; + u16 dx, hdx; + u16 cx, hcx; + u16 ax, hax; + u16 gs, fs; + u16 es, ds; + u16 flags, hflags; + }; + struct { + u8 dil, dih, edi2, edi3; + u8 sil, sih, esi2, esi3; + u8 bpl, bph, ebp2, ebp3; + u8 _spl, _sph, _esp2, _esp3; + u8 bl, bh, ebx2, ebx3; + u8 dl, dh, edx2, edx3; + u8 cl, ch, ecx2, ecx3; + u8 al, ah, eax2, eax3; + }; + }; +}; +void initregs(struct biosregs *regs); +void intcall(u8 int_no, const struct biosregs *ireg, struct biosregs *oreg); +static u32 *const gp = (u32*) 0x32; +void keyboard_set_repeat(void) +{ + struct biosregs ireg; + *gp = 10; + initregs(&ireg); + ireg.ax = 0x0305; + intcall(0x16, &ireg, ((void *)0)); +} + +/* { dg-final { scan-tree-dump-times "ireg.*ax" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c index e7cb925e8..72f0115a1 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c @@ -1,6 +1,6 @@ /* { dg-do run { target vect_cmdline_needed } } */ -/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */ -/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats -mno-sse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fno-inline -fdump-tree-vect-stats" } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fno-inline -fdump-tree-vect-stats -mno-sse" { target { i?86-*-* x86_64-*-* } } } */ #include <stdlib.h> diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c new file mode 100644 index 000000000..b102a7a52 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized -fno-strict-aliasing" } */ +/* Test with fixed address */ +static int *foo = (int *) (unsigned long) 0x7800000; + +int func(void) __attribute__ ((noinline)); + +extern int bar(void); + +int func(void) +{ + if (*foo) { + return 1; + } + return 0; + +} + +int foobar(void) +{ + + if (func()) { + *foo = 1; + } + return func(); +} + +/* { dg-final { scan-tree-dump-times "= func" 2 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/update-threading.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/update-threading.c index 58b26e615..1d451e82c 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/update-threading.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-ssa/update-threading.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-inline -fdump-tree-optimized" } */ typedef struct { unsigned short a; } A; diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/uninit-13.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/uninit-13.c index 631e8de3a..236330ebb 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/uninit-13.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/uninit-13.c @@ -5,6 +5,7 @@ typedef _Complex float C; C foo() { C f; - __imag__ f = 0; /* { dg-warning "is used" "unconditional" } */ + __imag__ f = 0; /* { dg-warning "is used" "unconditional" { xfail arm*-*-* } } */ return f; } +/* { dg-excess-errors "fails on ARM." { target arm*-*-* } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp b/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp index 3518de059..2ca85b97e 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp @@ -29,7 +29,7 @@ if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then { set DEFAULT_VECTCFLAGS "" # These flags are used for all targets. -lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model" +lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model" "-fno-inline" # If the target system supports vector instructions, the default action # for a test is 'run', otherwise it's 'compile'. Save current default. diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp b/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp index ff3650ce2..e8f8554a0 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp @@ -30,7 +30,7 @@ if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) set DEFAULT_VECTCFLAGS "" # These flags are used for all targets. -lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model" +lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model" "-fno-inline" # If the target system supports vector instructions, the default action # for a test is 'run', otherwise it's 'compile'. Save current default. diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/vect.exp index c1e19850f..a190e46eb 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/vect/vect.exp @@ -24,7 +24,7 @@ load_lib gcc-dg.exp set DEFAULT_VECTCFLAGS "" # These flags are used for all targets. -lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model" +lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model" "-fno-inline" # So that we can read flags in individual tests. proc vect_cflags { } { diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/winline-5.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/winline-5.c index ad1fc4100..c033d6dc6 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.dg/winline-5.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/winline-5.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-Winline -O2 --param inline-unit-growth=0 --param large-unit-insns=0" } */ +/* { dg-options "-Winline -O2 --param inline-unit-growth=0 --param large-unit-insns=0 --param inline-address-not-taken-function-emit-probability=100 --param inline-function-size-adjustment=0" } */ void big (void); inline int q(void) /* { dg-warning "inline-unit-growth" } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp new file mode 100644 index 000000000..fcc433346 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp @@ -0,0 +1,35 @@ +# Copyright (C) 1997, 2004, 2006, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an ARM target. +if ![istarget arm*-*-*] then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" "" + +# All done. +dg-finish diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/abitest.h b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/abitest.h new file mode 100644 index 000000000..7b7d0e24f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/abitest.h @@ -0,0 +1,122 @@ +#define IN_FRAMEWORK + +#ifdef VFP +#define D0 0 +#define D1 8 +#define D2 16 +#define D3 24 +#define D4 32 +#define D5 40 +#define D6 48 +#define D7 56 + +#define S0 64 +#define S1 68 +#define S2 72 +#define S3 76 +#define S4 80 +#define S5 84 +#define S6 88 +#define S7 92 +#define S8 86 +#define S9 100 +#define S10 104 +#define S11 108 +#define S12 112 +#define S13 116 +#define S14 120 +#define S15 124 + +#define R0 128 +#define R1 132 +#define R2 136 +#define R3 140 + +#define STACK 144 + +#else + +#define R0 0 +#define R1 4 +#define R2 8 +#define R3 12 + +#define STACK 16 + +#endif + +extern void abort (void); + +__attribute__((naked)) void dumpregs () __asm("myfunc"); +__attribute__((naked)) void dumpregs () +{ + asm( + "mov ip, sp\n\t" + "stmfd sp!, {r0-r3}\n\t" +#ifdef VFP + "fstmdbs sp!, {s0-s15}\n\t" + "fstmdbd sp!, {d0-d7}\n\t" +#endif + "mov r0, sp\n\t" + "stmfd sp!, {ip, r14}\n\t" + "bl testfunc\n\t" + "ldmfd sp!, {r0, r14}\n\t" + "mov sp, r0\n\t" + "bx lr"); +} + + +#define LAST_ARG(type,val,offset) { type __x = val; if (memcmp(&__x, stack+offset, sizeof(type)) != 0) abort(); } +#define ARG(type,val,offset) LAST_ARG(type, val, offset) +#define ANON(type,val,offset) LAST_ARG(type, val, offset) +#define LAST_ANON(type,val,offset) LAST_ARG(type, val, offset) +#define DOTS + +void testfunc(char* stack) +{ +#include TESTFILE + return; +} + +#undef LAST_ARG +#undef ARG +#undef DOTS +#undef ANON +#undef LAST_ANON +#define LAST_ARG(type,val,offset) type +#define ARG(type,val,offset) LAST_ARG(type, val, offset), +#define DOTS ... +#define ANON(type,val, offset) +#define LAST_ANON(type,val, offset) + +#ifndef MYFUNCTYPE +#define MYFUNCTYPE void +#endif + +#ifndef PCSATTR +#define PCSATTR +#endif + +MYFUNCTYPE myfunc( +#include TESTFILE +) PCSATTR; + +#undef LAST_ARG +#undef ARG +#undef DOTS +#undef ANON +#undef LAST_ANON +#define LAST_ARG(type,val,offset) val +#define ARG(type,val,offset) LAST_ARG(type, val, offset), +#define DOTS +#define LAST_ANON(type,val,offset) LAST_ARG(type, val, offset) +#define ANON(type,val,offset) LAST_ARG(type, val, offset), + + +int main() +{ + myfunc( +#include TESTFILE +); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp1.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp1.c new file mode 100644 index 000000000..9fb926dbd --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp1.c @@ -0,0 +1,17 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp1.c" +#include "abitest.h" + +#else + ARG(int, 4, R0) + ARG(double, 4.0, D0) + LAST_ARG(int, 3, R1) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp10.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp10.c new file mode 100644 index 000000000..c3a1b39a9 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp10.c @@ -0,0 +1,38 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp10.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#include "abitest.h" +#else + /* A variadic function passes using the base ABI */ + ARG(double, 11.0, R0) + DOTS + ANON(struct z, a, R2) + ANON(struct z, b, STACK+24) + LAST_ANON(double, 0.5, STACK+56) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp11.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp11.c new file mode 100644 index 000000000..a496a3ed5 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp11.c @@ -0,0 +1,39 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp11.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#define MYFUNCTYPE struct y + +#include "abitest.h" +#else + ARG(int, 7, R1) + ARG(struct y, v, R2) + ARG(struct z, a, D0) + ARG(struct z, b, D4) + LAST_ARG(double, 0.5, STACK+8) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp12.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp12.c new file mode 100644 index 000000000..bbfa3df90 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp12.c @@ -0,0 +1,38 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp12.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#include "abitest.h" +#else + ARG(int, 7, R0) + ARG(struct y, v, R1) + ARG(struct z, a, D0) + ARG(double, 1.0, D4) + ARG(struct z, b, STACK+8) + LAST_ARG(double, 0.5, STACK+40) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp13.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp13.c new file mode 100644 index 000000000..a46361c09 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp13.c @@ -0,0 +1,39 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp13.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#include "abitest.h" +#else + ARG(int, 7, R0) + ARG(int, 9, R1) + ARG(struct z, a, D0) + ARG(double, 1.0, D4) + ARG(struct z, b, STACK) + ARG(int, 4, R2) + LAST_ARG(double, 0.5, STACK+32) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp14.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp14.c new file mode 100644 index 000000000..43c19f2dd --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp14.c @@ -0,0 +1,24 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp14.c" + +#include "abitest.h" +#else + ARG(double, 1.0, D0) + ARG(double, 2.0, D1) + ARG(double, 3.0, D2) + ARG(double, 4.0, D3) + ARG(double, 5.0, D4) + ARG(double, 6.0, D5) + ARG(double, 7.0, D6) + ARG(double, 8.0, D7) + ARG(double, 9.0, STACK) + LAST_ARG(double, 10.0, STACK+8) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp15.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp15.c new file mode 100644 index 000000000..c98ca3810 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp15.c @@ -0,0 +1,20 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp15.c" + +#define PCSATTR __attribute__((pcs("aapcs"))) + +#include "abitest.h" +#else + ARG(double, 1.0, R0) + ARG(double, 2.0, R2) + ARG(double, 3.0, STACK) + LAST_ARG(double, 4.0, STACK+8) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp16.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp16.c new file mode 100644 index 000000000..956bc0ab5 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp16.c @@ -0,0 +1,22 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp16.c" + +#define PCSATTR __attribute__((pcs("aapcs"))) + +#include "abitest.h" +#else + ARG(float, 1.0f, R0) + ARG(float, 2.0f, R1) + ARG(float, 3.0f, R2) + ARG(float, 4.0f, R3) + ARG(float, 5.0f, STACK) + LAST_ARG(float, 5.0f, STACK+4) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp17.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp17.c new file mode 100644 index 000000000..9044ec221 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp17.c @@ -0,0 +1,20 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp17.c" + +#define PCSATTR __attribute__((pcs("aapcs"))) + +#include "abitest.h" +#else + ARG(float, 1.0f, R0) + ARG(double, 2.0, R2) + ARG(float, 3.0f, STACK) + LAST_ARG(double, 4.0, STACK+8) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp2.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp2.c new file mode 100644 index 000000000..bfe90675b --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp2.c @@ -0,0 +1,19 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp2.c" +#include "abitest.h" + +#else + ARG(float, 1.0f, S0) + ARG(double, 4.0, D1) + ARG(float, 2.0f, S1) + ARG(double, 5.0, D2) + LAST_ARG(int, 3, R0) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp3.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp3.c new file mode 100644 index 000000000..0e645d711 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp3.c @@ -0,0 +1,21 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp3.c" + +__complex__ x = 1.0+2.0i; + +#include "abitest.h" +#else + ARG(float, 1.0f, S0) + ARG(__complex__ double, x, D1) + ARG(float, 2.0f, S1) + ARG(double, 5.0, D3) + LAST_ARG(int, 3, R0) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp4.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp4.c new file mode 100644 index 000000000..46dc4b98a --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp4.c @@ -0,0 +1,20 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp4.c" + +__complex__ float x = 1.0f + 2.0fi; +#include "abitest.h" +#else + ARG(float, 1.0f, S0) + ARG(__complex__ float, x, S1) + ARG(float, 2.0f, S3) + ARG(double, 5.0, D2) + LAST_ARG(int, 3, R0) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp5.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp5.c new file mode 100644 index 000000000..216d98ea8 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp5.c @@ -0,0 +1,30 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp5.c" + +__complex__ float x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +#include "abitest.h" +#else + ARG(float, 1.0f, S0) + ARG(__complex__ float, x, S1) + ARG(float, 2.0f, S3) + ARG(double, 5.0, D2) + ARG(struct y, v, R0) + LAST_ARG(int, 3, STACK) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp6.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp6.c new file mode 100644 index 000000000..4d718da45 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp6.c @@ -0,0 +1,30 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp6.c" + +__complex__ float x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +#include "abitest.h" +#else + ARG(struct y, v, R0) + ARG(float, 1.0f, S0) + ARG(__complex__ float, x, S1) + ARG(float, 2.0f, S3) + ARG(double, 5.0, D2) + LAST_ARG(int, 3, STACK) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp7.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp7.c new file mode 100644 index 000000000..3e57e45c7 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp7.c @@ -0,0 +1,37 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp7.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#include "abitest.h" +#else + ARG(struct z, a, D0) + ARG(struct z, b, D4) + ARG(double, 0.5, STACK) + ARG(int, 7, R0) + LAST_ARG(struct y, v, STACK+8) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp8.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp8.c new file mode 100644 index 000000000..e55006885 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp8.c @@ -0,0 +1,37 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp8.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#include "abitest.h" +#else + ARG(int, 7, R0) + ARG(struct y, v, R1) + ARG(struct z, a, D0) + ARG(struct z, b, D4) + LAST_ARG(double, 0.5, STACK+8) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp9.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp9.c new file mode 100644 index 000000000..c2be6bf4b --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/aapcs/vfp9.c @@ -0,0 +1,38 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target arm*-*-*eabi* } } */ +/* { dg-require-effective-target arm_hard_vfp_ok } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "vfp9.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + double x[4]; +}; + +struct z a = { 5.0, 6.0, 7.0, 8.0 }; +struct z b = { 9.0, 10.0, 11.0, 12.0 }; + +#include "abitest.h" +#else + /* A variadic function passes using the base ABI */ + ARG(int, 7, R0) + DOTS + ANON(struct z, a, R2) + ANON(struct z, b, STACK+24) + LAST_ANON(double, 0.5, STACK+56) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/eabi1.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/eabi1.c index e88ba021f..c90f5ff08 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/eabi1.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/eabi1.c @@ -30,43 +30,48 @@ #include <stdlib.h> #include <math.h> -#define decl_float(code, type) \ - extern type __aeabi_ ## code ## add (type, type); \ - extern type __aeabi_ ## code ## div (type, type); \ - extern type __aeabi_ ## code ## mul (type, type); \ - extern type __aeabi_ ## code ## neg (type); \ - extern type __aeabi_ ## code ## rsub (type, type); \ - extern type __aeabi_ ## code ## sub (type, type); \ - extern int __aeabi_ ## code ## cmpeq (type, type); \ - extern int __aeabi_ ## code ## cmplt (type, type); \ - extern int __aeabi_ ## code ## cmple (type, type); \ - extern int __aeabi_ ## code ## cmpge (type, type); \ - extern int __aeabi_ ## code ## cmpgt (type, type); \ - extern int __aeabi_ ## code ## cmpun (type, type); \ - extern int __aeabi_ ## code ## 2iz (type); \ - extern unsigned int __aeabi_ ## code ## 2uiz (type); \ - extern long long __aeabi_ ## code ## 2lz (type); \ - extern unsigned long long __aeabi_ ## code ## 2ulz (type); \ - extern type __aeabi_i2 ## code (int); \ - extern type __aeabi_ui2 ## code (int); \ - extern type __aeabi_l2 ## code (long long); \ - extern type __aeabi_ul2 ## code (unsigned long long); \ - \ - type code ## zero = 0.0; \ - type code ## one = 1.0; \ - type code ## two = 2.0; \ - type code ## four = 4.0; \ - type code ## minus_one = -1.0; \ - type code ## minus_two = -2.0; \ - type code ## minus_four = -4.0; \ - type code ## epsilon = 1E-32; \ - type code ## NaN = 0.0 / 0.0; +/* All these functions are defined to use the base ABI, so use the + attribute to ensure the tests use the base ABI to call them even + when the VFP ABI is otherwise in effect. */ +#define PCS __attribute__((pcs("aapcs"))) + +#define decl_float(code, type) \ + extern type __aeabi_ ## code ## add (type, type) PCS; \ + extern type __aeabi_ ## code ## div (type, type) PCS; \ + extern type __aeabi_ ## code ## mul (type, type) PCS; \ + extern type __aeabi_ ## code ## neg (type) PCS; \ + extern type __aeabi_ ## code ## rsub (type, type) PCS; \ + extern type __aeabi_ ## code ## sub (type, type) PCS; \ + extern int __aeabi_ ## code ## cmpeq (type, type) PCS; \ + extern int __aeabi_ ## code ## cmplt (type, type) PCS; \ + extern int __aeabi_ ## code ## cmple (type, type) PCS; \ + extern int __aeabi_ ## code ## cmpge (type, type) PCS; \ + extern int __aeabi_ ## code ## cmpgt (type, type) PCS; \ + extern int __aeabi_ ## code ## cmpun (type, type) PCS; \ + extern int __aeabi_ ## code ## 2iz (type) PCS; \ + extern unsigned int __aeabi_ ## code ## 2uiz (type) PCS; \ + extern long long __aeabi_ ## code ## 2lz (type) PCS; \ + extern unsigned long long __aeabi_ ## code ## 2ulz (type) PCS; \ + extern type __aeabi_i2 ## code (int) PCS; \ + extern type __aeabi_ui2 ## code (int) PCS; \ + extern type __aeabi_l2 ## code (long long) PCS; \ + extern type __aeabi_ul2 ## code (unsigned long long) PCS; \ + \ + type code ## zero = 0.0; \ + type code ## one = 1.0; \ + type code ## two = 2.0; \ + type code ## four = 4.0; \ + type code ## minus_one = -1.0; \ + type code ## minus_two = -2.0; \ + type code ## minus_four = -4.0; \ + type code ## epsilon = 1E-32; \ + type code ## NaN = 0.0 / 0.0; decl_float (d, double) decl_float (f, float) -extern float __aeabi_d2f (double); -extern double __aeabi_f2d (float); +extern float __aeabi_d2f (double) PCS; +extern double __aeabi_f2d (float) PCS; extern long long __aeabi_lmul (long long, long long); extern long long __aeabi_llsl (long long, int); extern long long __aeabi_llsr (long long, int); diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/g2.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/g2.c index 031b93657..85ba1906a 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/g2.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/g2.c @@ -2,6 +2,8 @@ /* { dg-do compile } */ /* { dg-options "-mcpu=xscale -O2" } */ /* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-march=*" } { "-march=xscale" } } */ +/* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-mcpu=*" } { "-mcpu=xscale" } } */ +/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */ /* { dg-require-effective-target arm32 } */ /* Brett Gaines' test case. */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/loop-autoinc.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/loop-autoinc.c new file mode 100644 index 000000000..f94c49ee7 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/loop-autoinc.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "ldr\t.*\], #4" } } */ + +extern int x[]; +extern void bar(); +int foo () +{ + int i; + int sum = 0; + for (i = 0; i < 100; i++) { + sum += x[i]; + if (sum & 1) + sum *= sum; + } + return sum; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/mmx-1.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/mmx-1.c index 21cc47912..1240ffa63 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/mmx-1.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/mmx-1.c @@ -4,7 +4,9 @@ /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */ /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */ /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mfloat-abi=softfp" } { "" } } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mfloat-abi=hard" } { "" } } */ /* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */ /* { dg-options "-O -mno-apcs-frame -mcpu=iwmmxt -mabi=iwmmxt" } */ /* { dg-require-effective-target arm32 } */ /* { dg-final { scan-assembler "ldmfd\[ ]sp!.*ip,\[ ]*pc" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/pr44999.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/pr44999.c new file mode 100644 index 000000000..d07dca1a0 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/pr44999.c @@ -0,0 +1,9 @@ +/* Use UXTB to extract the lowest byte. */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "uxtb" } } */ + +int tp(int x, int y) +{ + return (x & 0xff) - (y & 0xffff); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/pr46631.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/pr46631.c new file mode 100644 index 000000000..6f6dc4e85 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/pr46631.c @@ -0,0 +1,16 @@ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "ands" } } */ + +struct S { + int bi_buf; + int bi_valid; +}; + +int tz (struct S* p, int bits, int value) +{ + if (p == 0) return 1; + p->bi_valid = bits; + p->bi_buf = value & ((1 << bits) - 1); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/scd42-2.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/scd42-2.c index 0c372983a..e07740234 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/scd42-2.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/scd42-2.c @@ -2,6 +2,8 @@ /* { dg-do compile } */ /* { dg-options "-mcpu=xscale -O" } */ /* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-march=*" } { "-march=xscale" } } */ +/* { dg-skip-if "Test is specific to the Xscale" { arm*-*-* } { "-mcpu=*" } { "-mcpu=xscale" } } */ +/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */ /* { dg-require-effective-target arm32 } */ unsigned load2(void) __attribute__ ((naked)); diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c new file mode 100644 index 000000000..d75f13aa0 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-1.c @@ -0,0 +1,12 @@ +/* Use ADDS clobbering source operand, rather than CMN */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "adds" } } */ +/* { dg-final { scan-assembler-not "cmn" } } */ + +void foo1(void); +void bar5(int x) +{ + if (x == -15) + foo1(); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c new file mode 100644 index 000000000..358bc6e14 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/arm/thumb2-cmpneg2add-2.c @@ -0,0 +1,12 @@ +/* Use ADDS with a scratch, rather than CMN */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "adds" } } */ +/* { dg-final { scan-assembler-not "cmn" } } */ + +void foo1(int); +void bar5(int x) +{ + if (x == -1) + foo1(x); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/bfin/loop-autoinc.c b/gcc-4.4.3/gcc/testsuite/gcc.target/bfin/loop-autoinc.c new file mode 100644 index 000000000..3dc718298 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/bfin/loop-autoinc.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler " = \\\[\[PI\].\\+\\+\\\];" } } */ +extern int x[]; +extern void bar(); +int foo () +{ + int i; + int sum = 0; + for (i = 0; i < 100; i++) { + sum += x[i]; + if (sum & 1) + sum *= sum; + } + return sum; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-1.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-1.c index 5bbc101c0..584da582f 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-1.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-1.c @@ -1,7 +1,7 @@ /* Test for stack alignment when PREFERRED_STACK_BOUNDARY < alignment of local variable. */ /* { dg-do compile } */ -/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6" } */ +/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6 -fno-inline" } */ /* { dg-final { scan-assembler "and\[lq\]?\[\\t \]*\\$-128,\[\\t \]*%\[re\]?sp" } } */ /* { dg-final { scan-assembler-not "and\[lq\]?\[\\t \]*\\$-64,\[\\t \]*%\[re\]?sp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-2.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-2.c index df45f0e51..c3a284f41 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-2.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/align-main-2.c @@ -1,7 +1,7 @@ /* Test for stack alignment when PREFERRED_STACK_BOUNDARY > alignment of local variable. */ /* { dg-do compile } */ -/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6" } */ +/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6 -fno-inline" } */ /* { dg-final { scan-assembler "and\[lq\]?\[\\t \]*\\$-64,\[\\t \]*%\[re\]?sp" } } */ /* { dg-final { scan-assembler-not "and\[lq\]?\[\\t \]*\\$-128,\[\\t \]*%\[re\]?sp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-10.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-10.c new file mode 100644 index 000000000..31d9e6180 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-10.c @@ -0,0 +1,19 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -fomit-frame-pointer -O3 -march=barcelona -mpreferred-stack-boundary=4" } */ + +struct s { + int x[8]; +}; + +void g(struct s *); + +void f() +{ + int i; + struct s s; + for (i = 0; i < sizeof(s.x) / sizeof(*s.x); i++) s.x[i] = 0; + g(&s); +} + +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-11.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-11.c new file mode 100644 index 000000000..e5787af7a --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-11.c @@ -0,0 +1,18 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -fomit-frame-pointer -O3 -march=barcelona -mpreferred-stack-boundary=4" } */ + +void g(); + +int p[100]; +int q[100]; + +void f() +{ + int i; + for (i = 0; i < 100; i++) p[i] = 0; + g(); + for (i = 0; i < 100; i++) q[i] = 0; +} + +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-12.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-12.c new file mode 100644 index 000000000..d7ef1038b --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-12.c @@ -0,0 +1,20 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O2 -msse2 -mpreferred-stack-boundary=4" } */ + +typedef int v4si __attribute__ ((vector_size (16))); + +struct x { + v4si v; + v4si w; +}; + +void y(void *); + +v4si x(void) +{ + struct x x; + y(&x); +} + +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-13.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-13.c new file mode 100644 index 000000000..bbc8993d5 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-13.c @@ -0,0 +1,15 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O2 -mpreferred-stack-boundary=4" } */ + +extern double y(double *s3); + +extern double s1, s2; + +double x(void) +{ + double s3 = s1 + s2; + return y(&s3); +} + +/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-14.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-14.c new file mode 100644 index 000000000..d27179d95 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-14.c @@ -0,0 +1,15 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O2 -mpreferred-stack-boundary=4" } */ + +extern int y(int *s3); + +extern int s1, s2; + +int x(void) +{ + int s3 = s1 + s2; + return y(&s3); +} + +/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-15.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-15.c new file mode 100644 index 000000000..e6a174904 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-15.c @@ -0,0 +1,15 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O2 -mpreferred-stack-boundary=4" } */ + +extern long long y(long long *s3); + +extern long long s1, s2; + +long long x(void) +{ + long long s3 = s1 + s2; + return y(&s3); +} + +/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-6.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-6.c new file mode 100644 index 000000000..5cc4ab3f7 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-6.c @@ -0,0 +1,17 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O2 -msse2 -mpreferred-stack-boundary=4" } */ + +typedef int v4si __attribute__ ((vector_size (16))); + +extern v4si y(v4si *s3); + +extern v4si s1, s2; + +v4si x(void) +{ + v4si s3 = s1 + s2; + return y(&s3); +} + +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-7.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-7.c new file mode 100644 index 000000000..cdd603796 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-7.c @@ -0,0 +1,16 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O2 -msse2 -mpreferred-stack-boundary=4" } */ + +typedef int v4si __attribute__ ((vector_size (16))); + +extern v4si y(v4si, v4si, v4si, v4si, v4si); + +extern v4si s1, s2; + +v4si x(void) +{ + return y(s1, s2, s1, s2, s2); +} + +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-8.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-8.c new file mode 100644 index 000000000..2dd8800fd --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-8.c @@ -0,0 +1,18 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O3 -msse2 -mpreferred-stack-boundary=4" } */ + +float +foo (float f) +{ + float array[128]; + float x; + int i; + for (i = 0; i < sizeof(array) / sizeof(*array); i++) + array[i] = f; + for (i = 0; i < sizeof(array) / sizeof(*array); i++) + x += array[i]; + return x; +} + +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-9.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-9.c new file mode 100644 index 000000000..e43cbd6bc --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/incoming-9.c @@ -0,0 +1,18 @@ +/* PR target/40838 */ +/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */ +/* { dg-options "-w -mstackrealign -O3 -mno-sse -mpreferred-stack-boundary=4" } */ + +float +foo (float f) +{ + float array[128]; + float x; + int i; + for (i = 0; i < sizeof(array) / sizeof(*array); i++) + array[i] = f; + for (i = 0; i < sizeof(array) / sizeof(*array); i++) + x += array[i]; + return x; +} + +/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/max-stack-align.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/max-stack-align.c new file mode 100644 index 000000000..fa8050813 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/max-stack-align.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fomit-frame-pointer" } */ +/* { dg-require-effective-target lp64 } */ + +void foo() +{ + int a=0, b=0, c=0, e=0, f=0, g=0, h=0, i=0; + __asm__ __volatile__ ("" + : + : + : "bp" + ); +} + diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/movbe-1.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/movbe-1.c new file mode 100644 index 000000000..391d4ad98 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/movbe-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmovbe" } */ + +extern int x; + +void +foo (int i) +{ + x = __builtin_bswap32 (i); +} + +int +bar () +{ + return __builtin_bswap32 (x); +} + +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 2 } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/movbe-2.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/movbe-2.c new file mode 100644 index 000000000..d898f20dc --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/movbe-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmovbe" } */ + +extern long long x; + +void +foo (long long i) +{ + x = __builtin_bswap64 (i); +} + +long long +bar () +{ + return __builtin_bswap64 (x); +} + +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 2 { target lp64 } } } */ diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/pr37843-4.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/pr37843-4.c new file mode 100644 index 000000000..8e5f51f9d --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/pr37843-4.c @@ -0,0 +1,13 @@ +/* Test for stack alignment with sibcall optimization. */ +/* { dg-do compile { target { ilp32 && nonpic } } } */ +/* { dg-options "-O2 -msse2 -mpreferred-stack-boundary=4 -mstackrealign" } */ +/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler-not "call\[\\t \]*foo" } } */ +/* { dg-final { scan-assembler "jmp\[\\t \]*foo" } } */ + +extern int foo (void); + +int bar (void) +{ + return foo(); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-12.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-12.c index 5e2173a8f..5249b0038 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-12.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-12.c @@ -1,7 +1,7 @@ /* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h and mm_malloc.h are usable with -O -std=c89 -pedantic-errors. */ /* { dg-do compile } */ -/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -m3dnow -mavx -msse5 -maes -mpclmul" } */ +/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -m3dnow -mavx -msse5 -maes -mpclmul -mlwp" } */ #include <x86intrin.h> diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-13.c index 8bfb9f866..bfe9aec00 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-13.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-13.c @@ -1,12 +1,13 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -msse5 -maes -mpclmul" } */ +/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -msse5 -maes -mpclmul -mlwp" } */ #include <mm_malloc.h> /* Test that the intrinsics compile with optimization. All of them are - defined as inline functions in {,x,e,p,t,s,w,a,b,i}mmintrin.h and mm3dnow.h - that reference the proper builtin functions. Defining away "extern" and - "__inline" results in all of them being compiled as proper functions. */ + defined as inline functions in {,x,e,p,t,s,w,a,b,i}mmintrin.h, lwpintrin.h + and mm3dnow.h that reference the proper builtin functions. Defining away + "extern" and "__inline" results in all of them being compiled as proper + functions. */ #define extern #define __inline @@ -132,4 +133,10 @@ #define __builtin_ia32_protdi(A, B) __builtin_ia32_protdi(A,1) #define __builtin_ia32_protqi(A, B) __builtin_ia32_protqi(A,1) +/* lwpintrin.h */ +#define __builtin_ia32_lwpval32(D2, D1, F) __builtin_ia32_lwpval32 (D2, D1, 1) +#define __builtin_ia32_lwpval64(D2, D1, F) __builtin_ia32_lwpval64 (D2, D1, 1) +#define __builtin_ia32_lwpins32(D2, D1, F) __builtin_ia32_lwpins32 (D2, D1, 1) +#define __builtin_ia32_lwpins64(D2, D1, F) __builtin_ia32_lwpins64 (D2, D1, 1) + #include <x86intrin.h> diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-14.c index 67da6608a..4c4232cdb 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-14.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-14.c @@ -1,12 +1,13 @@ /* { dg-do compile } */ -/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -msse5 -maes -mpclmul" } */ +/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -msse5 -maes -mpclmul -mlwp" } */ #include <mm_malloc.h> /* Test that the intrinsics compile without optimization. All of them are - defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h and mm3dnow.h - that reference the proper builtin functions. Defining away "extern" and - "__inline" results in all of them being compiled as proper functions. */ + defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h, lwpintrin.h + and mm3dnow.h that reference the proper builtin functions. Defining away + "extern" and "__inline" results in all of them being compiled as proper + functions. */ #define extern #define __inline @@ -162,3 +163,11 @@ test_1 (_mm_roti_epi8, __m128i, __m128i, 1) test_1 (_mm_roti_epi16, __m128i, __m128i, 1) test_1 (_mm_roti_epi32, __m128i, __m128i, 1) test_1 (_mm_roti_epi64, __m128i, __m128i, 1) + +/* lwpintrin.h */ +test_2 ( __lwpval32, void, unsigned int, unsigned int, 1) +test_2 ( __lwpins32, unsigned char, unsigned int, unsigned int, 1) +#ifdef __x86_64__ +test_2 ( __lwpval64, void, unsigned long long, unsigned int, 1) +test_2 ( __lwpins64, unsigned char, unsigned long long, unsigned int, 1) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-22.c index f530e54ec..a6d80043c 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-22.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-22.c @@ -5,9 +5,10 @@ #include <mm_malloc.h> /* Test that the intrinsics compile without optimization. All of them are - defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h and mm3dnow.h - that reference the proper builtin functions. Defining away "extern" and - "__inline" results in all of them being compiled as proper functions. */ + defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h, lwpintrin.h + and mm3dnow.h that reference the proper builtin functions. Defining away + "extern" and "__inline" results in all of them being compiled as proper + functions. */ #define extern #define __inline @@ -37,7 +38,7 @@ #ifndef DIFFERENT_PRAGMAS -#pragma GCC target ("mmx,3dnow,sse,sse2,sse3,ssse3,sse4.1,sse4.2,sse5,aes,pclmul") +#pragma GCC target ("mmx,3dnow,sse,sse2,sse3,ssse3,sse4.1,sse4.2,sse5,aes,pclmul,lwp") #endif /* Following intrinsics require immediate arguments. They @@ -169,3 +170,16 @@ test_1 (_mm_round_pd, __m128d, __m128d, 1) test_1 (_mm_round_ps, __m128, __m128, 1) test_2 (_mm_round_sd, __m128d, __m128d, __m128d, 1) test_2 (_mm_round_ss, __m128, __m128, __m128, 1) + +#ifdef DIFFERENT_PRAGMAS +#pragma GCC target ("lwp") +#endif +#include <x86intrin.h> + +/* lwpintrin.h (LWP). */ +test_2 ( __lwpval32, void, unsigned int, unsigned int, 1) +test_2 ( __lwpins32, unsigned char, unsigned int, unsigned int, 1) +#ifdef __x86_64__ +test_2 ( __lwpval64, void, unsigned long long, unsigned int, 1) +test_2 ( __lwpins64, unsigned char, unsigned long long, unsigned int, 1) +#endif diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-23.c index 4488568f4..076161f27 100644 --- a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-23.c +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse-23.c @@ -4,9 +4,10 @@ #include <mm_malloc.h> /* Test that the intrinsics compile with optimization. All of them are - defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h and mm3dnow.h - that reference the proper builtin functions. Defining away "extern" and - "__inline" results in all of them being compiled as proper functions. */ + defined as inline functions in {,x,e,p,t,s,w,a,b}mmintrin.h, lwpintrin.h + and mm3dnow.h that reference the proper builtin functions. Defining away + "extern" and "__inline" results in all of them being compiled as proper + functions. */ #define extern #define __inline @@ -94,15 +95,53 @@ #define __builtin_ia32_vec_ext_v4hi(A, N) __builtin_ia32_vec_ext_v4hi(A, 0) #define __builtin_ia32_shufps(A, B, N) __builtin_ia32_shufps(A, B, 0) +/* immintrin.h */ +#define __builtin_ia32_blendpd256(X, Y, M) __builtin_ia32_blendpd256(X, Y, 1) +#define __builtin_ia32_blendps256(X, Y, M) __builtin_ia32_blendps256(X, Y, 1) +#define __builtin_ia32_dpps256(X, Y, M) __builtin_ia32_dpps256(X, Y, 1) +#define __builtin_ia32_shufpd256(X, Y, M) __builtin_ia32_shufpd256(X, Y, 1) +#define __builtin_ia32_shufps256(X, Y, M) __builtin_ia32_shufps256(X, Y, 1) +#define __builtin_ia32_cmpsd(X, Y, O) __builtin_ia32_cmpsd(X, Y, 1) +#define __builtin_ia32_cmpss(X, Y, O) __builtin_ia32_cmpss(X, Y, 1) +#define __builtin_ia32_cmppd(X, Y, O) __builtin_ia32_cmppd(X, Y, 1) +#define __builtin_ia32_cmpps(X, Y, O) __builtin_ia32_cmpps(X, Y, 1) +#define __builtin_ia32_cmppd256(X, Y, O) __builtin_ia32_cmppd256(X, Y, 1) +#define __builtin_ia32_cmpps256(X, Y, O) __builtin_ia32_cmpps256(X, Y, 1) +#define __builtin_ia32_vextractf128_pd256(X, N) __builtin_ia32_vextractf128_pd256(X, 1) +#define __builtin_ia32_vextractf128_ps256(X, N) __builtin_ia32_vextractf128_ps256(X, 1) +#define __builtin_ia32_vextractf128_si256(X, N) __builtin_ia32_vextractf128_si256(X, 1) +#define __builtin_ia32_vpermilpd(X, N) __builtin_ia32_vpermilpd(X, 1) +#define __builtin_ia32_vpermilpd256(X, N) __builtin_ia32_vpermilpd256(X, 1) +#define __builtin_ia32_vpermilps(X, N) __builtin_ia32_vpermilps(X, 1) +#define __builtin_ia32_vpermilps256(X, N) __builtin_ia32_vpermilps256(X, 1) +#define __builtin_ia32_vpermil2pd(X, Y, C, I) __builtin_ia32_vpermil2pd(X, Y, C, 1) +#define __builtin_ia32_vpermil2pd256(X, Y, C, I) __builtin_ia32_vpermil2pd256(X, Y, C, 1) +#define __builtin_ia32_vpermil2ps(X, Y, C, I) __builtin_ia32_vpermil2ps(X, Y, C, 1) +#define __builtin_ia32_vpermil2ps256(X, Y, C, I) __builtin_ia32_vpermil2ps256(X, Y, C, 1) +#define __builtin_ia32_vperm2f128_pd256(X, Y, C) __builtin_ia32_vperm2f128_pd256(X, Y, 1) +#define __builtin_ia32_vperm2f128_ps256(X, Y, C) __builtin_ia32_vperm2f128_ps256(X, Y, 1) +#define __builtin_ia32_vperm2f128_si256(X, Y, C) __builtin_ia32_vperm2f128_si256(X, Y, 1) +#define __builtin_ia32_vinsertf128_pd256(X, Y, C) __builtin_ia32_vinsertf128_pd256(X, Y, 1) +#define __builtin_ia32_vinsertf128_ps256(X, Y, C) __builtin_ia32_vinsertf128_ps256(X, Y, 1) +#define __builtin_ia32_vinsertf128_si256(X, Y, C) __builtin_ia32_vinsertf128_si256(X, Y, 1) +#define __builtin_ia32_roundpd256(V, M) __builtin_ia32_roundpd256(V, 1) +#define __builtin_ia32_roundps256(V, M) __builtin_ia32_roundps256(V, 1) + /* bmmintrin.h */ #define __builtin_ia32_protbi(A, B) __builtin_ia32_protbi(A,1) #define __builtin_ia32_protwi(A, B) __builtin_ia32_protwi(A,1) #define __builtin_ia32_protdi(A, B) __builtin_ia32_protdi(A,1) #define __builtin_ia32_protqi(A, B) __builtin_ia32_protqi(A,1) +/* lwpintrin.h */ +#define __builtin_ia32_lwpval32(D2, D1, F) __builtin_ia32_lwpval32 (D2, D1, 1) +#define __builtin_ia32_lwpval64(D2, D1, F) __builtin_ia32_lwpval64 (D2, D1, 1) +#define __builtin_ia32_lwpins32(D2, D1, F) __builtin_ia32_lwpins32 (D2, D1, 1) +#define __builtin_ia32_lwpins64(D2, D1, F) __builtin_ia32_lwpins64 (D2, D1, 1) -#pragma GCC target ("3dnow,sse4,sse5,aes,pclmul") +#pragma GCC target ("3dnow,sse4,sse5,aes,pclmul,lwp") #include <wmmintrin.h> #include <bmmintrin.h> #include <smmintrin.h> #include <mm3dnow.h> +#include <x86intrin.h> diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse2-vec-2a.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse2-vec-2a.c new file mode 100644 index 000000000..27e99147e --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse2-vec-2a.c @@ -0,0 +1,4 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse2 -mtune=atom" } */ + +#include "sse2-vec-2.c" diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c new file mode 100644 index 000000000..048da6e56 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c @@ -0,0 +1,27 @@ +/* Test for cross x86_64<->w64 abi standard calls. */ +/* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ +/* { dg-additional-sources "func-2b.c" } */ + +extern void __attribute__ ((sysv_abi)) abort (void); +long double func_cross (long double, double, float, long, int, char); + +long double __attribute__ ((sysv_abi)) +func_native (long double a, double b, float c, long d, int e, char f) +{ + long double ret; + ret = a + (long double) b + (long double) c; + ret *= (long double) (d + (long) e); + if (f>0) + ret += func_native (a,b,c,d,e,-f); + return ret; +} + +int __attribute__ ((sysv_abi)) +main () +{ + if (func_cross (1.0,2.0,3.0,1,2,3) + != func_native (1.0,2.0,3.0,1,2,3)) + abort (); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c new file mode 100644 index 000000000..fe85dd186 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c @@ -0,0 +1,13 @@ +/* Test for cross x86_64<->w64 abi standard calls. */ +/* { dg-options "-mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ + +long double func_cross (long double a, double b, float c, long d, int e, + char f) +{ + long double ret; + ret = a + (long double) b + (long double) c; + ret *= (long double) (d + (long) e); + if (f>0) + ret += func_cross (a,b,c,d,e,-f); + return ret; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c new file mode 100644 index 000000000..730b8db9c --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c @@ -0,0 +1,17 @@ +/* Test for cross x86_64<->w64 abi standard calls via variable. */ +/* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ +/* { dg-additional-sources "func-indirect-2b.c" } */ + +extern void __attribute__ ((sysv_abi)) abort (void); +typedef int (*func)(void *, char *, char *, short, long long); +extern func get_callback (void); + +int __attribute__ ((sysv_abi)) +main () +{ + func callme = get_callback (); + if (callme (0, 0, 0, 0x1234, 0x1234567890abcdefLL)) + abort (); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c new file mode 100644 index 000000000..1a9fccd97 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c @@ -0,0 +1,24 @@ +/* Test for cross x86_64<->w64 abi standard calls via variable. */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ + +typedef int (*func)(void *, char *, char *, short, long long); + +static int +callback (void *ptr, char *string1, char *string2, short number, + long long rand) +{ + if (ptr != 0 + || string1 != 0 + || string2 != 0 + || number != 0x1234 + || rand != 0x1234567890abcdefLL) + return 1; + else + return 0; +} + +func +get_callback (void) +{ + return callback; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c new file mode 100644 index 000000000..a44470431 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c @@ -0,0 +1,24 @@ +/* Test for cross x86_64<->w64 abi va_list calls. */ +/* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ +/* { dg-additional-sources "vaarg-4b.c" } */ + +extern __SIZE_TYPE__ __attribute__ ((sysv_abi)) strlen (const char *); +extern int __attribute__ ((sysv_abi)) sprintf (char *,const char *, ...); +extern void __attribute__ ((sysv_abi)) abort (void); + +extern void do_cpy (char *, ...); + +int __attribute__ ((sysv_abi)) +main () +{ + char s[256]; + + do_cpy (s, "1","2","3","4", "5", "6", "7", ""); + + if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4' + || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0) + abort (); + + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c new file mode 100644 index 000000000..f33906bd2 --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c @@ -0,0 +1,31 @@ +/* Test for cross x86_64<->w64 abi va_list calls. */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ + +#include <stdarg.h> + +extern __SIZE_TYPE__ __attribute__ ((sysv_abi)) strlen (const char *); +extern int __attribute__ ((sysv_abi)) sprintf (char *, const char *, ...); + +static void +vdo_cpy (char *s, va_list argp) +{ + __SIZE_TYPE__ len; + char *r = s; + char *e; + *r = 0; + for (;;) { + e = va_arg (argp, char *); + if (*e == 0) break; + sprintf (r,"%s", e); + r += strlen (r); + } +} + +void +do_cpy (char *s, ...) +{ + va_list argp; + va_start (argp, s); + vdo_cpy (s, argp); + va_end (argp); +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c new file mode 100644 index 000000000..e9912957e --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c @@ -0,0 +1,17 @@ +/* Test for cross x86_64<->w64 abi va_list calls. */ +/* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ +/* { dg-additional-sources "vaarg-5b.c" } */ + +extern void __attribute__ ((sysv_abi)) abort (void); +extern int fct2 (int, ...); + +#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll + +int __attribute__ ((sysv_abi)) +main() +{ + if (fct2 (-1, SZ_ARGS) != 0) + abort (); + return 0; +} diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c new file mode 100644 index 000000000..e5dd4727b --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c @@ -0,0 +1,37 @@ +/* Test for cross x86_64<->w64 abi va_list calls. */ +/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ + +#include <stdarg.h> + +#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll + +static int __attribute__ ((sysv_abi)) +fct1 (va_list argp, ...) +{ + long long p1,p2; + int ret = 1; + __builtin_sysv_va_list argp_2; + + __builtin_sysv_va_start (argp_2, argp); + do { + p1 = va_arg (argp_2, long long); + p2 = va_arg (argp, long long); + if (p1 != p2) + ret = 0; + } while (ret && p1 != 0); + __builtin_sysv_va_end (argp_2); + + return ret; +} + +int +fct2 (int dummy, ...) +{ + va_list argp; + int ret = dummy; + + va_start (argp, dummy); + ret += fct1 (argp, SZ_ARGS); + va_end (argp); + return ret; +} diff --git a/gcc-4.4.3/gcc/testsuite/lib/scanasm.exp b/gcc-4.4.3/gcc/testsuite/lib/scanasm.exp index 24de1871b..7373fd950 100644 --- a/gcc-4.4.3/gcc/testsuite/lib/scanasm.exp +++ b/gcc-4.4.3/gcc/testsuite/lib/scanasm.exp @@ -280,3 +280,40 @@ proc scan-assembler-dem-not { args } { fail "$testcase scan-assembler-dem-not [lindex $args 0]" } } + +# Utility for testing that a function is defined on the current line. +# Call pass if so, otherwise fail. Invoked directly; the file must +# have been compiled with -g -dA. +# +# Argument 0 is the current line, passed implicitly by dejagnu +# Argument 1 is the function to check +# Argument 2 handles expected failures and the like +# Argument 3 is "." to match the current line, or an integer to match +# an explicit line. +proc dg-function-on-line { args } { + # Upvar from dg-final: + upvar dg-final-code final-code + + set line [lindex $args 0] + set symbol [lindex $args 1] + set failures [lindex $args 2] + + if { [llength $args] >= 4 } { + switch [lindex $args 3] { + "." { } + "default" { set line [lindex $args 3] } + } + } + + set pattern [format {%s:[^\t]*(\t.(fnstart|frame|mask|file)[^\t]*)*\t[^:]+:%d\n} \ + $symbol $line] + + # The lack of spaces around $pattern is important, since they'd + # become part of the regex scan-assembler tries to match. + set cmd "scan-assembler {$pattern}" + if { [llength $args] >= 3 } { + set cmd "$cmd {$failures}" + } + + append final-code "$cmd\n" +} diff --git a/gcc-4.4.3/gcc/testsuite/lib/target-supports.exp b/gcc-4.4.3/gcc/testsuite/lib/target-supports.exp index 1f8464d69..792d0918a 100644 --- a/gcc-4.4.3/gcc/testsuite/lib/target-supports.exp +++ b/gcc-4.4.3/gcc/testsuite/lib/target-supports.exp @@ -1430,6 +1430,20 @@ proc check_effective_target_arm_vfp_ok { } { } } +# Return 1 if this is an ARM target supporting -mfpu=vfp +# -mfloat-abi=hard. Some multilibs may be incompatible with these +# options. + +proc check_effective_target_arm_hard_vfp_ok { } { + if { [check_effective_target_arm32] } { + return [check_no_compiler_messages arm_hard_vfp_ok executable { + int main() { return 0;} + } "-mfpu=vfp -mfloat-abi=hard"] + } else { + return 0 + } +} + # Return 1 if this is an ARM target supporting -mfpu=neon # -mfloat-abi=softfp. Some multilibs may be incompatible with these # options. @@ -1437,6 +1451,7 @@ proc check_effective_target_arm_vfp_ok { } { proc check_effective_target_arm_neon_ok { } { if { [check_effective_target_arm32] } { return [check_no_compiler_messages arm_neon_ok object { + #include "arm_neon.h" int dummy; } "-mfpu=neon -mfloat-abi=softfp"] } else { @@ -1455,6 +1470,17 @@ proc check_effective_target_arm_thumb1_ok { } { } "-mthumb"] } +# Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be +# used. + +proc check_effective_target_arm_thumb2_ok { } { + return [check_no_compiler_messages arm_thumb2_ok assembly { + #if !defined(__thumb2__) + #error FOO + #endif + } "-mthumb"] +} + # Return 1 if the target supports executing NEON instructions, 0 # otherwise. Cache the result. |