public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/45267]  New: [4.5 regression] inlining fails with -m32
@ 2010-08-12 16:15 kretz at kde dot org
  2010-08-12 18:17 ` [Bug middle-end/45267] " rguenth at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kretz at kde dot org @ 2010-08-12 16:15 UTC (permalink / raw)
  To: gcc-bugs

My code, which previously compiled with GCC 4.3 and 4.4 with -m32 as well as
for 64 bit, fails to compile with GCC 4.5.[01] when compiling for 32 bit
(-m32).

I tried to reduce the problem to a minimal testcase and arrived at this:

typedef int __v4si __attribute__ ((__vector_size__ (16)));
typedef long long __v2di __attribute__ ((__vector_size__ (16)));
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_set_epi32 (int __q3, int __q2, int __q1, int __q0)
{
  return __extension__ (__m128i)(__v4si){ __q0, __q1, __q2, __q3 };
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_set1_epi32 (int __A)
{
  return _mm_set_epi32 (__A, __A, __A, __A);
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_cmpeq_epi32 (__m128i __A, __m128i __B)
{
  return (__m128i)__builtin_ia32_pcmpeqd128 ((__v4si)__A, (__v4si)__B);
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_slli_epi32 (__m128i __A, int __B)
{
  return (__m128i)__builtin_ia32_pslldi128 ((__v4si)__A, __B);
}
extern __inline int __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_testc_si128 (__m128i __M, __m128i __V)
{
  return __builtin_ia32_ptestc128 ((__v2di)__M, (__v2di)__V);
}

template<typename T>
class Vector
{
    public:
        inline Vector(__m128i x) : d(x) {}
        inline Vector(T a) : d(_mm_set1_epi32(a)) {}

        inline Vector<T> operator<<(int x) const
__attribute__((always_inline));

        inline bool operator==(const Vector<T> &x) const
        {
            return !_mm_testc_si128(_mm_cmpeq_epi32(d, x.d),
_mm_set1_epi32(0xffffffffu));
        }
    private:
        __m128i d;
};

template<> inline Vector<int> Vector<int>::operator<<(int x) const
{
    return _mm_slli_epi32(d, x);
}

template<typename T1, typename M> inline void foo(const T1 &, const M &) {}
class Fail {};

int main()
{
    Vector<int> a(1);
    if ((a << 2) == (a << 2)) {
        foo(a << 2, (a << 2) == (a << 2));
        throw Fail();
    }
    return 0;
}

g++ -m32 -O3 -Wall -march=core2 -msse4 -ansi -o arithmetics arithmetics.cpp
arithmetics.cpp: In function &#8216;int main()&#8217;:
arithmetics.cpp:47:31: sorry, unimplemented: inlining failed in call to
&#8216;Vector<T> Vector<T>::operator<<(int) const [with T = int]&#8217;: call
is unlikely and code size would grow
arithmetics.cpp:59:40: sorry, unimplemented: called from here
arithmetics.cpp:47:31: sorry, unimplemented: inlining failed in call to
&#8216;Vector<T> Vector<T>::operator<<(int) const [with T = int]&#8217;: call
is unlikely and code size would grow
arithmetics.cpp:59:40: sorry, unimplemented: called from here
arithmetics.cpp:47:31: sorry, unimplemented: inlining failed in call to
&#8216;Vector<T> Vector<T>::operator<<(int) const [with T = int]&#8217;: call
is unlikely and code size would grow
arithmetics.cpp:59:41: sorry, unimplemented: called from here


-- 
           Summary: [4.5 regression] inlining fails with -m32
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kretz at kde dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45267


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-08-30 15:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-12 16:15 [Bug middle-end/45267] New: [4.5 regression] inlining fails with -m32 kretz at kde dot org
2010-08-12 18:17 ` [Bug middle-end/45267] " rguenth at gcc dot gnu dot org
2010-08-12 19:09 ` hjl dot tools at gmail dot com
2010-08-12 20:17 ` hjl dot tools at gmail dot com
2010-08-12 21:07 ` steven at gcc dot gnu dot org
2010-08-12 21:17 ` kretz at kde dot org
2010-08-12 21:31 ` steven at gcc dot gnu dot org
2010-08-12 21:35 ` rguenth at gcc dot gnu dot org
2010-08-12 21:49 ` rguenth at gcc dot gnu dot org
2010-08-12 22:08 ` kretz at kde dot org
2010-08-12 22:16 ` [Bug c++/45267] " rguenth at gcc dot gnu dot org
2010-08-30 15:57 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).