From patchwork Wed Aug 31 06:52:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp92066wro; Tue, 30 Aug 2022 23:53:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR51Kt+SONFr/7+byLFZPd6oxpdcRbL7dlqNycY4nzxaLtWUo6Muq2o2TEX68SrNP1zIMLKy X-Received: by 2002:a17:907:3e07:b0:741:81ba:13f1 with SMTP id hp7-20020a1709073e0700b0074181ba13f1mr9876048ejc.226.1661928790113; Tue, 30 Aug 2022 23:53:10 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o22-20020a509b16000000b00445fb842889si10453075edi.398.2022.08.30.23.53.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 23:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CatpTXyC; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D50F4383CCE6 for ; Wed, 31 Aug 2022 06:53:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D50F4383CCE6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661928788; bh=9opgp9WT3SALwf0U6ddrrMHbXjm0tJSGhidlOYhF7aU=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=CatpTXyCgP2eEtPNgR9l/Oc4JrsrQzHJY/SvUFmN2iq8Vt4rPfVfhOw5pd6m61Oza NrwKkWz3JrF/IibUDI3vLwDzVC8MAjvvYCoY/JtLjeI2BEyF8LmmZbyQB/8CXJOUMt BSQQDHCVfB0jHM1IuA2RaYZ6orB9AdbKNBzg12ws= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by sourceware.org (Postfix) with ESMTPS id AB134383CCDC for ; Wed, 31 Aug 2022 06:52:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AB134383CCDC X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="282359642" X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="282359642" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 23:52:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="645133048" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 30 Aug 2022 23:52:21 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 23:52:21 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 23:52:20 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 30 Aug 2022 23:52:20 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 30 Aug 2022 23:52:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YLn6iy7ya6VMpw0mLvcJSTFtJx1/17wGpbqxRQBrvn+riX293Qzf1XX2F8dzOZjeK5NCc2CSWSFZbqeyd59hog7esG+oQH4/kXNQtZwV5QJXmWWpFBko40HblTGaG7gLQcDGoCJA69XjBxD6PrtgZkD+MWWCJl2uoX0ewbEG0CNcdfK5oT+CwAcPa+4+OWrrIv+IqoYY1+306cpdd7Kd4ShkcNtJH0SDjR++TT9h+fCffH7fpTZ0z4nUHWcKT1A1v/7TTLxc96axDAy8RyPzGLdik9k+ZgacX568omm7NOnSg7XnjH4OZeWz+CnIXDqjuX2lM7dP909M+HUv5QLjrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9opgp9WT3SALwf0U6ddrrMHbXjm0tJSGhidlOYhF7aU=; b=GNT5B3Bmy6aVy7KNRJ78dKTDC652Du8O03MpOMGdooqNxEYFyZWSUW7pXgfvV6J025SNPOYJWFCHpQHy8qEIjQc8RTe/VKZzMjoXPvCrQUSwoxX6zgA0t2h7zSZE4qPBQbq73Jcdga55xeifc51QyJOw0RQ5EdvyX4L9ZZwSyIA7qCSy9QRE6TeINGQE65vNhLcgFFcN32nugAWdQnYuro4fs0ckWCi7ZDtlTX4yHqmuNYANlm5W67u/uc2xYxWh72COssrivSHfFmYqOhVO2BnsIaRd74f/ozRB1dX1pGewCwhu+aypJzK07Xh8OPf5XUrLLPPT2q4qBJAdVhQHUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB5487.namprd11.prod.outlook.com (2603:10b6:5:39f::22) by DS7PR11MB5989.namprd11.prod.outlook.com (2603:10b6:8:70::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Wed, 31 Aug 2022 06:52:19 +0000 Received: from DM4PR11MB5487.namprd11.prod.outlook.com ([fe80::1cf5:eb50:5eb:a1c3]) by DM4PR11MB5487.namprd11.prod.outlook.com ([fe80::1cf5:eb50:5eb:a1c3%9]) with mapi id 15.20.5566.021; Wed, 31 Aug 2022 06:52:19 +0000 To: "Liu, Hongtao" , "gcc-patches@gcc.gnu.org" Subject: [PATCH] x86: Handle V8BF in expand_vec_perm_broadcast_1 Thread-Topic: [PATCH] x86: Handle V8BF in expand_vec_perm_broadcast_1 Thread-Index: AQHYvQW6IovsVyof/UufYFgnr99lMK3IkZGQ Date: Wed, 31 Aug 2022 06:52:19 +0000 Message-ID: References: <20220831064846.1305576-1-lingling.kong@intel.com> In-Reply-To: <20220831064846.1305576-1-lingling.kong@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: aaa669cb-fc24-4f74-d36f-08da8b1d5910 x-ms-traffictypediagnostic: DS7PR11MB5989:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /MRpw+484L7NuppgRHFTjUDYqP3d1pEIuTMbuLzSV6GVp/sQEehOt0U6phSXNG8z6/eEr3uXrs039+iYIqbQ3sAqdhZDTr4jhlNhPI7IXjnyIkpTeD+HKfnmqRXo2jqVSV3DnhJOyMHTs/x0sbLfAwHyUl0xRk3+Oe8ZiAWdAyEfnB/L4WvQS1Qi6of0DVO8w4OwA9OP9WwDdDAhvm/8ZfF1wCTbXdl0tHFtU/Me7fmRcGrc9aJvPcT3eKqkUDhqhKWFbH8vA4dDtWhQ6K50y+IyUfpJCVYFI/CoxNncYjuHMKVPRpI7fzHMpWCcxV21Ah4fP3oC89tSO5arJMPF8hBGhTrN4xNtQMGlG0qhTU+KdBFbpr10TqFX01eAdEu/puMS/y3/WZpSdq/upyoTCNvENAX4U8eO4Ukw+GzcOWS0L2xO+z92RQ2VoKztEWQPm30JOHFNcAQPkhb42Bau3PjxYCdhem0hamRxCcSb2yHgD2XHVSLi14aeV1h4zL9DRzyD/Z0LvkvMNS00Qxk37bhh6hNfFACOM+05kS8WEUkrstu8xRXzl/PThpMbhojY7RbFeXvkVM+FY8jSGb4qTFTJrKfnUGqLJDhbqvGcpL63Ju0FL7O7Zn1moy8oiZSKnPiFkQ0BQ7LkPzj2vyhgFtC7uT5yJ4WaLpRSqBDHgteUKoR8AxfRBoS2SxKp79tdgeJTIvrTtDC12ejsRxDX+BFEfCef7U8DsSedk53azvvqqjMmKPrmSy9mUGAyrsIxOXxcZCt9JIBBZYzEPeP33EbdEU+JvjbEgj0F2CK2ZIws1A/SqSJ3L691u3n07H9p x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5487.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(346002)(396003)(376002)(366004)(39860400002)(4326008)(8676002)(66946007)(84970400001)(66556008)(83380400001)(64756008)(66446008)(76116006)(316002)(478600001)(71200400001)(110136005)(55016003)(66476007)(52536014)(2906002)(5660300002)(8936002)(82960400001)(38070700005)(122000001)(38100700002)(86362001)(33656002)(9686003)(26005)(6506007)(7696005)(186003)(41300700001)(107886003)(32563001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: Si73a+mBhoWWvqiKkW8l31x5sttEKKbJU86yXDZXdd0BYuRtGb+u20f/1EAxARy0ugEDe1vyddo81bh7eKyVQxXqXL8FsJfoPevM/0MsVrzBgje2wxUBjQBV55OHjKCR6c36B6a68R53yHzxs+4UepOZiJLeE2/Eax3jkTN21sA3NU0hOjAvbabPGFPNd1i3VVUhMk48ZltRRZi/pJN0BhuKtmM4V7yQc2ed1fr+mcXjfHzn6sZQd972TQc9liZ9HxSg2jkAG8qGnBj0DDUq9SRr6DczNqqAsTWb5Xet/bnAQ3sCr5CwHblCtGuX2Xolq0v/mTR2aPuvBd7paEouilvt5k47oE68Wbw+1E7N/A8pa9DbUu17ENfd/3O291Jd1mlEfKT4o6DljczhJMKU05C0AokdWowQ4fdaL5HgTkzIMs4+xcZEzXYYP2UEowscADA3kjS4iEmKYpTIcD61vwfJC8mzAKlnFrZQ9y+QcrUs4W3zFYN40oL5Ptk2oQg5bFtpR46GvZFNZwwjGRnegQ/CnQ6u7WHCWEVRWHNkBfcdYGKADJ5lqoiSPfLFVxdzfU9xLXDptS8X6OPSz6vytC2OtQFCLu/4bP2WTTfXzzOaXfvjbYFAtWSWJjK2P0PaxQZ/9pQbWwFSY8IV1BUvIF0LSFSHaYi04X+5D74GxT9ombWWXdhgaVGoQtkkBMKn2gkP/vPIJlpdLeX4o+yDfZXp9xxibRYO19XHngJBpVtJViGC0+0WJoDzAFXB69FzLNpcr+byMuoLR+mJv3wNhpO4BYKJG/uPivwzl9cMIM6R931ayHiK/Vd3RMxuN2FaldG8u7tp7zrSYCPEd6/QYBctonkJNrxTBShwOufCC0i7myhGpydMiZBBXUveCP+xR01rYH0n3dcqj7+xa4satbFNLcbYKn3I8h/pH2YpkSIFXLOImRAdd1tV6aWC+XnKRsQKCPcgXENrW/yjiTN+e6kltLVJaSz40uND4NlDUyCK7owT5pkQPZEpIVBNqahld93BIUjPS4erCHfKN+askGLwIhJxQ2g7ql+Bqw9IvNrftmWHEPlPC6iazqIlY0u7g1qT8HrNcfGRxqfvAMvtWvUmnOn7CdtiV3KREFhreVY35iUAj5KdTBut5ISlO0aPsnrWvUsWL6OPSnPQ/C+vRladew2hNJMIJbQlE32MH4HSe2pDLS2JygRF+AwlcjHbVOe6e7fdlFBnPKyn8/CcTrkU7mtmQqaTkwqZfLuJKNCUFcfHx20ZpFxQSMhfcodMoybhIvRVxpaIk8WKaMPtDAVqs9U4xEcm33d/OhOwCW/bhOxWHMfw90Kc/jjCtGRWXDKojZ/JTWIK+JetM0Hgv2145PHPTamItUj/J9mpMKOQgvoMxYtiB1Yt91eo/MvK7lJsbYP6GV1pG2+U4YvsrYQTPeJQ4nEyQNGfhDVd/k4DlrXvEo/aOJ08tXGDltTzxohlgOW6ESLH2sOaZjkjfc2qVWwFm7AgoxVdThY6izXWljAjUITLYElmxReHyZAKZ+jxeEEl++eCTqgD/segD70pSwUkuFuUijkWgphy813mdbrK62tYmdtDsFNKLrs+ MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5487.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aaa669cb-fc24-4f74-d36f-08da8b1d5910 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Aug 2022 06:52:19.0465 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: m64jHw7rqrOE3VSx9qCVqU8arkIo5188Jvc+2OJwTYqmrSb/QC734ijlTm3OjS/Z6aAUwlNxhON41P6CVHtmEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB5989 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Kong, Lingling via Gcc-patches" From: "Li, Pan2 via Gcc-patches" Reply-To: "Kong, Lingling" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742658643047128448?= X-GMAIL-MSGID: =?utf-8?q?1742658643047128448?= Hi, Handle E_V8BFmode in expand_vec_perm_broadcast_1 and ix86_expand_vector_init_duplicate. Ok for trunk? gcc/ChangeLog: PR target/106742 * config/i386/i386-expand.cc (ix86_expand_vector_init_duplicate): Handle V8BF mode. (expand_vec_perm_broadcast_1): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr106742.c: New test. --- gcc/config/i386/i386-expand.cc | 17 ++++++++++++----- gcc/testsuite/gcc.target/i386/pr106742.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr106742.c diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 4b216308a18..a08222fe1b6 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -15030,11 +15030,15 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, machine_mode mode, dperm.op0 = dperm.op1 = gen_reg_rtx (mode); dperm.one_operand_p = true; - if (mode == V8HFmode) + if (mode == V8HFmode || mode == V8BFmode) { - tmp1 = force_reg (HFmode, val); + rtx (*gen_vec_set_0) (rtx, rtx, rtx) = NULL; + tmp1 = mode == V8HFmode ? force_reg (HFmode, val) + : force_reg (BFmode, val); tmp2 = gen_reg_rtx (mode); - emit_insn (gen_vec_setv8hf_0 (tmp2, CONST0_RTX (mode), tmp1)); + gen_vec_set_0 = mode == V8HFmode ? gen_vec_setv8hf_0 + : gen_vec_setv8bf_0; + emit_insn (gen_vec_set_0 (tmp2, CONST0_RTX (mode), tmp1)); tmp1 = gen_lowpart (mode, tmp2); } else @@ -21822,17 +21826,20 @@ expand_vec_perm_broadcast_1 (struct expand_vec_perm_d *d) return true; case E_V8HFmode: + case E_V8BFmode: /* This can be implemented via interleave and pshufd. */ if (d->testing_p) return true; if (elt >= nelt2) { - gen = gen_vec_interleave_highv8hf; + gen = vmode == V8HFmode ? gen_vec_interleave_highv8hf + : gen_vec_interleave_highv8bf; elt -= nelt2; } else - gen = gen_vec_interleave_lowv8hf; + gen = vmode == V8HFmode ? gen_vec_interleave_lowv8hf + : gen_vec_interleave_lowv8bf; nelt2 /= 2; dest = gen_reg_rtx (vmode); diff --git a/gcc/testsuite/gcc.target/i386/pr106742.c b/gcc/testsuite/gcc.target/i386/pr106742.c new file mode 100644 index 00000000000..4a53cd49902 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr106742.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options " -msse2 -mno-avx2 -O1" } */ +typedef __bf16 v8bf __attribute__ ((__vector_size__ (16))); + +v8bf +vec_init_dup_v8bf (__bf16 a1) +{ + return __extension__ (v8bf) { a1, a1, a1, a1, a1, a1, a1, a1 }; } +/* { dg-final { scan-assembler-times "punpcklwd" 1} } */ -- 2.18.2