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

Fixed SME index alias printing issue. #1925

Merged
merged 4 commits into from
Oct 24, 2022
Merged

Conversation

FinnWilkinson
Copy link
Contributor

This fixes issue #1924 where some SME instructions were not being printed correctly when aliased as the SME index was being recognised as a memory operand by mistake.

@wtdcode
Copy link
Contributor

wtdcode commented Oct 12, 2022

Hey, thanks for your contribution. Any examples for your changes?

@FinnWilkinson
Copy link
Contributor Author

Hi, prior to this change some SME instructions were not printing in cstool correctly. This would happen when an instruction that has an operand such as za0h.s[w12, 1] and is then aliased. Instead of having this operand as a SME_index type, in the AArch64GenAsmWriter.inc printAliasInstr function would allocate it as a memory operand instead (due to the '[' and ']' used for the SME tile index).

So, before this change, ld1w {za0h.s[w12, 2]}, p0/z, [x0] would be printed by cstool as

0  02 00 9f e0  ld1w	{za0h.s[w12, 2]}, p0/z, [x0]
	ID: 457 (ld1w)
	op_count: 4
		operands[0].type: REG = zas0
		operands[1].type: MEM
			operands[1].mem.base: REG = w12
		operands[2].type: REG = p0
		operands[3].type: MEM
			operands[3].mem.base: REG = x0
	Registers read: w12 x0

Which has too many operands, an additional memory operand, and hasn't stored the immidate value of the index (2).

After this change, ld1w {za0h.s[w12, 2]}, p0/z, [x0] is now printed as

 0  02 00 9f e0  ld1w	{za0h.s[w12, 2]}, p0/z, [x0]
	ID: 457 (ld1w)
	op_count: 3
		operands[0].type: REG = zas0
			operands[0].index.base: REG = w12
			operands[0].index.disp: 0x2
		operands[1].type: REG = p0
		operands[2].type: MEM
			operands[2].mem.base: REG = x0
	Registers read: x0

Which is correct

@FinnWilkinson
Copy link
Contributor Author

The changes made in the second commit was to fix the failing PyPI tests in next before the c99 flag was added to the build options. All this commit does is instantiate loop variables outside of the for loop declaration.

@wtdcode
Copy link
Contributor

wtdcode commented Oct 13, 2022

The changes made in the second commit was to fix the failing PyPI tests in next before the c99 flag was added to the build options. All this commit does is instantiate loop variables outside of the for loop declaration.

I fixed that already, maybe you can remove that commit and merge the latest next branch?

@FinnWilkinson
Copy link
Contributor Author

I fixed that already, maybe you can remove that commit and merge the latest next branch?

I think the changes I made are still worth it as it keeps all for loops in the AArch64InstrPrinter file consistent. But if this isn't essential than I'll happily remove the commit

@wtdcode
Copy link
Contributor

wtdcode commented Oct 14, 2022

I fixed that already, maybe you can remove that commit and merge the latest next branch?

I think the changes I made are still worth it as it keeps all for loops in the AArch64InstrPrinter file consistent. But if this isn't essential than I'll happily remove the commit

Oh, that's good too. I will test your first commit asap.

@FinnWilkinson
Copy link
Contributor Author

Hi, have you managed to take a look at the changes yes?

@FinnWilkinson
Copy link
Contributor Author

Hi @kabeor , I have added a test for issue #1924, and updated the cstest arm64_detail to correctly process new OP types introduced in the AArch64 update in PR #1907. Please check over and let me know if anything needs changing / adding to :)

@kabeor
Copy link
Member

kabeor commented Oct 24, 2022

Really cool! Thanks again for your great work. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants