From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2390D3851C1F; Wed, 3 Jun 2020 09:08:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2390D3851C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591175289; bh=ESelJDKL2bgm8PsgcvS7OFt7wNHwZY97uue3a0prteM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hmFzvK1bUKrBqfRAbRM4TFU7ViBbWeYDhOv1zG8A6T376y+MyR1wFBjQvWE0mwTkT v0UeJXnxRWsVJtQX8Az3F/IHheScVZ0DHsP0pR7WZaF877WDOOvwz8z//SDE8U9/O9 CP5wfB33jGrj2srdqt9uLHBA1WNjVZ/hP9xwnwyY= From: "guihaoc at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/68837] PowerPC switch statement performance Date: Wed, 03 Jun 2020 09:08:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: guihaoc at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2020 09:08:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D68837 HaoChen Gui changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |guihaoc at gcc dot gnu.org --- Comment #2 from HaoChen Gui --- (In reply to David Edelsohn from comment #0) > Improve performance of switch statements: >=20 > 1) Heuristics for decision tree vs tablejump >=20 > 2) Avoid sign extended lwa for offset I think #1 was already implemented in current GC. Jump tables coexists with conditional jumps. jump-table-max-growth-ratio-for-speed/size decide how la= rge a jump table could be and case-values-threshold defines if a jump table is beneficial.=20 An example of GIMPLE switch ;; GIMPLE switch case clusters: 35 37 JT(values:5 comparisons:5 range:8 density: 62.50%):65-72 JT(values:6 comparisons:6 range:12 density: 50.00%):111-122 For #2, the offset could be negative in a multiple jump table case. Right n= ow it uses lwax and there is no overhead for sing extend, I think. Please corr= ect me if I am wrong.=