From patchwork Wed Mar 6 20:01:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1909002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=S3gyJOyl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tqjy44hFSz1yX8 for ; Thu, 7 Mar 2024 07:02:03 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 147B63857C72 for ; Wed, 6 Mar 2024 20:02:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id D77033858D34 for ; Wed, 6 Mar 2024 20:01:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D77033858D34 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 D77033858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::233 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709755303; cv=none; b=I1M35n90kXB98NIUp9zkli3Sxb1vcIBRIhBFPno0zKHb3eeO5ICk49A6MGmnUVFfXDzPtCkL4y/lYi4KY76Q40mpuUhtlkuycrxfxGjVBzfPa11H3PMcogzsLQQq5OdQPsgvrKwape23RHF+0uXdcVkO5dB70D5NWlxLypEaFcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709755303; c=relaxed/simple; bh=STxBFy+0A2hoQ4CLMobk0GZDaArizsouxxqJ0UDwt2s=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=KTrh/9P0NQCed+CUFNV31JHQFpsNiBixtRgETjvDSc01IodkgxiVMT+vs5qRprxlPgJ00hYjKj/K/wDmwRyHvI+icRTRx0BG6KCRqXW7XuyjOujzg3q4Gh+fhL8f7jRrMcBckRt0PI8ZkAGP3AhsJ+lX5ZHwEaQwxagF6FCLhtg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d269b2ff48so273931fa.3 for ; Wed, 06 Mar 2024 12:01:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709755300; x=1710360100; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=euVkTELWfxZQqp5ZMB85dY5cn3puNuYJw/6ySn4oQLg=; b=S3gyJOylMT9COYAYPZswphOjhBK3nNQuX7kZIHp/1WZUbQKJq79jzTh2OjFBsx1oKt TsBa/Li9j4Ii1H2pcyQwWdLZx2MdPhGnTH9qzeo6wy5k42edWDi+JFryWi3RRtKiAOpE 0IO3ldaXhLFSnBcR6UZi1miexv0FEVYxj3IN8yqeufwTarEOznT4rl/pADUbNa+aQdd4 ay1W2vRXRKnY8Qm+F2Npfv8WREzZOALQQxC9HAc1mT02yzYTMIyx6mwb2wK8dQJaq9vb cYqMZCfFWFJOcP6PYlhdvMv3BdJWOAgIhUL/gPnaXxFwexvAh3Fbq7iYpUHcGP/ajjSj JVpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709755300; x=1710360100; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=euVkTELWfxZQqp5ZMB85dY5cn3puNuYJw/6ySn4oQLg=; b=XMBiYWt52dQhFb0mvlvURu8rk6ty0839iIrnd4hWFeDAq8WGWedx7NiAzgcJmbkyqK NIgLMLrcOx8miBuZv7rMylATocphUD73+Y70gCJzF2qlksb4CW2UwtedKOpjBz+Zlyby 6BX+BH7SzkOHvwUmYaCsWkxt72Q0tvWYz8j0ZtX2kw7WCFs2jMgTzWx5+z2k3hZALktg dR7ydreeuOXJ6lHXY59r3UaehIdGqjE4OHFo6kjXRjx0AQ9Nx98zwiDL9I6B4QK76nOY t+u0CVNA0n4e6dnDRmb/kbF/Bc6ECU3ZAOU5VfkOndUxEPhztqHV/y4MTde2yxyVwdy1 NEPA== X-Gm-Message-State: AOJu0YzjeOZWaLHZKK8YRkri9t2BA0gbDLPLtaB/sJrhy65SOVW98RqG yiaOCDbX36HfgGYIaDuo2qv7tbXfUb504DQ3hy3fRsmyp6CMzzT7J1SQscOUqy3/ew+CKl8pV4H lF3Y3t2rhWEQ/sNw2nY3astZHbm4IjAovkhw= X-Google-Smtp-Source: AGHT+IEr/hKJlHDEy/ccOI4ahVqfWse33JZi8x6ptS1uzrwqBZi68JKBzYtlD8Vt4+acI/MG8Xlv1/xXzZ3ayDcj3hw= X-Received: by 2002:a2e:bea1:0:b0:2d3:4226:f102 with SMTP id a33-20020a2ebea1000000b002d34226f102mr62091ljr.25.1709755299577; Wed, 06 Mar 2024 12:01:39 -0800 (PST) MIME-Version: 1.0 From: Uros Bizjak Date: Wed, 6 Mar 2024 21:01:27 +0100 Message-ID: Subject: [committed] i386: Fix and improve insn constraint for V2QI arithmetic/shift insns To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.1 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, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org optimize_function_for_size_p predicate is not stable during optab selection, because it also depends on node->count/node->frequency of the current function, which are updated during IPA, so they may change between early opts and late opts. Use optimize_size instead - optimize_size implies optimize_function_for_size_p (cfun), so if a named pattern uses "&& optimize_size" and the insn it splits into uses optimize_function_for_size_p (cfun), it shouldn't fail. PR target/114232 gcc/ChangeLog: * config/i386/mmx.md (negv2qi2): Enable for optimize_size instead of optimize_function_for_size_p. Explicitly enable for TARGET_SSE2. (negv2qi SSE reg splitter): Enable for TARGET_SSE2 only. (v2qi3): Enable for optimize_size instead of optimize_function_for_size_p. Explicitly enable for TARGET_SSE2. (v2qi SSE reg splitter): Enable for TARGET_SSE2 only. (v2qi3): Enable for optimize_size instead of optimize_function_for_size_p. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros. diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 2856ae6ffef..9a8d6030d8b 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -2874,11 +2874,18 @@ (define_insn "negv2qi2" (neg:V2QI (match_operand:V2QI 1 "register_operand" "0,Yw"))) (clobber (reg:CC FLAGS_REG))] - "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" + "!TARGET_PARTIAL_REG_STALL || optimize_size || TARGET_SSE2" "#" [(set_attr "isa" "*,sse2") (set_attr "type" "multi") - (set_attr "mode" "QI,TI")]) + (set_attr "mode" "QI,TI") + (set (attr "enabled") + (cond [(and (eq_attr "alternative" "0") + (and (match_test "TARGET_PARTIAL_REG_STALL") + (not (match_test "optimize_function_for_size_p (cfun)")))) + (symbol_ref "false") + ] + (const_string "*")))]) (define_split [(set (match_operand:V2QI 0 "general_reg_operand") @@ -2912,8 +2919,7 @@ (define_split (neg:V2QI (match_operand:V2QI 1 "sse_reg_operand"))) (clobber (reg:CC FLAGS_REG))] - "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) - && TARGET_SSE2 && reload_completed" + "TARGET_SSE2 && reload_completed" [(set (match_dup 0) (match_dup 2)) (set (match_dup 0) (minus:V16QI (match_dup 0) (match_dup 1)))] @@ -2975,11 +2981,18 @@ (define_insn "v2qi3" (match_operand:V2QI 1 "register_operand" "0,0,Yw") (match_operand:V2QI 2 "register_operand" "Q,x,Yw"))) (clobber (reg:CC FLAGS_REG))] - "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" + "!TARGET_PARTIAL_REG_STALL || optimize_size || TARGET_SSE2" "#" [(set_attr "isa" "*,sse2_noavx,avx") (set_attr "type" "multi,sseadd,sseadd") - (set_attr "mode" "QI,TI,TI")]) + (set_attr "mode" "QI,TI,TI") + (set (attr "enabled") + (cond [(and (eq_attr "alternative" "0") + (and (match_test "TARGET_PARTIAL_REG_STALL") + (not (match_test "optimize_function_for_size_p (cfun)")))) + (symbol_ref "false") + ] + (const_string "*")))]) (define_split [(set (match_operand:V2QI 0 "general_reg_operand") @@ -3021,8 +3034,7 @@ (define_split (match_operand:V2QI 1 "sse_reg_operand") (match_operand:V2QI 2 "sse_reg_operand"))) (clobber (reg:CC FLAGS_REG))] - "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) - && TARGET_SSE2 && reload_completed" + "TARGET_SSE2 && reload_completed" [(set (match_dup 0) (plusminus:V16QI (match_dup 1) (match_dup 2)))] { @@ -3684,9 +3696,10 @@ (define_insn_and_split "v2qi3" (match_operand:V2QI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "cI"))) (clobber (reg:CC FLAGS_REG))] - "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" + "!TARGET_PARTIAL_REG_STALL || optimize_size" "#" - "&& reload_completed" + "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) + && reload_completed" [(parallel [(set (zero_extract:HI (match_dup 3) (const_int 8) (const_int 8)) (subreg:HI