Bug 8869 - [x86 MMX] ICE with const variable optimization and MMX builtins
Summary: [x86 MMX] ICE with const variable optimization and MMX builtins
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: 3.3.2
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code, monitored
Depends on: 7277 10984
  Show dependency treegraph
Reported: 2002-12-07 21:06 UTC by otaylor
Modified: 2003-09-15 15:20 UTC (History)
2 users (show)

See Also:
Target: i?86-*-*
Known to work:
Known to fail:
Last reconfirmed: 2003-07-01 16:15:13


Note You need to log in before you can comment on or make changes to this bug.
Description otaylor 2002-12-07 21:06:00 UTC
There seems to be problems related to compile time
determinable constants as arguments of the MMX builtin functions.

(This bug appears to occur with gcc-3.2 as well, though
I've only tested the Red Hat 8 compiler, not stock 3.2)

CVS head, 7 December 2002


The following code, when compiled with:

 gcc -c -O1 -mmmx -march=i686 -mcpu=i686 constant-pool-bug.c

typedef int v4hi __attribute__ ((mode(V4HI)));
typedef int di __attribute__ ((mode(DI)));

static const di mmx_constants[1] = { 0x00ff000000000000LL };

v4hi foo (v4hi val)
  return __builtin_ia32_paddw (val, (v4hi)mmx_constants[0]);


constant-pool-bug.c: In function `foo':
constant-pool-bug.c:9: internal compiler error: in output_constant_pool, at varasm.c:3485

This does not occur with -O0.

Note that the cast to 'v4hi' seems to be important here.
If you try the same thing using porl, which takes a 'di'

typedef int di __attribute__ ((mode(DI)));

static const di mmx_constants[1] = { 0x00ff000000000000LL };

di foo (di val)
  return __builtin_ia32_por (val, mmx_constants[0]);

You get a different ICE:

constant-pool-bug.c: In function `foo':
constant-pool-bug.c:7: internal compiler error: in ix86_expand_binop_builtin, at config/i386/i386.c:12819

Which I believe is a a duplicate of #8600. (Some 
circumstantial evidence indicates that #8600 is hiding 
this bug here, not vice versa, but I'm not sure about 
Comment 1 Volker Reichelt 2002-12-08 13:27:18 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    The bug is already present in gcc 3.1
Comment 2 Dara Hazeghi 2003-05-09 21:54:03 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org
Subject: Re: target/8869: [x86 MMX]ICE with const variable optimization and MMX builtins
Date: Fri, 9 May 2003 21:54:03 -0700

 I can confirm that on gcc 3.2.3, 3.3 branch and mainline, the ICE noted  
 in this PR is still present.
Comment 3 Andrew Pinski 2003-06-02 05:27:49 UTC
The second ICE is the same as bug 10984 which has a different testcase but the same 
Comment 4 Andrew Pinski 2003-06-17 02:12:56 UTC
The first ICE was already filed under 7277.
Comment 5 Volker Reichelt 2003-06-19 19:45:50 UTC
The bug does not appear on the tree-ssa-branch.
Comment 6 Andrew Pinski 2003-06-19 20:07:17 UTC
It might not show up on the tree-ssa branch because the rtl is different does not mean this is not a 
bug that still needs to be fixed because it can happen (do not know how) on tree-sssa branch.
Comment 7 Volker Reichelt 2003-06-26 11:05:37 UTC
Now the ICE also appears on the tree-ssa-branch.
Comment 8 Andrew Pinski 2003-07-07 13:51:55 UTC
This is not a regression, removing markers and setting milestone to 3.4.
Comment 9 CVS Commits 2003-08-23 21:19:05 UTC
Subject: Bug 8869

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	hubicka@gcc.gnu.org	2003-08-23 21:18:58

Modified files:
	gcc            : expr.c ChangeLog 
	gcc/config/i386: i386.c i386.h i386.md 

Log message:
	PR target/11369
	* i386.c (ix86_expand_carry_flag_compare): Validate operand.
	PR target/11031
	* i386.c (const_0_to_3_operand, const_0_to_7_operand,
	const_0_to_15_operand, const_0_to_255_operand): New predicates.
	* i386.h (PREDICATE_CODES): Add these.
	* i386.c (pinsrw and pextrw patterns): Use them.
	PR target/10984
	* i386.c (ix86_expand_binop_builtin): Behave sanely for VOIDmodes.
	PR target/8869
	* expr.c (convert_modes): Deal properly with integer to vector
	constant conversion.
	PR target/8871
	* i386.md (zero_extendsidi2*): Add MMX and SSE alternatives.


Comment 10 Andrew Pinski 2003-08-23 21:53:31 UTC
Fixed on the mainline by the patch above.
Comment 11 CVS Commits 2003-09-06 08:06:19 UTC
Subject: Bug 8869

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	hubicka@gcc.gnu.org	2003-09-06 08:06:16

Modified files:
	gcc            : expr.c ChangeLog 

Log message:
	PR target/8869
	* expr.c (convert_modes): Deal properly with integer to vector
	constant conversion.