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 2636A80AF85; Thu, 16 Nov 2023 16:49:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2636A80AF85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1700142570; bh=SK1Gvjol8nd4SQXYJQFYj8DcaGdo/CxGfSXBwRS8PNc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=upE2woKIA7lmnGhVY3xzjezqMt3eg4XNkc7l3YPvNzkW21RfRmKlXaJkBaRGzC2WH cZbKSfPJSvaJi7Xt6AC3wVqFfCL2s07+KXqIMB3+UyKrVmX2LoHh3zGp3Lthrzm1NI FetrIMhhH70VKTvL13U2IHfecOOWbiYXPzvMjtDk= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [95.163.41.65]) (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 72D048024B1 for ; Thu, 16 Nov 2023 16:49:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 72D048024B1 Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1r3ckK-004WCj-2U; Thu, 16 Nov 2023 16:49:29 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Thu, 16 Nov 2023 16:44:56 +0300 Message-ID: <20231116134456.5898-1-skaplun@tarantool.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9C2A6B03AB739174CC4072CA9E0A353AD6FECEC47B48E4E1300894C459B0CD1B97FA699A89F79E33F5DE71A653AD8EC0F66C04E56A21AA59AAD00EA28E3F2047E X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75B37E0A1C175363BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063792EDBE6976DC04EF8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB5533756688B9189A6D9E9962F0AB676CD40B37D8B902E11568CC0C1EA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7D9442B0B5983000E8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6B737A621A50BC793CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249AECFD3D254B7B97C76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BED03C93EBFE568B33AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC8C7ADC89C2F0B2A5E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B8785BF30A5E9335375ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A547F743706F46781AE4E574F9C1599473D7CCF45F4E8D1599F87CCE6106E1FC07E67D4AC08A07B9B0735DFC8FA7AC12079C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF7727F4E48C1C38ECA64285C74DF5BB7DCB3A279AC41C03B38F55C6D49D0412C312B9ACBE231CC78A8AC21204250FC4D0B9685D5AA43879015650EE56225C198CA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojUgnpwJ++SjTjRYnXHddBoA== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769EA3703F611B604934F3105560DDD0D81B67A942A63B4089ADEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit] test: add test for conversions folding 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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch adds the test for commit 1a401622fe83ae695226c94df3416e312315d659 ("Fix assertions."). This patch removes incorrect assertions in the fold optimizations for conversions from numbers to different integer types. Although the issue affects only branch 2.0, there is no need to fix it. Nevertheless, the test is required to avoid regressions in the future. Part of tarantool/tarantool#9145 --- Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-833-fold-conv-from-num Tarantool PR: https://github.com/tarantool/tarantool/pull/9375 Related issues: * https://github.com/LuaJIT/LuaJIT/issues/833 * https://github.com/tarantool/tarantool/issues/9145 .../lj-833-fold-conv-from-num.test.lua | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/tarantool-tests/lj-833-fold-conv-from-num.test.lua diff --git a/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua b/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua new file mode 100644 index 00000000..9e2059bd --- /dev/null +++ b/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua @@ -0,0 +1,33 @@ +local tap = require('tap') + +-- XXX: Test the behaviour of fold optimizations from numbers to +-- different integer types. The test itself doesn't fail before +-- the commit since these changes relate only to version 2.0. + +local test = tap.test('lj-833-fold-conv-from-num'):skipcond({ + ['Test requires JIT enabled'] = not jit.status(), +}) + +local ffi = require('ffi') + +test:plan(3) + +local arr_i64 = ffi.new('int64_t [2]') +local arr_u64 = ffi.new('uint64_t [2]') +local arr_u32 = ffi.new('uint32_t [2]') + +jit.opt.start('hotloop=1') + +for _ = 1, 4 do + -- Test conversion to type (at store). Also, check the + -- conversion from number to int64_t at C array indexing. + arr_i64[1.1] = 1.1 + arr_u64[1.1] = 1.1 + arr_u32[1.1] = 1.1 +end + +test:is(arr_i64[1], 1LL, 'correct conversion to int64_t') +test:is(arr_u64[1], 1ULL, 'correct conversion to uint64_t') +test:is(arr_u32[1], 1ULL, 'correct conversion to uint32_t') + +test:done(true) -- 2.42.0