From patchwork Sat Aug 27 07:54:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 111855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id EDE1DB702E for ; Sat, 27 Aug 2011 17:54:50 +1000 (EST) Received: (qmail 16769 invoked by alias); 27 Aug 2011 07:54:48 -0000 Received: (qmail 16761 invoked by uid 22791); 27 Aug 2011 07:54:46 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pz0-f49.google.com (HELO mail-pz0-f49.google.com) (209.85.210.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 27 Aug 2011 07:54:32 +0000 Received: by pzk6 with SMTP id 6so7482978pzk.8 for ; Sat, 27 Aug 2011 00:54:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.216.20 with SMTP id o20mr1048745wfg.446.1314431671929; Sat, 27 Aug 2011 00:54:31 -0700 (PDT) Received: by 10.143.13.8 with HTTP; Sat, 27 Aug 2011 00:54:31 -0700 (PDT) Date: Sat, 27 Aug 2011 09:54:31 +0200 Message-ID: Subject: [PATCH, i386]: Fix PR50202, ICE: in final_scan_insn, at final.c:2709 (could not split insn) with __builtin_ia32_pcmpistri128 From: Uros Bizjak To: gcc-patches@gcc.gnu.org Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello! Attached patch fixes corner case with -fno-dse, where the insn has all outputs unused. Do not bother with the insn in this case and simply delete it from splitter. 2011-08-27 Uros Bizjak PR target/50202 * config/i386/sse.md (sse4_2_pcmpestr): Emit NOTE_INSN_DELETED note when all outputs are unused. (sse4_2_pcmpistr): Ditto. testsuite/ChangeLog: 2011-08-27 Uros Bizjak PR target/50202 * gcc.target/i386/pr50202.c: New test. Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}. Committed to mainline SVN and to 4.6. Uros. Index: config/i386/sse.md =================================================================== --- config/i386/sse.md (revision 178129) +++ config/i386/sse.md (working copy) @@ -9734,6 +9734,9 @@ operands[2], operands[3], operands[4], operands[5], operands[6])); + if (!(flags || ecx || xmm0)) + emit_note (NOTE_INSN_DELETED); + DONE; } [(set_attr "type" "sselog") @@ -9861,6 +9864,9 @@ emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL, operands[2], operands[3], operands[4])); + if (!(flags || ecx || xmm0)) + emit_note (NOTE_INSN_DELETED); + DONE; } [(set_attr "type" "sselog") Index: testsuite/gcc.target/i386/pr50202.c =================================================================== --- testsuite/gcc.target/i386/pr50202.c (revision 0) +++ testsuite/gcc.target/i386/pr50202.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-dse -fno-dce -msse4" } */ +/* { dg-require-effective-target sse4 } */ + +typedef char __v16qi __attribute__ ((__vector_size__ (16))); + +__v16qi v; +int i; + +void +foo (void) +{ + i = __builtin_ia32_pcmpistri128 (v, v, 255); + i = 255; +}