Skip to content

[SOL] Fine tune memcmp threshold #160

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

Merged
merged 1 commit into from
Jul 1, 2025
Merged
Changes from all commits
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
7 changes: 5 additions & 2 deletions llvm/lib/Target/SBF/SBFISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,11 @@ SBFTargetLowering::SBFTargetLowering(const TargetMachine &TM,
// Memcmp expands to three instructions for each load:
// 1. One load for each pointer being compared.
// 2. One jne for each load.
// The limit here should be three, since 3*3 = 9;
MaxLoadsPerMemcmp = MaxLoadsPerMemcmpOptSize = 3;
// There is also a 3 CUs overhead for adjusting the arguments to memcmp.
// We need at least three mov64 to set them.
// A syscall takes at least 10 + 3 CUs.
// The limit here should be four, since 3*4 = 12;
MaxLoadsPerMemcmp = MaxLoadsPerMemcmpOptSize = 4;

// CPU/Feature control
HasAlu32 = STI.getHasAlu32();
Expand Down
Loading