From patchwork Thu Jun 27 08:59:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 1123193 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-503855-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Ly4XkRLv"; 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 45ZDNX5p4Tz9sCJ for ; Thu, 27 Jun 2019 18:59:24 +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 :message-id:date:from:to:cc:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=XUMnu+X884SurpsG 5saNHsqInjTED7BM6eO9LT+YTWa5+E0glugFVCn9W7q3DuaTh77DzPjbT4MT9Jts RZ/Cv+wPGQlumGRWMnBLczc3jLl07gjyaLA0OWG+SSYYezch+yJF0qJ78LUslTp4 qE1vdCMpYzn6uI8iuWbUt70R+Us= 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 :message-id:date:from:to:cc:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=7AlKD/t6PZSuuLsfK2lB66 3/aGk=; b=Ly4XkRLvdUlgkg/t4hCgsCtxVOKggvpppF6XH8jI3/uEuj2pUf0946 8v0HT2UIMCVy9SHQw5ZcEx/MZi3AIFFAiGpwvzEmYXpH1bBtc9y3Xmx5wRaXbq9o DCtzaBVmGTj4ClGLVo1g1garE+XCIzwa9LyjJWpqsDPCUjsfmqIYQ= Received: (qmail 87963 invoked by alias); 27 Jun 2019 08:59:17 -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 87950 invoked by uid 89); 27 Jun 2019 08:59:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=avx512, AVX512 X-HELO: prv1-mh.provo.novell.com Received: from prv1-mh.provo.novell.com (HELO prv1-mh.provo.novell.com) (137.65.248.33) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Jun 2019 08:59:16 +0000 Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Thu, 27 Jun 2019 02:59:14 -0600 Message-Id: <5D14855F020000780023B73D@prv1-mh.provo.novell.com> Date: Thu, 27 Jun 2019 02:59:11 -0600 From: "Jan Beulich" To: Cc: "Kirill Yukhin" , , Subject: [PATCH] x86/AVX512: improve generated code for bit-wise negation of vectors of integers Mime-Version: 1.0 Content-Disposition: inline NOT on vectors of integers does not require loading a constant vector of all ones into a register - VPTERNLOG can be used here (and could/should be further used to carry out other binary and ternary logical operations which don't have a special purpose instruction). gcc/ 2019-06-27 Jan Beulich * config/i386/sse.md (ternlogsuffix): New. (one_cmpl2): Don't force CONSTM1_RTX into a register when AVX512F is in use. (one_cmpl2): New. --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -853,6 +853,13 @@ (V4SF "k") (V2DF "q") (SF "k") (DF "q")]) +;; Mapping of vector modes to VPTERNLOG suffix +(define_mode_attr ternlogsuffix + [(V8DI "q") (V4DI "q") (V2DI "q") + (V16SI "d") (V8SI "d") (V4SI "d") + (V32HI "d") (V16HI "d") (V8HI "d") + (V64QI "d") (V32QI "d") (V16QI "d")]) + ;; Number of scalar elements in each vector type (define_mode_attr ssescalarnum [(V64QI "64") (V16SI "16") (V8DI "8") @@ -12564,9 +12571,22 @@ (match_dup 2)))] "TARGET_SSE" { - operands[2] = force_reg (mode, CONSTM1_RTX (mode)); + if (!TARGET_AVX512F) + operands[2] = force_reg (mode, CONSTM1_RTX (mode)); + else + operands[2] = CONSTM1_RTX (mode); }) +(define_insn "one_cmpl2" + [(set (match_operand:VI 0 "register_operand" "=v") + (xor:VI (match_operand:VI 1 "nonimmediate_operand" "vm") + (match_operand:VI 2 "vector_all_ones_operand" "BC")))] + "TARGET_AVX512F" + "vpternlog\t{$0x55, %1, %0, %0|%0, %0, %1, 0x55}" + [(set_attr "type" "sselog") + (set_attr "prefix" "evex") + (set_attr "mode" "")]) + (define_expand "_andnot3" [(set (match_operand:VI_AVX2 0 "register_operand") (and:VI_AVX2