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 F324F9DB789; Mon, 29 Jan 2024 13:55:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F324F9DB789 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1706525756; bh=zVUfnHwynneRBBLjCP8R4bjB+WPQn/JwSZdeOUK57Ho=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sQkacpLAxZL1uBQb92jBUA6uPdmWilSS4xQ0RofXulDznQy4B68ePkMV3GTUT7w7l YWEG25oZPu5U5Gn5P2h1OFPvjGNJ0Xq7nKRhs/ltcwJdpiglcvDy68L1bWuWdeXT/E Pg8afAxpUNE9ajqxQiLiDMFdaOIVpzDNOsvEkDv0= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [95.163.41.73]) (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 A9CAD9C2039 for ; Mon, 29 Jan 2024 13:49:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A9CAD9C2039 Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1rUPCr-0000000BQ6r-3R2A; Mon, 29 Jan 2024 13:49:38 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Mon, 29 Jan 2024 13:45:13 +0300 Message-ID: <47242e634e89e7d1973aabfd32ced7585bcf086b.1706520765.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD96A58C36AA2E99649EAAC3983AE61A60E84CE716657D9D41E182A05F5380850409465A54A05909E5033594132A326AF8B4B65620C2EDDAD31DCA417647058147848EE0F73B0FEDEF0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE71BF69A9C8C5AF260EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371111040D1ED495018638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88DDE7AFD8C00FE88BE1BF1E404F07B8EDE748B92807338DACC7F00164DA146DAFE8445B8C89999728AA50765F7900637BA939FD1B3BAB99B389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8A9FF340AA05FB58CF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C24F796C710B8583CC0837EA9F3D197644AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3A15DAAE06F417D70BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CFED8438A78DFE0A9E1DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3AA8C68A3574AB3B435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5D1371025BDFCB98F5002B1117B3ED6966C192B483FF9D00EB48B7A7F94616420823CB91A9FED034534781492E4B8EEADFB12F4B11BB5604FC79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFA8E2E0D482E7A3DCE70AE305FDA10FBD411EF32F07A2BAD2B78F9BD734330CB7F62474FBACD619B08FB01E7B8BF01A690786D36BA52A904DB718120DE96C5CC50E8FBB9AF663CC66C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmd9AG1X07oRzzf4tHRhrzg== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769C2771F3607A3B79133594132A326AF8B4B65620C2EDDAD31B7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 luajit 13/26] test: enable in LuaJIT-tests 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 uses the basename of the ctest library to be loaded via FFI. It adds groups with the names of subtests and enables the test in . The corresponding conditions are changed to the tags checked by analogy with other tests. Tests with calls with 10 arguments with sizes less than 8 bits are dummy for M1. This suite lacks a mechanism to skip subtests satisfying complicated conditions, so it is done manually by the corresponding `if` check. Part of tarantool/tarantool#9398 --- test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua | 70 ++++++++++++---------- test/LuaJIT-tests/lib/ffi/index | 1 + 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua b/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua index b79d60b1..ee9dd5f0 100644 --- a/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua +++ b/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua @@ -35,33 +35,37 @@ double __stdcall stdcall_dd(double a, double b); float __stdcall stdcall_ff(float a, float b); ]] -local lib = ffi.load("../clib/ctest") - -do - local x - for i=1,100 do - x = lib.call_10i(-42, 17, 12345, 9987, -100, 11, 51, 0x12345678, 338, -78901234) +local lib = ffi.load("ctest") + +do --- 10 int args + if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI + local x + for i=1,100 do + x = lib.call_10i(-42, 17, 12345, 9987, -100, 11, 51, 0x12345678, 338, -78901234) + end + assert(x == -42 + 17 + 12345 + 9987 - 100 + 11 + 51 + 0x12345678 + 338 - 78901234) end - assert(x == -42+17+12345+9987-100+11+51+0x12345678+338-78901234) end -do +do --- 17 double args for i=1,100 do pcall(lib.call_max, i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i) end end -if ffi.abi("64bit") then - local y = ffi.cast("void *", 0x123456789abcdefLL) - local x - for i=1,100 do - lib.call_10j_p(0,0,0,0,0,0,0,0,0, y) - x = lib.call_10j_p(0,0,0,0,0,0,0,0,0, nil) +do --- 10 ints 1 pointer args +abi64 + if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI + local y = ffi.cast("void *", 0x123456789abcdefLL) + local x + for i=1,100 do + lib.call_10j_p(0,0,0,0,0,0,0,0,0, y) + x = lib.call_10j_p(0,0,0,0,0,0,0,0,0, nil) + end + assert(x == 0) end - assert(x == 0) end -do +do --- int, int64_t args local x = 0 for i=1,100 do x = x + lib.call_ij(100+i, i*0x300000002LL) @@ -69,7 +73,7 @@ do assert(x == 0x3b2e0000623eLL) end -do +do --- 10 double args local x for i=1,100 do x = lib.call_10d(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x12345678, 338, -78901234.75) @@ -77,15 +81,17 @@ do assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x12345678+338-78901234.75) end -do - local x - for i=1,100 do - x = lib.call_10f(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x123456, 338, -789012.75) +do --- 10 float args + if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI + local x + for i=1,100 do + x = lib.call_10f(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x123456, 338, -789012.75) + end + assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x123456+338-789012.75) end - assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x123456+338-789012.75) end -do +do --- boolean result local x for i=-100,100 do if not lib.call_b(i) then x = i end @@ -100,14 +106,14 @@ do assert(x == 90) end -do +do --- boolean result, tail call local function tail(x) return lib.call_b(x) end for i=1,100 do local a,b,c = tail(1), tail(1), tail(1) end end -do +do --- int8_t, uint8_t, int16_t, uint16_t args and results local x = 0 for i=0x01010080,0x010100ff do x = x + lib.call_i_i8(i) end assert(x == -8128) @@ -135,7 +141,7 @@ do end -- target-specific -if jit.arch == "x86" then +do --- fastcall +x86 for i=1,100 do assert(lib.fastcall_i(-42) == -41) end for i=1,100 do assert(lib.fastcall_ii(-42, 17) == -42+17) end for i=1,100 do assert(lib.fastcall_iii(-42, 17, 139) == -42+17+139) end @@ -143,12 +149,12 @@ if jit.arch == "x86" then for i=1,100 do assert(lib.fastcall_dd(12.5, -3.25) == 12.5-3.25) end local x = lib.fastcall_ji for i=1,100 do assert(x(0x123456789LL, -17) == 0x123456789LL-17) end +end - if jit.os == "Windows" then - for i=1,100 do assert(lib.stdcall_i(-42) == -41) end - for i=1,100 do assert(lib.stdcall_ii(-42, 17) == -42+17) end - for i=1,100 do assert(lib.stdcall_dd(12.5, -3.25) == 12.5-3.25) end - for i=1,100 do assert(lib.stdcall_ff(12.5, -3.25) == 12.5-3.25) end - end +do --- stdcall +x86 +windows + for i=1,100 do assert(lib.stdcall_i(-42) == -41) end + for i=1,100 do assert(lib.stdcall_ii(-42, 17) == -42+17) end + for i=1,100 do assert(lib.stdcall_dd(12.5, -3.25) == 12.5-3.25) end + for i=1,100 do assert(lib.stdcall_ff(12.5, -3.25) == 12.5-3.25) end end diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index index 0c1e5e66..d6e2b64a 100644 --- a/test/LuaJIT-tests/lib/ffi/index +++ b/test/LuaJIT-tests/lib/ffi/index @@ -11,6 +11,7 @@ ffi_convert.lua ffi_enum.lua ffi_gcstep_recursive.lua ffi_jit_arith.lua +ffi_jit_call.lua istype.lua jit_array.lua jit_complex.lua -- 2.43.0