Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono] Code duplication between amd64 and arm64 intrinsics #75144

Open
Tracked by #43051
matouskozak opened this issue Sep 6, 2022 · 2 comments
Open
Tracked by #43051

[Mono] Code duplication between amd64 and arm64 intrinsics #75144

matouskozak opened this issue Sep 6, 2022 · 2 comments

Comments

@matouskozak
Copy link
Member

There is a lot of arm64 code inside mini-llvm.c that could be used for amd64. For example the OP_ARM64_XNEG:

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;

which could be used for emitting negation on amd64 as well. Maybe we could reorganize the code so that it could be used on other platforms as well.

@SamMonoRT
Copy link
Member

cc @jandupej @vargaz

@fanyang-mono fanyang-mono changed the title Code duplication between amd64 and arm64 intrinsics [Mono] Code duplication between amd64 and arm64 intrinsics Sep 26, 2022
@fanyang-mono
Copy link
Member

No resource to address code refactor work in .NET8. Will re-visit in .NET9

@fanyang-mono fanyang-mono modified the milestones: 8.0.0, Future May 19, 2023
@fanyang-mono fanyang-mono removed their assignment Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants