From 56fd0532e263885ac08509c65d1466429ae33a3c Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis <vkarak@gmail.com> Date: Fri, 19 May 2017 11:45:43 +0200 Subject: [PATCH] Fix consistency issue of the SIMD i/f of modcc (#278) The `emit_gather()` function emitted the "wrong" instruction in terms of its arguments but the instruction actually generated was correct, because the `simd_printer` was passing the arguments to `emit_gather()` in a different order, which was though the correct order for the finally emitted instruction. Complicated? This commit cleans this up. --- modcc/backends/avx512.hpp | 2 +- modcc/options.hpp | 2 +- modcc/simd_printer.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modcc/backends/avx512.hpp b/modcc/backends/avx512.hpp index 153e329e..cce0bc88 100644 --- a/modcc/backends/avx512.hpp +++ b/modcc/backends/avx512.hpp @@ -121,7 +121,7 @@ struct simd_intrinsics<targetKind::avx512> { static void emit_gather(TextBuffer& tb, const A& addr, const I& index, const S& scale) { tb << "_mm512_i32gather_pd("; - emit_operands(tb, arg_emitter(addr), arg_emitter(index), + emit_operands(tb, arg_emitter(index), arg_emitter(addr), arg_emitter(scale)); tb << ")"; } diff --git a/modcc/options.hpp b/modcc/options.hpp index 1ca12eea..02c2f6fd 100644 --- a/modcc/options.hpp +++ b/modcc/options.hpp @@ -7,7 +7,7 @@ enum class targetKind { cpu, gpu, // Vectorisation targets - avx512, + avx512 }; struct Options { diff --git a/modcc/simd_printer.hpp b/modcc/simd_printer.hpp index 4c9efe96..668c89bc 100644 --- a/modcc/simd_printer.hpp +++ b/modcc/simd_printer.hpp @@ -377,7 +377,7 @@ void SimdPrinter<Arch>::visit(IndexedVariable *e) { value_name = emit_rawptr_name(e->index_name()); } - simd_backend::emit_gather(text_, vindex_name, value_name, "sizeof(value_type)"); + simd_backend::emit_gather(text_, value_name, vindex_name, "sizeof(value_type)"); } template<targetKind Arch> -- GitLab