From c77d687069b3d063da9856501a644f49035e09a2 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 9 Feb 2023 18:49:10 +0100 Subject: [PATCH] [mono] Fix SIMD multiplication by scalar (#81888) OP_XBINOP_BYSCALAR expects scalar as second argument. Fixes `System.Numerics.Tests.GenericVectorTests.TestMultiplicationWithScalar()` tests. --- src/mono/mono/mini/simd-intrinsics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/simd-intrinsics.c b/src/mono/mono/mini/simd-intrinsics.c index 31ce2397fc6e4..accaf2301d424 100644 --- a/src/mono/mono/mini/simd-intrinsics.c +++ b/src/mono/mono/mini/simd-intrinsics.c @@ -339,7 +339,7 @@ emit_simd_ins_for_binary_op (MonoCompile *cfg, MonoClass *klass, MonoMethodSigna } else if (fsig->params [0]->type != MONO_TYPE_GENERICINST) { MonoInst* ins = emit_simd_ins (cfg, klass, OP_CREATE_SCALAR_UNSAFE, args [0]->dreg, -1); ins->inst_c1 = arg_type; - ins = emit_simd_ins (cfg, klass, OP_XBINOP_BYSCALAR, ins->dreg, args [1]->dreg); + ins = emit_simd_ins (cfg, klass, OP_XBINOP_BYSCALAR, args [1]->dreg, ins->dreg); ins->inst_c0 = OP_FMUL; return ins; } else if ((fsig->params [0]->type == MONO_TYPE_GENERICINST) && (fsig->params [1]->type == MONO_TYPE_GENERICINST)) { @@ -385,7 +385,7 @@ emit_simd_ins_for_binary_op (MonoCompile *cfg, MonoClass *klass, MonoMethodSigna } else if (fsig->params [0]->type != MONO_TYPE_GENERICINST) { MonoInst* ins = emit_simd_ins (cfg, klass, OP_CREATE_SCALAR_UNSAFE, args [0]->dreg, -1); ins->inst_c1 = arg_type; - ins = emit_simd_ins (cfg, klass, OP_XBINOP_BYSCALAR, ins->dreg, args [1]->dreg); + ins = emit_simd_ins (cfg, klass, OP_XBINOP_BYSCALAR, args [1]->dreg, ins->dreg); ins->inst_c0 = OP_IMUL; return ins; }