arm64ec: Single instruction optimization in EC map lookup

We can merge the lsr+and in to a single lsr by 18 and then use ldr with
LSL of 3 to accomplish the same result. Modern Cortex doesn't even
generate an additional integer pipeline uop for this ldr+lsl instruction
anymore.
This commit is contained in:
Ryan Houdek committed 2026-05-29 19:17:13 -07:00
1 parent f5fafa5b96
commit fd3546a999
2 files changed
+4 -6

No files matched your search

+2 -3
View File
@@ -18,9 +18,8 @@ check_target_ec:
// Check if target is in fact x86 code
ldr x16, [x18, #0x60] // TEB->PEB
ldr x16, [x16, #0x368] // PEB->EcCodeBitMap
lsr x17, x9, #15
and x17, x17, #0x1fffffffffff8
ldr x16, [x16, x17]
lsr x17, x9, #18
ldr x16, [x16, x17, lsl #3]
lsr x17, x9, #12
lsr x16, x16, x17
tbnz x16, #0, ExitFunctionEC