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

Use a shorter insruction on x86 for loading unsigned 32-bit immediates into 64-bit registers. #487

Merged
merged 1 commit into from
Apr 5, 2023
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
4 changes: 3 additions & 1 deletion x86/TargetPrinter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ module Target(System: SYSTEM):TARGET =
| Pmovq_ri(rd, n) ->
let n1 = camlint64_of_coqint n in
let n2 = Int64.to_int32 n1 in
if n1 = Int64.of_int32 n2 then
if Int64.shift_right_logical n1 32 = Int64.zero then
fprintf oc " movl $%Ld, %a\n" n1 ireg32 rd
else if n1 = Int64.of_int32 n2 then
fprintf oc " movq $%ld, %a\n" n2 ireg64 rd
else
fprintf oc " movabsq $%Ld, %a\n" n1 ireg64 rd
Expand Down