From patchwork Wed Jul 5 13:50:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 116146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1883651vqx; Wed, 5 Jul 2023 06:51:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEr+7vxT/v4xDQ73PX9COHsX+U7zVniBbgbNX6akcqwEQBoo9L03Ty8hd+EpdgzE8oeLJ2X X-Received: by 2002:aa7:c98c:0:b0:51d:9db4:8201 with SMTP id c12-20020aa7c98c000000b0051d9db48201mr11303362edt.7.1688565099215; Wed, 05 Jul 2023 06:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688565099; cv=none; d=google.com; s=arc-20160816; b=Ls1JOwTioI4lZzW3sAssQ81L1bQFo/eDXjSEf1+P1uNJoLs/E/G9nSPSFvwtVWDp6O yLL6YrrlKYG7zfZBi0T74AU+0aEtuJ7a98nHd7RcTbjx3iuzPnB2WaB4KK6ZtPzd+Qyq ciH6g63FIy2mk71AqdDaPuFVB/S1BN032CbEqDzCQ06uRTbBN2i8pZJR5nubsCA3siEe 3x9fiaonBb7owfCnEI3OjWcq5yKzhOWlgsJm/MVCr/ah/4qQw47GEGAWO8mX4A6EpDh/ B12eML7uREYu1ai9FX7Vg04Dpsh0RkTNQYduUSRMdVY5m0OmbZeCCyNMVPTIroqaoR8u eLCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=MRtVB2/+sIDFa2hrvWchtBCtQvz7i7xnuQfnJLOimZo=; fh=wJQXjlF2pzwEVBXObiUXCE1/GsELYeDpatHPYmXU/Wc=; b=0roWOgu4xxNk3YquBLIdfDC4S2UZR/5hQbdt8QVHATLMDkBUjgdx4TcJubf2s2fZOR M3ivtBOmDR1rW+Fy4CVHg4VSYFLmFprBJlRjnIErPej1WYfV64R77xKfBcM5DLRMvI7q rbc20rWb3l0aJ+srJlPa/HO1w+kneQDp5dTl5x4tbIRKk8ZmVozMcf/U8mBRWSDdGAJf cTS+O6e7Ff40LWOfiREeKIINXfKCGth4ousjd5AE88Msa+HUZyxCA+8sQJIppjymdyGY PyVVfakfJZiwoF0K6ryJC0GYadq8B+iwkVTmNCog466pKIoycttoZq8d6Sf4cxTATNJE 24fg== ARC-Authentication-Results: i=1; mx.google.com; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j24-20020a50ed18000000b0051e2a1744f3si138830eds.26.2023.07.05.06.51.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 06:51:39 -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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 69311385773C for ; Wed, 5 Jul 2023 13:51:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by sourceware.org (Postfix) with ESMTPS id A671E3858C5E for ; Wed, 5 Jul 2023 13:50:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A671E3858C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp91t1688565027tdwg26my Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 05 Jul 2023 21:50:26 +0800 (CST) X-QQ-SSF: 01400000000000G0T000000A0000000 X-QQ-FEAT: 90EFqYDyPxC3V6bIiNn4L65bwqgTC56BYQ+pRtLE2gLt1T+xsH/A4mQ7BnGpf Q6mEBxoMb50GB+0KRZ3fC/OU67eb0r1p0NCDQoZSe/jEzKGiB1Mg9qeJ7bYBVJ/iB65f9oN wQJRt7V3FiNFCQUgxxhKBQ3uNpkUuZHTnKFqBf6PZMhFLonXNNUogWrAhUCfbAy0X18MTT0 u2wpLedrpsA8pke05QrTCl9hjQ6yWtaStVj8ppzoDQWRKGobEE1W+gEH3lI6cJr1MTXGitc SZ2yCgafpnMAZH+B8gO/h/28UExyULADDI6ej/Cnedj8fhITN5hfcN5182U9WsTXv8ts+v7 QbNsZaUGVc6GOs2JgLAfBTIJ7yWKeIBBf4ogcKCE1iwsRLw7i+LhqXPIKUFeshU7kjXIO+b 5UXbcSje6XyHX5nelVQpkw== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 7877143717639067706 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, palmer@dabbelt.com, palmer@rivosinc.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Juzhe-Zhong Subject: [PATCH v1] RISC-V: Support gather_load/scatter RVV auto-vectorization Date: Wed, 5 Jul 2023 21:50:22 +0800 Message-Id: <20230705135022.245282-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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: , 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?1770588837711099802?= X-GMAIL-MSGID: =?utf-8?q?1770588837711099802?= Thanks Richi's help for gather/scatter middle-end support. Now, enable gather_load/scatter_store in RISC-V backend port. RISC-V folks can start to review implementation in this patch since implementation is done. Adding more testcase in v2 soon. gcc/ChangeLog: * config/riscv/autovec.md (len_mask_gather_load): New pattern. (len_mask_gather_load): Ditto. (len_mask_gather_load): Ditto. (len_mask_gather_load): Ditto. (len_mask_gather_load): Ditto. (len_mask_gather_load): Ditto. (len_mask_gather_load): Ditto. (len_mask_gather_load): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. (len_mask_scatter_store): Ditto. * config/riscv/predicates.md (const_1_operand): New predicate. (vector_gs_scale_operand_16): Ditto. (vector_gs_scale_operand_32): Ditto. (vector_gs_scale_operand_64): Ditto. (vector_gs_extension_operand): Ditto. (vector_gs_scale_operand_16_rv32): Ditto. (vector_gs_scale_operand_32_rv32): Ditto. * config/riscv/riscv-protos.h (enum insn_type): Add enum for gather/scatter. (expand_gather_scatter): New function. * config/riscv/riscv-v.cc (gen_const_vector_dup): Support broadcast poly_int. (emit_vlmax_masked_store_insn): New function. (emit_nonvlmax_masked_store_insn): Ditto. (modulo_sel_indices): Ditto. (expand_vec_perm): Fix SLP bug for gather/scatter. (prepare_gather_scatter): New function. (expand_gather_scatter): Ditto. * config/riscv/vector-iterators.md: Support gather_load/scatter RVV auto-vectorization. * config/riscv/vector.md (vec_duplicate): Use "@". (@vec_duplicate): Ditto. (@pred_indexed_store): Fix naming. (@pred_indexed_store): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/rvv.exp: * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-12.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-12.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-12.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-12.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-9.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-1.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-10.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-2.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-3.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-4.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-5.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-6.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-7.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-8.c: New test. * gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-9.c: New test. --- gcc/config/riscv/autovec.md | 256 +++++++++++++++++ gcc/config/riscv/predicates.md | 33 ++- gcc/config/riscv/riscv-protos.h | 3 + gcc/config/riscv/riscv-v.cc | 258 ++++++++++++++++-- gcc/config/riscv/vector-iterators.md | 118 ++++++-- gcc/config/riscv/vector.md | 21 +- .../autovec/gather-scatter/gather_load-1.c | 38 +++ .../autovec/gather-scatter/gather_load-10.c | 35 +++ .../autovec/gather-scatter/gather_load-11.c | 32 +++ .../autovec/gather-scatter/gather_load-12.c | 112 ++++++++ .../autovec/gather-scatter/gather_load-2.c | 38 +++ .../autovec/gather-scatter/gather_load-3.c | 35 +++ .../autovec/gather-scatter/gather_load-4.c | 35 +++ .../autovec/gather-scatter/gather_load-5.c | 35 +++ .../autovec/gather-scatter/gather_load-6.c | 35 +++ .../autovec/gather-scatter/gather_load-7.c | 35 +++ .../autovec/gather-scatter/gather_load-8.c | 35 +++ .../autovec/gather-scatter/gather_load-9.c | 35 +++ .../gather-scatter/gather_load_run-1.c | 41 +++ .../gather-scatter/gather_load_run-10.c | 41 +++ .../gather-scatter/gather_load_run-11.c | 39 +++ .../gather-scatter/gather_load_run-12.c | 124 +++++++++ .../gather-scatter/gather_load_run-2.c | 41 +++ .../gather-scatter/gather_load_run-3.c | 41 +++ .../gather-scatter/gather_load_run-4.c | 41 +++ .../gather-scatter/gather_load_run-5.c | 41 +++ .../gather-scatter/gather_load_run-6.c | 41 +++ .../gather-scatter/gather_load_run-7.c | 41 +++ .../gather-scatter/gather_load_run-8.c | 41 +++ .../gather-scatter/gather_load_run-9.c | 41 +++ .../gather-scatter/len_gather_load-1.c | 9 + .../gather-scatter/len_gather_load-10.c | 9 + .../gather-scatter/len_gather_load-11.c | 9 + .../gather-scatter/len_gather_load-12.c | 11 + .../gather-scatter/len_gather_load-2.c | 9 + .../gather-scatter/len_gather_load-3.c | 9 + .../gather-scatter/len_gather_load-4.c | 9 + .../gather-scatter/len_gather_load-5.c | 9 + .../gather-scatter/len_gather_load-6.c | 9 + .../gather-scatter/len_gather_load-7.c | 9 + .../gather-scatter/len_gather_load-8.c | 9 + .../gather-scatter/len_gather_load-9.c | 9 + .../gather-scatter/len_gather_load_run-1.c | 4 + .../gather-scatter/len_gather_load_run-10.c | 4 + .../gather-scatter/len_gather_load_run-11.c | 4 + .../gather-scatter/len_gather_load_run-12.c | 4 + .../gather-scatter/len_gather_load_run-2.c | 4 + .../gather-scatter/len_gather_load_run-3.c | 4 + .../gather-scatter/len_gather_load_run-4.c | 4 + .../gather-scatter/len_gather_load_run-5.c | 4 + .../gather-scatter/len_gather_load_run-6.c | 4 + .../gather-scatter/len_gather_load_run-7.c | 4 + .../gather-scatter/len_gather_load_run-8.c | 4 + .../gather-scatter/len_gather_load_run-9.c | 4 + .../gather-scatter/len_mask_gather_load-1.c | 9 + .../gather-scatter/len_mask_gather_load-10.c | 9 + .../gather-scatter/len_mask_gather_load-11.c | 11 + .../gather-scatter/len_mask_gather_load-2.c | 9 + .../gather-scatter/len_mask_gather_load-3.c | 9 + .../gather-scatter/len_mask_gather_load-4.c | 9 + .../gather-scatter/len_mask_gather_load-5.c | 9 + .../gather-scatter/len_mask_gather_load-6.c | 9 + .../gather-scatter/len_mask_gather_load-7.c | 9 + .../gather-scatter/len_mask_gather_load-8.c | 9 + .../gather-scatter/len_mask_gather_load-9.c | 9 + .../len_mask_gather_load_run-1.c | 4 + .../len_mask_gather_load_run-10.c | 4 + .../len_mask_gather_load_run-11.c | 4 + .../len_mask_gather_load_run-2.c | 4 + .../len_mask_gather_load_run-3.c | 4 + .../len_mask_gather_load_run-4.c | 4 + .../len_mask_gather_load_run-5.c | 4 + .../len_mask_gather_load_run-6.c | 4 + .../len_mask_gather_load_run-7.c | 4 + .../len_mask_gather_load_run-8.c | 4 + .../len_mask_gather_load_run-9.c | 4 + .../gather-scatter/mask_gather_load-1.c | 39 +++ .../gather-scatter/mask_gather_load-10.c | 36 +++ .../gather-scatter/mask_gather_load-11.c | 115 ++++++++ .../gather-scatter/mask_gather_load-2.c | 39 +++ .../gather-scatter/mask_gather_load-3.c | 36 +++ .../gather-scatter/mask_gather_load-4.c | 36 +++ .../gather-scatter/mask_gather_load-5.c | 36 +++ .../gather-scatter/mask_gather_load-6.c | 36 +++ .../gather-scatter/mask_gather_load-7.c | 36 +++ .../gather-scatter/mask_gather_load-8.c | 36 +++ .../gather-scatter/mask_gather_load-9.c | 36 +++ .../gather-scatter/mask_gather_load_run-1.c | 48 ++++ .../gather-scatter/mask_gather_load_run-10.c | 48 ++++ .../gather-scatter/mask_gather_load_run-11.c | 140 ++++++++++ .../gather-scatter/mask_gather_load_run-2.c | 48 ++++ .../gather-scatter/mask_gather_load_run-3.c | 48 ++++ .../gather-scatter/mask_gather_load_run-4.c | 48 ++++ .../gather-scatter/mask_gather_load_run-5.c | 48 ++++ .../gather-scatter/mask_gather_load_run-6.c | 48 ++++ .../gather-scatter/mask_gather_load_run-7.c | 48 ++++ .../gather-scatter/mask_gather_load_run-8.c | 48 ++++ .../gather-scatter/mask_gather_load_run-9.c | 48 ++++ gcc/testsuite/gcc.target/riscv/rvv/rvv.exp | 2 + 99 files changed, 3123 insertions(+), 45 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-9.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-9.c diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index 4ab0e9f99eb..509b946adfa 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -57,6 +57,262 @@ } ) +;; ========================================================================= +;; == Gather Load +;; ========================================================================= + +(define_expand "len_mask_gather_load" + [(match_operand:VNX1_QHSD 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX1_QHSDI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +(define_expand "len_mask_gather_load" + [(match_operand:VNX2_QHSD 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX2_QHSDI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +(define_expand "len_mask_gather_load" + [(match_operand:VNX4_QHSD 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX4_QHSDI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +(define_expand "len_mask_gather_load" + [(match_operand:VNX8_QHSD 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX8_QHSDI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +(define_expand "len_mask_gather_load" + [(match_operand:VNX16_QHSD 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX16_QHSDI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +(define_expand "len_mask_gather_load" + [(match_operand:VNX32_QHS 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX32_QHSI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +(define_expand "len_mask_gather_load" + [(match_operand:VNX64_QH 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX64_QHI 2 "register_operand") + (match_operand 3 "") + (match_operand 4 "") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +;; When SEW = 8 and LMUL = 8, we can't find any index mode with +;; larger SEW. Since RVV indexed load/store support zero extend +;; implicitly and not support scaling, we should only allow +;; operands[3] and operands[4] to be const_1_operand. +(define_expand "len_mask_gather_load" + [(match_operand:VNX128_Q 0 "register_operand") + (match_operand 1 "pmode_reg_or_0_operand") + (match_operand:VNX128_Q 2 "register_operand") + (match_operand 3 "const_1_operand") + (match_operand 4 "const_1_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, true); + DONE; +}) + +;; ========================================================================= +;; == Scatter Store +;; ========================================================================= + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX1_QHSDI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX1_QHSD 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX2_QHSDI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX2_QHSD 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX4_QHSDI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX4_QHSD 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX8_QHSDI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX8_QHSD 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX16_QHSDI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX16_QHSD 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX32_QHSI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX32_QHS 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX64_QHI 1 "register_operand") + (match_operand 2 "") + (match_operand 3 "") + (match_operand:VNX64_QH 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + +;; When SEW = 8 and LMUL = 8, we can't find any index mode with +;; larger SEW. Since RVV indexed load/store support zero extend +;; implicitly and not support scaling, we should only allow +;; operands[3] and operands[4] to be const_1_operand. +(define_expand "len_mask_scatter_store" + [(match_operand 0 "pmode_reg_or_0_operand") + (match_operand:VNX128_Q 1 "register_operand") + (match_operand 2 "const_1_operand") + (match_operand 3 "const_1_operand") + (match_operand:VNX128_Q 4 "register_operand") + (match_operand 5 "autovec_length_operand") + (match_operand 6 "const_0_operand") + (match_operand: 7 "vector_mask_operand")] + "TARGET_VECTOR" +{ + riscv_vector::expand_gather_scatter (operands, false); + DONE; +}) + ;; ========================================================================= ;; == Vector creation ;; ========================================================================= diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index eb975eaf994..e5aee8f47ab 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -61,6 +61,10 @@ (and (match_code "const_int,const_wide_int,const_vector") (match_test "op == CONST0_RTX (GET_MODE (op))"))) +(define_predicate "const_1_operand" + (and (match_code "const_int,const_wide_int,const_vector") + (match_test "op == CONST1_RTX (GET_MODE (op))"))) + (define_predicate "reg_or_0_operand" (ior (match_operand 0 "const_0_operand") (match_operand 0 "register_operand"))) @@ -341,6 +345,33 @@ (ior (match_operand 0 "register_operand") (match_code "const_vector"))) +(define_predicate "vector_gs_scale_operand_16" + (and (match_code "const_int") + (match_test "INTVAL (op) == 1 || INTVAL (op) == 2"))) + +(define_predicate "vector_gs_scale_operand_32" + (and (match_code "const_int") + (match_test "INTVAL (op) == 1 || INTVAL (op) == 4"))) + +(define_predicate "vector_gs_scale_operand_64" + (and (match_code "const_int") + (match_test "INTVAL (op) == 1 || (INTVAL (op) == 8 && Pmode == DImode)"))) + +(define_predicate "vector_gs_extension_operand" + (ior (match_operand 0 "const_1_operand") + (and (match_operand 0 "const_0_operand") + (match_test "Pmode == SImode")))) + +(define_predicate "vector_gs_scale_operand_16_rv32" + (and (match_code "const_int") + (match_test "INTVAL (op) == 1 + || (INTVAL (op) == 2 && Pmode == SImode)"))) + +(define_predicate "vector_gs_scale_operand_32_rv32" + (and (match_code "const_int") + (match_test "INTVAL (op) == 1 + || (INTVAL (op) == 4 && Pmode == SImode)"))) + (define_predicate "ltge_operator" (match_code "lt,ltu,ge,geu")) @@ -376,7 +407,7 @@ || rtx_equal_p (op, CONST0_RTX (GET_MODE (op)))) && maybe_gt (GET_MODE_BITSIZE (GET_MODE (op)), GET_MODE_BITSIZE (Pmode)))") (ior (match_test "rtx_equal_p (op, CONST0_RTX (GET_MODE (op)))") - (ior (match_operand 0 "const_int_operand") + (ior (match_code "const_int, const_poly_int") (ior (match_operand 0 "register_operand") (match_test "satisfies_constraint_Wdm (op)")))))) diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 5766e3597e8..fd6caccc183 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -148,6 +148,8 @@ enum insn_type RVV_WIDEN_TERNOP = 4, RVV_SCALAR_MOV_OP = 4, /* +1 for VUNDEF according to vector.md. */ RVV_SLIDE_OP = 4, /* Dest, VUNDEF, source and offset. */ + RVV_GATHER_M_OP = 5, + RVV_SCATTER_M_OP = 4, }; enum vlmul_type { @@ -255,6 +257,7 @@ void expand_vec_init (rtx, rtx); void expand_vec_perm (rtx, rtx, rtx, rtx); void expand_select_vl (rtx *); void expand_load_store (rtx *, bool); +void expand_gather_scatter (rtx *, bool); /* Rounding mode bitfield for fixed point VXRM. */ enum fixed_point_rounding_mode diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 8d5bed7ebe4..be18b8e7ebe 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -564,7 +564,14 @@ const_vec_all_in_range_p (rtx vec, poly_int64 minval, poly_int64 maxval) static rtx gen_const_vector_dup (machine_mode mode, poly_int64 val) { - rtx c = gen_int_mode (val, GET_MODE_INNER (mode)); + scalar_mode smode = GET_MODE_INNER (mode); + rtx c = gen_int_mode (val, smode); + if (!val.is_constant () && GET_MODE_SIZE (smode) > GET_MODE_SIZE (Pmode)) + { + rtx dup = gen_reg_rtx (mode); + emit_insn (gen_vec_duplicate (mode, dup, c)); + return dup; + } return gen_const_vec_duplicate (mode, c); } @@ -901,6 +908,39 @@ emit_nonvlmax_masked_insn (unsigned icode, int op_num, rtx *ops, rtx avl) e.emit_insn ((enum insn_code) icode, ops); } +/* This function emits a VLMAX masked store instruction. */ +static void +emit_vlmax_masked_store_insn (unsigned icode, int op_num, rtx *ops) +{ + machine_mode dest_mode = GET_MODE (ops[0]); + machine_mode mask_mode = get_mask_mode (dest_mode).require (); + insn_expander e (/*OP_NUM*/ op_num, + /*HAS_DEST_P*/ false, + /*FULLY_UNMASKED_P*/ false, + /*USE_REAL_MERGE_P*/ true, + /*HAS_AVL_P*/ true, + /*VLMAX_P*/ true, dest_mode, + mask_mode); + e.emit_insn ((enum insn_code) icode, ops); +} + +/* This function emits a non-VLMAX masked store instruction. */ +static void +emit_nonvlmax_masked_store_insn (unsigned icode, int op_num, rtx *ops, rtx avl) +{ + machine_mode dest_mode = GET_MODE (ops[0]); + machine_mode mask_mode = get_mask_mode (dest_mode).require (); + insn_expander e (/*OP_NUM*/ op_num, + /*HAS_DEST_P*/ false, + /*FULLY_UNMASKED_P*/ false, + /*USE_REAL_MERGE_P*/ true, + /*HAS_AVL_P*/ true, + /*VLMAX_P*/ false, dest_mode, + mask_mode); + e.set_vl (avl); + e.emit_insn ((enum insn_code) icode, ops); +} + /* This function emits a masked instruction. */ void emit_vlmax_masked_mu_insn (unsigned icode, int op_num, rtx *ops) @@ -2431,6 +2471,25 @@ expand_vec_cmp_float (rtx target, rtx_code code, rtx op0, rtx op1, return false; } +/* Modulo all SEL indices to ensure they are all in range if [0, MAX_SEL]. */ +static rtx +modulo_sel_indices (rtx sel, poly_uint64 max_sel) +{ + rtx sel_mod; + machine_mode sel_mode = GET_MODE (sel); + poly_uint64 nunits = GET_MODE_NUNITS (sel_mode); + /* If SEL is variable-length CONST_VECTOR, we don't need to modulo it. */ + if (!nunits.is_constant () && CONST_VECTOR_P (sel)) + sel_mod = sel; + else + { + rtx mod = gen_const_vector_dup (sel_mode, max_sel); + sel_mod + = expand_simple_binop (sel_mode, AND, sel, mod, NULL, 0, OPTAB_DIRECT); + } + return sel_mod; +} + /* Implement vec_perm. */ void @@ -2444,42 +2503,47 @@ expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel) index is in range of [0, nunits - 1]. A single vrgather instructions is enough. Since we will use vrgatherei16.vv for variable-length vector, it is never out of range and we don't need to modulo the index. */ - if (!nunits.is_constant () || const_vec_all_in_range_p (sel, 0, nunits - 1)) + if (nunits.is_constant () && const_vec_all_in_range_p (sel, 0, nunits - 1)) { emit_vlmax_gather_insn (target, op0, sel); return; } /* Check if the two values vectors are the same. */ - if (rtx_equal_p (op0, op1) || const_vec_duplicate_p (sel)) + if (rtx_equal_p (op0, op1)) { /* Note: vec_perm indices are supposed to wrap when they go beyond the size of the two value vectors, i.e. the upper bits of the indices are effectively ignored. RVV vrgather instead produces 0 for any out-of-range indices, so we need to modulo all the vec_perm indices to ensure they are all in range of [0, nunits - 1]. */ - rtx max_sel = gen_const_vector_dup (sel_mode, nunits - 1); - rtx sel_mod = expand_simple_binop (sel_mode, AND, sel, max_sel, NULL, 0, - OPTAB_DIRECT); - emit_vlmax_gather_insn (target, op1, sel_mod); + rtx sel_mod = modulo_sel_indices (sel, nunits - 1); + emit_vlmax_gather_insn (target, op0, sel_mod); return; } - rtx sel_mod = sel; - rtx max_sel = gen_const_vector_dup (sel_mode, 2 * nunits - 1); - /* We don't need to modulo indices for VLA vector. - Since we should gurantee they aren't out of range before. */ - if (nunits.is_constant ()) + /* Check if all the indices are same. */ + rtx elt; + if (const_vec_duplicate_p (sel, &elt)) { - /* Note: vec_perm indices are supposed to wrap when they go beyond the - size of the two value vectors, i.e. the upper bits of the indices - are effectively ignored. RVV vrgather instead produces 0 for any - out-of-range indices, so we need to modulo all the vec_perm indices - to ensure they are all in range of [0, 2 * nunits - 1]. */ - sel_mod = expand_simple_binop (sel_mode, AND, sel, max_sel, NULL, 0, - OPTAB_DIRECT); + poly_uint64 value = rtx_to_poly_int64 (elt); + rtx op = op0; + if (maybe_gt (value, nunits - 1)) + { + sel = gen_const_vector_dup (sel_mode, value - nunits); + op = op1; + } + emit_vlmax_gather_insn (target, op, sel); } + /* Note: vec_perm indices are supposed to wrap when they go beyond the + size of the two value vectors, i.e. the upper bits of the indices + are effectively ignored. RVV vrgather instead produces 0 for any + out-of-range indices, so we need to modulo all the vec_perm indices + to ensure they are all in range of [0, 2 * nunits - 1]. */ + rtx sel_mod = modulo_sel_indices (sel, 2 * nunits - 1); + rtx max_sel = gen_const_vector_dup (sel_mode, 2 * nunits - 1); + /* This following sequence is handling the case that: __builtin_shufflevector (vec1, vec2, index...), the index can be any value in range of [0, 2 * nunits - 1]. */ @@ -2812,4 +2876,160 @@ expand_load_store (rtx *ops, bool is_load) } } +/* Prepare insn_code for gather_load/scatter_store according to + the vector mode and index mode. */ +static insn_code +prepare_gather_scatter (machine_mode vec_mode, machine_mode idx_mode, + bool is_load) +{ + if (!is_load) + return code_for_pred_indexed_store (UNSPEC_UNORDERED, vec_mode, idx_mode); + else + { + unsigned src_eew_bitsize = GET_MODE_BITSIZE (GET_MODE_INNER (idx_mode)); + unsigned dst_eew_bitsize = GET_MODE_BITSIZE (GET_MODE_INNER (vec_mode)); + if (dst_eew_bitsize == src_eew_bitsize) + return code_for_pred_indexed_load_same_eew (UNSPEC_UNORDERED, vec_mode); + else if (dst_eew_bitsize > src_eew_bitsize) + { + unsigned factor = dst_eew_bitsize / src_eew_bitsize; + switch (factor) + { + case 2: + return code_for_pred_indexed_load_x2_greater_eew ( + UNSPEC_UNORDERED, vec_mode); + case 4: + return code_for_pred_indexed_load_x4_greater_eew ( + UNSPEC_UNORDERED, vec_mode); + case 8: + return code_for_pred_indexed_load_x8_greater_eew ( + UNSPEC_UNORDERED, vec_mode); + default: + gcc_unreachable (); + } + } + else + { + unsigned factor = src_eew_bitsize / dst_eew_bitsize; + switch (factor) + { + case 2: + return code_for_pred_indexed_load_x2_smaller_eew ( + UNSPEC_UNORDERED, vec_mode); + case 4: + return code_for_pred_indexed_load_x4_smaller_eew ( + UNSPEC_UNORDERED, vec_mode); + case 8: + return code_for_pred_indexed_load_x8_smaller_eew ( + UNSPEC_UNORDERED, vec_mode); + default: + gcc_unreachable (); + } + } + } +} + +/* Expand LEN_MASK_{GATHER_LOAD,SCATTER_STORE}. */ +void +expand_gather_scatter (rtx *ops, bool is_load) +{ + rtx base, vec_offset, vec_reg, len, mask; + bool zero_extend_p; + int scale_log2; + if (is_load) + { + vec_reg = ops[0]; + base = ops[1]; + vec_offset = ops[2]; + zero_extend_p = INTVAL (ops[3]); + scale_log2 = exact_log2 (INTVAL (ops[4])); + len = ops[5]; + mask = ops[7]; + } + else + { + vec_reg = ops[4]; + base = ops[0]; + vec_offset = ops[1]; + zero_extend_p = INTVAL (ops[2]); + scale_log2 = exact_log2 (INTVAL (ops[3])); + len = ops[5]; + mask = ops[7]; + } + + machine_mode vec_mode = GET_MODE (vec_reg); + machine_mode idx_mode = GET_MODE (vec_offset); + scalar_mode inner_vec_mode = GET_MODE_INNER (vec_mode); + scalar_mode inner_idx_mode = GET_MODE_INNER (idx_mode); + unsigned inner_vsize = GET_MODE_BITSIZE (inner_vec_mode); + unsigned inner_offsize = GET_MODE_BITSIZE (inner_idx_mode); + poly_int64 nunits = GET_MODE_NUNITS (vec_mode); + + if (inner_offsize < inner_vsize) + { + /* 7.2. Vector Load/Store Addressing Modes. + If the vector offset elements are narrower than XLEN, they are + zero-extended to XLEN before adding to the base effective address. If + the vector offset elements are wider than XLEN, the least-significant + XLEN bits are used in the address calculation. An implementation must + raise an illegal instruction exception if the EEW is not supported for + offset elements. */ + if (!zero_extend_p || (zero_extend_p && scale_log2 != 0)) + { + if (zero_extend_p) + inner_idx_mode + = int_mode_for_size (inner_offsize * 2, 0).require (); + else + inner_idx_mode = int_mode_for_size (BITS_PER_WORD, 0).require (); + machine_mode new_idx_mode + = get_vector_mode (inner_idx_mode, nunits).require (); + rtx tmp = gen_reg_rtx (new_idx_mode); + emit_insn (gen_extend_insn (tmp, vec_offset, new_idx_mode, idx_mode, + zero_extend_p ? true : false)); + vec_offset = tmp; + idx_mode = new_idx_mode; + } + } + + if (scale_log2 != 0) + { + rtx tmp = expand_binop (idx_mode, ashl_optab, vec_offset, + gen_int_mode (scale_log2, Pmode), NULL_RTX, 0, + OPTAB_DIRECT); + vec_offset = tmp; + } + + insn_code icode = prepare_gather_scatter (vec_mode, idx_mode, is_load); + poly_int64 value; + if (poly_int_rtx_p (len, &value) && known_eq (value, nunits)) + { + if (is_load) + { + rtx load_ops[] + = {vec_reg, mask, RVV_VUNDEF (vec_mode), base, vec_offset}; + emit_vlmax_masked_insn (icode, RVV_GATHER_M_OP, load_ops); + } + else + { + rtx store_ops[] = {mask, base, vec_offset, vec_reg}; + emit_vlmax_masked_store_insn (icode, RVV_SCATTER_M_OP, store_ops); + } + } + else + { + if (is_load) + { + rtx load_ops[] + = {vec_reg, mask, RVV_VUNDEF (vec_mode), base, vec_offset}; + emit_nonvlmax_masked_insn (icode, RVV_GATHER_M_OP, load_ops, len); + } + else + { + rtx store_ops[] = {mask, base, vec_offset, vec_reg}; + emit_nonvlmax_masked_store_insn (icode, RVV_SCATTER_M_OP, store_ops, + len); + } + } +} + } // namespace riscv_vector diff --git a/gcc/config/riscv/vector-iterators.md b/gcc/config/riscv/vector-iterators.md index a79ea79abb6..b763c6d14d2 100644 --- a/gcc/config/riscv/vector-iterators.md +++ b/gcc/config/riscv/vector-iterators.md @@ -115,6 +115,9 @@ (define_mode_iterator VEEWEXT2 [ (VNx1HI "TARGET_MIN_VLEN < 128") VNx2HI VNx4HI VNx8HI VNx16HI (VNx32HI "TARGET_MIN_VLEN > 32") (VNx64HI "TARGET_MIN_VLEN >= 128") + (VNx1HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN < 128") (VNx2HF "TARGET_VECTOR_ELEN_FP_16") (VNx4HF "TARGET_VECTOR_ELEN_FP_16") + (VNx8HF "TARGET_VECTOR_ELEN_FP_16") (VNx16HF "TARGET_VECTOR_ELEN_FP_16") (VNx32HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN > 32") + (VNx64HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN >= 128") (VNx1SI "TARGET_MIN_VLEN < 128") VNx2SI VNx4SI VNx8SI (VNx16SI "TARGET_MIN_VLEN > 32") (VNx32SI "TARGET_MIN_VLEN >= 128") (VNx1DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN < 128") (VNx2DI "TARGET_VECTOR_ELEN_64") (VNx4DI "TARGET_VECTOR_ELEN_64") (VNx8DI "TARGET_VECTOR_ELEN_64") (VNx16DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN >= 128") @@ -161,6 +164,8 @@ (define_mode_iterator VEEWTRUNC2 [ (VNx1QI "TARGET_MIN_VLEN < 128") VNx2QI VNx4QI VNx8QI VNx16QI VNx32QI (VNx64QI "TARGET_MIN_VLEN >= 128") (VNx1HI "TARGET_MIN_VLEN < 128") VNx2HI VNx4HI VNx8HI VNx16HI (VNx32HI "TARGET_MIN_VLEN >= 128") + (VNx1HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN < 128") (VNx2HF "TARGET_VECTOR_ELEN_FP_16") (VNx4HF "TARGET_VECTOR_ELEN_FP_16") + (VNx8HF "TARGET_VECTOR_ELEN_FP_16") (VNx16HF "TARGET_VECTOR_ELEN_FP_16") (VNx32HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN >= 128") (VNx1SI "TARGET_MIN_VLEN < 128") VNx2SI VNx4SI VNx8SI (VNx16SI "TARGET_MIN_VLEN >= 128") (VNx1SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN < 128") (VNx2SF "TARGET_VECTOR_ELEN_FP_32") @@ -172,6 +177,8 @@ (define_mode_iterator VEEWTRUNC4 [ (VNx1QI "TARGET_MIN_VLEN < 128") VNx2QI VNx4QI VNx8QI VNx16QI (VNx32QI "TARGET_MIN_VLEN >= 128") (VNx1HI "TARGET_MIN_VLEN < 128") VNx2HI VNx4HI VNx8HI (VNx16HI "TARGET_MIN_VLEN >= 128") + (VNx1HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN < 128") (VNx2HF "TARGET_VECTOR_ELEN_FP_16") (VNx4HF "TARGET_VECTOR_ELEN_FP_16") + (VNx8HF "TARGET_VECTOR_ELEN_FP_16") (VNx16HF "TARGET_VECTOR_ELEN_FP_16") ]) (define_mode_iterator VEEWTRUNC8 [ @@ -362,46 +369,67 @@ ]) (define_mode_iterator VNX1_QHSD [ - (VNx1QI "TARGET_MIN_VLEN < 128") (VNx1HI "TARGET_MIN_VLEN < 128") (VNx1SI "TARGET_MIN_VLEN < 128") + (VNx1QI "TARGET_MIN_VLEN < 128") + (VNx1HI "TARGET_MIN_VLEN < 128") + (VNx1SI "TARGET_MIN_VLEN < 128") (VNx1DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN < 128") + (VNx1HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN < 128") (VNx1SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN < 128") (VNx1DF "TARGET_VECTOR_ELEN_FP_64 && TARGET_MIN_VLEN < 128") ]) (define_mode_iterator VNX2_QHSD [ - VNx2QI VNx2HI VNx2SI + VNx2QI + VNx2HI + VNx2SI (VNx2DI "TARGET_VECTOR_ELEN_64") + (VNx2HF "TARGET_VECTOR_ELEN_FP_16") (VNx2SF "TARGET_VECTOR_ELEN_FP_32") (VNx2DF "TARGET_VECTOR_ELEN_FP_64") ]) (define_mode_iterator VNX4_QHSD [ - VNx4QI VNx4HI VNx4SI + VNx4QI + VNx4HI + VNx4SI (VNx4DI "TARGET_VECTOR_ELEN_64") + (VNx4HF "TARGET_VECTOR_ELEN_FP_16") (VNx4SF "TARGET_VECTOR_ELEN_FP_32") (VNx4DF "TARGET_VECTOR_ELEN_FP_64") ]) (define_mode_iterator VNX8_QHSD [ - VNx8QI VNx8HI VNx8SI + VNx8QI + VNx8HI + VNx8SI (VNx8DI "TARGET_VECTOR_ELEN_64") + (VNx8HF "TARGET_VECTOR_ELEN_FP_16") (VNx8SF "TARGET_VECTOR_ELEN_FP_32") (VNx8DF "TARGET_VECTOR_ELEN_FP_64") ]) -(define_mode_iterator VNX16_QHS [ - VNx16QI VNx16HI (VNx16SI "TARGET_MIN_VLEN > 32") +(define_mode_iterator VNX16_QHSD [ + VNx16QI + VNx16HI + (VNx16SI "TARGET_MIN_VLEN > 32") + (VNx16DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN >= 128") + (VNx16HF "TARGET_VECTOR_ELEN_FP_16") (VNx16SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN > 32") - (VNx16DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN >= 128") (VNx16DF "TARGET_VECTOR_ELEN_FP_64 && TARGET_MIN_VLEN >= 128") + (VNx16DF "TARGET_VECTOR_ELEN_FP_64 && TARGET_MIN_VLEN >= 128") ]) (define_mode_iterator VNX32_QHS [ - VNx32QI (VNx32HI "TARGET_MIN_VLEN > 32") (VNx32SI "TARGET_MIN_VLEN >= 128") (VNx32SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN >= 128") + VNx32QI + (VNx32HI "TARGET_MIN_VLEN > 32") + (VNx32SI "TARGET_MIN_VLEN >= 128") + (VNx32HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN > 32") + (VNx32SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN >= 128") ]) (define_mode_iterator VNX64_QH [ (VNx64QI "TARGET_MIN_VLEN > 32") (VNx64HI "TARGET_MIN_VLEN >= 128") + (VNx64HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN >= 128") ]) (define_mode_iterator VNX128_Q [ @@ -409,35 +437,49 @@ ]) (define_mode_iterator VNX1_QHSDI [ - (VNx1QI "TARGET_MIN_VLEN < 128") (VNx1HI "TARGET_MIN_VLEN < 128") (VNx1SI "TARGET_MIN_VLEN < 128") - (VNx1DI "TARGET_64BIT && TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN < 128") + (VNx1QI "TARGET_MIN_VLEN < 128") + (VNx1HI "TARGET_MIN_VLEN < 128") + (VNx1SI "TARGET_MIN_VLEN < 128") + (VNx1DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN < 128 && TARGET_64BIT") ]) (define_mode_iterator VNX2_QHSDI [ - VNx2QI VNx2HI VNx2SI - (VNx2DI "TARGET_64BIT && TARGET_VECTOR_ELEN_64") + VNx2QI + VNx2HI + VNx2SI + (VNx2DI "TARGET_VECTOR_ELEN_64 && TARGET_64BIT") ]) (define_mode_iterator VNX4_QHSDI [ - VNx4QI VNx4HI VNx4SI - (VNx4DI "TARGET_64BIT && TARGET_VECTOR_ELEN_64") + VNx4QI + VNx4HI + VNx4SI + (VNx4DI "TARGET_VECTOR_ELEN_64 && TARGET_64BIT") ]) (define_mode_iterator VNX8_QHSDI [ - VNx8QI VNx8HI VNx8SI - (VNx8DI "TARGET_64BIT && TARGET_VECTOR_ELEN_64") + VNx8QI + VNx8HI + VNx8SI + (VNx8DI "TARGET_VECTOR_ELEN_64 && TARGET_64BIT") ]) (define_mode_iterator VNX16_QHSDI [ - VNx16QI VNx16HI (VNx16SI "TARGET_MIN_VLEN > 32") (VNx16DI "TARGET_64BIT && TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN >= 128") + VNx16QI + VNx16HI + (VNx16SI "TARGET_MIN_VLEN > 32") + (VNx16DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN >= 128 && TARGET_64BIT") ]) (define_mode_iterator VNX32_QHSI [ - VNx32QI (VNx32HI "TARGET_MIN_VLEN > 32") (VNx32SI "TARGET_MIN_VLEN >= 128") + VNx32QI + (VNx32HI "TARGET_MIN_VLEN > 32") + (VNx32SI "TARGET_MIN_VLEN >= 128") ]) (define_mode_iterator VNX64_QHI [ - VNx64QI (VNx64HI "TARGET_MIN_VLEN >= 128") + (VNx64QI "TARGET_MIN_VLEN > 32") + (VNx64HI "TARGET_MIN_VLEN >= 128") ]) (define_mode_iterator V_WHOLE [ @@ -1356,6 +1398,8 @@ (define_mode_attr VINDEX_DOUBLE_TRUNC [ (VNx1HI "VNx1QI") (VNx2HI "VNx2QI") (VNx4HI "VNx4QI") (VNx8HI "VNx8QI") (VNx16HI "VNx16QI") (VNx32HI "VNx32QI") (VNx64HI "VNx64QI") + (VNx1HF "VNx1QI") (VNx2HF "VNx2QI") (VNx4HF "VNx4QI") (VNx8HF "VNx8QI") + (VNx16HF "VNx16QI") (VNx32HF "VNx32QI") (VNx64HF "VNx64QI") (VNx1SI "VNx1HI") (VNx2SI "VNx2HI") (VNx4SI "VNx4HI") (VNx8SI "VNx8HI") (VNx16SI "VNx16HI") (VNx32SI "VNx32HI") (VNx1SF "VNx1HI") (VNx2SF "VNx2HI") (VNx4SF "VNx4HI") (VNx8SF "VNx8HI") @@ -1383,6 +1427,7 @@ (define_mode_attr VINDEX_DOUBLE_EXT [ (VNx1QI "VNx1HI") (VNx2QI "VNx2HI") (VNx4QI "VNx4HI") (VNx8QI "VNx8HI") (VNx16QI "VNx16HI") (VNx32QI "VNx32HI") (VNx64QI "VNx64HI") (VNx1HI "VNx1SI") (VNx2HI "VNx2SI") (VNx4HI "VNx4SI") (VNx8HI "VNx8SI") (VNx16HI "VNx16SI") (VNx32HI "VNx32SI") + (VNx1HF "VNx1SI") (VNx2HF "VNx2SI") (VNx4HF "VNx4SI") (VNx8HF "VNx8SI") (VNx16HF "VNx16SI") (VNx32HF "VNx32SI") (VNx1SI "VNx1DI") (VNx2SI "VNx2DI") (VNx4SI "VNx4DI") (VNx8SI "VNx8DI") (VNx16SI "VNx16DI") (VNx1SF "VNx1DI") (VNx2SF "VNx2DI") (VNx4SF "VNx4DI") (VNx8SF "VNx8DI") (VNx16SF "VNx16DI") ]) @@ -1390,6 +1435,7 @@ (define_mode_attr VINDEX_QUAD_EXT [ (VNx1QI "VNx1SI") (VNx2QI "VNx2SI") (VNx4QI "VNx4SI") (VNx8QI "VNx8SI") (VNx16QI "VNx16SI") (VNx32QI "VNx32SI") (VNx1HI "VNx1DI") (VNx2HI "VNx2DI") (VNx4HI "VNx4DI") (VNx8HI "VNx8DI") (VNx16HI "VNx16DI") + (VNx1HF "VNx1DI") (VNx2HF "VNx2DI") (VNx4HF "VNx4DI") (VNx8HF "VNx8DI") (VNx16HF "VNx16DI") ]) (define_mode_attr VINDEX_OCT_EXT [ @@ -1434,6 +1480,40 @@ (VNx4DI "VNx8BI") (VNx8DI "VNx16BI") (VNx16DI "VNx32BI") ]) +(define_mode_attr gs_extension [ + (VNx1QI "immediate_operand") (VNx2QI "immediate_operand") (VNx4QI "immediate_operand") (VNx8QI "immediate_operand") (VNx16QI "immediate_operand") + (VNx32QI "vector_gs_extension_operand") (VNx64QI "const_1_operand") + (VNx1HI "immediate_operand") (VNx2HI "immediate_operand") (VNx4HI "immediate_operand") (VNx8HI "immediate_operand") (VNx16HI "immediate_operand") + (VNx32HI "vector_gs_extension_operand") (VNx64HI "const_1_operand") + (VNx1SI "immediate_operand") (VNx2SI "immediate_operand") (VNx4SI "immediate_operand") (VNx8SI "immediate_operand") (VNx16SI "immediate_operand") + (VNx32SI "vector_gs_extension_operand") + (VNx1DI "immediate_operand") (VNx2DI "immediate_operand") (VNx4DI "immediate_operand") (VNx8DI "immediate_operand") (VNx16DI "immediate_operand") + + (VNx1HF "immediate_operand") (VNx2HF "immediate_operand") (VNx4HF "immediate_operand") (VNx8HF "immediate_operand") (VNx16HF "immediate_operand") + (VNx32HF "vector_gs_extension_operand") (VNx64HF "const_1_operand") + (VNx1SF "immediate_operand") (VNx2SF "immediate_operand") (VNx4SF "immediate_operand") (VNx8SF "immediate_operand") (VNx16SF "immediate_operand") + (VNx32SF "vector_gs_extension_operand") + (VNx1DF "immediate_operand") (VNx2DF "immediate_operand") (VNx4DF "immediate_operand") (VNx8DF "immediate_operand") (VNx16DF "immediate_operand") +]) + +(define_mode_attr gs_scale [ + (VNx1QI "const_1_operand") (VNx2QI "const_1_operand") (VNx4QI "const_1_operand") (VNx8QI "const_1_operand") + (VNx16QI "const_1_operand") (VNx32QI "const_1_operand") (VNx64QI "const_1_operand") + (VNx1HI "vector_gs_scale_operand_16") (VNx2HI "vector_gs_scale_operand_16") (VNx4HI "vector_gs_scale_operand_16") (VNx8HI "vector_gs_scale_operand_16") + (VNx16HI "vector_gs_scale_operand_16") (VNx32HI "vector_gs_scale_operand_16_rv32") (VNx64HI "const_1_operand") + (VNx1SI "vector_gs_scale_operand_32") (VNx2SI "vector_gs_scale_operand_32") (VNx4SI "vector_gs_scale_operand_32") (VNx8SI "vector_gs_scale_operand_32") + (VNx16SI "vector_gs_scale_operand_32") (VNx32SI "vector_gs_scale_operand_32_rv32") + (VNx1DI "vector_gs_scale_operand_64") (VNx2DI "vector_gs_scale_operand_64") (VNx4DI "vector_gs_scale_operand_64") (VNx8DI "vector_gs_scale_operand_64") + (VNx16DI "vector_gs_scale_operand_64") + + (VNx1HF "vector_gs_scale_operand_16") (VNx2HF "vector_gs_scale_operand_16") (VNx4HF "vector_gs_scale_operand_16") (VNx8HF "vector_gs_scale_operand_16") + (VNx16HF "vector_gs_scale_operand_16") (VNx32HF "vector_gs_scale_operand_16_rv32") (VNx64HF "const_1_operand") + (VNx1SF "vector_gs_scale_operand_32") (VNx2SF "vector_gs_scale_operand_32") (VNx4SF "vector_gs_scale_operand_32") (VNx8SF "vector_gs_scale_operand_32") + (VNx16SF "vector_gs_scale_operand_32") (VNx32SF "vector_gs_scale_operand_32_rv32") + (VNx1DF "vector_gs_scale_operand_64") (VNx2DF "vector_gs_scale_operand_64") (VNx4DF "vector_gs_scale_operand_64") (VNx8DF "vector_gs_scale_operand_64") + (VNx16DF "vector_gs_scale_operand_64") +]) + (define_int_iterator WREDUC [UNSPEC_WREDUC_SUM UNSPEC_WREDUC_USUM]) (define_int_iterator ORDER [UNSPEC_ORDERED UNSPEC_UNORDERED]) diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index a6174f9483e..8bda7965c14 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -813,7 +813,7 @@ ;; This pattern only handles duplicates of non-constant inputs. ;; Constant vectors go through the movm pattern instead. ;; So "direct_broadcast_operand" can only be mem or reg, no CONSTANT. -(define_expand "vec_duplicate" +(define_expand "@vec_duplicate" [(set (match_operand:V 0 "register_operand") (vec_duplicate:V (match_operand: 1 "direct_broadcast_operand")))] @@ -1352,8 +1352,17 @@ } } else if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (Pmode) - && immediate_operand (operands[3], Pmode)) - operands[3] = gen_rtx_SIGN_EXTEND (mode, force_reg (Pmode, operands[3])); + && (immediate_operand (operands[3], Pmode) + || CONST_POLY_INT_P (operands[3]))) + { + rtx tmp = gen_reg_rtx (Pmode); + poly_int64 value = rtx_to_poly_int64 (operands[3]); + /* We only allow CONST_POLY_INT which has value <= GET_MODE_SIZE. */ + if (CONST_POLY_INT_P (operands[3])) + gcc_assert (known_le (value, GET_MODE_SIZE (mode))); + emit_move_insn (tmp, gen_int_mode (value, Pmode)); + operands[3] = gen_rtx_SIGN_EXTEND (mode, tmp); + } else operands[3] = force_reg (mode, operands[3]); }) @@ -1733,7 +1742,7 @@ [(set_attr "type" "vstx") (set_attr "mode" "")]) -(define_insn "@pred_indexed_store" +(define_insn "@pred_indexed_store" [(set (mem:BLK (scratch)) (unspec:BLK [(unspec: @@ -1744,11 +1753,11 @@ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE) (match_operand 1 "pmode_reg_or_0_operand" " rJ") (match_operand:VNX16_QHSDI 2 "register_operand" " vr") - (match_operand:VNX16_QHS 3 "register_operand" " vr")] ORDER))] + (match_operand:VNX16_QHSD 3 "register_operand" " vr")] ORDER))] "TARGET_VECTOR" "vsxei.v\t%3,(%z1),%2%p0" [(set_attr "type" "vstx") - (set_attr "mode" "")]) + (set_attr "mode" "")]) (define_insn "@pred_indexed_store" [(set (mem:BLK (scratch)) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-1.c new file mode 100644 index 00000000000..42d979b8849 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-1.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 uint8_t +#define INDEX16 uint16_t +#define INDEX32 uint32_t +#define INDEX64 uint64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-10.c new file mode 100644 index 00000000000..63b985b5309 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-10.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX64 int64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 64) \ + T (uint8_t, 64) \ + T (int16_t, 64) \ + T (uint16_t, 64) \ + T (_Float16, 64) \ + T (int32_t, 64) \ + T (uint32_t, 64) \ + T (float, 64) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-11.c new file mode 100644 index 00000000000..2bd06efb13e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-11.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define TEST_LOOP(DATA_TYPE) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict *src) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += *src[i]; \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (_Float16) \ + T (int32_t) \ + T (uint32_t) \ + T (float) \ + T (int64_t) \ + T (uint64_t) \ + T (double) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-12.c new file mode 100644 index 00000000000..9c5dd4c416f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-12.c @@ -0,0 +1,112 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-vect-cost-model -fdump-tree-vect-details" } */ + +#include + +#define TEST_LOOP(DATA_TYPE, INDEX_TYPE) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE##_##INDEX_TYPE (DATA_TYPE *restrict y, DATA_TYPE *restrict x, \ + INDEX_TYPE *restrict index) \ + { \ + for (int i = 0; i < 100; ++i) \ + { \ + y[i * 2] = x[index[i * 2]] + 1; \ + y[i * 2 + 1] = x[index[i * 2 + 1]] + 2; \ + } \ + } + +TEST_LOOP (int8_t, int8_t) +TEST_LOOP (uint8_t, int8_t) +TEST_LOOP (int16_t, int8_t) +TEST_LOOP (uint16_t, int8_t) +TEST_LOOP (int32_t, int8_t) +TEST_LOOP (uint32_t, int8_t) +TEST_LOOP (int64_t, int8_t) +TEST_LOOP (uint64_t, int8_t) +TEST_LOOP (_Float16, int8_t) +TEST_LOOP (float, int8_t) +TEST_LOOP (double, int8_t) +TEST_LOOP (int8_t, int16_t) +TEST_LOOP (uint8_t, int16_t) +TEST_LOOP (int16_t, int16_t) +TEST_LOOP (uint16_t, int16_t) +TEST_LOOP (int32_t, int16_t) +TEST_LOOP (uint32_t, int16_t) +TEST_LOOP (int64_t, int16_t) +TEST_LOOP (uint64_t, int16_t) +TEST_LOOP (_Float16, int16_t) +TEST_LOOP (float, int16_t) +TEST_LOOP (double, int16_t) +TEST_LOOP (int8_t, int32_t) +TEST_LOOP (uint8_t, int32_t) +TEST_LOOP (int16_t, int32_t) +TEST_LOOP (uint16_t, int32_t) +TEST_LOOP (int32_t, int32_t) +TEST_LOOP (uint32_t, int32_t) +TEST_LOOP (int64_t, int32_t) +TEST_LOOP (uint64_t, int32_t) +TEST_LOOP (_Float16, int32_t) +TEST_LOOP (float, int32_t) +TEST_LOOP (double, int32_t) +TEST_LOOP (int8_t, int64_t) +TEST_LOOP (uint8_t, int64_t) +TEST_LOOP (int16_t, int64_t) +TEST_LOOP (uint16_t, int64_t) +TEST_LOOP (int32_t, int64_t) +TEST_LOOP (uint32_t, int64_t) +TEST_LOOP (int64_t, int64_t) +TEST_LOOP (uint64_t, int64_t) +TEST_LOOP (_Float16, int64_t) +TEST_LOOP (float, int64_t) +TEST_LOOP (double, int64_t) +TEST_LOOP (int8_t, uint8_t) +TEST_LOOP (uint8_t, uint8_t) +TEST_LOOP (int16_t, uint8_t) +TEST_LOOP (uint16_t, uint8_t) +TEST_LOOP (int32_t, uint8_t) +TEST_LOOP (uint32_t, uint8_t) +TEST_LOOP (int64_t, uint8_t) +TEST_LOOP (uint64_t, uint8_t) +TEST_LOOP (_Float16, uint8_t) +TEST_LOOP (float, uint8_t) +TEST_LOOP (double, uint8_t) +TEST_LOOP (int8_t, uint16_t) +TEST_LOOP (uint8_t, uint16_t) +TEST_LOOP (int16_t, uint16_t) +TEST_LOOP (uint16_t, uint16_t) +TEST_LOOP (int32_t, uint16_t) +TEST_LOOP (uint32_t, uint16_t) +TEST_LOOP (int64_t, uint16_t) +TEST_LOOP (uint64_t, uint16_t) +TEST_LOOP (_Float16, uint16_t) +TEST_LOOP (float, uint16_t) +TEST_LOOP (double, uint16_t) +TEST_LOOP (int8_t, uint32_t) +TEST_LOOP (uint8_t, uint32_t) +TEST_LOOP (int16_t, uint32_t) +TEST_LOOP (uint16_t, uint32_t) +TEST_LOOP (int32_t, uint32_t) +TEST_LOOP (uint32_t, uint32_t) +TEST_LOOP (int64_t, uint32_t) +TEST_LOOP (uint64_t, uint32_t) +TEST_LOOP (_Float16, uint32_t) +TEST_LOOP (float, uint32_t) +TEST_LOOP (double, uint32_t) +TEST_LOOP (int8_t, uint64_t) +TEST_LOOP (uint8_t, uint64_t) +TEST_LOOP (int16_t, uint64_t) +TEST_LOOP (uint16_t, uint64_t) +TEST_LOOP (int32_t, uint64_t) +TEST_LOOP (uint32_t, uint64_t) +TEST_LOOP (int64_t, uint64_t) +TEST_LOOP (uint64_t, uint64_t) +TEST_LOOP (_Float16, uint64_t) +TEST_LOOP (float, uint64_t) +TEST_LOOP (double, uint64_t) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 88 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-assembler-not "vluxei64\.v" } } */ +/* { dg-final { scan-assembler-not "vsuxei64\.v" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-2.c new file mode 100644 index 00000000000..bdc19d7f3d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-2.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 int8_t +#define INDEX16 int16_t +#define INDEX32 int32_t +#define INDEX64 int64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-3.c new file mode 100644 index 00000000000..05d4cfa00eb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-3.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 uint8_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 8) \ + T (uint16_t, 8) \ + T (_Float16, 8) \ + T (int32_t, 8) \ + T (uint32_t, 8) \ + T (float, 8) \ + T (int64_t, 8) \ + T (uint64_t, 8) \ + T (double, 8) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-4.c new file mode 100644 index 00000000000..e9f0d4d9da5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-4.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 int8_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 8) \ + T (uint16_t, 8) \ + T (_Float16, 8) \ + T (int32_t, 8) \ + T (uint32_t, 8) \ + T (float, 8) \ + T (int64_t, 8) \ + T (uint64_t, 8) \ + T (double, 8) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-5.c new file mode 100644 index 00000000000..5e07ecd9251 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-5.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX16 uint16_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 16) \ + T (uint8_t, 16) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 16) \ + T (uint32_t, 16) \ + T (float, 16) \ + T (int64_t, 16) \ + T (uint64_t, 16) \ + T (double, 16) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-6.c new file mode 100644 index 00000000000..79b49e21af7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-6.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX16 int16_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 16) \ + T (uint8_t, 16) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 16) \ + T (uint32_t, 16) \ + T (float, 16) \ + T (int64_t, 16) \ + T (uint64_t, 16) \ + T (double, 16) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-7.c new file mode 100644 index 00000000000..7a6e25b4b1f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-7.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX32 uint32_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 32) \ + T (uint8_t, 32) \ + T (int16_t, 32) \ + T (uint16_t, 32) \ + T (_Float16, 32) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 32) \ + T (uint64_t, 32) \ + T (double, 32) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-8.c new file mode 100644 index 00000000000..271812bf533 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-8.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX32 int32_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 32) \ + T (uint8_t, 32) \ + T (int16_t, 32) \ + T (uint16_t, 32) \ + T (_Float16, 32) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 32) \ + T (uint64_t, 32) \ + T (double, 32) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-9.c new file mode 100644 index 00000000000..6efe1a53dcc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load-9.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fdump-tree-vect-details" } */ + +#include + +#define INDEX64 uint64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices) \ + { \ + for (int i = 0; i < 128; ++i) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 64) \ + T (uint8_t, 64) \ + T (int16_t, 64) \ + T (uint16_t, 64) \ + T (_Float16, 64) \ + T (int32_t, 64) \ + T (uint32_t, 64) \ + T (float, 64) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1.c new file mode 100644 index 00000000000..10610be26a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-1.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-10.c new file mode 100644 index 00000000000..8e2c22bebbd --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-10.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-10.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 64) + RUN_LOOP (uint8_t, 64) + RUN_LOOP (int16_t, 64) + RUN_LOOP (uint16_t, 64) + RUN_LOOP (_Float16, 64) + RUN_LOOP (int32_t, 64) + RUN_LOOP (uint32_t, 64) + RUN_LOOP (float, 64) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-11.c new file mode 100644 index 00000000000..6c5242ce6e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-11.c @@ -0,0 +1,39 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-11.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE *src_##DATA_TYPE[128]; \ + DATA_TYPE src2_##DATA_TYPE[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + src_##DATA_TYPE[i] = src2_##DATA_TYPE + i; \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] + src_##DATA_TYPE[i][0])); + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-12.c new file mode 100644 index 00000000000..32cf58b1f7d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-12.c @@ -0,0 +1,124 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-vect-cost-model" } */ + +#include "gather_load-12.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, INDEX_TYPE) \ + DATA_TYPE dest_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + DATA_TYPE src_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + INDEX_TYPE index_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + for (int i = 0; i < 202; i++) \ + { \ + src_##DATA_TYPE##_##INDEX_TYPE[i] \ + = (DATA_TYPE) ((i * 19 + 735) & (sizeof (DATA_TYPE) * 7 - 1)); \ + index_##DATA_TYPE##_##INDEX_TYPE[i] = (i * 7) % (55); \ + } \ + f_##DATA_TYPE##_##INDEX_TYPE (dest_##DATA_TYPE##_##INDEX_TYPE, \ + src_##DATA_TYPE##_##INDEX_TYPE, \ + index_##DATA_TYPE##_##INDEX_TYPE); \ + for (int i = 0; i < 100; i++) \ + { \ + assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2] \ + == (src_##DATA_TYPE##_##INDEX_TYPE \ + [index_##DATA_TYPE##_##INDEX_TYPE[i * 2]] \ + + 1)); \ + assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1] \ + == (src_##DATA_TYPE##_##INDEX_TYPE \ + [index_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]] \ + + 2)); \ + } + + RUN_LOOP (int8_t, int8_t) + RUN_LOOP (uint8_t, int8_t) + RUN_LOOP (int16_t, int8_t) + RUN_LOOP (uint16_t, int8_t) + RUN_LOOP (int32_t, int8_t) + RUN_LOOP (uint32_t, int8_t) + RUN_LOOP (int64_t, int8_t) + RUN_LOOP (uint64_t, int8_t) + RUN_LOOP (_Float16, int8_t) + RUN_LOOP (float, int8_t) + RUN_LOOP (double, int8_t) + RUN_LOOP (int8_t, int16_t) + RUN_LOOP (uint8_t, int16_t) + RUN_LOOP (int16_t, int16_t) + RUN_LOOP (uint16_t, int16_t) + RUN_LOOP (int32_t, int16_t) + RUN_LOOP (uint32_t, int16_t) + RUN_LOOP (int64_t, int16_t) + RUN_LOOP (uint64_t, int16_t) + RUN_LOOP (_Float16, int16_t) + RUN_LOOP (float, int16_t) + RUN_LOOP (double, int16_t) + RUN_LOOP (int8_t, int32_t) + RUN_LOOP (uint8_t, int32_t) + RUN_LOOP (int16_t, int32_t) + RUN_LOOP (uint16_t, int32_t) + RUN_LOOP (int32_t, int32_t) + RUN_LOOP (uint32_t, int32_t) + RUN_LOOP (int64_t, int32_t) + RUN_LOOP (uint64_t, int32_t) + RUN_LOOP (_Float16, int32_t) + RUN_LOOP (float, int32_t) + RUN_LOOP (double, int32_t) + RUN_LOOP (int8_t, int64_t) + RUN_LOOP (uint8_t, int64_t) + RUN_LOOP (int16_t, int64_t) + RUN_LOOP (uint16_t, int64_t) + RUN_LOOP (int32_t, int64_t) + RUN_LOOP (uint32_t, int64_t) + RUN_LOOP (int64_t, int64_t) + RUN_LOOP (uint64_t, int64_t) + RUN_LOOP (_Float16, int64_t) + RUN_LOOP (float, int64_t) + RUN_LOOP (double, int64_t) + RUN_LOOP (int8_t, uint8_t) + RUN_LOOP (uint8_t, uint8_t) + RUN_LOOP (int16_t, uint8_t) + RUN_LOOP (uint16_t, uint8_t) + RUN_LOOP (int32_t, uint8_t) + RUN_LOOP (uint32_t, uint8_t) + RUN_LOOP (int64_t, uint8_t) + RUN_LOOP (uint64_t, uint8_t) + RUN_LOOP (_Float16, uint8_t) + RUN_LOOP (float, uint8_t) + RUN_LOOP (double, uint8_t) + RUN_LOOP (int8_t, uint16_t) + RUN_LOOP (uint8_t, uint16_t) + RUN_LOOP (int16_t, uint16_t) + RUN_LOOP (uint16_t, uint16_t) + RUN_LOOP (int32_t, uint16_t) + RUN_LOOP (uint32_t, uint16_t) + RUN_LOOP (int64_t, uint16_t) + RUN_LOOP (uint64_t, uint16_t) + RUN_LOOP (_Float16, uint16_t) + RUN_LOOP (float, uint16_t) + RUN_LOOP (double, uint16_t) + RUN_LOOP (int8_t, uint32_t) + RUN_LOOP (uint8_t, uint32_t) + RUN_LOOP (int16_t, uint32_t) + RUN_LOOP (uint16_t, uint32_t) + RUN_LOOP (int32_t, uint32_t) + RUN_LOOP (uint32_t, uint32_t) + RUN_LOOP (int64_t, uint32_t) + RUN_LOOP (uint64_t, uint32_t) + RUN_LOOP (_Float16, uint32_t) + RUN_LOOP (float, uint32_t) + RUN_LOOP (double, uint32_t) + RUN_LOOP (int8_t, uint64_t) + RUN_LOOP (uint8_t, uint64_t) + RUN_LOOP (int16_t, uint64_t) + RUN_LOOP (uint16_t, uint64_t) + RUN_LOOP (int32_t, uint64_t) + RUN_LOOP (uint32_t, uint64_t) + RUN_LOOP (int64_t, uint64_t) + RUN_LOOP (uint64_t, uint64_t) + RUN_LOOP (_Float16, uint64_t) + RUN_LOOP (float, uint64_t) + RUN_LOOP (double, uint64_t) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c new file mode 100644 index 00000000000..7b0ecace264 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-2.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-3.c new file mode 100644 index 00000000000..ab954819f33 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-3.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-3.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 8) + RUN_LOOP (uint16_t, 8) + RUN_LOOP (_Float16, 8) + RUN_LOOP (int32_t, 8) + RUN_LOOP (uint32_t, 8) + RUN_LOOP (float, 8) + RUN_LOOP (int64_t, 8) + RUN_LOOP (uint64_t, 8) + RUN_LOOP (double, 8) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-4.c new file mode 100644 index 00000000000..a31e5baa4cc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-4.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-4.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 8) + RUN_LOOP (uint16_t, 8) + RUN_LOOP (_Float16, 8) + RUN_LOOP (int32_t, 8) + RUN_LOOP (uint32_t, 8) + RUN_LOOP (float, 8) + RUN_LOOP (int64_t, 8) + RUN_LOOP (uint64_t, 8) + RUN_LOOP (double, 8) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-5.c new file mode 100644 index 00000000000..cd95f4e477a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-5.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-5.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 16) + RUN_LOOP (uint8_t, 16) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 16) + RUN_LOOP (uint32_t, 16) + RUN_LOOP (float, 16) + RUN_LOOP (int64_t, 16) + RUN_LOOP (uint64_t, 16) + RUN_LOOP (double, 16) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-6.c new file mode 100644 index 00000000000..a5275b41acc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-6.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-6.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 16) + RUN_LOOP (uint8_t, 16) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 16) + RUN_LOOP (uint32_t, 16) + RUN_LOOP (float, 16) + RUN_LOOP (int64_t, 16) + RUN_LOOP (uint64_t, 16) + RUN_LOOP (double, 16) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-7.c new file mode 100644 index 00000000000..3260e91bc6d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-7.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-7.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 32) + RUN_LOOP (uint8_t, 32) + RUN_LOOP (int16_t, 32) + RUN_LOOP (uint16_t, 32) + RUN_LOOP (_Float16, 32) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 32) + RUN_LOOP (uint64_t, 32) + RUN_LOOP (double, 32) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-8.c new file mode 100644 index 00000000000..a9433c296c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-8.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-8.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 32) + RUN_LOOP (uint8_t, 32) + RUN_LOOP (int16_t, 32) + RUN_LOOP (uint16_t, 32) + RUN_LOOP (_Float16, 32) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 32) + RUN_LOOP (uint64_t, 32) + RUN_LOOP (double, 32) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-9.c new file mode 100644 index 00000000000..0819cfe78ef --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-9.c @@ -0,0 +1,41 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */ + +#include "gather_load-9.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128]; \ + DATA_TYPE dest2_##DATA_TYPE[128]; \ + DATA_TYPE src_##DATA_TYPE[128]; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); + + RUN_LOOP (int8_t, 64) + RUN_LOOP (uint8_t, 64) + RUN_LOOP (int16_t, 64) + RUN_LOOP (uint16_t, 64) + RUN_LOOP (_Float16, 64) + RUN_LOOP (int32_t, 64) + RUN_LOOP (uint32_t, 64) + RUN_LOOP (float, 64) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-1.c new file mode 100644 index 00000000000..73feb70c7eb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-1.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-10.c new file mode 100644 index 00000000000..71158e781a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-10.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-10.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-11.c new file mode 100644 index 00000000000..ea9165a8733 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-11.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-11.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-12.c new file mode 100644 index 00000000000..8181167a638 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-12.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-vect-cost-model -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-12.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 88 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-assembler-not "vluxei64\.v" } } */ +/* { dg-final { scan-assembler-not "vsuxei64\.v" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-2.c new file mode 100644 index 00000000000..fb118ad9c6f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-2.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-3.c new file mode 100644 index 00000000000..0abc5a3cdbd --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fno-vect-cost-model -fdump-tree-vect-details" } */ + +#include "gather_load-3.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-4.c new file mode 100644 index 00000000000..b0d1b4658c4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-4.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-4.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-5.c new file mode 100644 index 00000000000..74efebace7b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-5.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-5.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-6.c new file mode 100644 index 00000000000..8019145f2cb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-6.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-6.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-7.c new file mode 100644 index 00000000000..82aca112818 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-7.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-7.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-8.c new file mode 100644 index 00000000000..5240e447590 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-8.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-8.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-9.c new file mode 100644 index 00000000000..dd40be98e0c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load-9.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "gather_load-9.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-1.c new file mode 100644 index 00000000000..4d0a9b257f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-1.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-1.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-10.c new file mode 100644 index 00000000000..789be8f6bc9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-10.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-10.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-11.c new file mode 100644 index 00000000000..d3cb6d684e6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-11.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-11.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-12.c new file mode 100644 index 00000000000..bc284b2c8f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-12.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -fno-vect-cost-model -ffast-math" } */ + +#include "gather_load_run-12.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-2.c new file mode 100644 index 00000000000..69db94eace1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-2.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-2.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-3.c new file mode 100644 index 00000000000..affb80bea11 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-3.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math -fno-vect-cost-model" } */ + +#include "gather_load_run-3.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-4.c new file mode 100644 index 00000000000..659122f4ab8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-4.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-4.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-5.c new file mode 100644 index 00000000000..2caf84db858 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-5.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-5.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-6.c new file mode 100644 index 00000000000..54f6b85616d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-6.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-6.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-7.c new file mode 100644 index 00000000000..8cb7149adb5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-7.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-7.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-8.c new file mode 100644 index 00000000000..f98f996abd6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-8.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-8.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-9.c new file mode 100644 index 00000000000..e28bbbb4fdf --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_gather_load_run-9.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "gather_load_run-9.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-1.c new file mode 100644 index 00000000000..b172b9e6562 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-1.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-10.c new file mode 100644 index 00000000000..856c6068637 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-10.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-10.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-11.c new file mode 100644 index 00000000000..deef2321ae8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-11.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-vect-cost-model -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-11.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 88 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-assembler-not "vluxei64\.v" } } */ +/* { dg-final { scan-assembler-not "vsuxei64\.v" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-2.c new file mode 100644 index 00000000000..403ce868932 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-2.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-3.c new file mode 100644 index 00000000000..435699e9baa --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fno-vect-cost-model -fdump-tree-vect-details" } */ + +#include "mask_gather_load-3.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-4.c new file mode 100644 index 00000000000..e4c40b99f60 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-4.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-4.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-5.c new file mode 100644 index 00000000000..7c0b3a48bdc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-5.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-5.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-6.c new file mode 100644 index 00000000000..690e1264756 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-6.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-6.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-7.c new file mode 100644 index 00000000000..0c45b6701de --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-7.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-7.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-8.c new file mode 100644 index 00000000000..7a808657a6b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-8.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-8.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-9.c new file mode 100644 index 00000000000..9c2987fa9aa --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load-9.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math -fdump-tree-vect-details" } */ + +#include "mask_gather_load-9.c" + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-1.c new file mode 100644 index 00000000000..a5fa2de5014 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-1.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-1.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-10.c new file mode 100644 index 00000000000..97930a80f95 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-10.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-10.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-11.c new file mode 100644 index 00000000000..868363e36a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-11.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-11.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-2.c new file mode 100644 index 00000000000..d9191388a2b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-2.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-2.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-3.c new file mode 100644 index 00000000000..ab8d95fdb2a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-3.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math -fno-vect-cost-model" } */ + +#include "mask_gather_load_run-3.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-4.c new file mode 100644 index 00000000000..8ed98ebbc30 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-4.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-4.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-5.c new file mode 100644 index 00000000000..1c385d192bc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-5.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-5.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-6.c new file mode 100644 index 00000000000..12fd1de9f6e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-6.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-6.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-7.c new file mode 100644 index 00000000000..baef2f11213 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-7.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-7.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-8.c new file mode 100644 index 00000000000..3b262a280e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-8.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-8.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-9.c new file mode 100644 index 00000000000..498edca4578 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/len_mask_gather_load_run-9.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */ + +#include "mask_gather_load_run-9.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-1.c new file mode 100644 index 00000000000..39529877b0d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-1.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 uint8_t +#define INDEX16 uint16_t +#define INDEX32 uint32_t +#define INDEX64 uint64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-10.c new file mode 100644 index 00000000000..137d73d874b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-10.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX64 int64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 64) \ + T (uint8_t, 64) \ + T (int16_t, 64) \ + T (uint16_t, 64) \ + T (_Float16, 64) \ + T (int32_t, 64) \ + T (uint32_t, 64) \ + T (float, 64) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-11.c new file mode 100644 index 00000000000..057880d67c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-11.c @@ -0,0 +1,115 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-vect-cost-model -fdump-tree-vect-details" } */ + +#include + +#define TEST_LOOP(DATA_TYPE, INDEX_TYPE) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE##_##INDEX_TYPE (DATA_TYPE *restrict y, DATA_TYPE *restrict x, \ + INDEX_TYPE *restrict index, \ + INDEX_TYPE *restrict cond) \ + { \ + for (int i = 0; i < 100; ++i) \ + { \ + if (cond[i * 2]) \ + y[i * 2] = x[index[i * 2]] + 1; \ + if (cond[i * 2 + 1]) \ + y[i * 2 + 1] = x[index[i * 2 + 1]] + 2; \ + } \ + } + +TEST_LOOP (int8_t, int8_t) +TEST_LOOP (uint8_t, int8_t) +TEST_LOOP (int16_t, int8_t) +TEST_LOOP (uint16_t, int8_t) +TEST_LOOP (int32_t, int8_t) +TEST_LOOP (uint32_t, int8_t) +TEST_LOOP (int64_t, int8_t) +TEST_LOOP (uint64_t, int8_t) +TEST_LOOP (_Float16, int8_t) +TEST_LOOP (float, int8_t) +TEST_LOOP (double, int8_t) +TEST_LOOP (int8_t, int16_t) +TEST_LOOP (uint8_t, int16_t) +TEST_LOOP (int16_t, int16_t) +TEST_LOOP (uint16_t, int16_t) +TEST_LOOP (int32_t, int16_t) +TEST_LOOP (uint32_t, int16_t) +TEST_LOOP (int64_t, int16_t) +TEST_LOOP (uint64_t, int16_t) +TEST_LOOP (_Float16, int16_t) +TEST_LOOP (float, int16_t) +TEST_LOOP (double, int16_t) +TEST_LOOP (int8_t, int32_t) +TEST_LOOP (uint8_t, int32_t) +TEST_LOOP (int16_t, int32_t) +TEST_LOOP (uint16_t, int32_t) +TEST_LOOP (int32_t, int32_t) +TEST_LOOP (uint32_t, int32_t) +TEST_LOOP (int64_t, int32_t) +TEST_LOOP (uint64_t, int32_t) +TEST_LOOP (_Float16, int32_t) +TEST_LOOP (float, int32_t) +TEST_LOOP (double, int32_t) +TEST_LOOP (int8_t, int64_t) +TEST_LOOP (uint8_t, int64_t) +TEST_LOOP (int16_t, int64_t) +TEST_LOOP (uint16_t, int64_t) +TEST_LOOP (int32_t, int64_t) +TEST_LOOP (uint32_t, int64_t) +TEST_LOOP (int64_t, int64_t) +TEST_LOOP (uint64_t, int64_t) +TEST_LOOP (_Float16, int64_t) +TEST_LOOP (float, int64_t) +TEST_LOOP (double, int64_t) +TEST_LOOP (int8_t, uint8_t) +TEST_LOOP (uint8_t, uint8_t) +TEST_LOOP (int16_t, uint8_t) +TEST_LOOP (uint16_t, uint8_t) +TEST_LOOP (int32_t, uint8_t) +TEST_LOOP (uint32_t, uint8_t) +TEST_LOOP (int64_t, uint8_t) +TEST_LOOP (uint64_t, uint8_t) +TEST_LOOP (_Float16, uint8_t) +TEST_LOOP (float, uint8_t) +TEST_LOOP (double, uint8_t) +TEST_LOOP (int8_t, uint16_t) +TEST_LOOP (uint8_t, uint16_t) +TEST_LOOP (int16_t, uint16_t) +TEST_LOOP (uint16_t, uint16_t) +TEST_LOOP (int32_t, uint16_t) +TEST_LOOP (uint32_t, uint16_t) +TEST_LOOP (int64_t, uint16_t) +TEST_LOOP (uint64_t, uint16_t) +TEST_LOOP (_Float16, uint16_t) +TEST_LOOP (float, uint16_t) +TEST_LOOP (double, uint16_t) +TEST_LOOP (int8_t, uint32_t) +TEST_LOOP (uint8_t, uint32_t) +TEST_LOOP (int16_t, uint32_t) +TEST_LOOP (uint16_t, uint32_t) +TEST_LOOP (int32_t, uint32_t) +TEST_LOOP (uint32_t, uint32_t) +TEST_LOOP (int64_t, uint32_t) +TEST_LOOP (uint64_t, uint32_t) +TEST_LOOP (_Float16, uint32_t) +TEST_LOOP (float, uint32_t) +TEST_LOOP (double, uint32_t) +TEST_LOOP (int8_t, uint64_t) +TEST_LOOP (uint8_t, uint64_t) +TEST_LOOP (int16_t, uint64_t) +TEST_LOOP (uint16_t, uint64_t) +TEST_LOOP (int32_t, uint64_t) +TEST_LOOP (uint32_t, uint64_t) +TEST_LOOP (int64_t, uint64_t) +TEST_LOOP (uint64_t, uint64_t) +TEST_LOOP (_Float16, uint64_t) +TEST_LOOP (float, uint64_t) +TEST_LOOP (double, uint64_t) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 88 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-assembler-not "vluxei64\.v" } } */ +/* { dg-final { scan-assembler-not "vsuxei64\.v" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-2.c new file mode 100644 index 00000000000..f93d97ba680 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-2.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 int8_t +#define INDEX16 int16_t +#define INDEX32 int32_t +#define INDEX64 int64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-3.c new file mode 100644 index 00000000000..c3d36d0be28 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-3.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 uint8_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 8) \ + T (uint16_t, 8) \ + T (_Float16, 8) \ + T (int32_t, 8) \ + T (uint32_t, 8) \ + T (float, 8) \ + T (int64_t, 8) \ + T (uint64_t, 8) \ + T (double, 8) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-4.c new file mode 100644 index 00000000000..a1262e80ac9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-4.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX8 int8_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 8) \ + T (uint8_t, 8) \ + T (int16_t, 8) \ + T (uint16_t, 8) \ + T (_Float16, 8) \ + T (int32_t, 8) \ + T (uint32_t, 8) \ + T (float, 8) \ + T (int64_t, 8) \ + T (uint64_t, 8) \ + T (double, 8) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-5.c new file mode 100644 index 00000000000..379d2da2e2b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-5.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX16 uint16_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 16) \ + T (uint8_t, 16) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 16) \ + T (uint32_t, 16) \ + T (float, 16) \ + T (int64_t, 16) \ + T (uint64_t, 16) \ + T (double, 16) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-6.c new file mode 100644 index 00000000000..a7e0897021d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-6.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX16 int16_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 16) \ + T (uint8_t, 16) \ + T (int16_t, 16) \ + T (uint16_t, 16) \ + T (_Float16, 16) \ + T (int32_t, 16) \ + T (uint32_t, 16) \ + T (float, 16) \ + T (int64_t, 16) \ + T (uint64_t, 16) \ + T (double, 16) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-7.c new file mode 100644 index 00000000000..bcdc6a131a5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-7.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX32 uint32_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 32) \ + T (uint8_t, 32) \ + T (int16_t, 32) \ + T (uint16_t, 32) \ + T (_Float16, 32) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 32) \ + T (uint64_t, 32) \ + T (double, 32) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-8.c new file mode 100644 index 00000000000..d5aaa84df9d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-8.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX32 int32_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 32) \ + T (uint8_t, 32) \ + T (int16_t, 32) \ + T (uint16_t, 32) \ + T (_Float16, 32) \ + T (int32_t, 32) \ + T (uint32_t, 32) \ + T (float, 32) \ + T (int64_t, 32) \ + T (uint64_t, 32) \ + T (double, 32) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-9.c new file mode 100644 index 00000000000..808d472848f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load-9.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -fdump-tree-vect-details" } */ + +#include + +#define INDEX64 uint64_t + +#define TEST_LOOP(DATA_TYPE, BITS) \ + void __attribute__ ((noinline, noclone)) \ + f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ + INDEX##BITS *restrict indices, INDEX##BITS *restrict cond) \ + { \ + for (int i = 0; i < 128; ++i) \ + if (cond[i]) \ + dest[i] += src[indices[i]]; \ + } + +#define TEST_ALL(T) \ + T (int8_t, 64) \ + T (uint8_t, 64) \ + T (int16_t, 64) \ + T (uint16_t, 64) \ + T (_Float16, 64) \ + T (int32_t, 64) \ + T (uint32_t, 64) \ + T (float, 64) \ + T (int64_t, 64) \ + T (uint64_t, 64) \ + T (double, 64) + +TEST_ALL (TEST_LOOP) + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */ +/* { dg-final { scan-tree-dump " \.LEN_MASK_GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.GATHER_LOAD" "vect" } } */ +/* { dg-final { scan-tree-dump-not " \.MASK_GATHER_LOAD" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-1.c new file mode 100644 index 00000000000..94d9b9e4be7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-1.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-1.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-10.c new file mode 100644 index 00000000000..41d7803f88a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-10.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-10.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 64) + RUN_LOOP (uint8_t, 64) + RUN_LOOP (int16_t, 64) + RUN_LOOP (uint16_t, 64) + RUN_LOOP (_Float16, 64) + RUN_LOOP (int32_t, 64) + RUN_LOOP (uint32_t, 64) + RUN_LOOP (float, 64) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c new file mode 100644 index 00000000000..435ff9330ac --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c @@ -0,0 +1,140 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-vect-cost-model" } */ + +#include "mask_gather_load-11.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, INDEX_TYPE) \ + DATA_TYPE dest_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + DATA_TYPE src_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + INDEX_TYPE index_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + INDEX_TYPE cond_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ + for (int i = 0; i < 202; i++) \ + { \ + src_##DATA_TYPE##_##INDEX_TYPE[i] \ + = (DATA_TYPE) ((i * 19 + 735) & (sizeof (DATA_TYPE) * 7 - 1)); \ + dest_##DATA_TYPE##_##INDEX_TYPE[i] \ + = (DATA_TYPE) ((i * 7 + 666) & (sizeof (DATA_TYPE) * 5 - 1)); \ + dest2_##DATA_TYPE##_##INDEX_TYPE[i] \ + = (DATA_TYPE) ((i * 7 + 666) & (sizeof (DATA_TYPE) * 5 - 1)); \ + index_##DATA_TYPE##_##INDEX_TYPE[i] = (i * 7) % (55); \ + cond_##DATA_TYPE##_##INDEX_TYPE[i] = (INDEX_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE##_##INDEX_TYPE (dest_##DATA_TYPE##_##INDEX_TYPE, \ + src_##DATA_TYPE##_##INDEX_TYPE, \ + index_##DATA_TYPE##_##INDEX_TYPE, \ + cond_##DATA_TYPE##_##INDEX_TYPE); \ + for (int i = 0; i < 100; i++) \ + { \ + if (cond_##DATA_TYPE##_##INDEX_TYPE[i * 2]) \ + assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2] \ + == (src_##DATA_TYPE##_##INDEX_TYPE \ + [index_##DATA_TYPE##_##INDEX_TYPE[i * 2]] \ + + 1)); \ + else \ + assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2] \ + == dest2_##DATA_TYPE##_##INDEX_TYPE[i * 2]); \ + if (cond_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]) \ + assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1] \ + == (src_##DATA_TYPE##_##INDEX_TYPE \ + [index_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]] \ + + 2)); \ + else \ + assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1] \ + == dest2_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]); \ + } + + RUN_LOOP (int8_t, int8_t) + RUN_LOOP (uint8_t, int8_t) + RUN_LOOP (int16_t, int8_t) + RUN_LOOP (uint16_t, int8_t) + RUN_LOOP (int32_t, int8_t) + RUN_LOOP (uint32_t, int8_t) + RUN_LOOP (int64_t, int8_t) + RUN_LOOP (uint64_t, int8_t) + RUN_LOOP (_Float16, int8_t) + RUN_LOOP (float, int8_t) + RUN_LOOP (double, int8_t) + RUN_LOOP (int8_t, int16_t) + RUN_LOOP (uint8_t, int16_t) + RUN_LOOP (int16_t, int16_t) + RUN_LOOP (uint16_t, int16_t) + RUN_LOOP (int32_t, int16_t) + RUN_LOOP (uint32_t, int16_t) + RUN_LOOP (int64_t, int16_t) + RUN_LOOP (uint64_t, int16_t) + RUN_LOOP (_Float16, int16_t) + RUN_LOOP (float, int16_t) + RUN_LOOP (double, int16_t) + RUN_LOOP (int8_t, int32_t) + RUN_LOOP (uint8_t, int32_t) + RUN_LOOP (int16_t, int32_t) + RUN_LOOP (uint16_t, int32_t) + RUN_LOOP (int32_t, int32_t) + RUN_LOOP (uint32_t, int32_t) + RUN_LOOP (int64_t, int32_t) + RUN_LOOP (uint64_t, int32_t) + RUN_LOOP (_Float16, int32_t) + RUN_LOOP (float, int32_t) + RUN_LOOP (double, int32_t) + RUN_LOOP (int8_t, int64_t) + RUN_LOOP (uint8_t, int64_t) + RUN_LOOP (int16_t, int64_t) + RUN_LOOP (uint16_t, int64_t) + RUN_LOOP (int32_t, int64_t) + RUN_LOOP (uint32_t, int64_t) + RUN_LOOP (int64_t, int64_t) + RUN_LOOP (uint64_t, int64_t) + RUN_LOOP (_Float16, int64_t) + RUN_LOOP (float, int64_t) + RUN_LOOP (double, int64_t) + RUN_LOOP (int8_t, uint8_t) + RUN_LOOP (uint8_t, uint8_t) + RUN_LOOP (int16_t, uint8_t) + RUN_LOOP (uint16_t, uint8_t) + RUN_LOOP (int32_t, uint8_t) + RUN_LOOP (uint32_t, uint8_t) + RUN_LOOP (int64_t, uint8_t) + RUN_LOOP (uint64_t, uint8_t) + RUN_LOOP (_Float16, uint8_t) + RUN_LOOP (float, uint8_t) + RUN_LOOP (double, uint8_t) + RUN_LOOP (int8_t, uint16_t) + RUN_LOOP (uint8_t, uint16_t) + RUN_LOOP (int16_t, uint16_t) + RUN_LOOP (uint16_t, uint16_t) + RUN_LOOP (int32_t, uint16_t) + RUN_LOOP (uint32_t, uint16_t) + RUN_LOOP (int64_t, uint16_t) + RUN_LOOP (uint64_t, uint16_t) + RUN_LOOP (_Float16, uint16_t) + RUN_LOOP (float, uint16_t) + RUN_LOOP (double, uint16_t) + RUN_LOOP (int8_t, uint32_t) + RUN_LOOP (uint8_t, uint32_t) + RUN_LOOP (int16_t, uint32_t) + RUN_LOOP (uint16_t, uint32_t) + RUN_LOOP (int32_t, uint32_t) + RUN_LOOP (uint32_t, uint32_t) + RUN_LOOP (int64_t, uint32_t) + RUN_LOOP (uint64_t, uint32_t) + RUN_LOOP (_Float16, uint32_t) + RUN_LOOP (float, uint32_t) + RUN_LOOP (double, uint32_t) + RUN_LOOP (int8_t, uint64_t) + RUN_LOOP (uint8_t, uint64_t) + RUN_LOOP (int16_t, uint64_t) + RUN_LOOP (uint16_t, uint64_t) + RUN_LOOP (int32_t, uint64_t) + RUN_LOOP (uint32_t, uint64_t) + RUN_LOOP (int64_t, uint64_t) + RUN_LOOP (uint64_t, uint64_t) + RUN_LOOP (_Float16, uint64_t) + RUN_LOOP (float, uint64_t) + RUN_LOOP (double, uint64_t) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-2.c new file mode 100644 index 00000000000..88b6a15315f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-2.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-2.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-3.c new file mode 100644 index 00000000000..cc517753ed0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-3.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-3.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 8) + RUN_LOOP (uint16_t, 8) + RUN_LOOP (_Float16, 8) + RUN_LOOP (int32_t, 8) + RUN_LOOP (uint32_t, 8) + RUN_LOOP (float, 8) + RUN_LOOP (int64_t, 8) + RUN_LOOP (uint64_t, 8) + RUN_LOOP (double, 8) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-4.c new file mode 100644 index 00000000000..83c1a002add --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-4.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-4.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 8) + RUN_LOOP (uint8_t, 8) + RUN_LOOP (int16_t, 8) + RUN_LOOP (uint16_t, 8) + RUN_LOOP (_Float16, 8) + RUN_LOOP (int32_t, 8) + RUN_LOOP (uint32_t, 8) + RUN_LOOP (float, 8) + RUN_LOOP (int64_t, 8) + RUN_LOOP (uint64_t, 8) + RUN_LOOP (double, 8) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-5.c new file mode 100644 index 00000000000..c707e67ebab --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-5.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-5.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 16) + RUN_LOOP (uint8_t, 16) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 16) + RUN_LOOP (uint32_t, 16) + RUN_LOOP (float, 16) + RUN_LOOP (int64_t, 16) + RUN_LOOP (uint64_t, 16) + RUN_LOOP (double, 16) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-6.c new file mode 100644 index 00000000000..8f18850b8e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-6.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-6.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 16) + RUN_LOOP (uint8_t, 16) + RUN_LOOP (int16_t, 16) + RUN_LOOP (uint16_t, 16) + RUN_LOOP (_Float16, 16) + RUN_LOOP (int32_t, 16) + RUN_LOOP (uint32_t, 16) + RUN_LOOP (float, 16) + RUN_LOOP (int64_t, 16) + RUN_LOOP (uint64_t, 16) + RUN_LOOP (double, 16) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-7.c new file mode 100644 index 00000000000..9101fda4a1b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-7.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-7.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 32) + RUN_LOOP (uint8_t, 32) + RUN_LOOP (int16_t, 32) + RUN_LOOP (uint16_t, 32) + RUN_LOOP (_Float16, 32) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 32) + RUN_LOOP (uint64_t, 32) + RUN_LOOP (double, 32) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-8.c new file mode 100644 index 00000000000..ac2360825cc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-8.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns -mcmodel=medany" } */ + +#include "mask_gather_load-8.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 32) + RUN_LOOP (uint8_t, 32) + RUN_LOOP (int16_t, 32) + RUN_LOOP (uint16_t, 32) + RUN_LOOP (_Float16, 32) + RUN_LOOP (int32_t, 32) + RUN_LOOP (uint32_t, 32) + RUN_LOOP (float, 32) + RUN_LOOP (int64_t, 32) + RUN_LOOP (uint64_t, 32) + RUN_LOOP (double, 32) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-9.c new file mode 100644 index 00000000000..8306002b06f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-9.c @@ -0,0 +1,48 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param=riscv-autovec-preference=fixed-vlmax -ffast-math -fno-schedule-insns" } */ + +#include "mask_gather_load-9.c" +#include + +int +main (void) +{ +#define RUN_LOOP(DATA_TYPE, BITS) \ + DATA_TYPE dest_##DATA_TYPE[128] = {0}; \ + DATA_TYPE dest2_##DATA_TYPE[128] = {0}; \ + DATA_TYPE src_##DATA_TYPE[128] = {0}; \ + INDEX##BITS indices_##DATA_TYPE##_##BITS[128] = {0}; \ + INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ + for (int i = 0; i < 128; i++) \ + { \ + dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ + src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ + indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ + cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ + } \ + f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ + indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ + for (int i = 0; i < 128; i++) \ + { \ + if (cond_##DATA_TYPE##_##BITS[i]) \ + assert (dest_##DATA_TYPE[i] \ + == (dest2_##DATA_TYPE[i] \ + + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); \ + else \ + assert (dest_##DATA_TYPE[i] == dest2_##DATA_TYPE[i]); \ + } + + RUN_LOOP (int8_t, 64) + RUN_LOOP (uint8_t, 64) + RUN_LOOP (int16_t, 64) + RUN_LOOP (uint16_t, 64) + RUN_LOOP (_Float16, 64) + RUN_LOOP (int32_t, 64) + RUN_LOOP (uint32_t, 64) + RUN_LOOP (float, 64) + RUN_LOOP (int64_t, 64) + RUN_LOOP (uint64_t, 64) + RUN_LOOP (double, 64) + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp index 5e69235a268..6431337e45a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp +++ b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp @@ -71,6 +71,8 @@ foreach op $AUTOVEC_TEST_OPTS { "" "$op" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/ternop/*.\[cS\]]] \ "" "$op" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/gather-scatter/*.\[cS\]]] \ + "" "$op" } # widening operation only test on LMUL < 8