-
Notifications
You must be signed in to change notification settings - Fork 824
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
Singlepass aarch64 #2750
Singlepass aarch64 #2750
Conversation
Not ready to merge. Mac support is not here yet. |
.iter() | ||
.cloned(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to do into_iter()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can use into_iter()
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I'll still need a .cloned()
so I think it will not change much in the end.
3f0f2ee
to
2d218fb
Compare
Ready to merge now |
…ods (now 30 tests pass)
…09 tests passes now)
…tion yet (120 tests passes now)
2d218fb
to
7f4fd02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see a lot of unimplemented!()
in machine_arm64.rs. Generally unimplemented!
means the same thing as todo!
: "this code is not implemented yet but needs to be implemented".
Use unreachable!
instead to indicate "I am sure that this code is unreachable". They both panic, but it makes it clearer whether there is still work to be done.
NEON::V31, | ||
]; | ||
match n { | ||
0..=15 => Ok(REGS[n]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? Should this be 31? If not then add a comment explaining why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, typo yes.
match n { | ||
0..=31 => Ok(REGS[n]), | ||
_ => Err(()), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match n { | |
0..=31 => Ok(REGS[n]), | |
_ => Err(()), | |
} | |
REGS.get(n).ok_or(()) |
get
returns an Option
, ok_or
converts it to a Result
.
But perhaps this function should be changed to use plain indexing and simply panic if an out-of-range value is passed in since you're always unwraping the result anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not happy "expected enum arm64_decl::GPR
, found &arm64_decl::GPR
"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can used .cloned()
to turn an Option<&T>
to an Option<T>
.
|
||
type Assembler = VecAssembler<Aarch64Relocation>; | ||
|
||
/// Force `dynasm!` to use the correct arch (x64) when cross-compiling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Force `dynasm!` to use the correct arch (x64) when cross-compiling. | |
/// Force `dynasm!` to use the correct arch (aarch64) when cross-compiling. |
if (disp & 0x7) != 0 || (disp >= 0x8000) { | ||
unreachable!(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this should use assert!
instead.
|
||
fn emit_mov_imm(&mut self, dst: Location, val: u64) { | ||
match dst { | ||
Location::GPR(dst) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to encode the immediate as a logical immediate so it can be instantiated with ORR dst, XZR, #imm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. also can use MOVN if !val is small enough.
But all this are optimisation that can come later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a todo comment with that suggestion so we log it somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The are a few relatively easy optimisation here and there, not just this one (like using LDP/STP more), maybe a notion page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let's create a notion doc!
), | ||
} | ||
} | ||
fn emit_add2(&mut self, sz: Size, src: Location, dst: Location) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just be a wrapper over emit_add
?
offset: reloc_at as u32, | ||
addend: 0, | ||
}); | ||
self.assembler.emit_movk(Location::GPR(GPR::X27), 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first one should be movz
.
|
||
pub struct MachineARM64 { | ||
assembler: Assembler, | ||
used_gprs: HashSet<GPR>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This should probably be a bitset instead of a hash table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the small size of the set? I have use HashSet to be consistant with the x64, that used HashSet too.
I have use |
I see |
bors r+ |
Description
Add Aarch64 support on Singlapass, for both Linux and MacOS.