From patchwork Thu Jul 13 22:00:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 107709 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp67941qge; Thu, 13 Jul 2017 15:01:17 -0700 (PDT) X-Received: by 10.84.136.129 with SMTP id 1mr12841599pll.39.1499983277828; Thu, 13 Jul 2017 15:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499983277; cv=none; d=google.com; s=arc-20160816; b=V4GWaxHEFnP2Zj1ThsvDHlsRsAVIF9Luu2vuySW4KOsbxYh/BThs0nkDNf5V/3djVB A6QTQjBiI9wmdjSvCE2cDp+J0yUg/mIjKcOGgnRIqWcUiY6L4wkeIe7lKgGITe2pws5O /cj9z4vRy8D+XMQarPdndZXu1+72mllxIZ6Y101l0k1kZiAm5e93gaiZ5cepfOK2G8qs qUYcEhXZc8OZ2a7mktQydrpI6keiakjx1TZ7gSqhtiQWG+QOoSY88ZP1XRqFsx2TL4Yb KybgpUpAbCtlmZn949ZXQxYx8m9VYFNszxgRHjT1p+Ay1FYRe5eZ8I/XOVO/Uxugbomc m77Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:mime-version:delivered-to:sender :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=ECa1kdNkFGupoxkrNQR4RZYSAP4/9+C7Lw916UquRZc=; b=qs+9mxjtOB726BOwY6V23jMc1eOLu2DkyznClg56QyGyShJ+4KdZLXL/FPNwfTIE01 33QzCZD0DNI/PzfnkiyLGIpiqrKCGQHnMQhi40hl4ZoWGt7mzoxok+eNjmLN+OITM412 0eyhaECeFmbIuOZh2NMPbJ8j5kimZBUUVaNoS8Nz1yySRbq5jHpz21zww0WNn7PfF7Bq KmGUrfvORgM1arPVbT3bO3v7ZHtr2qkXQiVqlu2AJ+H844XWT4ulGRgiNwZR1P7l5N+4 GhcI41+LrXeYQDGr8LuD9eTjT1ggwGPgL8i0erEw7Sw2AmlQRRzc14OKvQ2e09QXW4CT ADUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=jUOAznJF; spf=pass (google.com: domain of gcc-patches-return-458130-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458130-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 64si5631055pla.387.2017.07.13.15.01.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 15:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458130-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=jUOAznJF; spf=pass (google.com: domain of gcc-patches-return-458130-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458130-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=PbDTnP1x682V9SnGMm283cyKmhQqzq9WBgdLPHJrhFU kPzdalYdfQRRwx4JRl9KIuHR2NegDGjKK7HnDtQNjtuv29srbro3hcYQ/hJiu7Jl xQbf83jaV/X4HIGzWR03IyNosUmoHA+/yDhxu60yNA10TstMa5WoW2Zc0EGfaB4A = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=N2Ub6E6PcqsQMbsfS0BXhxmPKms=; b=jUOAznJFD2MqdzSVK Kk+5pwa0tSLZxMjwPk7899MECq5x/UArQkaFyKX1ps0Kj+s4SKDkoU/kD/CONVZV 9vFxHJRsWMNnvH6Aakde4QuyehpRQmZ+SsJzXnP74bQBaAUHyzdB2LcE6w8lQ737 I7Sz5oRr7SN9v3RjzqEsJvr7Ak= Received: (qmail 117462 invoked by alias); 13 Jul 2017 22:01:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 117345 invoked by uid 89); 13 Jul 2017 22:00:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2532, 63307 X-HELO: mail-lf0-f41.google.com Received: from mail-lf0-f41.google.com (HELO mail-lf0-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 22:00:52 +0000 Received: by mail-lf0-f41.google.com with SMTP id b207so44207847lfg.2 for ; Thu, 13 Jul 2017 15:00:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=vB/W5Hi25+3l3otCQlNpL5UWvCsAfFLW9TOGjxUex+A=; b=a43IgVr3SqD/X7ogBnpOMh2OiaEnQiDKrQ5BHa5c2GL4V0xeNB9mjru+wuGPzw41VP dzvojtJVVKWLwAe+v0uJOUJ9Vlymn7grZfWw70AD6SARaFusOY0jcOsKnDJKvox8gc39 cW30PQtti7enN13vmt45RoSZBh/3XTTq5Asz+KmWytX+I/s6YCxj+CmC735jT22Wqd5W D7G63L7tzfT1bgbuQBdcWX1NiRbJ6v743SQstEZmsbDJLFXCcHtD3m/39/InhG6DJvNd rCDJ8Fx34SnldySwcuUjiQxnMT7xDMMyqBPW6+BGDcwNhamDW1EbF5aQPbqtE1r5azmD V+Eg== X-Gm-Message-State: AIVw112XzoHJ550OHIq1Ljwu+saeKgYty2bGYO1QJUnLmAD4k2okraOl PsQyFLQhrhayjqj2xR1FEPCqu+0z4DWO9cNHMw== X-Received: by 10.25.229.13 with SMTP id c13mr2047082lfh.102.1499983249401; Thu, 13 Jul 2017 15:00:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.87.82 with HTTP; Thu, 13 Jul 2017 15:00:48 -0700 (PDT) From: Jim Wilson Date: Thu, 13 Jul 2017 15:00:48 -0700 Message-ID: Subject: [PATCH] scheduler bug fix for AArch64 insn fusing SCHED_GROUP usage To: "gcc-patches@gcc.gnu.org" Cc: Jim Wilson The AArch64 port uses SCHED_GROUP to mark instructions that get fused at issue time, to ensure that they will be issued together. However, in the scheduler, use of a SCHED_GROUP forces all other instructions to issue in the next cycle. This is wrong for AArch64 ports using insn fusing which can issue multiple insns per cycle, as aarch64 SCHED_GROUP insns can all issue in the same cycle, and other insns can issue in the same cycle also. I put a testcase and some info in bug 81434. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81434 The attached patch fixes the problem. The behavior in pass == 0 is same as now. All non sched group insns are ignored, and all sched group insns are checked to see if they need to be queued for a latter cycle. The difference is in the second pass where non sched group insns are queued for a latter cycle only if there is a sched group insn that got queued. Since sched group insns always sort to the top of the list of insns to schedule, all sched group insns still get scheduled together as before. This has been tested with an Aarch64 bootstrap and make check. OK? Jim 2017-07-13 Jim Wilson PR rtl-optimization/81434 * haifa-sched.c (prune_ready_list): Init min_cost_group to 0. Update comment for main loop. In sched_group_found if, also add checks for pass and min_cost_group. diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 1b13e32..f6369d9 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -6300,7 +6300,7 @@ prune_ready_list (state_t temp_state, bool first_cycle_insn_p, { int i, pass; bool sched_group_found = false; - int min_cost_group = 1; + int min_cost_group = 0; if (sched_fusion) return; @@ -6316,8 +6316,8 @@ prune_ready_list (state_t temp_state, bool first_cycle_insn_p, } /* Make two passes if there's a SCHED_GROUP_P insn; make sure to handle - such an insn first and note its cost, then schedule all other insns - for one cycle later. */ + such an insn first and note its cost. If at least one SCHED_GROUP_P insn + gets queued, then all other insns get queued for one cycle later. */ for (pass = sched_group_found ? 0 : 1; pass < 2; ) { int n = ready.n_ready; @@ -6330,7 +6330,8 @@ prune_ready_list (state_t temp_state, bool first_cycle_insn_p, if (DEBUG_INSN_P (insn)) continue; - if (sched_group_found && !SCHED_GROUP_P (insn)) + if (sched_group_found && !SCHED_GROUP_P (insn) + && ((pass == 0) || (min_cost_group >= 1))) { if (pass == 0) continue;