From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 650236EC108; Thu, 23 Nov 2023 09:36:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 650236EC108 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1700721377; bh=oM0QTEGm+PJX+Tuxv7WpqSFbCTIzD0oxwVqM3/jplFA=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=s60e1QscE9whR1gQmsKl7Lez4msYTuNoajzjf/lnJkDH7Ew3HrTETNlV+ACynxj8i amUjKDhubZzADk0HuldpB6mt5GikseNDU2S2e2OLDAxkMZN+bLEVQmZctD4CY1A5EO hVFmY4V1zB4QwKRRuFj4IvJWZXCvPwcerZm+bEAE= Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [95.163.41.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id AE9C76EB734 for ; Thu, 23 Nov 2023 09:35:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AE9C76EB734 Received: by smtp54.i.mail.ru with esmtpa (envelope-from ) id 1r63Iu-00BATv-2k; Thu, 23 Nov 2023 09:35:13 +0300 Date: Thu, 23 Nov 2023 06:30:49 +0000 To: Sergey Kaplun Message-ID: References: <20231024101420.12398-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231024101420.12398-1-skaplun@tarantool.org> X-Clacks-Overhead: GNU Terry Pratchett X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92D71B79D2A671AE6422F1D012930A708C4696DB667808124182A05F538085040001FFF4B7DB501E0DCA75913E65E9D47ECADA17A1952AFF09AB6EF9B15EE608B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE746D93DAA4671895CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063727BBC20C3D5F36038638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8BDFD4D9DF7DD3DA5EC5D703A10056592117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEB1593CA6EC85F86DB78CF848AE20165DD8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3457EE4B4996FC5466E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB861051D4BA689FC2E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FB26E97DCB74E6252CE5475246E174218B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5F9421B6526F0898187F945740453513F7ECCF1D4C929BCE6F87CCE6106E1FC07E67D4AC08A07B9B0B355ED1E20F5346ACB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D3488E5CD2E691F55666D92192C6693F410C270FC781E4DE08D5F5396D64AD01BA789713B700728FD791D7E09C32AA3244C3E0B7DF60936D1F916ECB3205702852B259227199D06760ABAD658CF5C8AB4025DA084F8E80FEBD376A4ED3E9341DC2FCD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojOz05VK5QHNrmRBA/i6Ka2A== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D531C191C8E96013370F38B7E853CB9F16C1273588BA88E190882326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] IR_MIN/IR_MAX is non-commutative due to underlying FPU ops. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, I've checked the patchset into all long-term branches in tarantool/luajit and bumped a new version in master, release/2.11 and release/2.10. On 24.10.23, Sergey Kaplun via Tarantool-patches wrote: > From: Mike Pall > > Thanks to Peter Cawley. > > (cherry-picked from commit 7a2b83a0c5d980bf3db0aeda33c79e7bb4b3da01) > > Even after the commit c05d103305da0626e025dbf81370ca9f4f788c83 ("Fix > math.min()/math.max() inconsistencies."), some of the corner cases (see > tests in the commit for details) for `math.min()`/`math.max()` still > inconsistent in the JIT and the VM. This happens because `IR_MIN` and > `IR_MAX` are marked as commutative, so their operands were swapped by > `asm_swapops()`. As a result, because `minsd`[1]/`maxsd`[2] instructions > don't change the sign byte of the destination register, its sign is > preserved if we compare 0 with -0. When we compare something with NaN, > the second source operand (either a NaN or a valid floating-point value) > is written to the result. Hence, swapping the operands changed the > resulting value. > > This patch removes the commutative flag from the aforementioned IRs to > prevent swapping of their operands. > > [1]: https://c9x.me/x86/html/file_module_x86_id_173.html > [2]: https://c9x.me/x86/html/file_module_x86_id_168.html > > Sergey Kaplun: > * added the description and the test for the problem > > Part of tarantool/tarantool#9145 > --- > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1082-min-max-0-commutative > Tarantool PR: https://github.com/tarantool/tarantool/pull/9294 > Related Issues: > * https://github.com/tarantool/tarantool/issues/9145 > * https://github.com/LuaJIT/LuaJIT/issues/1082 > * https://github.com/LuaJIT/LuaJIT/issues/957 > > src/lj_ir.h | 4 +- > test/tarantool-tests/gh-6163-min-max.test.lua | 23 ++++------- > .../lj-1082-min-max-0-commutative.test.lua | 41 +++++++++++++++++++ > 3 files changed, 51 insertions(+), 17 deletions(-) > create mode 100644 test/tarantool-tests/lj-1082-min-max-0-commutative.test.lua > > -- > 2.42.0 > -- Best regards, IM