From patchwork Sat Aug 10 10:16:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1145132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-506628-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Ix3UrQYl"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 465J1V17bBz9sDQ for ; Sat, 10 Aug 2019 20:16:45 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=npMiRYDsuJY72r41tQX9ObGckfvQA nIVaogyGSndKHUymK8U2EM3DSiYqdvw0IAoK1yvO7NgqIiSiaSjBhRtfoKqdBTqp q9GrilW+sof4kH463jWVGhnWiXADVgHjV/KN0M6rEaPDsst7c/r+phkNQuDoZiql klLXGXEs/zJGCU= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=TRlTPCY7uqJakrhNKP9diSX/81s=; b=Ix3 UrQYlD4E8sfRxVvPuGVhqGF82GIwzRFiyHJ4Nzh181pHmwDkKsQXIZyeW7jFDkkB DAT0c9nBMNGVsaP94otdNtkzmZcMxRPdOaIJHfW+/U9EMD+ZyAMuiYf8lBMuRWbW MPZmdUoVFPtVk31qzVXXMrCQzF5qYXv0tWesVExs= Received: (qmail 44187 invoked by alias); 10 Aug 2019 10:16:38 -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 44173 invoked by uid 89); 10 Aug 2019 10:16:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=UD:c.jj, UD:jj, mmx, sk:ftreel X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Aug 2019 10:16:37 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 459B2796FC; Sat, 10 Aug 2019 10:16:36 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-200.ams2.redhat.com [10.36.116.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3AFA5D6A0; Sat, 10 Aug 2019 10:16:35 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x7AAGX57026817; Sat, 10 Aug 2019 12:16:34 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x7AAGX2f026816; Sat, 10 Aug 2019 12:16:33 +0200 Date: Sat, 10 Aug 2019 12:16:33 +0200 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [committed] Fix mmx usadv8qi expander (PR target/91408) Message-ID: <20190810101633.GH2726@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.11.3 (2019-02-01) X-IsSubscribed: yes Hi! As mentioned in the PR, both instructions this expander uses use register_mmxmem_operand predicate in the operands operands[2] and [3] are passed to, and register_mmxmem_operand is for TARGET_MMX_WITH_SSE just register_operand. Thus, the following patch adjusts the expander's predicates to match that. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk as obvious. 2019-08-10 Jakub Jelinek PR target/91408 * config/i386/mmx.md (usadv8qi): Use register_operand instead of vector_operand. * gcc.target/i386/pr91408.c: New test. Jakub --- gcc/config/i386/mmx.md.jj 2019-08-05 09:58:10.120454205 +0200 +++ gcc/config/i386/mmx.md 2019-08-09 09:49:09.933071645 +0200 @@ -1973,8 +1973,8 @@ (define_expand "reduc_plus_scal_v8qi" (define_expand "usadv8qi" [(match_operand:V2SI 0 "register_operand") (match_operand:V8QI 1 "register_operand") - (match_operand:V8QI 2 "vector_operand") - (match_operand:V2SI 3 "vector_operand")] + (match_operand:V8QI 2 "register_operand") + (match_operand:V2SI 3 "register_operand")] "TARGET_MMX_WITH_SSE" { rtx t1 = gen_reg_rtx (V1DImode); --- gcc/testsuite/gcc.target/i386/pr91408.c.jj 2019-08-09 09:52:08.357389049 +0200 +++ gcc/testsuite/gcc.target/i386/pr91408.c 2019-08-09 09:51:40.217812123 +0200 @@ -0,0 +1,29 @@ +/* PR target/91408 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-vectorize -fno-tree-forwprop" } */ + +long long a; +unsigned char b; +short *c; +int d; + +void +foo (long long *x) +{ + unsigned char *e = (char *) x; + int f, g = 0; + for (d = 0; d < 8; d++) + { + f = b - e[d]; + if (f < 0) + f = -f; + g += f; + } + c[0] = g; +} + +void +bar (void) +{ + foo (&a); +}