tests/fixedbugs: regression test for issue 100 (#129)

Adds a regression test based on klauspost/compress#186. This necessitated some related changes:

* Mark "RET" as a terminal instruction
* printer refactor to maintain compatibility with asmfmt
* Tweaks to other regression tests to ensure they are run correctly in CI

Updates #100 #65 #8
This commit is contained in:
Michael McLoughlin
2020-01-27 21:05:33 -08:00
committed by GitHub
parent 5a144d9b53
commit e089a6c93c
24 changed files with 11711 additions and 92 deletions

View File

@@ -81,3 +81,27 @@ func TestConstraints(t *testing.T) {
"",
})
}
func TestAlignmentNoOperands(t *testing.T) {
ctx := build.NewContext()
ctx.Function("alignment")
ctx.SignatureExpr("func()")
ctx.ADDQ(reg.RAX, reg.RBX)
ctx.VMOVDQU(reg.Y4, reg.Y11)
ctx.VZEROUPPER()
ctx.ADDQ(reg.R9, reg.R13)
ctx.RET()
AssertPrintsLines(t, ctx, printer.NewGoAsm, []string{
"// Code generated by avo. DO NOT EDIT.",
"",
"// func alignment()",
"TEXT ·alignment(SB), $0",
"\tADDQ AX, BX",
"\tVMOVDQU Y4, Y11",
"\tVZEROUPPER", // instruction with no alignment doesn't affect width
"\tADDQ R9, R13", // retains alignment from above
"\tRET",
"",
})
}