This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/45267] New: [4.5 regression] inlining fails with -m32


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]