From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2EC703858D33; Tue, 6 Feb 2024 01:14:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EC703858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707182040; bh=TjU4pOU4xXNEIHZswwBW92rr+xVLKgoCvAmdqnQETyc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dxmwBf/85++8zKr3ONCi3B9ezwsR6V19d4ulYcxgMQAwoMj8h6JuAY3WJNXZwvqmV LIow8qH7YR+Matgpb4OqIjYHZ9934WQLWmVr3Pwd4iOeAmW0FTSyfpJ1YK3oUzjtBz 6Z0BlV4Q0fcJ/23G4/I5OaEHKjSjqs/Gpv1ju79Q= From: "pan2.li at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51492] vectorizer does not support saturated arithmetic patterns Date: Tue, 06 Feb 2024 01:13:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.6.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pan2.li at intel dot com 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51492 --- Comment #16 from Li Pan --- I have a try like below and finally have the Standard Name "SAT_ADD". Could= you please help to double-check if my understanding is correct? Given below example code below: typedef unsigned int uint32_t; uint32_t sat_add (uint32_t x, uint32_t y) { return (x + y) | - ((x + y) < x); } And then add one simpify to match.pd and define new DEF_INTERNAL_OPTAB_FN f= or it. Then we have the SAT_ADD representation after expand. uint32_t sat_add (uint32_t x, uint32_t y) { uint32_t _6; ;; basic block 2, loop depth 0 ;; pred: ENTRY _6 =3D .SAT_ADD (x_4(D), y_5(D)); [tail call] return _6; ;; succ: EXIT } If everything goes well, I will prepare the patch for it later. Thanks.=