Skip to content

Commit a51e95c

Browse files
committed
[SOL] Fine tune memcmp threshold (#160)
1 parent 1802759 commit a51e95c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/SBF/SBFISelLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ SBFTargetLowering::SBFTargetLowering(const TargetMachine &TM,
160160
// Memcmp expands to three instructions for each load:
161161
// 1. One load for each pointer being compared.
162162
// 2. One jne for each load.
163-
// The limit here should be three, since 3*3 = 9;
164-
MaxLoadsPerMemcmp = MaxLoadsPerMemcmpOptSize = 3;
163+
// There is also a 3 CUs overhead for adjusting the arguments to memcmp.
164+
// We need at least three mov64 to set them.
165+
// A syscall takes at least 10 + 3 CUs.
166+
// The limit here should be four, since 3*4 = 12;
167+
MaxLoadsPerMemcmp = MaxLoadsPerMemcmpOptSize = 4;
165168

166169
// CPU/Feature control
167170
HasAlu32 = STI.getHasAlu32();

0 commit comments

Comments
 (0)