#include "mini.h"
#include "ir-emit.h"
+#include "mono/utils/bsearch.h"
/*
General notes on SIMD intrinsics
return OP_EXPAND_R4;
case MONO_TYPE_R8:
return OP_EXPAND_R8;
+ default:
+ g_assert_not_reached ();
}
- g_assert_not_reached ();
}
static int
case MONO_TYPE_U4:
case MONO_TYPE_R4:
return OP_EXTRACT_I4;
+ default:
+ g_assert_not_reached ();
}
- g_assert_not_reached ();
}
/*Returns the amount to shift the element index to get the dword it belongs to*/
case MONO_TYPE_U4:
case MONO_TYPE_R4:
return 0;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+static G_GNUC_UNUSED int
+mono_type_to_insert_op (MonoType *type)
+{
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ return OP_INSERT_I1;
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ return OP_INSERT_I2;
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ return OP_INSERT_I4;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ return OP_INSERT_I8;
+ case MONO_TYPE_R4:
+ return OP_INSERT_R4;
+ case MONO_TYPE_R8:
+ return OP_INSERT_R8;
+ default:
+ g_assert_not_reached ();
}
- g_assert_not_reached ();
}
static int
return OP_INSERTX_R4_SLOW;
case MONO_TYPE_R8:
return OP_INSERTX_R8_SLOW;
+ default:
+ g_assert_not_reached ();
}
- g_assert_not_reached ();
}
static MonoInst*
size = mono_type_size (sig->params [0], &align);
- if (size == 2 || size == 4 || size == 8) {
+ if (COMPILE_LLVM (cfg)) {
+ MONO_INST_NEW (cfg, ins, mono_type_to_insert_op (sig->params [0]));
+ ins->klass = cmethod->klass;
+ ins->dreg = ins->sreg1 = dreg = load_simd_vreg (cfg, cmethod, args [0], &indirect);
+ ins->sreg2 = args [1]->dreg;
+ ins->inst_c0 = intrinsic->opcode;
+ MONO_ADD_INS (cfg->cbb, ins);
+ } else if (size == 2 || size == 4 || size == 8) {
MONO_INST_NEW (cfg, ins, mono_type_to_slow_insert_op (sig->params [0]));
ins->klass = cmethod->klass;
/*This is a partial load so we encode the dependency on the previous value by setting dreg and sreg1 to the same value.*/
static MonoInst*
emit_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args, const SimdIntrinsc *intrinsics, guint32 size)
{
- const SimdIntrinsc * result = bsearch (cmethod->name, intrinsics, size, sizeof (SimdIntrinsc), &simd_intrinsic_compare_by_name);
+ const SimdIntrinsc * result = mono_binary_search (cmethod->name, intrinsics, size, sizeof (SimdIntrinsc), &simd_intrinsic_compare_by_name);
if (!result) {
DEBUG (printf ("function doesn't have a simd intrinsic %s::%s/%d\n", cmethod->klass->name, cmethod->name, fsig->param_count));
return NULL;