Bug 32123 - gcc.target/i386/sse2-vec-6.c fails for -mtune=k8
Summary: gcc.target/i386/sse2-vec-6.c fails for -mtune=k8
Status: RESOLVED DUPLICATE of bug 26449
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 33329
  Show dependency treegraph
 
Reported: 2007-05-28 07:48 UTC by Uroš Bizjak
Modified: 2007-09-07 10:42 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uroš Bizjak 2007-05-28 07:48:36 UTC
This testcase fails for:

gcc -O2 -msse2 -mtune=k8 sse2-vec-6.c

Analyzing compilation unit
Performing interprocedural optimizations
 <visibility> <early_local_cleanups> <inline> <static-var> <pure-const> <type-escape-var>Assembling functions:
 i386_cpuid_ecx i386_cpuid_edx i386_extended_cpuid_ecx i386_extended_cpuid_edx sse2_test
sse2-vec-6.c: In function âsse2_testâ:
sse2-vec-6.c:69: internal compiler error: in expand_simple_binop, at optabs.c:1214
Please submit a full bug report,

Backtrace:

#0  fancy_abort (file=0x8701de4 "../../gcc-svn/trunk/gcc/optabs.c", line=1214, function=0x87022f2 "expand_simple_binop") at ../../gcc-svn/trunk/gcc/diagnostic.c:656
#1  0x082706e7 in expand_simple_binop (mode=V2SFmode, code=VEC_SELECT, op0=0xb795a57c, op1=0xb792c938, target=0xb795c350, unsignedp=1, methods=OPTAB_LIB_WIDEN) at ../../gcc-svn/trunk/gcc/optabs.c:1214
#2  0x081a5edb in force_operand (value=0xb795a5ac, target=0xb795c350) at ../../gcc-svn/trunk/gcc/expr.c:6084
#3  0x086144ab in move_invariant_reg (loop=0xb794ef74, invno=0) at ../../gcc-svn/trunk/gcc/loop-invariant.c:1178
#4  0x0861580d in move_loop_invariants () at ../../gcc-svn/trunk/gcc/loop-invariant.c:1240
#5  0x086137d5 in rtl_move_loop_invariants () at ../../gcc-svn/trunk/gcc/loop-init.c:239
#6  0x08276976 in execute_one_pass (pass=0x87c7280) at ../../gcc-svn/trunk/gcc/passes.c:1067

The problem is that we enter force_operand() with:

(gdb) p debug_rtx (value)
(vec_select:V2SF (subreg:V4SF (reg:V2DI 91 [ pretmp.201 ]) 0)
    (parallel [
            (const_int 0 [0x0])
            (const_int 1 [0x1])
        ]))

There is no optab for vec_select, and we crash later in assert in expand_simple_optab() on uninitialized optab.

The failure is actually the same as in PR26449, however the solution [1] looks rather suspicious to me, as force_operand() won't return NULL, but would crash via expand_simple_optab() for RTXs without optab.

[1] http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00313.html
Comment 1 Uroš Bizjak 2007-05-28 08:35:00 UTC
Standalone testcase, compile with -O2 -msse2 -mtune=k8:

--cut here--
typedef short __v8hi __attribute__ ((__vector_size__ (16)));
typedef long long __m128i __attribute__ ((__vector_size__ (16)));

void sse2_test (void)
{
  union
  {
    __m128i x;
  } val1, res[8], tmp;
  short ins[8] = { 8, 5, 9, 4, 2, 6, 1, 20 };
  int i;

  for (i = 0; i < 8; i++)
    {
      tmp.x = val1.x;
      if (memcmp (&tmp, &res[i], sizeof (tmp)))
	(__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi) val1.x, ins[i], 0);
    }
}
--cut here--
Comment 2 Uroš Bizjak 2007-06-01 06:42:40 UTC

*** This bug has been marked as a duplicate of 26449 ***