[Bug c/23972] New: Codegen Error in Inlined Code

evandro at yahoo dot com gcc-bugzilla@gcc.gnu.org
Mon Sep 19 20:05:00 GMT 2005


When building the attached file with -O3 (to enable inlining), Saturate16 () is
inlined in Mul16_all () and its return value is lost:

	movq	%mm0, -24(%rsp)	# 
	emms
	movw	%cx, (%r8)	# tmp83,* pDst

Note that the %cx is not loaded from the slot at "-24(%rsp)" before it's stored.
 The correct would be:

	movq	%mm0, -24(%rsp)	# 
	emms
	movw	-24(%rsp), %cx	# tmp83,* pDst
	movw	%cx, (%r8)	# tmp83,* pDst

Better yet:

	movq	%mm0, (%r8)	# 
	emms

The same error happens in 32-bit mode ("-m32 -mmmx").  This error affects 4.0.0
as well.

-- 
           Summary: Codegen Error in Inlined Code
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: evandro at yahoo dot com
                CC: gcc-bugs at gcc dot gnu 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=23972



More information about the Gcc-bugs mailing list