From patchwork Thu Dec 8 10:59:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jose E. Marchesi" X-Patchwork-Id: 31283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp124403wrr; Thu, 8 Dec 2022 02:56:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5OeQ0ZjxiAmog3hrBUwQDw148pQNx8Wy68PFJ4zJycMZSsYJ3yXBwQayVCj18cWVbTFrXF X-Received: by 2002:a17:907:a688:b0:7ba:ba67:f2f with SMTP id vv8-20020a170907a68800b007baba670f2fmr54193879ejc.199.1670497011307; Thu, 08 Dec 2022 02:56:51 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sd1-20020a1709076e0100b00780ec98afafsi20412786ejc.113.2022.12.08.02.56.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 02:56:51 -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=@gcc.gnu.org header.s=default header.b=qbfI9EbM; arc=fail (signature failed); 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 388443952497 for ; Thu, 8 Dec 2022 10:56:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 388443952497 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670497010; bh=4sEM8Cwq5ngOnEicGXZRWo8pE34Q6JdubaAFThjJi2w=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=qbfI9EbMUmv99+4exqaeJ2Akz2EtKQoPlDi8eqo7ru/GBm6px4YQNdUOwLoKtDNZA A6HjjJOi46rYJUu8MxMRz6C0WbGzCab0E1zhLU7fViHaDVALiQkM6WMoCWg+zwJLRz 2xww9gshi1gRAKu8BZTNavDUT2S+23kGdfVjXPgg= 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 625E93950C71 for ; Thu, 8 Dec 2022 10:56:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 625E93950C71 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B87jD59023738 for ; Thu, 8 Dec 2022 10:56:02 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3maudutfpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 08 Dec 2022 10:56:02 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2B89IRJa016118 for ; Thu, 8 Dec 2022 10:56:02 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2043.outbound.protection.outlook.com [104.47.74.43]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3maa4rkppn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 08 Dec 2022 10:56:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U0IH44QfyKliSWHorLofEVFXxJenTOkj536SphEX45DKPpsicCx4clY8PB2GVI7U4DOYAdXpIXlunLlBnMk8EdyvJ1urmV4bQrJIw9yVbipf4iSlQwVs8gfzQVAIYNWm8quiq9bOu8PFLjS+HPwuR0zNvGUNeCbkjI6IczknXUp66CkwQM4971xAvPH6MmUy2q1E+om17OXl1FXEqcNyQ1c1MEjOgKoxNY4OBhvPCWoG1IpgUdL7L/nbpH8dJaIZwaSDmEMayckbvvHGX79Z9q1BYNgHgYIk0T3Nt8XvFY7q3tZ1UFj5W5U2YblzHm8lSynOSvfeACtl1zD+cuQ5YA== 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=4sEM8Cwq5ngOnEicGXZRWo8pE34Q6JdubaAFThjJi2w=; b=CPy9QXImmwt2PztUhsUxRlFgTfVoPZsH8chIDQkFVkOwMsA/C2P6HZBDTL/fRvL2XRPo+Z1WSOgf0hnw/Pvp6dGyrIpKp5S1RfGi7U3KRW5b86aMl+1907EZW5JJ+SIdCptWeHrSXbStXiFsGO3QM5HpXPiHMn3v7FAJMF1Fbw3eFnjx6pj33Gisp/snjacgKFZtwQVEN/1qDb1TJlvi9CQOZ9qeAVsnwcrBs/1Uz0ddxpFePhXM3jAC4RIX2nvcV2GlIRo6bQYRifP+VYUYeXmdcQSuEwIHi7Q7YcKEIuPqGMygmwMxJjdRHol1AcW1tS1nwFP4ik/y9JiWVjf0Sw== 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 Received: from BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) by DS7PR10MB5390.namprd10.prod.outlook.com (2603:10b6:5:3a1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Thu, 8 Dec 2022 10:56:00 +0000 Received: from BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::ebe9:b7c9:82ae:d256]) by BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::ebe9:b7c9:82ae:d256%7]) with mapi id 15.20.5880.014; Thu, 8 Dec 2022 10:56:00 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH] expr.cc: avoid unexpected side effects in expand_expr_divmod optimization Date: Thu, 8 Dec 2022 11:59:44 +0100 Message-Id: <20221208105944.660323-1-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: LO2P265CA0073.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::13) To BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB2888:EE_|DS7PR10MB5390:EE_ X-MS-Office365-Filtering-Correlation-Id: 504dffff-d280-4e5a-2175-08dad90aca83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QNEEnlOf0lGXnShwtNRom+dicKfZpI0XaJKQ15HzUF3ZfUhBoVLUO6pM8mxNPsLzU6zT0QJqXDjBrbtmX01tRIevrb55BzQBG1Fh3miO/aHPsk9SObbflrU7wOm0zmL1vSnXjE+Gi55o9+zt4u7UrKOqO4AgXjygsbvGyX3dzY3NIHODVTqIMbSvrE3pPNIKq1S4+Jh3Xw29okUlsgNXgAYsbMnbU4TSUQnNZbhqYFae1GiZcNtZbtk2fqYbAnbPAeBAkzXm1csKzJm8fLFSYh+Jv9Ua19QKybDn43FjC8hOrcM8JOv644jqnOji4OBNuoZKg4EO2KB7lJ38cLyTN2G986Y4EzjTXUywZj8n7nyCDs6sHCVezxqox1dZ3BKo9UZ84QSw/FY22bnPCSci+xmOUyBNK9cd/7XqBSSchiZCKtpF60ku46pWSIk+oPQqYFxqGND0uBe9AePGbSvUYCcMlHQ6bg/S3vqo+UF/O6MpGv+NYmdxPaPtKhe2mg31co9PEKpW/9mVvJGS4CjODD+mdzLN4Jp8hORAzyG4fVWSPHP5zIeOkeMyZtAxDYXcOWLITL78pSwZmoOsBNu+VAAwa4spq3ym5TYVCksFiuUWLqAX80ov7TDt0cvbu42psP/VWPKEYNN2d/6ctP+4LButXS3UtYnbTLskdpsxca/mQA8OL27L5HdyfmO+jdMbGVXCEqBGjz16NysKYkhNzgkSEaZJjM3dWwH92JF/xp1mDVpLn3aEnAkndee3G3m2dpD54DVAzMf48EWcF/203A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2888.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(136003)(376002)(39860400002)(396003)(366004)(451199015)(84970400001)(36756003)(8936002)(86362001)(41300700001)(2906002)(5660300002)(83380400001)(66476007)(6486002)(316002)(2616005)(66946007)(38100700002)(6916009)(8676002)(66556008)(478600001)(186003)(6666004)(6506007)(26005)(1076003)(6512007)(56340200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q3jzMKEFBpwl//Ue8M4F7hsxm6yBYqhJdU3+smmta4OTpwM8fL3nuOnT1n7TV5fnJKF0Q8Ru8++odruEVAhcmWmA7sEYKysp3W7O9d6YtIXjDdZNVKbfYZr/QrbneC5wGtGNJLcLpVzGTnLI1aKQCSHvk/XLepdlG0e7OMVgnLhDS1jaG/ofBgUJLLKy8a/BpaBWcTrhdTTH5b4TAJ3ukxj37JvX+/jAVghSVqgYEz60imfxkeRCtlhzTxpLmaNLthxwFSbi/V3lYIUHQVboZAWPakfLsNU7qXwguSd03FIKYNotNDrkx/TlydWuYgnWuAZcjPsh1gqa3lgm6b/P/NsYVbtn4z3kvzaft0Rd7wSPzptSaYQxyQnLrbFF9J6AgJ8fWuPtGGr77REUQ7nxFHQXvILTmLkSfLvSGXKVDZ9HxM2FZxGLB7MeOaxUVHCRmm/Au/orYxUmEIvVVpUjJX23KPrv42QmAixod5BSCtWsL19165kn1k3b3RVrKyVEjChdYZ+CbomG2DBgxVEFCc4WtvaZl+XRn4DXdyAgZV9yTrRL4C659ASJcOw3ksQe6iyCK971ivLStJxJBolT339UMyZOTWUUZvmAIWFi6btiLqPCP5WhMSUVFGlrabb8yABhW8KdRkVkQbfAkYPWWylUfeqIo0Fpwg7ANeR2A88FvIKSG0XPX9QYKsnaQslgwi4RdZo13mFV4zjccBBlcr22pHET/h66gb9xLhCNaM+CbLQNgHsfqlKFkqHX6ld9w/xPOuIYgjgZAF/S+VyAIjaKsOUxLfMoUmv3LRLMZccr3jtw+qSoIW0S6wcOcIL2pZkqFYOe6ggt+dClFzGTuZYsWM2XEDBeKn5mkO6nr4P5j7jTO1fnqKXs58umE6jxHBurxxoqkzKSNpJ9RPkY8zwQKvHZQYNs3RKvbwkVM0OeYPWi4S79kLjbW90pgPRyI47TK+o+IsaAvGDo6P6qjXBs9o2y0MP5qzzBTsjm0hlm1Ggc6OqQcKXq8O/xWtDM/i9tyEjzX52H5cmtAqztOE/XRpH8jbzmjMFFIt6iZnBpjFw+OIbnSJwEYKJQZaEvFE4NUmVilkL3y5Jd5MdZmblNc2IwcsahbVNHerb8l30XPoq7EZOjzksldd5ORXjWWJoJOhZJYL2ApQY6JiRiEH95DUns/pbAc6VBUMqlq08MUPo2Lib3GLvz98m84V4qMOk9tBtsuR/ghnGlu0kbuQKzRcsI3Y7X6kHRHKjZSqTvH8k9tY+unKT3+gQ8Uh9LZqng2bmQ/9vUK6MLrQCrh26Q0ipDYR5G0bqqWoiwrGi08Y8EF5TwkfZ4s+XZyx7txjIotlXVtXnXkk9j1uDjNQfb+PVDGNjNguzqG5p/FBigzVwE/5RZORkqeIGXAGWyGwNngyCwNiWMTF/vDxtBWL/WswTaKs6kzknAr3VQ5YBqpiwZOhFTub0873nFbcN7Ss7S5nrXRMtbr2qqV00kK6Gvg94RwlVYqzcvPXzLxk9eFNloxx/FS5lpP8YJD3Kz2NpgFOWrRASrCQM4nntl3npMimk0AgqUJfA64fpUoPRELmzcezSWkGVTedbaL1BWKGaLofIi7pmhYg0WJiSI1g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 504dffff-d280-4e5a-2175-08dad90aca83 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2888.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2022 10:55:59.9650 (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: qKUSFPBeVmDeE87+QUZu7g8PMW7uwoGhZQvymbibkcr0B7o+u/NNuUlKOSMJDql5EamP7M0b5ygcsjV9jHR4+E5Cp7a1pCsCuWlDE+Ja2Do= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5390 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-08_06,2022-12-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212080090 X-Proofpoint-ORIG-GUID: O4XW73RNHCTIVKZk54jlcpl0Zrz6WgUF X-Proofpoint-GUID: O4XW73RNHCTIVKZk54jlcpl0Zrz6WgUF X-Spam-Status: No, score=-12.0 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Jose E. Marchesi via Gcc-patches" From: "Jose E. Marchesi" Reply-To: "Jose E. Marchesi" 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?1751643074496369230?= X-GMAIL-MSGID: =?utf-8?q?1751643074496369230?= The expand_expr_divmod function in expr.cc attempts to optimize cases where both arguments of a division/modulus are known to be positive when interpreted as signed. In these cases, both signed division and unsigned division will raise the same value, and therefore the cheapest option can be used. In order to determine what is the cheaper option in the current target, expand_expr_divmod actually expands both a signed divmod and an unsigned divmod using local "sequences": start_sequence (); ... expand_divmod (... signed ...); ... end_sequence (); start_sequence (); ... expand_divmod (... unsigned ...); ... end_sequence (); And then compares the cost of each generated sequence, choosing the best one. Finally, it emits the selected expanded sequence and returns the rtx with the result. This approach has a caveat. Some targets do not provide instructions for division/modulus instructions. In the case of BPF, it provides unsigned division/modulus, but not signed division/modulus. In these cases, the expand_divmod tries can contain calls to funcalls. For example, in BPF: start_sequence (); ... expand_divmod (... signed ...); -> This generates funcall to __divdi3 ... end_sequence (); start_sequence (); ... expand_divmod (... unsigned ...); -> This generates direct `div' insn. ... end_sequence (); The problem is that when a funcall is expanded, an accompanying global symbol definition is written in the output stream: .global __divdi3 And this symbol definition remains in the compiled assembly file, even if the sequence using the direct `div' instruction above is used. This is particularly bad in BPF, because the kernel bpf loader chokes on the spurious symbol __divdi3 and makes the resulting BPF object unloadable (note that BPF objects are not linked before processed by the kernel.) In order to fix this, this patch modifies expand_expr_divmod in the following way: - When trying each sequence (signed, unsigned) the expand_divmod calls are told to _not_ use libcalls if everything else fails. This is done by passing OPTAB_WIDEN as the `methods' argument. (Before it was using the default value OPTAB_LIB_WIDEN.) - If any of the tried expanded sequences contain a funcall, then the optimization is not attempted. A couple of BPF tests are also added to make sure this doesn't break at any point in the future. Tested in bpf-unknown-none and x86_64-linux-gnu. Regtested in x86_64-linux-gnu. No regressions. gcc/ChangeLog * expr.cc (expand_expr_divmod): Avoid side-effects of trying sequences involving funcalls in optimization. gcc/testsuite/ChangeLog: * gcc.target/bpf/divmod-funcall-1.c: New test. * gcc.target/bpf/divmod-funcall-2.c: Likewise. --- gcc/expr.cc | 44 +++++++++++-------- .../gcc.target/bpf/divmod-funcall-1.c | 8 ++++ .../gcc.target/bpf/divmod-funcall-2.c | 8 ++++ 3 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/gcc.target/bpf/divmod-funcall-1.c create mode 100644 gcc/testsuite/gcc.target/bpf/divmod-funcall-2.c diff --git a/gcc/expr.cc b/gcc/expr.cc index d9407432ea5..4d4be5d7bda 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -9168,32 +9168,38 @@ expand_expr_divmod (tree_code code, machine_mode mode, tree treeop0, do_pending_stack_adjust (); start_sequence (); rtx uns_ret = expand_divmod (mod_p, code, mode, treeop0, treeop1, - op0, op1, target, 1); + op0, op1, target, 1, OPTAB_WIDEN); rtx_insn *uns_insns = get_insns (); end_sequence (); start_sequence (); rtx sgn_ret = expand_divmod (mod_p, code, mode, treeop0, treeop1, - op0, op1, target, 0); + op0, op1, target, 0, OPTAB_WIDEN); rtx_insn *sgn_insns = get_insns (); end_sequence (); - unsigned uns_cost = seq_cost (uns_insns, speed_p); - unsigned sgn_cost = seq_cost (sgn_insns, speed_p); - /* If costs are the same then use as tie breaker the other other - factor. */ - if (uns_cost == sgn_cost) - { - uns_cost = seq_cost (uns_insns, !speed_p); - sgn_cost = seq_cost (sgn_insns, !speed_p); - } - - if (uns_cost < sgn_cost || (uns_cost == sgn_cost && unsignedp)) - { - emit_insn (uns_insns); - return uns_ret; - } - emit_insn (sgn_insns); - return sgn_ret; + /* Do not try to optimize if any of the sequences tried above + resulted in a funcall. */ + if (uns_ret && sgn_ret) + { + unsigned uns_cost = seq_cost (uns_insns, speed_p); + unsigned sgn_cost = seq_cost (sgn_insns, speed_p); + + /* If costs are the same then use as tie breaker the other + other factor. */ + if (uns_cost == sgn_cost) + { + uns_cost = seq_cost (uns_insns, !speed_p); + sgn_cost = seq_cost (sgn_insns, !speed_p); + } + + if (uns_cost < sgn_cost || (uns_cost == sgn_cost && unsignedp)) + { + emit_insn (uns_insns); + return uns_ret; + } + emit_insn (sgn_insns); + return sgn_ret; + } } return expand_divmod (mod_p, code, mode, treeop0, treeop1, op0, op1, target, unsignedp); diff --git a/gcc/testsuite/gcc.target/bpf/divmod-funcall-1.c b/gcc/testsuite/gcc.target/bpf/divmod-funcall-1.c new file mode 100644 index 00000000000..dffb1506f06 --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/divmod-funcall-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-not "__divdi3" } } */ + +int +foo (unsigned int len) +{ + return ((unsigned long)len) * 234 / 5; +} diff --git a/gcc/testsuite/gcc.target/bpf/divmod-funcall-2.c b/gcc/testsuite/gcc.target/bpf/divmod-funcall-2.c new file mode 100644 index 00000000000..41e8e40c35c --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/divmod-funcall-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-not "__moddi3" } } */ + +int +foo (unsigned int len) +{ + return ((unsigned long)len) * 234 % 5; +}