[Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error

2007-12-11 Thread lo at meep dot co dot uk
Using snapshot: gcc-4.3-20071109

Problem code follows:
///
#include 

class Vec {
__m128i vec;
public:
Vec(int mm) {
vec = _mm_set1_epi16(mm);
}
operator __m128i() const {
return vec;
}
};

int main() {
_mm_shuffle_epi32(Vec(5), _MM_SHUFFLE(3,3,3,3));  // error
}
///

This compiles fine with e.g. -O2, but with optimisations off, gcc reports
"error: can't convert value to a vector".

This seems to be because a macro version of _mm_shuffle_epi32 is used when
optimisations are off, and the type conversion from Vec to __mm128i can't
happen for the first parameter.


-- 
   Summary: SSE2 intrinsics - emmintrin with optimisations off and
type conversion error
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lo at meep dot co dot uk


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



[Bug c++/34715] New: always_inline does not seem to force inlining when used only in the definition of a function in a namespace

2008-01-08 Thread lo at meep dot co dot uk
Snapshot gcc-4.3-20080104, gcc-4.3-20071109.

Test code below.  When 'inline' modifier and 'always_inline' attribute are used
only in the definition of "min", inlining does not appear to happen (and no
error is output).  When I add the modifier and attribute to the declaration of
"min", inlining does happen as expected.

Also: If I change X to a class, and min to a static function, inlining occurs
even if I mark only the declaration with 'inline' and 'always_inline'.

Note: I am assuming inlining hasn't happened due to the presence of the
following line in the assembly generated with the -S option:
 call_ZN1X3minIiEERKT_S3_S3_
Apologies if that's not correct, or if I have misunderstood what's supposed to
happen with use of always_inline.  

==
PREPROCESSED SOURCE #1
==

# 1 "y.cpp"
# 1 ""
# 1 ""
# 1 "y.cpp"
# 1 "try.h" 1


namespace X
{
 template 
 const T& min(const T& a, const T& b);
}


template 
inline __attribute__ ((always_inline)) const T& X::min(const T& a, const T& b)
{
 return a < b ? a : b;
}
# 2 "y.cpp" 2
int main()
{
 int a, b;
 return X::min(a, b);
}

==
PREPROCESSED SOURCE #2
==

# 1 "y.cpp"
# 1 ""
# 1 ""
# 1 "y.cpp"
# 1 "try.h" 1


namespace X
{
 template 
 inline __attribute__ ((always_inline)) const T& min(const T& a, const T& b);
}


template 
inline __attribute__ ((always_inline)) const T& X::min(const T& a, const T& b)
{
 return a < b ? a : b;
}
# 2 "y.cpp" 2
int main()
{
 int a, b;
 return X::min(a, b);
}


-- 
   Summary: always_inline does not seem to force inlining when used
only in the definition of a function in a namespace
       Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lo at meep dot co dot uk


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



[Bug tree-optimization/34715] always_inline does not seem to force inlining when used only in the definition of a function in a namespace

2008-01-09 Thread lo at meep dot co dot uk


--- Comment #1 from lo at meep dot co dot uk  2008-01-09 11:42 ---
In addition, the following code fails with:

try.h: In function ‘int main()’:
try.h:9: sorry, unimplemented: inlining failed in call to ‘const T&
X::min(const T&, const T&) [with T = int]’: function not inlinable
y.cpp:5: sorry, unimplemented: called from here

Again, supplementing the first declaration of min with "inline __attribute__
((always_inline))" allows the code to compile successfully.

==

# 1 "y.cpp"
# 1 ""
# 1 ""
# 1 "y.cpp"
# 1 "try.h" 1


namespace X
{
 template 
 const T& min(const T& a, const T& b);

 template 
 inline __attribute__ ((always_inline)) const T& min(const T& a, const T& b)
 {
  return a < b ? a : b;
 }
}
# 2 "y.cpp" 2
template 
inline __attribute__ ((always_inline)) T y(const T& a, const T& b)
{
 return X::min(a, b);
}
int main()
{
 int a, b;
 return y(a, b);
}


-- 


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