From patchwork Wed Oct 30 07:20:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 99806 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 C491C385828B for ; Wed, 30 Oct 2024 07:20:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 9DB9C3858C98 for ; Wed, 30 Oct 2024 07:20:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9DB9C3858C98 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 9DB9C3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::230 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730272832; cv=none; b=PSniR0/lCQN06inKT6zhw+a03IpctbLVeJqWsYhGjvBcMbl2v4Zn7HZ0oDDTHuIn/U+yTmv+R7OW4CnvghG5FH9TTVWLcAGn1P2CSQvrmWysO92XuWKI0+vwJ+BmVqi3hHIXyzZVO2XyxPJ2tWKTQjH8+KyxwiWTV1KA7FUtwBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730272832; c=relaxed/simple; bh=SQinETeYWCjblr4YwqUM+FUU2KJxQH4wTtixm7EyXT0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=wAGIBqtGEFtndmXPm4FZD7wfXEQVJYqEWAeD+753FghD+SFQCAKukB6t2GnSo2h9bpeqVYm1GN0aB6v+d79TYryAYMzvIXeeNKykBzx3oM+GM123eCVE2TzYH84X6oi4KwmmT6s2RvHT8+9esSzis9oiL39VdSoYjnyYGk9NpHc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2fb3da341c9so61931821fa.2 for ; Wed, 30 Oct 2024 00:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730272827; x=1730877627; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=SQinETeYWCjblr4YwqUM+FUU2KJxQH4wTtixm7EyXT0=; b=L0JE7i4aq3fVlcTH45coryqaMXRfVZjSMNE+ngngvUmjzv6DIrRMunif0/to/QTCXe RG7TfeRYH/8dYr6n/uk1yH65HCF714ows4fGo6Vt6RAcGfXx7lA8JotMDv2OONv63Rkl dnUd3n/GJGWfEGaJrMbrZe406OKhzSgICBPKY3ieU/dVXeKqePWswuTmvVfCywoYPC1Z vQ65reK29HN3VH+p7qzacQMK9dq0yHPAXplb9zIk7tj87gC5vG820N1Url8P9vGKf14Q RCpRGuqgtX2jvEA3n86xF/gXXeXPnV6DJbVrZsx9JwzQw5oemgJ+qDopkYImtc1ZRiQf WY0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730272827; x=1730877627; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SQinETeYWCjblr4YwqUM+FUU2KJxQH4wTtixm7EyXT0=; b=SzUIJv26OwfYZRNa/AguReuVaDTZQl1MSr3mYZl1zOT+zYF4aRNJmpXQ01r99eNtpk Rss8ZZWC1nko4RAmxsyCw23T5eDqQS4AjAD8bXoRRdGmI48NOl0MdOL0eo0zi7DFuUHL LLffFYEViBhC14v96CGAq72oJao7U4aZonQQksrN+Kh717Gvfxr6DsoFMTa9oYWg4+Ey bpvY31aUZQ7RrTZ6lVQn6jjmur5OP9cf0lEETiPaOhqnLbxyxev9bH21juWYc9UrgDhf U0EKJQvQAbjlBClkjtNbOIe3Tisab4PwBppV9uaAVOBZpexwO69t972A6Mc8Fm7bcSS1 N8Gw== X-Gm-Message-State: AOJu0Yys0us8k8BOzXMnYvo5sl1MT/g+RWy+Dm64dwOO/PbSkyRQg1Ez 7ueOGGvsa+xvqxn5dqfJwyDCsJxeXVpuYtXzcAdr6aOZZvbsr5lHYE791TuX9TmiezfgEkfEDAI I4jIZU/nMp0Zv+MqfisrH4tC9vL7VMpudvDY= X-Google-Smtp-Source: AGHT+IGEz01S8cCW8obnsF59y/dyhOFogho3rQqeazD7AAuBAZ3/GsvZc9g2bYpFKC7nArHbUKJah7urIumcJdL62q4= X-Received: by 2002:a05:651c:1994:b0:2fa:d84a:bd8f with SMTP id 38308e7fff4ca-2fcbe08cd04mr63598411fa.30.1730272826377; Wed, 30 Oct 2024 00:20:26 -0700 (PDT) MIME-Version: 1.0 From: Uros Bizjak Date: Wed, 30 Oct 2024 08:20:14 +0100 Message-ID: Subject: [committed] i386: Use assign_stack_temp instead of assign_386_stack_local with SLOT_TEMP To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.0 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 It is better to use assign_stack_temp instead of assign_386_stack_local with SLOT_TEMP because assign_stack_temp also shares sub-space of stack slots (e.g. HImode temp shares stack slot with SImode stack slot). Use assign_386_stack_local only for special stack slots (SLOT_STV_TEMP that can be nested inside other stack temp access, SLOT_FLOATxFDI_387 that has relaxed alignment constraint) or slots that can't be shared (SLOT_CW_*). The patch removes SLOT_TEMP. assign_stack_temp should be used instead. gcc/ChangeLog: * config/i386/i386.h (enum ix86_stack_slot): Remove SLOT_TEMP. * config/i386/i386-expand.cc (ix86_expand_builtin) : Use assign_stack_temp instead of assign_386_stack_local with SLOT_TEMP. : Ditto. (ix86_expand_divmod_libfunc): Ditto. * config/i386/i386.md (floatunssi2): Ditto. * config/i386/sync.md (atomic_load): Ditto. (atomic_store): Ditto. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros. diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 36011cc6b35..0de0e842731 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -13738,13 +13738,13 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, case IX86_BUILTIN_LDMXCSR: op0 = expand_normal (CALL_EXPR_ARG (exp, 0)); - target = assign_386_stack_local (SImode, SLOT_TEMP); + target = assign_stack_temp (SImode, GET_MODE_SIZE (SImode)); emit_move_insn (target, op0); emit_insn (gen_sse_ldmxcsr (target)); return 0; case IX86_BUILTIN_STMXCSR: - target = assign_386_stack_local (SImode, SLOT_TEMP); + target = assign_stack_temp (SImode, GET_MODE_SIZE (SImode)); emit_insn (gen_sse_stmxcsr (target)); return copy_to_mode_reg (SImode, target); @@ -25743,7 +25743,7 @@ ix86_expand_divmod_libfunc (rtx libfunc, machine_mode mode, rtx op0, rtx op1, rtx *quot_p, rtx *rem_p) { - rtx rem = assign_386_stack_local (mode, SLOT_TEMP); + rtx rem = assign_stack_temp (mode, GET_MODE_SIZE (mode)); rtx quot = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL, mode, op0, mode, op1, mode, diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 2dcd8803a08..51934400951 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2539,8 +2539,7 @@ enum ix86_fpcmp_strategy { enum ix86_stack_slot { - SLOT_TEMP = 0, - SLOT_CW_STORED, + SLOT_CW_STORED = 0, SLOT_CW_ROUNDEVEN, SLOT_CW_TRUNC, SLOT_CW_FLOOR, diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index e4d1c56ea54..fb6aaa81505 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -6282,7 +6282,7 @@ (define_expand "floatunssi2" { emit_insn (gen_floatunssi2_i387_with_xmm (operands[0], operands[1], - assign_386_stack_local (DImode, SLOT_TEMP))); + assign_stack_temp (DImode, GET_MODE_SIZE (DImode)))); DONE; } if (!TARGET_AVX512F) diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index f2b3ba0aa7a..f03d418c369 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -170,7 +170,7 @@ (define_expand "atomic_load" if (mode == DImode && !TARGET_64BIT) emit_insn (gen_atomic_loaddi_fpu (operands[0], operands[1], - assign_386_stack_local (DImode, SLOT_TEMP))); + assign_stack_temp (DImode, GET_MODE_SIZE (DImode)))); else { rtx dst = operands[0]; @@ -251,7 +251,7 @@ (define_expand "atomic_store" out to be significantly larger than this plus a barrier. */ emit_insn (gen_atomic_storedi_fpu (operands[0], operands[1], - assign_386_stack_local (DImode, SLOT_TEMP))); + assign_stack_temp (DImode, GET_MODE_SIZE (DImode)))); } else {