From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id AE4763858D37 for ; Fri, 21 Apr 2023 07:54:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE4763858D37 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-63b5c4c769aso2647503b3a.3 for ; Fri, 21 Apr 2023 00:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1682063663; x=1684655663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M+8RsA44kDpp09yFbLkF/XoJuNTBva6C3apOpqubi+I=; b=Z2ryFPaLAaVtOn0vtSVzdPXzkhLPx0k0taeoLvrs5zoLMMCHuaeUOhFLkVQ8v0W7bH LBkwmolBIr1n6Pr71W4TnzvjP1WxQCtPCV+cwzYiYAEy0JaMuk4Y4U520SHePfOPL8ou 4GZHf7SAkKySsLnohH9IfA4wLSrxT1wPyc/evD+sMsF9YTEOE+d3yY0v+vXLxloMpkNn 3+W+A0kQwpTUw1EwXlrHYpNgpXTIP8h1NAFVxZIockY9l+8vQ+Lo90WeuWiZ5XJ2r3Kc d46xKWute4U9EGrhYJO6qnOBCbfX4WwjUP9/eb6oUQoO7VwcZ1Wi2qOZRPdEeUv+sRI+ 86yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682063663; x=1684655663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M+8RsA44kDpp09yFbLkF/XoJuNTBva6C3apOpqubi+I=; b=UfdjkqohOELkqGnDgOO2PZ3vVSAE0UR0eeHsKSRCpZF4kGK9V3AtTllAggaBtZOvX5 UA+YpN7VZy+MmjECaMbXFmCGLnJn1OJF+GpWHut0Sz5rswhCgsOym0zs9lrWQh3QL7G7 ZWKtvfjL/zuDvmvZsdIjJLXrmvoxjeUNzoNscmuhNminDnJxwFReduCUreGS0DiBwD4F FZADjK5GBPJoOtcIzsHRVdDyehEUUMI9mzZGdCiPWcJCP7UAiMmWM8E1tuCjHI+wmxgH 5wrLHDG8fSHV3rJSd6nnBOf/JGopgxKbXakgSEuZOxOSFP5PCj1kISsKLBwN6p5/V4o9 xQNQ== X-Gm-Message-State: AAQBX9frv34sC1xQDcg+QWR8bzRmaIJ9TxdPscuiLhPgaijZmGLni3V6 eCvErQaBubYC5umJWpkjp9ekEZZDJvGTlc23rPE8t2UKjMhGtfBsqtcQvGrNTaGNvGAN40bcC2S xbjBTHd87HipV55tjxLpKmTomZRuCJEHnFtlamDmODouh7yjFOm5A25KroxLjhF6bF8qWPjiqC6 CECX07 X-Google-Smtp-Source: AKy350YnLCdWsHenZ1z6uWOR9eaynwch5igaa5Iw8kiN53IS21UK2ecp3G5z7M8xIJyJzgYymQaQ7w== X-Received: by 2002:a05:6a00:1393:b0:63f:15cc:9c1a with SMTP id t19-20020a056a00139300b0063f15cc9c1amr2883144pfg.1.1682063663210; Fri, 21 Apr 2023 00:54:23 -0700 (PDT) Received: from localhost.localdomain (1-169-217-217.dynamic-ip.hinet.net. [1.169.217.217]) by smtp.gmail.com with ESMTPSA id fa23-20020a056a002d1700b006259e883ee9sm650992pfb.189.2023.04.21.00.54.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Apr 2023 00:54:22 -0700 (PDT) From: Hau Hsu To: libc-alpha@sourceware.org, hongrong.hsu@sifive.com, jerry.shih@sifive.com, nick.knight@sifive.com, kito.cheng@sifive.com Cc: greentime.hu@sifive.com, alice.chan@sifive.com, andrew@sifive.com, vincent.chen@sifive.com, hau.hsu@sifive.com Subject: [PATCH v2 1/5] riscv: Enabling vectorized mem*/str* functions in build time Date: Fri, 21 Apr 2023 15:54:01 +0800 Message-Id: <20230421075405.14892-2-hau.hsu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230421075405.14892-1-hau.hsu@sifive.com> References: <20230421075405.14892-1-hau.hsu@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 List-Id: From: Vincent Chen Let the build selects the vectorized mem*/str* functions when it detects the compiler supports RISC-V V extension and enables it in this build. We agree that the these vectorized mem*/str* functions should be selected by IFUNC. Therefore, this patch is intended as a **temporary solution** to enable reviewers to evaluate the effectiveness of these vectorized mem*/str* functions. --- scripts/build-many-glibcs.py | 10 ++++++++++ sysdeps/riscv/preconfigure | 19 +++++++++++++++++++ sysdeps/riscv/preconfigure.ac | 18 ++++++++++++++++++ sysdeps/riscv/rv32/rvv/Implies | 2 ++ sysdeps/riscv/rv64/rvv/Implies | 2 ++ 5 files changed, 51 insertions(+) create mode 100644 sysdeps/riscv/rv32/rvv/Implies create mode 100644 sysdeps/riscv/rv64/rvv/Implies diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 82f8d97281..2fbb91a028 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -381,6 +381,11 @@ class Context(object): variant='rv32imafdc-ilp32d', gcc_cfg=['--with-arch=rv32imafdc', '--with-abi=ilp32d', '--disable-multilib']) + self.add_config(arch='riscv32', + os_name='linux-gnu', + variant='rv32imafdcv-ilp32d', + gcc_cfg=['--with-arch=rv32imafdcv', '--with-abi=ilp32d', + '--disable-multilib']) self.add_config(arch='riscv64', os_name='linux-gnu', variant='rv64imac-lp64', @@ -396,6 +401,11 @@ class Context(object): variant='rv64imafdc-lp64d', gcc_cfg=['--with-arch=rv64imafdc', '--with-abi=lp64d', '--disable-multilib']) + self.add_config(arch='riscv64', + os_name='linux-gnu', + variant='rv64imafdcv-lp64d', + gcc_cfg=['--with-arch=rv64imafdcv', '--with-abi=lp64d', + '--disable-multilib']) self.add_config(arch='s390x', os_name='linux-gnu', glibcs=[{}, diff --git a/sysdeps/riscv/preconfigure b/sysdeps/riscv/preconfigure index 4dedf4b0bb..5ddc195b46 100644 --- a/sysdeps/riscv/preconfigure +++ b/sysdeps/riscv/preconfigure @@ -7,6 +7,7 @@ riscv*) flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'` float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'` atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2` + vector=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_vector' | cut -d' ' -f2` case "$xlen" in 64 | 32) @@ -32,6 +33,24 @@ riscv*) ;; esac + case "$vector" in + __riscv_vector) + case "$flen" in + 64) + float_machine=rvv + ;; + *) + # V 1.0 spec requires both F and D extensions, but this may be an older version. Degrade to scalar only. + ;; + esac + ;; + *) + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: vector $vector flen $flen float_machine $float_machine" >&5 +$as_echo "$as_me: vector $vector flen $flen float_machine $float_machine" >&6;} + case "$float_abi" in soft) abi_flen=0 diff --git a/sysdeps/riscv/preconfigure.ac b/sysdeps/riscv/preconfigure.ac index a5c30e0dbf..b6b8bb46e4 100644 --- a/sysdeps/riscv/preconfigure.ac +++ b/sysdeps/riscv/preconfigure.ac @@ -7,6 +7,7 @@ riscv*) flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'` float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'` atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2` + vector=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_vector' | cut -d' ' -f2` case "$xlen" in 64 | 32) @@ -32,6 +33,23 @@ riscv*) ;; esac + case "$vector" in + __riscv_vector) + case "$flen" in + 64) + float_machine=rvv + ;; + *) + # V 1.0 spec requires both F and D extensions, but this may be an older version. Degrade to scalar only. + ;; + esac + ;; + *) + ;; + esac + + AC_MSG_NOTICE([vector $vector flen $flen float_machine $float_machine]) + case "$float_abi" in soft) abi_flen=0 diff --git a/sysdeps/riscv/rv32/rvv/Implies b/sysdeps/riscv/rv32/rvv/Implies new file mode 100644 index 0000000000..25ce1df222 --- /dev/null +++ b/sysdeps/riscv/rv32/rvv/Implies @@ -0,0 +1,2 @@ +riscv/rv32/rvd +riscv/rvv diff --git a/sysdeps/riscv/rv64/rvv/Implies b/sysdeps/riscv/rv64/rvv/Implies new file mode 100644 index 0000000000..9993bb30e3 --- /dev/null +++ b/sysdeps/riscv/rv64/rvv/Implies @@ -0,0 +1,2 @@ +riscv/rv64/rvd +riscv/rvv -- 2.37.1