From patchwork Mon Mar 4 17:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 209655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1576564dyc; Mon, 4 Mar 2024 09:43:35 -0800 (PST) X-Forwarded-Encrypted: i=4; AJvYcCUZAIGA/E67BQq9E3sG7skZnc53muCrHytzEVf9J4Q3HWUqdTsipMWAxGM++OpaM8f+2PXLIs2niKkll8QMnUWcbqIk6w== X-Google-Smtp-Source: AGHT+IGABgNm3XyDHlX229W/2BK+F36Ozzvp4Vj0oK5uQ9nJuOZ/ndXJcbb4eg+Hu5mIdgw1MH27 X-Received: by 2002:a05:620a:19a4:b0:788:2e47:b297 with SMTP id bm36-20020a05620a19a400b007882e47b297mr2170836qkb.78.1709574214831; Mon, 04 Mar 2024 09:43:34 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1709574214; cv=pass; d=google.com; s=arc-20160816; b=gpWcF+HzrteEnj0HvpFzSwxKii894ZU9iEJPdUtnwQA0+pk3IKW2AZkvee7jRbwAEj 1MJMUvZ4z/rYLXby8qRp7OWig1c7pHdxF6kt4hh1uvgcq/xy/8xTID0xNnESJRu6MQqS mEkuhPtLcjRUne/J4gpepNVGIKGR2lYQuaR7VpHjRhr4KKtUJpn+GWIn26jix6u1uO5T YEFAk7uuAGFfT7miIVZq1xIe5Tc6bUGx/ozZmapLfz54DWf8FsiC0+ovuy96E3FIM9TR 1tz0R2P5Va4v0iBivsTbzVnYY32SF20b7aYidF8KjaV8AKnsR+smXGFoaFFal/csY9HP lStQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=79XnTjGlit07FkfUYE7qcOAab9OEpnmULGLI7CCM7/c=; fh=WTJsRs4G52V/gMcjhbfNbo8t5XJoGVmdKBTHDFPm0CA=; b=xOzFaSuYAFl1nRM2xMIFZk0OukU27ydXJTtuEoGvjyR0+/8I7PM/1wB8FzeOo9Dxm9 8IC+5tKExyX0GORSQjbjiUDmQvNakWA/arF0hkAAzm81PtnZh9AcP5vvHF3kbIljAAqO kCdcRACMufUkQRsSRfxCWGHtLkSRLHJSgzpZ99Iz57xfnb21vpepo90KNEZ0iLhup3Nh W4rcvsfyR1tm4B/232VO0DqYthNWZ8NvPpsIrSbqBepo3XbY2ESjF58wK4bK01YRWOwa n9GlIdE5fSkUCldJ/P88MoXpcJro9PKKgMcCcanaLjrKSCu8K9Jx70T7lgj4vsmjZKtT IsRQ==; dara=google.com ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=TV2oUTFX; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mxCam54a; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j19-20020a05620a0a5300b007882e0bc1besi1405397qka.742.2024.03.04.09.43.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 09:43:34 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=TV2oUTFX; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mxCam54a; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 81332385840B for ; Mon, 4 Mar 2024 17:43:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 24B2D3858C55 for ; Mon, 4 Mar 2024 17:42:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 24B2D3858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 24B2D3858C55 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709574168; cv=pass; b=f0UciimkkDKQ0rgenHCPjzJtQRuplwq4rdDTQGfo7cGPigYNRiZyYq8Mwb36HnI/7eJmfqgKOjWYKP1EGq79j7ntnh1xB5xvWIKXmAzFZVKP6BxL0L72Ywqfz2MhIdlRfdKSEyJ3RTKBI0LPorcK9gfk3rSDD8ko3GQ1w92QWOk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709574168; c=relaxed/simple; bh=6L0f39iGI6dQZ4JLDr2sMS6aWXAdMp21wQxI/s4/OBw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ACHowk8RLC0aRTswawFv/z0WmrXNAFADE9j2REFtDRPF0OKsDANgsQ9o3LQHBUAfqOImWUkrq5WXsEmOSRO4A3eu1iokBhOqLfs9iqC0vUtClZ6cfZebMuoG6rAb67WtiGzlrGTyjgRKnlpjshxdGcA3Wpu7Zkaz6Ijd9cDpanM= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 424GXwrv002982 for ; Mon, 4 Mar 2024 17:42:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=79XnTjGlit07FkfUYE7qcOAab9OEpnmULGLI7CCM7/c=; b=TV2oUTFXUsOwCED6QmD6KpDc6yeL9J/leLArCd6dOuNIv+qg63a9rpFSk2LfgxeH5gO6 3Ca6mq5iKHJ235Uo8KTIvYGpaZSkMyeeWmClaOAIKUpkhk6gRhDn0wcpTfsbdNheBYez 9Letj9h3YzKG0t3yPDCj9wVud3QWSZG/iAh07GkOoY3cnJEuIlOOwk4ZS69HuTOfy1qV WdCYGGapBqKUA3G0BSlBlrMkJUhSSWPDGp/iO+amX1Q9lOGTFvMBl+O1Mk0AiGtfnZSp u+maUAyJpRFL3t1I+MUZvCb+cvu82R+Hu+B/3qOsG6plZC/an39tStu6abWYkrvl5XnJ 5w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wktheccfv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 04 Mar 2024 17:42:45 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 424HEgVl017051 for ; Mon, 4 Mar 2024 17:42:44 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wktj64vra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 04 Mar 2024 17:42:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d2s+Qvt1vbXflXYUpnF6yrmlmeB4VIlc7sdoHuYZN+lIGa0/4FwjM5i3c12LU8+X1ZmGVV6R6hZvW7r+587Nx2I4dDWE8GsKAHWmSj2P6D9VcopQsR/tfQQQ5jTFVwnYy+LtzOorfORlSKdqbk+dOo0SOh9q2qxqbbCw6AecwJD7LRfw9qQ+MoZnnh9EMmlUAjwQuSBjErhsX7uX9CdybCENmoZPBecxRvMd7srY82qnNdSTj4KuUPxYoCaoi7PfRwWW7S+zrzEnotxcEX0vG0DN9cNKOTps4nwZ8t3TDC19RO/lN87OkTUXQz1vpfKrBHrEK7vS2NgrerCEEKAR0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=79XnTjGlit07FkfUYE7qcOAab9OEpnmULGLI7CCM7/c=; b=iA4twfLvAgFU7SVNMWyZ1etyZmt89nrjCfWE2RlCN2BHBUZQUxmc2n3tgd+0wunWUdYyN6fYVqaSEF/6BgWVKukbep/Kck3Plkea+PyY6/jDBE8Dyk13kyd9dSEa+ggTIF+U0/l+DnhRqV221K4W8UWaKZu0+pxMHOhjmCZspDdMXo74apTmODat+cRrY9F7TAdL/YdKiixEeXmiEdVoySJFM+jcmagEgDiAwYI45F4RQ1nCM+dZVGplsncVlegSvo7wO0rBYT/Nu3zIelxjt3LFMJLwPqi1p02sn/xrHWtqPH9Dk3NPt4HP2WpYR2X2go8SMqaL6M5YaXIq9O9kFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=79XnTjGlit07FkfUYE7qcOAab9OEpnmULGLI7CCM7/c=; b=mxCam54aTWrkhlvgvPjUDYIH3UB6sLJS6f3kTMnrlHADkElkm2jb1kRd4JRY0oiw5HY5vqO7R6P2QAc32WbNmCdFAulPiiDaRi2KSR/PEtfcamCIznhj8nszSc/OKQGScMzQLtUym8BWv/aIKJDa9+A3oQMkiNdX0R84ohQLi0E= Received: from DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) by SA1PR10MB6640.namprd10.prod.outlook.com (2603:10b6:806:2b6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Mon, 4 Mar 2024 17:42:42 +0000 Received: from DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::c0b9:6482:3e36:a112]) by DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::c0b9:6482:3e36:a112%3]) with mapi id 15.20.7339.035; Mon, 4 Mar 2024 17:42:42 +0000 From: David Faust To: gcc-patches@gcc.gnu.org Cc: jose.marchesi@oracle.com Subject: [PATCH] bpf: add inline memset expansion Date: Mon, 4 Mar 2024 09:43:22 -0800 Message-ID: <20240304174322.24822-1-david.faust@oracle.com> X-Mailer: git-send-email 2.43.0 X-ClientProxiedBy: MW4PR04CA0360.namprd04.prod.outlook.com (2603:10b6:303:8a::35) To DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7953:EE_|SA1PR10MB6640:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c1eb638-1dfe-463b-5790-08dc3c727e8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PtIkGH8jHKmLPFIok3Z4zvd+Au1sj3skpoSoBJRtUAFB+iCNAn+5ua0CZZ+cJhlm/oIdx0yoGfa8MccrDq/NotFuTYpoivhs1b6WZd9EIjexLTE1NCvTSsBCO9IFdZfsSz3p6GXQwHo2yoHjcz8rV4jOAhgNxStR/W1SmQbJWPwVjikCB+0JN4NvwPsydjfu5d097e1EIV++BVxqUg2iTZYNDcbE6N2Ec31wp3G4kcjA+/51BcJDKSmQNyVjlseFq0iySkOwhA8qYeQlDXwqv+aAxOuPiRbLxZik97uFyGtNX/zTKDnJLV9WHWnCJSuC4bVhZy+G3zXLjRmVfnSb0yR+JDtolIOfrPFR1kAmQWF0v5gleNPtTymKHh77/lHjnjOEye2Y2omdu9cLeQl4uoTiXgOie2jPRl/CDl1WeWaou34YFrHYju7TqZFzsniyx4mrMJxcgOgZC2Ga6kC4VG0nEwoIVMJfUyZQntbEoKyd6QJ02UDXzmamwkXwTdoLxBEFfgZaWbZG3tomMBJklv+Gv867TBluVQL4FPB/UTD0Fl3KDsjX4WgSx7EbClO6iqg9thKzg+NiU7dKZJx0maDbILW0oxrwbbtKGFsngfE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR10MB7953.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005); DIR:OUT; SFP:1101; X-M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QB2LzvnAjHFMn2JeNNRar96C2Ve3v4tKRixmOfIiBUrEPSXx1iyBbJu6rB1Vdx3PjPbSfGq03TqjIEbOPM/jnr5PCvIQ73D609ajgpyzsZqIbeTjRywZHCxTzlSa/TyXpGDcjI0t6QKORqDzpsQ+DOPIBq7GALI5le8qorTdu7W8sr6BVBnOmg9mZY1hOderSeQcJ8jrUhpBn9RoNiiCB9a59k+JAatjlc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c1eb638-1dfe-463b-5790-08dc3c727e8f X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7953.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2024 17:42:42.7878 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SZGY4pHzGHoYCHxTDcKoN7m3RUdM1TuXinOgQXgyhwoB7tJHsqTmBXsPj63g/M5xldDHWe2oBi7O82fT6OF7HA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6640 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-04_13,2024-03-04_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403040134 X-Proofpoint-ORIG-GUID: _zNT0cx3objsWkMFCzWxSScSrGAptIhs X-Proofpoint-GUID: _zNT0cx3objsWkMFCzWxSScSrGAptIhs X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792618492239870362 X-GMAIL-MSGID: 1792618492239870362 Similar to memmove and memcpy, the BPF backend cannot fall back on a library call to implement __builtin_memset, and should always expand calls to it inline if possible. This patch implements simple inline expansion of memset in the BPF backend in a verifier-friendly way. Similar to memcpy and memmove, the size must be an integer constant, as is also required by clang. Tested for bpf-unknown-none target on x86_64-linux-gnu host. Also testetd against kernel BPF verifier by compiling and loading a test program using the inline memset expansion. gcc/ * config/bpf/bpf-protos.h (bpf_expand_setmem): New prototype. * config/bpf/bpf.cc (bpf_expand_setmem): New. * config/bpf/bpf.md (setmemdi): New define_expand. gcc/testsuite/ * gcc.target/bpf/memset-1.c: New test. --- gcc/config/bpf/bpf-protos.h | 1 + gcc/config/bpf/bpf.cc | 66 +++++++++++++++++++++++++ gcc/config/bpf/bpf.md | 17 +++++++ gcc/testsuite/gcc.target/bpf/memset-1.c | 39 +++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 gcc/testsuite/gcc.target/bpf/memset-1.c diff --git a/gcc/config/bpf/bpf-protos.h b/gcc/config/bpf/bpf-protos.h index 366acb87ae4..ac0c2f4038f 100644 --- a/gcc/config/bpf/bpf-protos.h +++ b/gcc/config/bpf/bpf-protos.h @@ -36,5 +36,6 @@ class gimple_opt_pass; gimple_opt_pass *make_pass_lower_bpf_core (gcc::context *ctxt); bool bpf_expand_cpymem (rtx *, bool); +bool bpf_expand_setmem (rtx *); #endif /* ! GCC_BPF_PROTOS_H */ diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index 22b0cf2dc46..0e33f4347ba 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -1309,6 +1309,72 @@ bpf_expand_cpymem (rtx *operands, bool is_move) return true; } +/* Expand setmem, as from __builtin_memset. + OPERANDS are the same as the setmem pattern. + Return true if the expansion was successful, false otherwise. */ + +bool +bpf_expand_setmem (rtx *operands) +{ + /* Size must be constant for this expansion to work. */ + if (!CONST_INT_P (operands[1])) + { + if (flag_building_libgcc) + warning (0, "could not inline call to %<__builtin_memset%>: " + "size must be constant"); + else + error ("could not inline call to %<__builtin_memset%>: " + "size must be constant"); + return false; + } + + /* Alignment is a CONST_INT. */ + gcc_assert (CONST_INT_P (operands[3])); + + rtx dst = operands[0]; + rtx size = operands[1]; + rtx val = operands[2]; + unsigned HOST_WIDE_INT size_bytes = UINTVAL (size); + unsigned align = UINTVAL (operands[3]); + enum machine_mode mode; + switch (align) + { + case 1: mode = QImode; break; + case 2: mode = HImode; break; + case 4: mode = SImode; break; + case 8: mode = DImode; break; + default: + gcc_unreachable (); + } + + unsigned iters = size_bytes >> ceil_log2 (align); + unsigned remainder = size_bytes & (align - 1); + unsigned inc = GET_MODE_SIZE (mode); + unsigned offset = 0; + + for (unsigned int i = 0; i < iters; i++) + { + emit_move_insn (adjust_address (dst, mode, offset), val); + offset += inc; + } + if (remainder & 4) + { + emit_move_insn (adjust_address (dst, SImode, offset), val); + offset += 4; + remainder -= 4; + } + if (remainder & 2) + { + emit_move_insn (adjust_address (dst, HImode, offset), val); + offset += 2; + remainder -= 2; + } + if (remainder & 1) + emit_move_insn (adjust_address (dst, QImode, offset), val); + + return true; +} + /* Finally, build the GCC target. */ struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md index ca677bc6b50..ea688aadf91 100644 --- a/gcc/config/bpf/bpf.md +++ b/gcc/config/bpf/bpf.md @@ -663,4 +663,21 @@ (define_expand "movmemdi" FAIL; }) +;; memset +;; 0 is dst +;; 1 is length +;; 2 is value +;; 3 is alignment +(define_expand "setmemdi" + [(set (match_operand:BLK 0 "memory_operand") + (match_operand:QI 2 "nonmemory_operand")) + (use (match_operand:DI 1 "general_operand")) + (match_operand 3 "immediate_operand")] + "" + { + if (bpf_expand_setmem (operands)) + DONE; + FAIL; +}) + (include "atomic.md") diff --git a/gcc/testsuite/gcc.target/bpf/memset-1.c b/gcc/testsuite/gcc.target/bpf/memset-1.c new file mode 100644 index 00000000000..9e9f8eff028 --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/memset-1.c @@ -0,0 +1,39 @@ +/* Ensure memset is expanded inline rather than emitting a libcall. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct context { + unsigned int data; + unsigned int data_end; + unsigned int data_meta; + unsigned int ingress; + unsigned int queue_index; + unsigned int egress; +}; + +void +set_small (struct context *ctx) +{ + void *data = (void *)(long)ctx->data; + char *dest = data; + __builtin_memset (dest + 4, 0, sizeof (struct context) - 4); +} + +void +set_large (struct context *ctx) +{ + void *data = (void *)(long)ctx->data; + char *dest = data; + __builtin_memset (dest, 0xfe, 130); +} + +void +set_variable (struct context *ctx) +{ + void *data = (void *)(long)ctx->data; + char *dest = data; + __builtin_memset (dest, 0xbc, ctx->data_meta); /* { dg-error "could not inline call" } */ +} + +/* { dg-final { scan-assembler-times "call" 0 } } */