1 2002-05-31 Jakub Jelinek <jakub@redhat.com>
4 * combine.c (combine_simplify_rtx) [SUBREG]: Don't ICE if VOIDmode
5 operand subreg cannot be simplified.
7 * gcc.dg/20020531-1.c: New test.
9 --- gcc/testsuite/gcc.dg/20020531-1.c.jj Fri May 31 17:15:15 2002
10 +++ gcc/testsuite/gcc.dg/20020531-1.c Fri May 31 17:13:50 2002
12 +/* PR optimization/6842
13 + This testcase caused ICE when trying to optimize V8QI subreg of VOIDmode
15 +/* { dg-do compile { target i?86-*-* } } */
16 +/* { dg-options "-O2 -mmmx" } */
18 +typedef int __v8qi __attribute__ ((__mode__ (__V8QI__)));
19 +extern void abort (void);
20 +extern void exit (int);
24 + unsigned long long a = 0x0102030405060708LL;
25 + unsigned long long b = 0x1020304050607080LL;
26 + unsigned long long c;
28 + c = (unsigned long long) __builtin_ia32_paddusb ((__v8qi) a, (__v8qi) b);
29 + __builtin_ia32_emms ();
30 + if (c != 0x1122334455667788)
33 --- gcc/combine.c.jj Thu May 23 10:22:59 2002
34 +++ gcc/combine.c Fri May 31 17:05:09 2002
35 @@ -3863,7 +3863,12 @@ combine_simplify_rtx (x, op0_mode, last,
37 /* simplify_subreg can't use gen_lowpart_for_combine. */
38 if (CONSTANT_P (SUBREG_REG (x))
39 - && subreg_lowpart_offset (mode, op0_mode) == SUBREG_BYTE (x))
40 + && subreg_lowpart_offset (mode, op0_mode) == SUBREG_BYTE (x)
41 + /* Don't call gen_lowpart_for_combine if the inner mode
42 + is VOIDmode and we cannot simplify it, as SUBREG without
43 + inner mode is invalid. */
44 + && (GET_MODE (SUBREG_REG (x)) != VOIDmode
45 + || gen_lowpart_common (mode, SUBREG_REG (x))))
46 return gen_lowpart_for_combine (mode, SUBREG_REG (x));
48 if (GET_MODE_CLASS (GET_MODE (SUBREG_REG (x))) == MODE_CC)