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

[AArch64][SME] Rewrite __arm_sc_memset to remove invalid instruction #101522

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,29 @@ DEFINE_COMPILERRT_FUNCTION_ALIAS(__arm_sc_memmove, __arm_sc_memcpy)
#define zva_val x5

DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(__arm_sc_memset)
dup v0.16B, valw
# ifdef __ARM_FEATURE_SVE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why the space between the # and the ifdef/else/endif ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no real reason for the spaces, I'll remove them before merging.

mov z0.b, valw
# else
sub sp, sp, #16
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bfi valw, valw, #8, #8
bfi valw, valw, #16, #16
bfi val, val, #32, #32
fmov d0, val
fmov v0.d[1], val

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, @efriedma-quic!

.cfi_def_cfa_offset 16
strb valw, [sp, #15]
strb valw, [sp, #14]
strb valw, [sp, #13]
strb valw, [sp, #12]
strb valw, [sp, #11]
strb valw, [sp, #10]
strb valw, [sp, #9]
strb valw, [sp, #8]
strb valw, [sp, #7]
strb valw, [sp, #6]
strb valw, [sp, #5]
strb valw, [sp, #4]
strb valw, [sp, #3]
strb valw, [sp, #2]
strb valw, [sp, #1]
strb valw, [sp]
ldr q0, [sp], #16
# endif
add dstend2, dstin, count

cmp count, 96
Expand Down
Loading