From patchwork Mon Feb 3 20:04:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 105949 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAC963858C35 for ; Mon, 3 Feb 2025 20:06:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAC963858C35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=OF5zyevt X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 011683858D20 for ; Mon, 3 Feb 2025 20:04:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 011683858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 011683858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::236 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738613068; cv=none; b=YFnH+sGQECPqjbZB3yVxR0FNnySk+QBzOvpEoVzuh+MDoA3vsUuh12qnw4H44DfsBMNbyAn4qc/Jwvw8lZN+sdWv354mD4IrCqxu7z72p0FWPhcF7i1Zfju0DUuGqJnaLk6WnppdCJFv9hqUypCU6Er/kcGKimTi0ZlQ1EHScNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738613068; c=relaxed/simple; bh=9ffgJbMpKGjkjYDI1z3FCwKt45xqcQsXB8tyQUHyP2E=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=f9SNsNKzgKXJU0ciegNqoIh4decXhjv5PbEF84IKfuQieO2GfpTQq7c4wyR3FQECQt8CQ9J+GKPAuKHgk7Fx87WeVY6/0zmlk6QoGtzWxh1KApmITS3JpkBnYx+UIAGUVPrQatMxj6meYXXYmQhrT6pPMivOq9/5gMp6YKc7y7E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 011683858D20 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-30738a717ffso40871601fa.0 for ; Mon, 03 Feb 2025 12:04:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738613065; x=1739217865; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=0xsVqonBJqYCHj1LI8IzCYm4Ojf7rMUPUG3D3c13nzY=; b=OF5zyevt+gV1fMBtmQF9wb5oVhwCZQ8/HUugmVp1wbHSM7O6MChhD5rbFnR7ylJ7Fx g9E9sHt5oG/CWxWwklau2wu6IsWlTaUVUG6PLwzDIjZgLmnI8hECF4f0KQYPK//EOr3b ajBoC7JrfHYS6pMN8Hb73zBTVdRpLHl+XguY3P9LUmN51LjLy4oUxOSW+pWoTfS988Lb /Mmz0eD8GjKGSuIv26M6abJHBaIW7eADcfvlXzSpzOJ5ytIusGfezIRD31a5HQcn7Y9t W7WgYLesGVVMD8z12/WFc6fBEsUkr7QBBjZSOIh9cmlRxxF0B3hClWwLc9LblkIOLj5j I3Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738613065; x=1739217865; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0xsVqonBJqYCHj1LI8IzCYm4Ojf7rMUPUG3D3c13nzY=; b=WdjK9dFQL/P5Ans+xjs4RM56TiVY+bM+bky6YvHMMaUGXrSlwojhsx+9asDGgdgEmj 0/VpkL6Bg8cbnAKXeZDeD0lMF8hIVH1Nw9sWRr6aBZYmg7MdPj/suFP31sW+UhjdHIZO FccLEvWdQo1joTcXS3ZwQN7Cy8b56UF4AMwX5crX2Bb49iobuRA2x3GsvjNocDUHDKCl mnSyuOZCniuDUmfkCcrGXk94rnXKtoFXn+rma9qYaDROh8ctk6CGHZRCm3+nzQdPAnLE PUV+0HNfZ5VIlJlhpa7lnpgyvWzABz8gbuphIT1SQ9RoOttk/8hCZ8hPNRVqkv5bCW1l E4yg== X-Gm-Message-State: AOJu0YyjgLkd0DPGjqICNQDjqn9zJZqb1ibqlDZ+jYOBqWcSZkQSxFop jPRi3GzQfkOwobSf6uo86YNTe1Hf36D3vLHWhVJaSWxsv08ojKBsCOx5wUxUXk85ojsocpcHA5H xfT7/QoDm/s+WEiBooQcAc6ixBvVElKPC X-Gm-Gg: ASbGncucim0Gf5AXPEY8wDsK5MZsHdPoNJqv1OiSDWrgsp58dYaUUFLqTFNpNS6vgml dyAUeg4oA08vrsvQnOSxIoVQ1kqKwp3ueeyPAJ/tiaiyaTJqRsXhcp40un2jR2vWZaWGao7y/ X-Google-Smtp-Source: AGHT+IG6b5MyV+l2AiTnJ4seIIvpj8xon5vAALz+p2No1OaoXkcPngmC20vjUgPsh5bWiYhxyyr0K8onanbcn9GKmuk= X-Received: by 2002:a05:651c:515:b0:306:1302:8c7a with SMTP id 38308e7fff4ca-30796961542mr74685971fa.36.1738613065058; Mon, 03 Feb 2025 12:04:25 -0800 (PST) MIME-Version: 1.0 From: Uros Bizjak Date: Mon, 3 Feb 2025 21:04:13 +0100 X-Gm-Features: AWEUYZkBln0NX31kPQPl-BCcp8PcQ1f-h9FniAuW3EnEt_2RrbI-wIQq4OgRk68 Message-ID: Subject: [committed] i386: Fix and improve TARGET_INDIRECT_BRANCH_REGISTER handling some more To: "gcc-patches@gcc.gnu.org" Cc: "H. J. Lu" X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org gcc/ChangeLog: * config/i386/i386.md (*sibcall_pop_memory): Disable for TARGET_INDIRECT_BRANCH_REGISTER * config/i386/predicates.md (call_insn_operand): Enable when "satisfies_constraint_Bw (op)" is true, instead of open-coding constraint here. (sibcall_insn_operand): Ditto with "satisfies_constraint_Bs (op)". Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index d6ae3ee378a..cb37b2af50b 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -20244,7 +20244,7 @@ (define_insn "*sibcall_pop_memory" (plus:SI (reg:SI SP_REG) (match_operand:SI 2 "immediate_operand" "i"))) (unspec [(const_int 0)] UNSPEC_PEEPSIB)] - "!TARGET_64BIT" + "!TARGET_64BIT && !TARGET_INDIRECT_BRANCH_REGISTER" "* return ix86_output_call_insn (insn, operands[0]);" [(set_attr "type" "call")]) diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 9a9101ed374..8631588f78e 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -781,22 +781,14 @@ (define_special_predicate "call_insn_operand" (ior (match_test "constant_call_address_operand (op, mode == VOIDmode ? mode : Pmode)") (match_operand 0 "call_register_operand") - (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (ior (and (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") - (match_operand 0 "GOT_memory_operand")))))) + (match_test "satisfies_constraint_Bw (op)"))) ;; Similarly, but for tail calls, in which we cannot allow memory references. (define_special_predicate "sibcall_insn_operand" (ior (match_test "constant_call_address_operand (op, mode == VOIDmode ? mode : Pmode)") (match_operand 0 "register_no_elim_operand") - (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (ior (and (not (match_test "TARGET_X32")) - (match_operand 0 "sibcall_memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") - (match_operand 0 "GOT_memory_operand")))))) + (match_test "satisfies_constraint_Bs (op)"))) ;; Return true if OP is a 32-bit GOT symbol operand. (define_predicate "GOT32_symbol_operand"