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 BF0CC57AFE0; Fri, 18 Aug 2023 15:45:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BF0CC57AFE0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692362759; bh=QlNx1aShQCtidq4tJjwNVOprvRCHbYpa1TyMg7FOY4o=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=EDP9mChV39lTH+Dp6pgP8dZWH2QF7rmajeMrVfnhYqyZiKZlHVO5qexo3WW4iL1ei jf3vjz2kAfHN6AN1nm/q9z8uBZ3AgK8zBISJD7uXHo2A1o23sSYnf1kRIrwbnCnFSc 35qr19Mez+r9AJsnZpbWDnyJyx8lnykWP9Luz2I4= Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [95.163.41.74]) (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 8EB8C57AFE0 for ; Fri, 18 Aug 2023 15:45:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8EB8C57AFE0 Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1qWyrV-00Dkpc-2C; Fri, 18 Aug 2023 15:45:58 +0300 Message-ID: Date: Fri, 18 Aug 2023 15:45:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Sergey Kaplun , Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD93C8852532D76B9E34B7F521CF8AAC5F31026AE04F73B8670182A05F538085040B2523ABC806C95B30FC9593925D8B5EF73FC99FD1BB79FAD75C0AAF3E748A01A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE736691C7D10565E03C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE78887611F2F2455C9EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BE5CCB53A13BC8DBA3955A043254A58563E57B412BA475019CC7F00164DA146DAFE8445B8C89999728AA50765F7900637EAAFF0EA65433293389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8B861051D4BA689FCF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C98E93883770458359735652A29929C6C4AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C31DEDF2E2F39E2AF1BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166176DF2183F8FC7C06C9A9530EBF72002725E5C173C3A84C361DD96311B40C2D435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5B2DB4FCA4C47598309380EAB8E1F4D1B8AB6CE151B797D12F87CCE6106E1FC07E67D4AC08A07B9B01F9513A7CA91E555CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D346BEB6F73FB9D1E4A55B2D753DF688BE52137F2D6BDA8105967DC74F111BF106C177C772935EA68281D7E09C32AA3244CBC5208B11CBD11B46A5A1E07F316952595A9E0DC41E9A4CF85A42E4C463514DC5DA084F8E80FEBD3FFA33E6B6B2F82C47A83BD0C44CE203720ABEDE4BBDD9CDD X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojgZIFrgxvv3pa3jjk3JPl2w== X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458DE0DB53EC294B5EDEDC913BF3C1580C966FC42E45911BEF0282EC151BADDC1D3523A6D01B4765B2DFB59E2DDD9FE06B14FA522850F29BC30B0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 4/5] Fix pow() optimization inconsistencies. 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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! thanks for the patch! LGTM with two minor comments inline. On 8/15/23 12:36, Sergey Kaplun wrote: > From: Mike Pall > > (cherry-picked from commit 9512d5c1aced61e13e7be2d3208ec7ae3516b458) > > This patch fixes different misbehaviour between JIT-compiled code and misbehaviour -> misbehaviours > the interpreter for power operator with the following ways: > * Drop folding optimizations for base ^ 0.5 => sqrt(base), as far as > pow(base, 0.5) isn't interchangeable and depends on the > implementation. > * Drop folding optimizations for 2 ^ int_pow => ldexp(1.0, int_pow), to > avoid dependcy on the implementation. dependcy -> dependency > * Now `asm_pow()` always assemble a call to the `lj_vm_powi()` function, > that is general now for all CPU architectures. Using this internal > function instead of toolchain-provided `pow()` guarantees consistency > between interpreter and JIT results. Also, it drops custom > implementation for the `vm_powi_sse()` on x86_64. > * `math_extern2` macro in the VM may take the second argument, that is > used as the target function to call. The first argument is still the > name for `func_nnsse` macro. > * Narrowing for power operation avoids range guard for non-constant base > IR. This leads to invalid result if value on trace is out of range. > Now it is done unconditionally. > > Be aware, that [220/502] lib/string/format/num.lua test [1] from > LuaJIT-test suite fails after this commit. > > [1]: https://www.exploringbinary.com/incorrect-floating-point-to-decimal-conversions/ > > Sergey Kaplun: > * added the description and the test for the problem