From 71aaa2ff33c3699b3feafc9b409f83bf8b52213c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 9 Sep 2008 21:18:55 +0200 Subject: [PATCH] re PR target/37438 (ICE in extract_insn, at recog.c:2027 for i{4,5}86) PR target/37438 * config/i386/i386.md (zero_extendqihi2_movzbl): Enable when optimizing for size, not speed. * gcc.dg/pr37438.c: New test. From-SVN: r140167 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.md | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr37438.c | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr37438.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a255250c73..41d43e68e6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-09-09 Jakub Jelinek + PR target/37438 + * config/i386/i386.md (zero_extendqihi2_movzbl): Enable when optimizing + for size, not speed. + PR rtl-optimization/37408 * function.c (assign_parm_find_stack_rtl): Set correct MEM_SIZE if parm is promoted. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index d952847b266..976bc727e45 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -3713,7 +3713,7 @@ (define_insn "*zero_extendqihi2_movzbl" [(set (match_operand:HI 0 "register_operand" "=r") (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))] - "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_speed_p (cfun)) + "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun)) && reload_completed" "movz{bl|x}\t{%1, %k0|%k0, %1}" [(set_attr "type" "imovx") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79182a476c1..86a9042c263 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2008-09-09 Jakub Jelinek + PR target/37438 + * gcc.dg/pr37438.c: New test. + PR c++/37389 * g++.dg/parse/enum4.C: New test. diff --git a/gcc/testsuite/gcc.dg/pr37438.c b/gcc/testsuite/gcc.dg/pr37438.c new file mode 100644 index 00000000000..a6e366dc3c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr37438.c @@ -0,0 +1,21 @@ +/* PR target/37438 */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-options "-Os -march=i486" { target { { i686-*-* x86_64-*-* } && ilp32 } } } */ + +extern int bar (unsigned long long int); +extern int baz (const char *, unsigned int, unsigned short); + +int +foo (unsigned long long int x) +{ + return (x & 0xff) | ((unsigned int) (x >> 12) & ~0xff); +} + +int +test (const char *v, unsigned int w, unsigned long long int x) +{ + unsigned short k; + k = ((bar (x) & 0xff) << 8) | (foo (x) & 0xff); + return baz (v, w, k); +}