From patchwork Mon Apr 29 20:14:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 240499 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D95262C00CB for ; Tue, 30 Apr 2013 06:14:21 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=oR1s0fgIUqbI/bmXdYba0raNUkvm37TFAqgQqCRINzw KnhvkL4K/nlrQLT2tVJCGc8glRrJFO1t0b6YF+F/O8UgXw9LolQgAI29a+achUu7 D6Suiood5CihO/jJnzm/C25OJ1HowTgKW68ZKuRz0jqbcX8p3jagW3n8OK8dkxkc = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=fHcH+p/gNgA8olAQm3iFr/XaKCY=; b=PzDbdOI2LIu1Ed5dl a3I5TNpDIRsu8Uky6Nd0hFE0IPX37TGFf5qfHIQ+LtpKexiBdJ62pRYeAJwTwC5l QmIKq7I7St06fDCMfnTBEIcWxV38Nqk/GnuEKQ41OnRvd+gtmnQOpYOT8ZWNhmsq Y6vdQdKq0s4HAQfK74QjmBpQaQ= Received: (qmail 3918 invoked by alias); 29 Apr 2013 20:14:15 -0000 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 Received: (qmail 3908 invoked by uid 89); 29 Apr 2013 20:14:15 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS, TW_ZJ autolearn=ham version=3.3.1 Received: from mail-oa0-f45.google.com (HELO mail-oa0-f45.google.com) (209.85.219.45) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 29 Apr 2013 20:14:14 +0000 Received: by mail-oa0-f45.google.com with SMTP id o17so6566851oag.18 for ; Mon, 29 Apr 2013 13:14:13 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.149.129 with SMTP id ua1mr14598325oeb.56.1367266453214; Mon, 29 Apr 2013 13:14:13 -0700 (PDT) Received: by 10.182.156.49 with HTTP; Mon, 29 Apr 2013 13:14:13 -0700 (PDT) Date: Mon, 29 Apr 2013 22:14:13 +0200 Message-ID: Subject: [PATCH, i386]: Fix PR44578, GCC generates MMX instructions but fails to generate "emms" From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" Cc: Teresa Johnson X-Virus-Found: No Hello! Attached patch fixes PR44578, where MMX register was allocated for zero_extendsidi2 RTX. The patch adds "!" to the interfering alternative, so RA won't choose alternative involving MMX register unless absolute necessary. 2013-04-29 Uros Bizjak PR target/44578 * config/i386/i386.md (*zero_extendisid2): Add "!" to m->?*y alternative. testsuite/ChangeLog: 2013-04-29 Uros Bizjak PR target/44578 * gcc.target/i386/pr44578.c: New test. Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} and was committed to mainline SVN. The patch will be backported to 4.7 and 4.8 branches. Uros. Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 198401) +++ config/i386/i386.md (working copy) @@ -3049,10 +3049,10 @@ (define_insn "*zero_extendsidi2" [(set (match_operand:DI 0 "nonimmediate_operand" - "=r,?r,?o,r ,o,?*Ym,?*y,?*Yi,?*x") + "=r,?r,?o,r ,o,?*Ym,?!*y,?*Yi,?*x") (zero_extend:DI (match_operand:SI 1 "x86_64_zext_operand" - "0 ,rm,r ,rmWz,0,r ,m ,r ,m")))] + "0 ,rm,r ,rmWz,0,r ,m ,r ,m")))] "" { switch (get_attr_type (insn)) Index: testsuite/gcc.target/i386/pr44578.c =================================================================== --- testsuite/gcc.target/i386/pr44578.c (revision 0) +++ testsuite/gcc.target/i386/pr44578.c (working copy) @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mtune=athlon64" } */ + +extern void abort (void); + +long double +__attribute__((noinline, noclone)) +test (float num) +{ + unsigned int i; + + if (num < 0.0) + num = 0.0; + + __builtin_memcpy (&i, &num, sizeof(unsigned int)); + + return (long double)(unsigned long long) i; +} + +int +main () +{ + long double x; + + x = test (0.0); + + if (x != 0.0) + abort (); + + return 0; +}