From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A94FD384A033; Mon, 27 Apr 2020 20:50:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A94FD384A033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588020627; bh=iAzpuYVsybNLIHvD0FXZg5Q45A/dAjYx1VzPkHyzLmk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vjr8qYMALCxZOTGC3omm3LUYIu9JIrgbCfupCTg4Eqjvu+98IRLa1vnJ183Jcyrxq VaBfU4L2Uy7D9+aym5Wk6dLACtdN0pGvayEggjV3SyNlZcLhfSgDKQpQom0Hl/LU9w VpyDyonlD3PsJSbNUPYBG+ncLT+Zr6vpKfKCXqug= From: "gabravier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94804] Failure to elide useless movs in 128-bit addition Date: Mon, 27 Apr 2020 20:50:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: gabravier at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: 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: Mon, 27 Apr 2020 20:50:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94804 --- Comment #1 from Gabriel Ravier --- For subtraction, it's even worse. using i128 =3D __int128; i128 sub128(i128 a, i128 b) { return a - b; } results in=20 sub128(__int128, __int128): mov rax, rdi sub rax, rdx sbb rsi, rcx mov rdx, rsi ret with LLVM and=20 sub128(__int128, __int128): mov r9, rdi mov r8, rsi mov rdi, r8 mov rax, r9 mov r8, rdx sub rax, r8 mov rdx, rdi sbb rdx, rcx ret with GCC. The excess of `mov`s feels to me like there is some sort of bug in the 128-= bit register allocator or something like that.=