Skip to content

[mono][interp] Lower div.un to shr.un.imm - #83498

Merged
BrzVlad merged 2 commits into
dotnet:mainfrom
BrzVlad:feature-interp-small-opt2
Mar 16, 2023
Merged

[mono][interp] Lower div.un to shr.un.imm#83498
BrzVlad merged 2 commits into
dotnet:mainfrom
BrzVlad:feature-interp-small-opt2

Conversation

@BrzVlad

Copy link
Copy Markdown
Member

If divisor is power of 2.

Generate sub opcode instead which is detected by other optimizations.
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

If divisor is power of 2.

Author:BrzVlad
Assignees:BrzVlad
Labels:

area-Codegen-Interpreter-mono

Milestone:-

#endif
td->sp -= 2;
interp_ins_set_sregs2 (td->last_ins, td->sp [1].local, td->sp [0].local);
push_simple_type (td, STACK_TYPE_I);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The original interp opcode looks like it was storing the result of a signed pointer subtraction into an unsigned int (mono_u), but I assume this will behave correctly as-is?

kg
kg approved these changes Mar 16, 2023

interp_clear_ins (def);
interp_clear_ins (ins);
local_ref_count [sreg_imm]--;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably mono_interp_stats.super_instructions++; is missing

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Some of these stats are not that useful anymore, I will probably get rid of them in the future. Also this is more of a peephole optimization. This pass will probably end up being rebranded.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@BrzVlad@kg@kotlarmilos