diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 6ceaa5f123b572..c2d9dd6a31d593 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -9958,14 +9958,6 @@ MONO_RESTORE_WARNING values [ins->dreg] = immediate_unroll_end (&ictx, &cbb); break; } - case OP_ARM64_MVN: { - LLVMTypeRef ret_t = LLVMTypeOf (lhs); - LLVMValueRef result = bitcast_to_integral (ctx, lhs); - result = LLVMBuildNot (builder, result, "arm64_mvn"); - result = convert (ctx, result, ret_t); - values [ins->dreg] = result; - break; - } case OP_ARM64_BIC: { LLVMTypeRef ret_t = LLVMTypeOf (lhs); LLVMValueRef result = bitcast_to_integral (ctx, lhs); @@ -10527,25 +10519,6 @@ MONO_RESTORE_WARNING values [ins->dreg] = result; break; } - case OP_ARM64_XNEG: - case OP_ARM64_XNEG_SCALAR: { - gboolean scalar = ins->opcode == OP_ARM64_XNEG_SCALAR; - gboolean is_float = FALSE; - switch (inst_c1_type (ins)) { - case MONO_TYPE_R4: case MONO_TYPE_R8: is_float = TRUE; - } - LLVMValueRef result = lhs; - if (scalar) - result = scalar_from_vector (ctx, result); - if (is_float) - result = LLVMBuildFNeg (builder, result, "arm64_xneg"); - else - result = LLVMBuildNeg (builder, result, "arm64_xneg"); - if (scalar) - result = vector_from_scalar (ctx, LLVMTypeOf (lhs), result); - values [ins->dreg] = result; - break; - } case OP_ARM64_PMULL: case OP_ARM64_PMULL2: { gboolean high = ins->opcode == OP_ARM64_PMULL2; @@ -11302,9 +11275,32 @@ MONO_RESTORE_WARNING values [ins->dreg] = result; break; } + case OP_NEGATION: + case OP_NEGATION_SCALAR: { + gboolean scalar = ins->opcode == OP_NEGATION_SCALAR; + gboolean is_float = (ins->inst_c1 == MONO_TYPE_R4 || ins->inst_c1 == MONO_TYPE_R8); + LLVMValueRef result = lhs; + if (scalar) + result = scalar_from_vector (ctx, result); + if (is_float) + result = LLVMBuildFNeg (builder, result, ""); + else + result = LLVMBuildNeg (builder, result, ""); + if (scalar) + result = vector_from_scalar (ctx, LLVMTypeOf (lhs), result); + values [ins->dreg] = result; + break; + } + case OP_ONES_COMPLEMENT: { + LLVMTypeRef ret_t = LLVMTypeOf (lhs); + LLVMValueRef result = bitcast_to_integral (ctx, lhs); + result = LLVMBuildNot (builder, result, ""); + result = convert (ctx, result, ret_t); + values [ins->dreg] = result; + break; + } #endif - case OP_DUMMY_USE: break; diff --git a/src/mono/mono/mini/mini-ops.h b/src/mono/mono/mini/mini-ops.h index 7a2cb69a5f693e..4a64e6a598531e 100644 --- a/src/mono/mono/mini/mini-ops.h +++ b/src/mono/mono/mini/mini-ops.h @@ -1627,9 +1627,6 @@ MINI_OP(OP_ARM64_REVN, "arm64_revn", XREG, XREG, NONE) MINI_OP(OP_ARM64_PMULL, "arm64_pmull", XREG, XREG, XREG) MINI_OP(OP_ARM64_PMULL2, "arm64_pmull2", XREG, XREG, XREG) -MINI_OP(OP_ARM64_XNEG, "arm64_xneg", XREG, XREG, NONE) -MINI_OP(OP_ARM64_XNEG_SCALAR, "arm64_xneg_scalar", XREG, XREG, NONE) - MINI_OP(OP_ARM64_SMULL, "arm64_smull", XREG, XREG, XREG) MINI_OP(OP_ARM64_SMULL_SCALAR, "arm64_smull_scalar", XREG, XREG, XREG) MINI_OP(OP_ARM64_SMULL2, "arm64_smull2", XREG, XREG, XREG) @@ -1721,8 +1718,6 @@ MINI_OP(OP_ARM64_CMTST, "arm64_cmtst", XREG, XREG, XREG) MINI_OP(OP_ARM64_BIC, "arm64_bic", XREG, XREG, XREG) -MINI_OP(OP_ARM64_MVN, "arm64_mvn", XREG, XREG, NONE) - MINI_OP(OP_ARM64_SADD, "arm64_sadd", XREG, XREG, XREG) MINI_OP(OP_ARM64_SADD2, "arm64_sadd2", XREG, XREG, XREG) MINI_OP(OP_ARM64_UADD, "arm64_uadd", XREG, XREG, XREG) @@ -1778,5 +1773,8 @@ MINI_OP(OP_WASM_ONESCOMPLEMENT, "wasm_onescomplement", XREG, XREG, NONE) #endif #if defined(TARGET_ARM64) || defined(TARGET_AMD64) -MINI_OP3(OP_BSL, "bitwise_select", XREG, XREG, XREG, XREG) +MINI_OP3(OP_BSL, "bitwise_select", XREG, XREG, XREG, XREG) +MINI_OP(OP_NEGATION, "negate", XREG, XREG, NONE) +MINI_OP(OP_NEGATION_SCALAR, "negate_scalar", XREG, XREG, NONE) +MINI_OP(OP_ONES_COMPLEMENT, "ones_complement", XREG, XREG, NONE) #endif // TARGET_ARM64 || TARGET_AMD64 diff --git a/src/mono/mono/mini/simd-intrinsics.c b/src/mono/mono/mini/simd-intrinsics.c index 29bf643f3cfd91..63e6b52f91d853 100644 --- a/src/mono/mono/mini/simd-intrinsics.c +++ b/src/mono/mono/mini/simd-intrinsics.c @@ -383,16 +383,16 @@ emit_simd_ins_for_binary_op (MonoCompile *cfg, MonoClass *klass, MonoMethodSigna static MonoInst* emit_simd_ins_for_unary_op (MonoCompile *cfg, MonoClass *klass, MonoMethodSignature *fsig, MonoInst **args, MonoTypeEnum arg_type, int id) { -#ifdef TARGET_ARM64 +#if defined(TARGET_ARM64) || defined(TARGET_AMD64) int op = -1; switch (id){ case SN_Negate: case SN_op_UnaryNegation: - op = OP_ARM64_XNEG; + op = OP_NEGATION; break; case SN_OnesComplement: case SN_op_OnesComplement: - op = OP_ARM64_MVN; + op = OP_ONES_COMPLEMENT; break; default: g_assert_not_reached (); @@ -2628,11 +2628,11 @@ static SimdIntrinsic advsimd_methods [] = { {SN_MultiplyWideningUpper, OP_ARM64_SMULL2, None, OP_ARM64_UMULL2}, {SN_MultiplyWideningUpperAndAdd, OP_ARM64_SMLAL2, None, OP_ARM64_UMLAL2}, {SN_MultiplyWideningUpperAndSubtract, OP_ARM64_SMLSL2, None, OP_ARM64_UMLSL2}, - {SN_Negate, OP_ARM64_XNEG}, + {SN_Negate, OP_NEGATION}, {SN_NegateSaturate, OP_XOP_OVR_X_X, INTRINS_AARCH64_ADV_SIMD_SQNEG}, {SN_NegateSaturateScalar, OP_XOP_OVR_SCALAR_X_X, INTRINS_AARCH64_ADV_SIMD_SQNEG}, - {SN_NegateScalar, OP_ARM64_XNEG_SCALAR}, - {SN_Not, OP_ARM64_MVN}, + {SN_NegateScalar, OP_NEGATION_SCALAR}, + {SN_Not, OP_ONES_COMPLEMENT}, {SN_Or, OP_XBINOP_FORCEINT, XBINOP_FORCEINT_OR}, {SN_OrNot, OP_XBINOP_FORCEINT, XBINOP_FORCEINT_ORNOT}, {SN_PolynomialMultiply, OP_XOP_OVR_X_X_X, INTRINS_AARCH64_ADV_SIMD_PMUL},