This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49140] [4.6 regression] wrong code with -O2 and -O3, not with -O3 -no-inline
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 20 Jul 2011 17:29:14 +0000
- Subject: [Bug tree-optimization/49140] [4.6 regression] wrong code with -O2 and -O3, not with -O3 -no-inline
- Auto-submitted: auto-generated
- References: <bug-49140-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49140
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-20 17:26:11 UTC ---
The inline asm in that function is invalid:
:
: "r" (m_rounds), "r" (input), "r" (iterationCount), "r" (m_state.data()),
"r" (output), "r" (workspace.m_ptr)
: "%eax", "%edx", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3",
"%xmm4", "%xmm5", "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%xmm11",
It tells the compiler that it only uses the 6 input registers, while it
modifies 3 of them, e.g. the asm string contains:
"add %1" ", " "1*16" ";"
"sub %2" ", " "4" ";"
"add %4" ", " "1*16" ";"
GCC can assume that it will find the old content in the register after the
inline asm and will find there something completely different.
For the inputs that are clobbered, the pattern should use something like:
void *dummy1;
... asm volatile ("..." : "=r" (dummy1) : "0" (input_value));
to say that it can't be used.