This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/4999: asm code with concatenated content fails in template class member functions
- From: sethml at ofb dot net
- To: rodrigc at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org,nobody at gcc dot gnu dot org, sethml at ofb dot net
- Date: Mon, 03 Dec 2001 21:29:17 -0800
- Subject: Re: c++/4999: asm code with concatenated content fails in template class member functions
> I don't think you have valid asm. Here is what gcc 3.0.3 (prerelease)
> says when I try to compile your code:
Uh, I filed the bug report against 2.95.4, not 3.0. It looks like
gcc-3.0 became more strict about stray '%'s in code. If I fix the
'%'s, the problem remains. Note that it is only a problem with 2.95 -
apparently it's been fixed in 3.0. I'm making the assumption that
2.95 is still being actively maintained.
Here's a version that compiles under gcc-3.0, but breaks gcc-2.95.4:
template <class X> struct test {
static int foo(int *b1, int *b2) {
__asm__ ("movq" " %0, %%" "mm2" : : "m" (*(long long *)b1));
__asm__ ("movq" " %%" "mm2" ", %%" "mm3") ;
__asm__ ("punpckhbw" " %%" "mm0" ", %%" "mm2") ;
__asm__ ("punpckhbw" " %%" "mm0" ", %%" "mm3") ;
__asm__ ("movq" " %0, %%" "mm4" : : "m" (*(long long *)b2));
__asm__ ("movq" " %%" "mm4" ", %%" "mm5") ;
__asm__ ("punpckhbw" " %%" "mm0" ", %%" "mm4") ;
__asm__ ("punpckhbw" " %%" "mm0" ", %%" "mm5") ;
__asm__ ("psubsw" " %%" "mm4" ", %%" "mm2") ;
__asm__ ("psubsw" " %%" "mm5" ", %%" "mm3") ;
__asm__ ("pmaddwd" " %%" "mm2" ", %%" "mm2") ;
__asm__ ("pmaddwd" " %%" "mm3" ", %%" "mm3") ;
__asm__ ("paddd" " %%" "mm2" ", %%" "mm1") ;
__asm__ ("paddd" " %%" "mm3" ", %%" "mm1") ;
}
};
int main(int argc) {
test<int>::foo(&argc, &argc);
}
Seth