-
Notifications
You must be signed in to change notification settings - Fork 91
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
internal/opcodesextra: add PCALIGN pseudo-op #420
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package opcodesextra | ||
|
||
import "github.com/mmcloughlin/avo/internal/inst" | ||
|
||
// pseudo is pseudo-ops supported by the Go assembler. | ||
var pseudo = []*inst.Instruction{ | ||
// Reference: https://github.com/golang/go/blob/go1.22rc1/doc/asm.html#L469-L482 | ||
// | ||
// <p> | ||
// The <code>PCALIGN</code> pseudo-instruction is used to indicate that the next instruction should be aligned | ||
// to a specified boundary by padding with no-op instructions. | ||
// </p> | ||
// | ||
// <p> | ||
// It is currently supported on arm64, amd64, ppc64, loong64 and riscv64. | ||
// | ||
// For example, the start of the <code>MOVD</code> instruction below is aligned to 32 bytes: | ||
// <pre> | ||
// PCALIGN $32 | ||
// MOVD $2, R0 | ||
// </pre> | ||
// </p> | ||
// | ||
{ | ||
Opcode: "PCALIGN", | ||
Summary: "Align the next instruction to the specified boundary", | ||
Forms: []inst.Form{ | ||
{ | ||
Operands: []inst.Operand{ | ||
{Type: "imm8"}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 think the operand was in range 8 to 1024.
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.
Turns out it's power of 2 in the range 8 to 2048.
https://github.com/golang/go/blob/fa72f3e034fdabc5922ac019281f53ea0a8328cf/src/cmd/internal/obj/x86/asm6.go#L2048
I'll need to add a custom operand type for this.