{"id":288056,"date":"2018-08-16T14:21:57","date_gmt":"2018-08-16T10:21:57","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288056"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288056","title":{"rendered":"\u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 float 4&#215;4 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SIMD"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/418247\/\" class=\"post__text post__text-html js-mediator-article\">\u0423\u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u043b\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u043e, \u043a\u0430\u043a \u044f \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 MMX, SSE, \u0430 \u043f\u043e\u0437\u0436\u0435 \u0438 AVX \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 Intel. \u0412 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f \u043e\u043d\u0438 \u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u0430\u0433\u0438\u0435\u0439 \u043d\u0430 \u0444\u043e\u043d\u0435 x86 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0441\u0442\u0430\u043b \u0447\u0435\u043c-\u0442\u043e \u043e\u0431\u044b\u0434\u0435\u043d\u043d\u044b\u043c. \u041e\u043d\u0438 \u043c\u0435\u043d\u044f \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0446\u0435\u043f\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043e\u0444\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0438\u0433\u0440\u044b. \u0421\u043f\u043e\u0434\u0432\u0438\u0433\u043b\u043e \u043c\u0435\u043d\u044f \u043d\u0430 \u044d\u0442\u043e \u0442\u043e, \u043a\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0435\u0449\u0430\u043b\u0438 \u044d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0434\u0430\u0436\u0435 \u0434\u0443\u043c\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u041d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043a\u0443\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u043e\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435. \u0423 \u043c\u0435\u043d\u044f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0435 \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c\u0438 AMD \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438, \u0438 \u0438\u0445 \u043f\u043e\u0442\u043e\u043b\u043e\u043a \u0431\u044b\u043b SSE3. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c SSE3. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u0435\u0435, \u0447\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 SSE, \u0441 \u0440\u0435\u0434\u043a\u0438\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e SSE3. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a\u0443\u044e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044f \u0441\u043c\u043e\u0433\u0443 \u0432\u044b\u0436\u0430\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0434\u043b\u044f \u0440\u044f\u0434\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 float 4 \u043d\u0430 4.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kg\/ii\/cq\/kgiicqemuc5agmypikedjioaogc.jpeg\"><\/div>\n<p><a name=\"habracut\"><\/a><br \/>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u043e\u043c \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0434\u0438 \u0440\u0430\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f. \u0414\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u0441\u043e\u0444\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u043d\u0430 SSE \u0438 \u0432\u0440\u043e\u0434\u0435 \u043c\u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442. \u041d\u043e \u0442\u0443\u0442 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0442\u043e\u0432 \u044f \u0441\u043c\u043e\u0433\u0443 \u0432\u044b\u0436\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0438\u0437 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f 2-\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 float4x4. \u041d\u0430 \u043c\u043e\u0451\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u043c SSE \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u044d\u0442\u043e 16 \u0442\u0430\u043a\u0442\u043e\u0432. \u041f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 <abbr title=\"Intel Architecture Code Analyzer\">IACA<\/abbr> 3 \u0441\u0442\u0430\u043b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c 19, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e 0* \u0441\u0442\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c 1*. \u0412\u0438\u0434\u0438\u043c\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h3>\u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u0445<\/h3>\n<p>  \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <a href=\"https:\/\/software.intel.com\/en-us\/articles\/intel-architecture-code-analyzer\">Intel Architecture Code Analyzer<\/a>. \u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Haswell (HSW), \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 AVX2. \u0414\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f: <a href=\"https:\/\/software.intel.com\/sites\/landingpage\/IntrinsicsGuide\">Intel Intrinsics Guide<\/a> \u0438 <a href=\"https:\/\/www.intel.com\/content\/dam\/www\/public\/us\/en\/documents\/manuals\/64-ia-32-architectures-optimization-manual.pdf\">Intel optimization manual<\/a>.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e MSVS 2017 Community \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u041a\u043e\u0434 \u043f\u0438\u0448\u0443 \u0432 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0441 \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0430\u043c\u0438. \u041f\u0438\u0448\u0435\u0448\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u043d \u0441\u0440\u0430\u0437\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 x64 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0430 VC++ \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u043b\u0430\u0439\u043d \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440, \u0430 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u0438 \u043f\u043e\u0434 x64 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e \u0432 SIMD \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c (\u0438\u043b\u0438 \u0442\u044b\u0440\u0438\u0442\u044c) \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c SIMD \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 Intel \u043f\u043e\u043b\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<h2>\u0425\u043e\u0442\u0435\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u043f\u0440\u043e\u0449\u0435.\u2026 \u0410 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430<\/h2>\n<p>  \u0412\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043c\u0430\u043b\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0442\u0430\u043a \u0438 \u0441\u0442\u0430\u0442\u044c\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430 \u043d\u0451\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c. \u041f\u0438\u0441\u0430\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u0435 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u041a\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043d\u0430\u0434\u043e, \u0438 \u0442\u0430\u043a \u0438\u0437\u0443\u0447\u0438\u043b\u0438 \u0432 \u0412\u0423\u0417\u0430\u0445 \u0438\u043b\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u0430\u0448\u0430 \u0436\u0435 \u0446\u0435\u043b\u044c \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044f \u0434\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0448\u0451\u043b \u043d\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c. \u041c\u043e\u0439 \u0441\u043e\u0444\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 OpenGL API \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u0430\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0445 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0439, \u044f \u043d\u0430\u0447\u0430\u043b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c. \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0435 \u0442\u0430\u043a \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e. \u041d\u0443 \u0443\u043c\u043d\u043e\u0436\u0438\u043b\u0438 2-5-10 \u043c\u0430\u0442\u0440\u0438\u0446. \u0418 \u0432\u0441\u0451. \u0410 \u043f\u043e\u0442\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0430 \u0442\u044b\u0441\u044f\u0447\u0438-\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0432\u0435\u0440\u0448\u0438\u043d. \u0418 \u0432\u043e\u0442 \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u043a\u0443\u0434\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0435\u0435. \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u043e \u0437\u0430\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c.<\/p>\n<p>  \u041d\u043e \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c. \u0421 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442\u044c. \u041c\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0432 SIMD \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 \u0442\u0430\u043a, \u0447\u0442\u043e <strong>x<\/strong> \u0432 \u0441\u0442\u0430\u0440\u0448\u0435\u043c float (\u0438\u043d\u0434\u0435\u043a\u0441 3), \u0430 <strong>w<\/strong> \u0432 \u043c\u043b\u0430\u0434\u0448\u0435\u043c (\u0438\u043d\u0434\u0435\u043a\u0441 0). \u0422\u0443\u0442, \u0432\u0438\u0434\u0438\u043c\u043e, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u043c\u0443 \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a.<\/p>\n<p>  \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u0441\u043e\u0444\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440\u0435 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0439 <strong>w<\/strong> \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0449\u0435 (\u0442\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f <strong>1\/z<\/strong>), \u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 <strong>_ss<\/strong> \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0439 \u0432 \u043c\u043b\u0430\u0434\u0448\u0435\u043c float \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <em>xmm<\/em>), \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u044f <strong><nobr>x, y, z<\/nobr><\/strong>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 SSE \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0432\u0435\u043a\u0442\u043e\u0440 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 <strong><nobr>x, y, z, w<\/nobr><\/strong>, \u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c <strong><nobr>w, z, y, x<\/nobr><\/strong>.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u0422\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0438\u0445 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. <a href=\"http:\/\/www.agner.org\/optimize\/optimizing_cpp.pdf\">\u0425\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0442\u0443\u0442.<\/a><\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b<\/h2>\n<p>  <\/p>\n<h3>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0446\u0438\u043a\u043b\u0430\u043c\u0438, row ordered<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">for (int i = 0; i &lt; 4; ++i) {     for (int j = 0; j &lt; 4; ++j) {         r[i][j] = 0.f;         for (int k = 0; k &lt; 4; ++k) {             r[i][j] += m[i][k] * n[k][j];         }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0443\u0442 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c 4 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 3 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u0441\u0443\u043c\u043c\u0435 \u044d\u0442\u043e 64 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 48 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0418 \u044d\u0442\u043e \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0412\u0441\u0451 \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u043e, \u043a\u043e\u0440\u043e\u0447\u0435. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0446\u0438\u043a\u043b\u0430 IACA \u0432\u044b\u0434\u0430\u043b\u0430: <em>3.65 \u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u043e\u0434 x86 \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 2.97 \u043f\u043e\u0434 x64 \u0441\u0431\u043e\u0440\u043a\u0443<\/em>. \u041d\u0435 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0439\u0442\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b. \u041d\u0435 \u0437\u043d\u0430\u044e. IACA 2.1 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u0438 \u0446\u0438\u0444\u0440\u044b \u043d\u0430\u0434\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 4*4*4 = 64. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c x64, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e 192 \u0442\u0430\u043a\u0442\u043e\u0432. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430. \u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0447\u043d\u0435\u0435 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043d\u0435 \u0432\u0438\u0436\u0443 \u0441\u043c\u044b\u0441\u043b\u0430.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0446\u0438\u043a\u043b\u0430\u043c\u0438, column ordered<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u0442\u0440\u043e\u043a \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">for (int i = 0; i &lt; 4; ++i) {     for (int j = 0; j &lt; 4; ++j) {         r[j][i] = 0.f;         for (int k = 0; k &lt; 4; ++k) {             r[j][i] += m[k][i] * n[j][k];         }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0446\u0438\u043a\u043b\u0430\u043c\u0438, SIMD \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">for (int i = 0; i &lt; 4; ++i) {     for (int j = 0; j &lt; 4; ++j) {         r[j][3-i] = 0.f;         for (int k = 0; k &lt; 4; ++k) {             r[j][3-i] += m[k][3-i] * n[j][3-k];         }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u042d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438, \u043d\u043e \u044f\u0432\u043d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<h3>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b<\/h3>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u043e\u0433\u043e \u0438 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u041d\u0438\u0447\u0435\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e, \u0432\u0441\u0451 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u0438 \u0432 \u0442\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">struct alignas(sizeof(__m128)) vec4 {     union {         struct { float w, z, y, x; };         __m128 fmm;         float arr[4];     };      vec4() {}     vec4(float a, float b, float c, float d) : w(d), z(c), y(b), x(a) {}      static bool equ(float const a, float const b, float t = .00001f) {         return fabs(a-b) &lt; t;     }      bool operator == (vec4 const&amp; v) const {         return equ(x, v.x) &amp;&amp; equ(y, v.y) &amp;&amp; equ(z, v.z) &amp;&amp; equ(w, v.w);     } };  struct alignas(sizeof(__m256)) mtx4 {     \/\/ \u0442\u0443\u0442 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445     union {         struct {             float                 _30, _20, _10, _00,                 _31, _21, _11, _01,                 _32, _22, _12, _02,                 _33, _23, _13, _03;             };             __m128 r[4];             __m256 s[2];             vec4 v[4];         };      \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b     mtx4() {}     mtx4(         float i00, float i01, float i02, float i03,         float i10, float i11, float i12, float i13,         float i20, float i21, float i22, float i23,         float i30, float i31, float i32, float i33)         : _00(i00),  _01(i01),  _02(i02),  _03(i03)         , _10(i10),  _11(i11),  _12(i12),  _13(i13)         , _20(i20),  _21(i21),  _22(i22),  _23(i23)         , _30(i30),  _31(i31),  _32(i32),  _33(i33)     {}      \/\/ \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f     operator __m128 const* () const { return r; }     operator __m128* () { return r; }      \/\/ \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432     bool operator == (mtx4 const&amp; m) const {         return v[0]==m.v[0] &amp;&amp; v[1]==m.v[1] &amp;&amp; v[2]==m.v[2] &amp;&amp; v[3]==m.v[3];     }      \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b     static mtx4 identity() {         return mtx4(             1.f, 0.f, 0.f, 0.f,             0.f, 1.f, 0.f, 0.f,             0.f, 0.f, 1.f, 0.f,             0.f, 0.f, 0.f, 1.f);     }      static mtx4 zero() {         return mtx4(             0.f, 0.f, 0.f, 0.f,             0.f, 0.f, 0.f, 0.f,             0.f, 0.f, 0.f, 0.f,             0.f, 0.f, 0.f, 0.f);     } }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0420\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<\/h3>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u0430\u044f <em>\u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f<\/em> \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441 \u043d\u0435\u0439.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043b\u044f \u0435\u0451 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0440\u0451\u043c \u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0446\u0438\u043a\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void mul_mtx4_mtx4_unroll(__m128* const _r, __m128 const* const _m, __m128 const* const _n) {      mtx4 const&amp; m = **reinterpret_cast&lt;mtx4 const* const*&gt;(&amp;_m);      mtx4 const&amp; n = **reinterpret_cast&lt;mtx4 const* const*&gt;(&amp;_n);      mtx4&amp;       r = **reinterpret_cast&lt;mtx4* const*&gt;(&amp;_r);       r._00 = m._00*n._00 + m._01*n._10 + m._02*n._20 + m._03*n._30;      r._01 = m._00*n._01 + m._01*n._11 + m._02*n._21 + m._03*n._31;      r._02 = m._00*n._02 + m._01*n._12 + m._02*n._22 + m._03*n._32;      r._03 = m._00*n._03 + m._01*n._13 + m._02*n._23 + m._03*n._33;       r._10 = m._10*n._00 + m._11*n._10 + m._12*n._20 + m._13*n._30;      r._11 = m._10*n._01 + m._11*n._11 + m._12*n._21 + m._13*n._31;      r._12 = m._10*n._02 + m._11*n._12 + m._12*n._22 + m._13*n._32;      r._13 = m._10*n._03 + m._11*n._13 + m._12*n._23 + m._13*n._33;       r._20 = m._20*n._00 + m._21*n._10 + m._22*n._20 + m._23*n._30;      r._21 = m._20*n._01 + m._21*n._11 + m._22*n._21 + m._23*n._31;      r._22 = m._20*n._02 + m._21*n._12 + m._22*n._22 + m._23*n._32;      r._23 = m._20*n._03 + m._21*n._13 + m._22*n._23 + m._23*n._33;       r._30 = m._30*n._00 + m._31*n._10 + m._32*n._20 + m._33*n._30;      r._31 = m._30*n._01 + m._31*n._11 + m._32*n._21 + m._33*n._31;      r._32 = m._30*n._02 + m._31*n._12 + m._32*n._22 + m._33*n._32;      r._33 = m._30*n._03 + m._31*n._13 + m._32*n._23 + m._33*n._33; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e (\u043d\u043e \u043c\u043e\u0436\u043d\u043e \ud83d\ude42 ). \u041d\u0430 \u043d\u0435\u0433\u043e IACA \u0432\u044b\u0434\u0430\u043b\u0430: <em>x86 \u2014 69.95 \u0442\u0430\u043a\u0442\u0430, x64 \u2014 64 \u0442\u0430\u043a\u0442\u0430<\/em>. \u0412\u043e\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e 64 \u0442\u0430\u043a\u0442\u043e\u0432 \u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c.<\/p>\n<h2>SSE \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 SSE \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h3>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <em>FVec<\/em> \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 MSVS. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 SSE \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445. \u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0449\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430. <\/p>\n<pre><code>\/\/ \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 00, 10, 20, 30 \/\/ m[0] - \u0432 SIMD \u0441\u0442\u0440\u043e\u043a\u0430\u0445\/\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 \u0445\u0440\u0430\u043d\u0438\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u044b 01, 11, 21, 31 \/\/ m[1] 02, 12, 22, 32 \/\/ m[2] 03, 13, 23, 33 \/\/ m[3] <\/code><\/pre>\n<p>  \u0411\u0435\u0440\u0451\u043c \u043a\u043e\u0434 <em>unroll<\/em> \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0432\u044b\u0448\u0435. \u041a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u043d \u043d\u0435\u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u044b\u0439 \u0434\u043b\u044f SSE. \u041f\u0435\u0440\u0432\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u0442\u0440\u043e\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b: <em><nobr>r._00, r._01, r._02, r._03<\/nobr><\/em>. \u0423 \u043d\u0430\u0441 \u044d\u0442\u043e \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430. \u0414\u0430 \u0438 <strong>m<\/strong>, <strong>n<\/strong> \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u0447\u0451\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <strong>r<\/strong> \u0431\u044b\u043b \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u043c.<\/p>\n<pre><code>\/\/ \u043f\u0435\u0440\u0432\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b r[0] r00 = m00*n00 + m01*n10 + m02*n20 + m03*n30; r10 = m10*n00 + m11*n10 + m12*n20 + m13*n30; r20 = m20*n00 + m21*n10 + m22*n20 + m23*n30; r30 = m30*n00 + m31*n10 + m32*n20 + m33*n30;  \/\/ \u0432\u0442\u043e\u0440\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b r[1] r01 = m00*n01 + m01*n11 + m02*n21 + m03*n31; r11 = m10*n01 + m11*n11 + m12*n21 + m13*n31; r21 = m20*n01 + m21*n11 + m22*n21 + m23*n31; r31 = m30*n01 + m31*n11 + m32*n21 + m33*n31;  \/\/ \u0442\u0440\u0435\u0442\u044c\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b r[2] r02 = m00*n02 + m01*n12 + m02*n22 + m03*n32; r12 = m10*n02 + m11*n12 + m12*n22 + m13*n32; r22 = m20*n02 + m21*n12 + m22*n22 + m23*n32; r32 = m30*n02 + m31*n12 + m32*n22 + m33*n32;  \/\/ \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b r[3] r03 = m00*n03 + m01*n13 + m02*n23 + m03*n33; r13 = m10*n03 + m11*n13 + m12*n23 + m13*n33; r23 = m20*n03 + m21*n13 + m22*n23 + m23*n33; r33 = m30*n03 + m31*n13 + m32*n23 + m33*n33; <\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u0443\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u0427\u0442\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u044b \u0432\u0438\u0434\u0438\u043c? \u041f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0443 \u043d\u0430\u0441 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>m<\/strong>:  <\/p>\n<pre> m[0]={00,10,20,30}, m[1]={01,11,21,31}, m[2]={02,12,22,32}, m[3]={03,13,23,33}, <\/pre>\n<p>\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>n<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u044d\u0442\u043e:<em>n._00,n._10,n._20,n._30<\/em>. \u0418 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>n<\/strong> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u0442\u0440\u043e\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u043d\u043e\u0432\u0430 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>m<\/strong> \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0440\u0451\u043c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0430 \u0432\u043e\u0442 \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 <strong>n<\/strong>, \u0442\u043e \u043c\u044b \u0431\u0435\u0440\u0451\u043c \u0435\u0451 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <em>shuffle<\/em> \u0440\u0430\u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0435\u0451 \u0432\u0441\u0435\u043c 4-\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>m<\/strong> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <em>n._00<\/em> (\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0435\u0433\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0438\u043c\u0435\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 3) \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442: <\/p>\n<pre>_mm_shuffle_ps(n[0], n[0], _MM_SHUFFLE(3,3,3,3))<\/pre>\n<p>  \u0412 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>\/\/ \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 n[0]={00,10,20,30} r[0] = m[0] * n00 + m[1] * n10 + m[2] * n20 + m[3] * n30; \/\/ \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 n[1]={01,11,21,31} r[1] = m[0] * n01 + m[1] * n11 + m[2] * n21 + m[3] * n31; \/\/ \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 n[2]={02,12,22,32}  r[2] = m[0] * n02 + m[1] * n12 + m[2] * n22 + m[3] * n32; \/\/ \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 n[3]={03,13,23,33} r[3] = m[0] * n03 + m[1] * n13 + m[2] * n23 + m[3] * n33; <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u0430\u0437\u043e\u0432\u0430\u044f SSE \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void mul_mtx4_mtx4_sse_v1(__m128* const r, __m128 const* const m, __m128 const* const n) {   r[0] =     _mm_add_ps(       _mm_add_ps(         _mm_mul_ps(m[0], _mm_shuffle_ps(n[0], n[0], _MM_SHUFFLE(3,3,3,3))),         _mm_mul_ps(m[1], _mm_shuffle_ps(n[0], n[0], _MM_SHUFFLE(2,2,2,2)))),       _mm_add_ps(         _mm_mul_ps(m[2], _mm_shuffle_ps(n[0], n[0], _MM_SHUFFLE(1,1,1,1))),         _mm_mul_ps(m[3], _mm_shuffle_ps(n[0], n[0], _MM_SHUFFLE(0,0,0,0)))));    r[1] =     _mm_add_ps(       _mm_add_ps(         _mm_mul_ps(m[0], _mm_shuffle_ps(n[1], n[1], _MM_SHUFFLE(3,3,3,3))),         _mm_mul_ps(m[1], _mm_shuffle_ps(n[1], n[1], _MM_SHUFFLE(2,2,2,2)))),       _mm_add_ps(         _mm_mul_ps(m[2], _mm_shuffle_ps(n[1], n[1], _MM_SHUFFLE(1,1,1,1))),         _mm_mul_ps(m[3], _mm_shuffle_ps(n[1], n[1], _MM_SHUFFLE(0,0,0,0)))));    r[2] =     _mm_add_ps(       _mm_add_ps(         _mm_mul_ps(m[0], _mm_shuffle_ps(n[2], n[2], _MM_SHUFFLE(3,3,3,3))),         _mm_mul_ps(m[1], _mm_shuffle_ps(n[2], n[2], _MM_SHUFFLE(2,2,2,2)))),       _mm_add_ps(         _mm_mul_ps(m[2], _mm_shuffle_ps(n[2], n[2], _MM_SHUFFLE(1,1,1,1))),         _mm_mul_ps(m[3], _mm_shuffle_ps(n[2], n[2], _MM_SHUFFLE(0,0,0,0)))));    r[3] =     _mm_add_ps(       _mm_add_ps(         _mm_mul_ps(m[0], _mm_shuffle_ps(n[3], n[3], _MM_SHUFFLE(3,3,3,3))),         _mm_mul_ps(m[1], _mm_shuffle_ps(n[3], n[3], _MM_SHUFFLE(2,2,2,2)))),       _mm_add_ps(         _mm_mul_ps(m[2], _mm_shuffle_ps(n[3], n[3], _MM_SHUFFLE(1,1,1,1))),         _mm_mul_ps(m[3], _mm_shuffle_ps(n[3], n[3], _MM_SHUFFLE(0,0,0,0))))); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b <strong>n<\/strong> \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 <em>shuffle<\/em>, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 <em>_mm_mul_ps<\/em>, \u0441\u0443\u043c\u043c\u0443 \u043d\u0430 <em>_mm_add_ps<\/em>, \u0438 \u0432\u0441\u0451, \u0433\u043e\u0442\u043e\u0432\u043e. \u041e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u043f\u0440\u0430\u0432\u0434\u0430, \u043a\u0443\u0434\u0430 \u0441\u0442\u0440\u0430\u0448\u043d\u0435\u0435, \u0447\u0435\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041d\u0430 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 IACA \u0432\u044b\u0434\u0430\u043b\u0430: <em>x86 \u2014 18.89, x64 \u2014 16 \u0442\u0430\u043a\u0442\u043e\u0432<\/em>. \u042d\u0442\u043e \u0432 4 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e. \u0412 SSE \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 4-\u0435 float. \u041f\u043e\u0447\u0442\u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<h4>\u0423\u043a\u0440\u0430\u0448\u0430\u0435\u043c SSE \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e<\/h4>\n<p>  \u0418 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0432 \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0443\u0436\u0430\u0441\u043d\u043e. \u041f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u043e\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/ \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0443\u0434\u043e\u0431\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432 namespace)  __m128 operator + (__m128 const a, __m128 const b) { return _mm_add_ps(a, b); } __m128 operator - (__m128 const a, __m128 const b) { return _mm_sub_ps(a, b); } __m128 operator * (__m128 const a, __m128 const b) { return _mm_mul_ps(a, b); } __m128 operator \/ (__m128 const a, __m128 const b) { return _mm_div_ps(a, b); }  \/\/_mm_shuffle_ps(u, v, _MM_SHUFFLE(3,2,1,0)) \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 shuf&lt;3,2,1,0&gt;(u, v)  template &lt;int a, int b, int c, int d&gt; __m128 shuf(__m128 const u, __m128 const v) { return _mm_shuffle_ps(u, v, _MM_SHUFFLE(a, b, c, d)); } template &lt;int a, int b, int c, int d&gt; __m128 shuf(__m128 const v) { return _mm_shuffle_ps(v, v, _MM_SHUFFLE(a, b, c, d)); }  \/\/ \u043e\u0431\u043b\u0435\u0433\u0447\u0451\u043d\u043d\u044b\u0439 \u043e\u0434\u043d\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442  template &lt;int i&gt; __m128 shuf(__m128 const u, __m128 const v) { return _mm_shuffle_ps(u, v, _MM_SHUFFLE(i, i, i, i)); } template &lt;int i&gt; __m128 shuf(__m128 const v) { return _mm_shuffle_ps(v, v, _MM_SHUFFLE(i, i, i, i)); }  \/\/ \u0434\u043b\u044f float \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0438 \u0442\u0430\u043a\u043e\u0439 \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \/\/ \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u0451\u0442 \u043f\u0440\u043e\u0444\u0438\u0442, \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435\u0442  template &lt;int a, int b, int c, int d&gt; __m128 shufd(__m128 const v) { return _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(v), _MM_SHUFFLE(a, b, c, d))); } template &lt;int i&gt; __m128 shufd(__m128 const v) { return _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(v), _MM_SHUFFLE(i, i, i, i))); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0443\u043c\u0435\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c (\u0445\u043e\u0442\u044f \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u0435\u0437 __forceinline \u043d\u0438\u043a\u0430\u043a).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0442\u0430\u043a, \u043a\u043e\u0434 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f &#8230;<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void mul_mtx4_mtx4_sse_v2(__m128* const r, __m128 const* const m, __m128 const* const n) {     r[0] = m[0]*shuf&lt;3&gt;(n[0]) + m[1]*shuf&lt;2&gt;(n[0])          + m[2]*shuf&lt;1&gt;(n[0]) + m[3]*shuf&lt;0&gt;(n[0]);     r[1] = m[0]*shuf&lt;3&gt;(n[1]) + m[1]*shuf&lt;2&gt;(n[1])          + m[2]*shuf&lt;1&gt;(n[1]) + m[3]*shuf&lt;0&gt;(n[1]);     r[2] = m[0]*shuf&lt;3&gt;(n[2]) + m[1]*shuf&lt;2&gt;(n[2])          + m[2]*shuf&lt;1&gt;(n[2]) + m[3]*shuf&lt;0&gt;(n[2]);     r[3] = m[0]*shuf&lt;3&gt;(n[3]) + m[1]*shuf&lt;2&gt;(n[3])          + m[2]*shuf&lt;1&gt;(n[3]) + m[3]*shuf&lt;0&gt;(n[3]); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u0443\u0436\u0435 \u043a\u0443\u0434\u0430 \u043b\u0443\u0447\u0448\u0435 \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0435\u0439. \u041d\u0430 \u044d\u0442\u043e IACA \u0432\u044b\u0434\u0430\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: <em>x86 \u2014 19 (\u0430 \u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0440\u043e\u0431\u043d\u044b\u0439?), x64 \u2014 16<\/em>. \u041f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c, \u043d\u043e \u043a\u043e\u0434 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u0435\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435.<\/p>\n<h4>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0431\u0443\u0434\u0443\u0449\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e<\/h4>\n<p>  \u0412\u0432\u0435\u0434\u0451\u043c \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0434\u0430\u0432\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0432 \u0436\u0435\u043b\u0435\u0437\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044e <em>multiple-add (fma)<\/em>. <em><nobr>fma(a, b, c) = a * b + c<\/nobr><\/em>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f multiple-add<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">__m128 mad(__m128 const a, __m128 const b, __m128 const c) {     return _mm_add_ps(_mm_mul_ps(a, b), c); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0430\u0434\u043e? \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u0434\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c <em>mad<\/em> \u043d\u0430 <em>fma<\/em> \u0447\u0435\u0440\u0435\u0437 \u0442\u0435 \u0436\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b, \u043a\u043e\u043c\u0443 \u043a\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u043e. \u041d\u043e \u043e\u0441\u043d\u043e\u0432\u0443 \u043f\u043e\u0434 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u044b \u0437\u0430\u043b\u043e\u0436\u0438\u043c \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 multiple-add<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void mul_mtx4_mtx4_sse_v3(__m128* const r, __m128 const* const m, __m128 const* const n) {     r[0] = mad(m[0], shuf&lt;3&gt;(n[0]), m[1]*shuf&lt;2&gt;(n[0]))          + mad(m[2], shuf&lt;1&gt;(n[0]), m[3]*shuf&lt;0&gt;(n[0]));     r[1] = mad(m[0], shuf&lt;3&gt;(n[1]), m[1]*shuf&lt;2&gt;(n[1])           + mad(m[2], shuf&lt;1&gt;(n[1]), m[3]*shuf&lt;0&gt;(n[1]));     r[2] = mad(m[0], shuf&lt;3&gt;(n[2]), m[1]*shuf&lt;2&gt;(n[2]))          + mad(m[2], shuf&lt;1&gt;(n[2]), m[3]*shuf&lt;0&gt;(n[2]));     r[3] = mad(m[0], shuf&lt;3&gt;(n[3]), m[1]*shuf&lt;2&gt;(n[3]))          + mad(m[2], shuf&lt;1&gt;(n[3]), m[3]*shuf&lt;0&gt;(n[3])); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  IACA: <em>x86 \u2014 18.89, x64 \u2014 16<\/em>. \u041e\u043f\u044f\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u043e\u0435. \u0412\u0441\u0451-\u0442\u0430\u043a\u0438 IACA \u043f\u043e\u0440\u043e\u0439 \u0432\u044b\u0434\u0430\u0451\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u041a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043d\u0435 \u0442\u0430\u043a \u0441\u0438\u043b\u044c\u043d\u043e. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0434\u0430\u0436\u0435 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u043f\u043e\u0445\u0443\u0436\u0435 \u0441\u0442\u0430\u043b. \u041d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0440\u043e\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0436\u0435\u0440\u0442\u0432.<\/p>\n<h4>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 _mm_stream<\/h4>\n<p>  \u0420\u0430\u0437\u043d\u044b\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e\u0442 \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u043d\u0435 \u0434\u0451\u0440\u0433\u0430\u0442\u044c \u043a\u044d\u0448 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u044b\u0441\u044f\u0447\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435. \u041d\u043e \u0434\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u044d\u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u043f\u043e\u0442\u043e\u0447\u043d\u044b\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void mul_mtx4_mtx4_sse_v4(__m128* const r, __m128 const* const m, __m128 const* const n) {     _mm_stream_ps(&amp;r[0].m128_f32[0],         mad(m[0], shuf&lt;3&gt;(n[0]), m[1]*shuf&lt;2&gt;(n[0])) +         mad(m[2], shuf&lt;1&gt;(n[0]), m[3]*shuf&lt;0&gt;(n[0])));      _mm_stream_ps(&amp;r[1].m128_f32[0],         mad(m[0], shuf&lt;3&gt;(n[1]), m[1]*shuf&lt;2&gt;(n[1])) +         mad(m[2], shuf&lt;1&gt;(n[1]), m[3]*shuf&lt;0&gt;(n[1])));      _mm_stream_ps(&amp;r[2].m128_f32[0],         mad(m[0], shuf&lt;3&gt;(n[2]), m[1]*shuf&lt;2&gt;(n[2])) +         mad(m[2], shuf&lt;1&gt;(n[2]), m[3]*shuf&lt;0&gt;(n[2])));      _mm_stream_ps(&amp;r[3].m128_f32[0],         mad(m[0], shuf&lt;3&gt;(n[3]), m[1]*shuf&lt;2&gt;(n[3])) +         mad(m[2], shuf&lt;1&gt;(n[3]), m[3]*shuf&lt;0&gt;(n[3]))); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e \u0442\u0430\u043a\u0442\u0430\u043c \u0442\u0443\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c, \u043e\u0442 \u0441\u043b\u043e\u0432\u0430 \u0441\u043e\u0432\u0441\u0435\u043c. \u041d\u043e, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c, \u043a\u044d\u0448 \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u043c.<\/p>\n<h2>AVX \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<h3>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 AVX \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8d\/l-\/1r\/8dl-1rgisfl2sqr0dhzmizkmawg.jpeg\" align=\"right\"><br \/>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 SSE \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0432\u0445\u043e\u0434\u0438\u0442 4-\u0435 float, \u0430 \u0432 AVX \u0443\u0436\u0435 8. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u0442\u044c \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u043d\u0441 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0434\u0432\u043e\u0435, \u0442\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u0440\u0430\u0437\u0430 \u0432 1.5. \u041d\u043e \u0447\u0442\u043e-\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0435 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043d\u0430 AVX. \u0421\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0434\u0432\u043e\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432?<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0421\u043d\u043e\u0432\u0430 \u0432\u044b\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u0441 \u043a\u043e\u0434\u043e\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u0440\u044f\u0434\u043e\u043c, \u0438 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438\u0441\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u043b\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u0432\u0435\u0440\u0445.<\/p>\n<pre><code>\/\/\u0421\u043d\u043e\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445: 00, 10, 20, 30, 01, 11, 21, 31, 02, 12, 22, 32, 03, 13, 23, 33  \/\/\u0418 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f SSE: r0 = m0*n00 + m1*n10 + m2*n20 + m3*n30 r1 = m0*n01 + m1*n11 + m2*n21 + m3*n31 r2 = m0*n02 + m1*n12 + m2*n22 + m3*n32 r3 = m0*n03 + m1*n13 + m2*n23 + m3*n33 <\/code><\/pre>\n<p>  \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 <em><nobr>ymm = {r0:r1}<\/nobr><\/em> \u0438 <em><nobr>ymm = {r2:r3}<\/nobr><\/em>. \u0415\u0441\u043b\u0438 \u0432 SSE \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0443 \u043d\u0430\u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u043e\u0431\u0449\u0430\u043b\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u044b, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0435\u0433\u043e \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 SSE \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0443\u0436\u0435 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <strong>m<\/strong> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b <em>ymm<\/em>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c <em><nobr>ymm = {m0:m1}<\/nobr><\/em> \u0438 <em><nobr>ymm = {m2:m3}<\/nobr><\/em> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0420\u0430\u043d\u044c\u0448\u0435 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u043d\u044c\u0448\u0435, \u0442\u043e \u043d\u0430\u0434\u043e <em><nobr>ymm={m0:m1}<\/nobr><\/em> \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <em><nobr>ymm={n00,n00,n00,n00}:{n10,n10,n10,n10}<\/nobr><\/em>. \u0422\u0430\u043a \u043a\u0430\u043a <em>n00<\/em> \u0438 <em>n01<\/em> \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>n<\/strong>, \u0442\u043e, \u0441\u0443\u0434\u044f \u043f\u043e \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u043d\u0430\u0431\u043e\u0440\u0443 AVX \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0440\u0430\u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e <em>ymm<\/em> \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0440\u043e\u0433\u043e. \u0418 <em>shuffle<\/em>, \u0438 <em>permute<\/em> \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0435\u0442\u0432\u0435\u0440\u043e\u043a float (\u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0438 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 <em>xmm<\/em>) \u0432\u043d\u0443\u0442\u0440\u0438 <em>ymm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c <em>ymm<\/em> \u0438\u0437 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>n<\/strong>, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0431\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <em>n00<\/em> \u0438 <em>n10<\/em> \u0432 \u0441\u0442\u0430\u0440\u0448\u0435\u043c \u0438\u0437 2-\u0445 <em>xmm<\/em> \u0432\u043d\u0443\u0442\u0440\u0438 <em>ymm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. <em><nobr>{n00,n10,n20,n30}:{n01,n11,n21,n31}<\/nobr><\/em>. \u041e\u0431\u044b\u0447\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441 \u0443 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043e\u0442 0 \u0434\u043e 3. \u0418 \u0430\u0434\u0440\u0435\u0441\u0443\u0435\u0442 float \u043b\u0438\u0448\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0434\u043d\u043e\u0433\u043e <em>xmm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 <em>ymm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u041f\u0435\u0440\u0435\u043a\u0438\u043d\u0443\u0442\u044c <em>n10<\/em> \u0438\u0437 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e <em>xmm<\/em> \u0432 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 <em>\u0434\u0451\u0448\u0435\u0432\u043e<\/em> \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u0410 \u0442\u0443\u0442 \u0435\u0449\u0451 \u044d\u0442\u043e\u0442 \u0444\u043e\u043a\u0443\u0441 \u043d\u0430\u0434\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437. \u0421 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0442\u0435\u0440\u0435\u0439 \u0442\u0430\u043a\u0442\u043e\u0432 \u043c\u044b \u0441\u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u041d\u0430\u0434\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<p>  \u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u043e\u0431\u043e\u0431\u0449\u0430\u043b\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0440\u043e\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u0439\u0442\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 <em>{r0:r1}<\/em>. \u0417\u043d\u0430\u0447\u0438\u0442 \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0434\u043e \u043d\u0435 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e \u0434\u0432\u0435. \u0418 \u0442\u0443\u0442 \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043c\u0438\u043d\u0443\u0441\u043e\u043c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 <em>shuffle<\/em> \u0438 <em>permute<\/em>, \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043b\u044e\u0441\u043e\u043c. \u0421\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 <em>ymm<\/em>, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <strong>n<\/strong>.<\/p>\n<pre><code>n0n1 = {00, 10, 20, 30} : {01, 11, 21, 31} n2n3 = {02, 12, 22, 32} : {03, 13, 23, 33} <\/code><\/pre>\n<p>  \u0410\u0433\u0430, \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 <em>xmm<\/em> \u0447\u0430\u0441\u0442\u044f\u0445 <em>ymm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b <em>00<\/em> \u0438 <em>01<\/em>. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 permute \u0432 <em><nobr>{_00,_00,_00,_00}:{_01,_01,_01,_01}<\/nobr><\/em>, \u0443\u043a\u0430\u0437\u0430\u0432 \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u043d\u0434\u0435\u043a\u0441 3 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 <em>xmm<\/em> \u0447\u0430\u0441\u0442\u0435\u0439. \u042d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e. \u0412\u0435\u0434\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445. \u0422\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c <em>ymm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0434\u043b\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c <em>{m0:m0}<\/em>, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>m<\/strong>.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e. \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0432 <em>ymm<\/em> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0441\u0434\u0432\u043e\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong>m<\/strong>:<\/p>\n<pre><code>mm[0] = {m0:m0} mm[1] = {m1:m1} mm[2] = {m2:m2} mm[3] = {m3:m3} <\/code><\/pre>\n<p>  \u0418 \u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043a\u0430\u043a:<\/p>\n<pre><code>r0r1 = mm[0] * {n00,n00,n00,n00:n01,n01,n01,n01} + \/\/ permute&lt;3,3,3,3&gt;(n0n1) mm[1] * {n10,n10,n10,n10:n11,n11,n11,n11} + \/\/ permute&lt;2,2,2,2&gt;(n0n1) mm[2] * {n20,n20,n20,n20:n21,n21,n21,n21} + \/\/ permute&lt;1,1,1,1&gt;(n0n1) mm[3] * {n30,n30,n30,n30:n31,n31,n31,n31}   \/\/ permute&lt;0,0,0,0&gt;(n0n1)  r2r3 = mm[0] * {n02,n02,n02,n02:n03,n03,n03,n03} + \/\/ permute&lt;3,3,3,3&gt;(n2n3) mm[1] * {n12,n12,n12,n12:n13,n13,n13,n13} + \/\/ permute&lt;2,2,2,2&gt;(n2n3) mm[2] * {n22,n22,n22,n22:n23,n23,n23,n23} + \/\/ permute&lt;1,1,1,1&gt;(n2n3) mm[3] * {n32,n32,n32,n32:n33,n33,n33,n33}   \/\/ permute&lt;0,0,0,0&gt;(n2n3) <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e:<\/p>\n<pre><code>r0r1 = mm[0]*n0n1&lt;3,3,3,3&gt;+mm[1]*n0n1&lt;2,2,2,2&gt;+mm[2]*n0n1&lt;1,1,1,1&gt;+mm[3]*n0n1&lt;0,0,0,0&gt; r2r3 = mm[0]*n2n3&lt;3,3,3,3&gt;+mm[1]*n2n3&lt;2,2,2,2&gt;+mm[2]*n2n3&lt;1,1,1,1&gt;+mm[3]*n2n3&lt;0,0,0,0&gt; <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0432 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<pre><code>r0r1 = mm[0]*n0n1&lt;3&gt; + mm[1]*n0n1&lt;2&gt; + mm[2]*n0n1&lt;1&gt; + mm[3]*n0n1&lt;0&gt; r2r3 = mm[0]*n2n3&lt;3&gt; + mm[1]*n2n3&lt;2&gt; + mm[2]*n2n3&lt;1&gt; + mm[3]*n2n3&lt;0&gt; <\/code><\/pre>\n<p>  \u0412\u0440\u043e\u0434\u0435 \u0432\u0441\u0451 \u044f\u0441\u043d\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void mul_mtx4_mtx4_avx_v1(__m128* const r, __m128 const* const m, __m128 const* const n) {     __m256 mm0 = _mm256_set_m128(m[0], m[0]);     __m256 mm1 = _mm256_set_m128(m[1], m[1]);     __m256 mm2 = _mm256_set_m128(m[2], m[2]);     __m256 mm3 = _mm256_set_m128(m[3], m[3]);      __m256 n0n1 = _mm256_load_ps(&amp;n[0].m128_f32[0]);     __m256 y1 = _mm256_permute_ps(n0n1, 0xFF);\/\/3,3,3,3     __m256 y2 = _mm256_permute_ps(n0n1, 0xAA);\/\/2,2,2,2     __m256 y3 = _mm256_permute_ps(n0n1, 0x55);\/\/1,1,1,1     __m256 y4 = _mm256_permute_ps(n0n1, 0x00);\/\/0,0,0,0      y1 = _mm256_mul_ps(y1, mm0);     y2 = _mm256_mul_ps(y2, mm1);     y3 = _mm256_mul_ps(y3, mm2);     y4 = _mm256_mul_ps(y4, mm3);      y1 = _mm256_add_ps(y1, y2);     y3 = _mm256_add_ps(y3, y4);     y1 = _mm256_add_ps(y1, y3);      __m256 n2n3 = _mm256_load_ps(&amp;n[2].m128_f32[0]);     __m256 y5 = _mm256_permute_ps(n2n3, 0xFF);     __m256 y6 = _mm256_permute_ps(n2n3, 0xAA);     __m256 y7 = _mm256_permute_ps(n2n3, 0x55);     __m256 y8 = _mm256_permute_ps(n2n3, 0x00);      y5 = _mm256_mul_ps(y5, mm0);     y6 = _mm256_mul_ps(y6, mm1);     y7 = _mm256_mul_ps(y7, mm2);     y8 = _mm256_mul_ps(y8, mm3);      y5 = _mm256_add_ps(y5, y6);     y7 = _mm256_add_ps(y7, y8);     y5 = _mm256_add_ps(y5, y7);      _mm256_stream_ps(&amp;r[0].m128_f32[0], y1);     _mm256_stream_ps(&amp;r[2].m128_f32[0], y5); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u043e\u0442 \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u043e\u0442 IACA: <em>x86 \u2014 12.53, x64 \u2014 12<\/em>. \u0425\u043e\u0442\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0448\u0435. \u0427\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u0442\u0438\u043b\u0438.<\/p>\n<h3>AVX \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043b\u044e\u0441 \u00ab\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440\u00bb<\/h3>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 AVX \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0435 \u043d\u0430 \u043f\u043e\u043b\u043d\u0443\u044e \u043c\u043e\u0449\u044c. \u041d\u0430\u0445\u043e\u0434\u0438\u043c, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u0432\u0443\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <strong>ymm<\/strong> \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c <em>broadcast<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <em>ymm<\/em> \u0434\u0432\u0443\u043c\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <em>xmm<\/em>. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u00ab\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u0430\u00bb \u0434\u043b\u044f AVX \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0430\u044f AVX \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">__m256 operator + (__m256 const a, __m256 const b) { return _mm256_add_ps(a, b); } __m256 operator - (__m256 const a, __m256 const b) { return _mm256_sub_ps(a, b); } __m256 operator * (__m256 const a, __m256 const b) { return _mm256_mul_ps(a, b); } __m256 operator \/ (__m256 const a, __m256 const b) { return _mm256_div_ps(a, b); }  template &lt;int i&gt; __m256 perm(__m256 const v) { return _mm256_permute_ps(v, _MM_SHUFFLE(i, i, i, i)); } template &lt;int a, int b, int c, int d&gt; __m256 perm(__m256 const v) { return _mm256_permute_ps(v, _MM_SHUFFLE(a, b, c, d)); } template &lt;int i, int j&gt; __m256 perm(__m256 const v) { return _mm256_permutevar_ps(v, _mm256_set_epi32(i, i, i, i, j, j, j, j)); } template &lt;int a, int b, int c, int d, int e, int f, int g, int h&gt; __m256 perm(__m256 const v) { return _mm256_permutevar_ps(v, _mm256_set_epi32(a, b, c, d, e, f, g, h)); }  __m256 mad(__m256 const a, __m256 const b, __m256 const c) {     return _mm256_add_ps(_mm256_mul_ps(a, b), c); }  void mul_mtx4_mtx4_avx_v2(__m128* const r, __m128 const* const m, __m128 const* const n) {     __m256 const mm[] {         _mm256_broadcast_ps(m+0),         _mm256_broadcast_ps(m+1),         _mm256_broadcast_ps(m+2),         _mm256_broadcast_ps(m+3)     };      __m256 const n0n1 = _mm256_load_ps(&amp;n[0].m128_f32[0]);     _mm256_stream_ps(&amp;r[0].m128_f32[0],         mad(perm&lt;3&gt;(n0n1), mm[0], perm&lt;2&gt;(n0n1)*mm[1])+         mad(perm&lt;1&gt;(n0n1), mm[2], perm&lt;0&gt;(n0n1)*mm[3]));      __m256 const n2n3 = _mm256_load_ps(&amp;n[2].m128_f32[0]);     _mm256_stream_ps(&amp;r[2].m128_f32[0],         mad(perm&lt;3&gt;(n2n3), mm[0], perm&lt;2&gt;(n2n3)*mm[1])+         mad(perm&lt;1&gt;(n2n3), mm[2], perm&lt;0&gt;(n2n3)*mm[3])); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0443\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. IACA \u0432\u044b\u0434\u0430\u0451\u0442 \u0446\u0438\u0444\u0440\u044b: <em>x86 \u2014 10, x64 \u2014 8.58<\/em>, \u0447\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043d\u0435 \u0432 2 \u0440\u0430\u0437\u0430.<\/p>\n<h3>AVX+FMA \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439)<\/h3>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043d\u043e\u0432\u0430 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043f\u0440\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 FMA, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 AVX. \u041f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 <em>mul+add<\/em> \u043d\u0430 \u043e\u0434\u043d\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u0425\u043e\u0442\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u044f \u0441\u043c\u043e\u0442\u0440\u044e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c <em><nobr>a*b + c*d + e*f + g*h<\/nobr><\/em>. \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043b\u043e\u0431: <em><nobr>fma(a, b, fma(c, d, fma(e, f, g * h)))<\/nobr><\/em>. \u041d\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043f\u0430\u0440\u0435\u043d\u043d\u044b\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c SIMD \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440. \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f <em><nobr>fma(a, b, c * d) + fma(e, f, g * h)<\/nobr><\/em>, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u0434\u0432\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 <em>fma<\/em> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">AVX+FMA \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">__m256 fma(__m256 const a, __m256 const b, __m256 const c) {     return _mm256_fmadd_ps(a, b, c); }  void mul_mtx4_mtx4_avx_fma(__m128* const r, __m128 const* const m, __m128 const* const n) {     __m256 const mm[]{         _mm256_broadcast_ps(m + 0),         _mm256_broadcast_ps(m + 1),         _mm256_broadcast_ps(m + 2),         _mm256_broadcast_ps(m + 3) };      __m256 const n0n1 = _mm256_load_ps(&amp;n[0].m128_f32[0]);     _mm256_stream_ps(&amp;r[0].m128_f32[0],         fma(perm&lt;3&gt;(n0n1), mm[0], perm&lt;2&gt;(n0n1)*mm[1])+         fma(perm&lt;1&gt;(n0n1), mm[2], perm&lt;0&gt;(n0n1)*mm[3]));      __m256 const n2n3 = _mm256_load_ps(&amp;n[2].m128_f32[0]);     _mm256_stream_ps(&amp;r[2].m128_f32[0],         fma(perm&lt;3&gt;(n2n3), mm[0], perm&lt;2&gt;(n2n3)*mm[1])+         fma(perm&lt;1&gt;(n2n3), mm[2], perm&lt;0&gt;(n2n3)*mm[3])); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  IACA: <em>x86 \u2014 9.21, x64 \u2014 8<\/em>. \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043a\u0442\u043e-\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u044f \u0443\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0430\u043a.<\/p>\n<h2>Benchmarks<\/h2>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u044d\u0442\u0438 \u0446\u0438\u0444\u0440\u044b \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u0441\u0442\u0438\u043d\u0443 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438. \u0414\u0430\u0436\u0435 \u043f\u0440\u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0435 \u043e\u043d\u0438 \u043f\u043b\u0430\u0432\u0430\u044e\u0442 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445. \u0418 \u0443\u0436 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445. \u041f\u0440\u0438 \u043b\u044e\u0431\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0437\u0430\u043c\u0435\u0440\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f.<\/p>\n<h4>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>Function: \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u043d\u0430 <b>s<\/b> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433\u043e\u043c, \u0438\u043d\u0430\u0447\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 mov (\u0431\u0435\u0437 \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433\u0430). \u0414\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0430\u0436\u043d\u043e.<\/li>\n<li>IACA cycles: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0442\u043e\u0432 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 IACA<\/li>\n<li>Measured cycles: \u0437\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0442\u043e\u0432 (\u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435)<\/li>\n<li>IACA speedup: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0442\u043e\u0432 \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435<\/li>\n<li>Measured speedup: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0442\u043e\u0432 \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 (\u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435)<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f loop_m \u0442\u0430\u043a\u0442\u044b \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u044b \u043d\u0430 64. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041f\u043e \u0444\u0430\u043a\u0442\u0443 \u0442\u0430\u043a \u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c.<\/p>\n<h3>i3-3770:<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">x86<\/b><\/p>\n<div class=\"spoiler_text\">\n<table>\n<tr>\n<th>Function<\/th>\n<th>IACA cycles<\/th>\n<th>Measured cycles<\/th>\n<th>IACA speedup<\/th>\n<th>Measured speedup<\/th>\n<\/tr>\n<tr>\n<th>unroll_m<\/th>\n<th>70.00<\/th>\n<th>50.75<\/th>\n<th>1.00<\/th>\n<th>1.00<\/th>\n<\/tr>\n<tr>\n<th>loop_m<\/th>\n<th>233.60<\/th>\n<th>119.21<\/th>\n<th>0.30<\/th>\n<th>0.43<\/th>\n<\/tr>\n<tr>\n<th>sse_v1m<\/th>\n<th>18.89<\/th>\n<th>27.51<\/th>\n<th>3.70<\/th>\n<th>1.84<\/th>\n<\/tr>\n<tr>\n<th>sse_v2m<\/th>\n<th>19.00<\/th>\n<th>27.61<\/th>\n<th>3.68<\/th>\n<th>1.84<\/th>\n<\/tr>\n<tr>\n<th>sse_v3m<\/th>\n<th>18.89<\/th>\n<th>27.22<\/th>\n<th>3.70<\/th>\n<th>1.86<\/th>\n<\/tr>\n<tr>\n<th>sse_v4s<\/th>\n<th>18.89<\/th>\n<th>27.18<\/th>\n<th>3.70<\/th>\n<th>1.87<\/th>\n<\/tr>\n<tr>\n<th>avx_v1m<\/th>\n<th>13.00<\/th>\n<th>19.21<\/th>\n<th>5.38<\/th>\n<th>2.64<\/th>\n<\/tr>\n<tr>\n<th>avx_v1s<\/th>\n<th>13.00<\/th>\n<th>20.03<\/th>\n<th>5.38<\/th>\n<th>2.53<\/th>\n<\/tr>\n<tr>\n<th>avx_v2m<\/th>\n<th>10.00<\/th>\n<th>12.91<\/th>\n<th>6.99<\/th>\n<th>3.93<\/th>\n<\/tr>\n<tr>\n<th>avx_v2s<\/th>\n<th>10.00<\/th>\n<th>17.34<\/th>\n<th>6.99<\/th>\n<th>2.93<\/th>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">x64<\/b><\/p>\n<div class=\"spoiler_text\">\n<table>\n<tr>\n<th>Function<\/th>\n<th>IACA cycles<\/th>\n<th>Measured cycles<\/th>\n<th>IACA speedup<\/th>\n<th>Measured speedup<\/th>\n<\/tr>\n<tr>\n<th>unroll_m<\/th>\n<th>70<\/th>\n<th>68.60<\/th>\n<th>1.00<\/th>\n<th>1.00<\/th>\n<\/tr>\n<tr>\n<th>loop_m<\/th>\n<th>233.60<\/th>\n<th>119.37<\/th>\n<th>0.30<\/th>\n<th>0.57<\/th>\n<\/tr>\n<tr>\n<th>sse_v1m<\/th>\n<th>18.89<\/th>\n<th>21.98<\/th>\n<th>3.70<\/th>\n<th>3.12<\/th>\n<\/tr>\n<tr>\n<th>sse_v2m<\/th>\n<th>19.00<\/th>\n<th>21.09<\/th>\n<th>3.68<\/th>\n<th>3.25<\/th>\n<\/tr>\n<tr>\n<th>sse_v3m<\/th>\n<th>18.89<\/th>\n<th>22.19<\/th>\n<th>3.70<\/th>\n<th>3.09<\/th>\n<\/tr>\n<tr>\n<th>sse_v4s<\/th>\n<th>18.89<\/th>\n<th>22.39<\/th>\n<th>3.70<\/th>\n<th>3.06<\/th>\n<\/tr>\n<tr>\n<th>avx_v1m<\/th>\n<th>13.00<\/th>\n<th>9.61<\/th>\n<th>5.38<\/th>\n<th>7.13<\/th>\n<\/tr>\n<tr>\n<th>avx_v1s<\/th>\n<th>13.00<\/th>\n<th>16.90<\/th>\n<th>5.38<\/th>\n<th>4.06<\/th>\n<\/tr>\n<tr>\n<th>avx_v2m<\/th>\n<th>10.00<\/th>\n<th>9.20<\/th>\n<th>6.99<\/th>\n<th>7.45<\/th>\n<\/tr>\n<tr>\n<th>avx_v2s<\/th>\n<th>10.00<\/th>\n<th>14.64<\/th>\n<th>6.99<\/th>\n<th>4.68<\/th>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>i7-8700K:<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">x86<\/b><\/p>\n<div class=\"spoiler_text\">\n<table>\n<tr>\n<th>Function<\/th>\n<th>IACA cycles<\/th>\n<th>Measured cycles<\/th>\n<th>IACA speedup<\/th>\n<th>Measured speedup<\/th>\n<\/tr>\n<tr>\n<th>unroll_m<\/th>\n<th>69.95<\/th>\n<th>40.25<\/th>\n<th>1.00<\/th>\n<th>1.00<\/th>\n<\/tr>\n<tr>\n<th>loop_m<\/th>\n<th>233.60<\/th>\n<th>79.49<\/th>\n<th>0.30<\/th>\n<th>0.51<\/th>\n<\/tr>\n<tr>\n<th>sse_v1m<\/th>\n<th>18.89<\/th>\n<th>19.31<\/th>\n<th>3.70<\/th>\n<th>2.09<\/th>\n<\/tr>\n<tr>\n<th>sse_v2m<\/th>\n<th>19.00<\/th>\n<th>19.98<\/th>\n<th>3.68<\/th>\n<th>2.01<\/th>\n<\/tr>\n<tr>\n<th>sse_v3m<\/th>\n<th>18.89<\/th>\n<th>19.69<\/th>\n<th>3.70<\/th>\n<th>2.04<\/th>\n<\/tr>\n<tr>\n<th>sse_v4s<\/th>\n<th>18.89<\/th>\n<th>19.67<\/th>\n<th>3.70<\/th>\n<th>2.05<\/th>\n<\/tr>\n<tr>\n<th>avx_v1m<\/th>\n<th>13.00<\/th>\n<th>14.22<\/th>\n<th>5.38<\/th>\n<th>2.83<\/th>\n<\/tr>\n<tr>\n<th>avx_v1s<\/th>\n<th>13.00<\/th>\n<th>14.13<\/th>\n<th>5.38<\/th>\n<th>2.85<\/th>\n<\/tr>\n<tr>\n<th>avx_v2m<\/th>\n<th>10.00<\/th>\n<th>11.73<\/th>\n<th>6.99<\/th>\n<th>3.43<\/th>\n<\/tr>\n<tr>\n<th>avx_v2s<\/th>\n<th>10.00<\/th>\n<th>11.81<\/th>\n<th>6.99<\/th>\n<th>3.41<\/th>\n<\/tr>\n<tr>\n<th>AVX+FMAm<\/th>\n<th>9.21<\/th>\n<th>10.38<\/th>\n<th>7.60<\/th>\n<th>3.88<\/th>\n<\/tr>\n<tr>\n<th>AVX+FMAs<\/th>\n<th>9.21<\/th>\n<th>10.32<\/th>\n<th>7.60<\/th>\n<th>3.90<\/th>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">x64<\/b><\/p>\n<div class=\"spoiler_text\">\n<table>\n<tr>\n<th>Function<\/th>\n<th>IACA cycles<\/th>\n<th>Measured cycles<\/th>\n<th>IACA speedup<\/th>\n<th>Measured speedup<\/th>\n<\/tr>\n<tr>\n<th>unroll_m<\/th>\n<th>69.95<\/th>\n<th>57.11<\/th>\n<th>1.00<\/th>\n<th>1.00<\/th>\n<\/tr>\n<tr>\n<th>loop_m<\/th>\n<th>233.60<\/th>\n<th>75.73<\/th>\n<th>0.30<\/th>\n<th>0.75<\/th>\n<\/tr>\n<tr>\n<th>sse_v1m<\/th>\n<th>18.89<\/th>\n<th>15.83<\/th>\n<th>3.70<\/th>\n<th>3.61<\/th>\n<\/tr>\n<tr>\n<th>sse_v2m<\/th>\n<th>19.00<\/th>\n<th>17.22<\/th>\n<th>3.68<\/th>\n<th>3.32<\/th>\n<\/tr>\n<tr>\n<th>sse_v3m<\/th>\n<th>18.89<\/th>\n<th>15.92<\/th>\n<th>3.70<\/th>\n<th>3.59<\/th>\n<\/tr>\n<tr>\n<th>sse_v4s<\/th>\n<th>18.89<\/th>\n<th>16.18<\/th>\n<th>3.70<\/th>\n<th>3.53<\/th>\n<\/tr>\n<tr>\n<th>avx_v1m<\/th>\n<th>13.00<\/th>\n<th>7.03<\/th>\n<th>5.38<\/th>\n<th>8.12<\/th>\n<\/tr>\n<tr>\n<th>avx_v1s<\/th>\n<th>13.00<\/th>\n<th>12.98<\/th>\n<th>5.38<\/th>\n<th>4.40<\/th>\n<\/tr>\n<tr>\n<th>avx_v2m<\/th>\n<th>10.00<\/th>\n<th>5.40<\/th>\n<th>6.99<\/th>\n<th>10.57<\/th>\n<\/tr>\n<tr>\n<th>avx_v2s<\/th>\n<th>10.00<\/th>\n<th>11.39<\/th>\n<th>6.99<\/th>\n<th>5.01<\/th>\n<\/tr>\n<tr>\n<th>AVX+FMAm<\/th>\n<th>9.21<\/th>\n<th>9.73<\/th>\n<th>7.60<\/th>\n<th>5.87<\/th>\n<\/tr>\n<tr>\n<th>AVX+FMAs<\/th>\n<th>9.21<\/th>\n<th>9.81<\/th>\n<th>7.60<\/th>\n<th>5.82<\/th>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<p>  \u041a\u043e\u0434 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0438\u0445 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<h2>BONUS \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0438<\/h2>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0438 \u043e\u043d \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u044f \u0438 \u0432\u0438\u0434\u0435\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 AVX512, \u0442\u043e \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u0445. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u0422\u0443\u0442 \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u044f\u0441\u043d\u044f\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043f\u043e\u043b\u043d\u0430\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044f \u0441 AVX+FMA. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u043e\u0442 \u0436\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u044d\u0442\u043e \u0437\u0434\u0435\u0441\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">__m512 operator + (__m512 const a, __m512 const b) { return _mm512_add_ps(a, b); } __m512 operator - (__m512 const a, __m512 const b) { return _mm512_sub_ps(a, b); } __m512 operator * (__m512 const a, __m512 const b) { return _mm512_mul_ps(a, b); } __m512 operator \/ (__m512 const a, __m512 const b) { return _mm512_div_ps(a, b); }  template &lt;int i&gt; __m512 perm(__m512 const v) { return _mm512_permute_ps(v, _MM_SHUFFLE(i, i, i, i)); } template &lt;int a, int b, int c, int d&gt; __m512 perm(__m512 const v) { return _mm512_permute_ps(v, _MM_SHUFFLE(a, b, c, d)); }  __m512 fma(__m512 const a, __m512 const b, __m512 const c) {     return _mm512_fmadd_ps(a, b, c); }  void mul_mtx4_mtx4_avx512(__m128* const r, __m128 const* const m, __m128 const* const _n) {     __m512 const mm[]{         _mm512_broadcast_f32x4(m[0]),         _mm512_broadcast_f32x4(m[1]),         _mm512_broadcast_f32x4(m[2]),         _mm512_broadcast_f32x4(m[3]) };      __m512 const n = _mm512_load_ps(&amp;_n[0].m128_f32[0]);     _mm512_stream_ps(&amp;r[0].m128_f32[0],         fma(perm&lt;3&gt;(n), mm[0], perm&lt;2&gt;(n)*mm[1])+         fma(perm&lt;1&gt;(n), mm[2], perm&lt;0&gt;(n)*mm[3])); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0426\u0438\u0444\u0440\u044b \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435: <em>x86 \u2014 4.79, x64 \u2014 5.42<\/em> (IACA \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 SKX). \u042d\u0442\u043e \u043f\u0440\u0438\u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 64 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 48 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h2>P.S. \u041a\u043e\u0434 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/h2>\n<p>  <\/p>\n<div class=\"oembed\"><a href=\"https:\/\/github.com\/truthfinder\/mul_m4_m4\">https:\/\/github.com\/truthfinder\/mul_m4_m4<\/a><\/div>\n<p>  \u042d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u043f\u044b\u0442 \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0435\u0439. \u0412\u0441\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u041e\u043d\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u043b\u0443\u0447\u0448\u0435.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/418247\/\"> https:\/\/habr.com\/post\/418247\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/418247\/\" class=\"post__text post__text-html js-mediator-article\">\u0423\u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u043b\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u043e, \u043a\u0430\u043a \u044f \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 MMX, SSE, \u0430 \u043f\u043e\u0437\u0436\u0435 \u0438 AVX \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 Intel. \u0412 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f \u043e\u043d\u0438 \u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u0430\u0433\u0438\u0435\u0439 \u043d\u0430 \u0444\u043e\u043d\u0435 x86 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0441\u0442\u0430\u043b \u0447\u0435\u043c-\u0442\u043e \u043e\u0431\u044b\u0434\u0435\u043d\u043d\u044b\u043c. \u041e\u043d\u0438 \u043c\u0435\u043d\u044f \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0446\u0435\u043f\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043e\u0444\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0438\u0433\u0440\u044b. \u0421\u043f\u043e\u0434\u0432\u0438\u0433\u043b\u043e \u043c\u0435\u043d\u044f \u043d\u0430 \u044d\u0442\u043e \u0442\u043e, \u043a\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0435\u0449\u0430\u043b\u0438 \u044d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0434\u0430\u0436\u0435 \u0434\u0443\u043c\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u041d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043a\u0443\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u043e\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435. \u0423 \u043c\u0435\u043d\u044f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0435 \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c\u0438 AMD \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438, \u0438 \u0438\u0445 \u043f\u043e\u0442\u043e\u043b\u043e\u043a \u0431\u044b\u043b SSE3. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c SSE3. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u0435\u0435, \u0447\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 SSE, \u0441 \u0440\u0435\u0434\u043a\u0438\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e SSE3. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a\u0443\u044e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044f \u0441\u043c\u043e\u0433\u0443 \u0432\u044b\u0436\u0430\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0434\u043b\u044f \u0440\u044f\u0434\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 float 4 \u043d\u0430 4.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kg\/ii\/cq\/kgiicqemuc5agmypikedjioaogc.jpeg\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-288056","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=288056"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288056\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}