From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 77DB83858C3A; Mon, 7 Feb 2022 11:49:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77DB83858C3A From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97005] [nvptx] FAIL: c-c++-common/torture/builtin-arith-overflow-15.c -O0 execution test Date: Mon, 07 Feb 2022 11:49:47 +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: 11.0 X-Bugzilla-Keywords: testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org 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, 07 Feb 2022 11:49:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97005 --- Comment #8 from Tom de Vries --- I've tried the workaround (posting here only the patch for trunchiqi2, the pattern that was actually triggered): ... @@ -424,9 +436,21 @@ [(set (match_operand:QI 0 "nvptx_nonimmediate_operand" "=3DR,m") (truncate:QI (match_operand:HI 1 "nvptx_register_operand" "R,R")))] "" - "@ - %.\\tcvt%t0.u16\\t%0, %1; - %.\\tst%A0.u8\\t%0, %1;" + { + if (which_alternative =3D=3D 1) + return "%.\\tst%A0.u8\\t%0, %1;"; + + const char *cvt =3D "%.\\tcvt%t0.u16\\t%0, %1;"; + if (1) + { + /* Workaround https://developer.nvidia.com/nvidia_bug/3527713. */ + output_asm_insn ("%.\\tcvt.s32.s16\\t%0, %1;", operands); + output_asm_insn ("%.\\tand.b32\\t%0, %0,0x0000ffff;", operands); + return ""; + } + + return cvt; + } [(set_attr "subregs_ok" "true")]) (define_insn "truncsi2" ... but it didn't work for the test-case from comment 0. Something that does seem to work for both cases, and the unreduced builtin-arith-overflow-15.c: ... diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index 6c399dea1908..c33903688a5d 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -507,7 +507,13 @@ (minus:HSDIM (match_operand:HSDIM 1 "nvptx_register_operand" "R") (match_operand:HSDIM 2 "nvptx_register_operand" "R")))] "" - "%.\\tsub%t0\\t%0, %1, %2;") + { + if (GET_MODE (operands[0]) =3D=3D HImode) + /* Workaround https://developer.nvidia.com/nvidia_bug/3527713. */ + return "%.\\tsub.s16\\t%0, %1, %2;"; + + return "%.\\tsub%t0\\t%0, %1, %2;"; + }) (define_insn "mul3" [(set (match_operand:HSDIM 0 "nvptx_register_operand" "=3DR") ...=