diff options
author | Colin Cross <ccross@android.com> | 2024-03-20 12:54:39 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2024-03-20 14:11:54 -0700 |
commit | fbe2133b4d3417adc93daa3819fccf52d2bb66ea (patch) | |
tree | 489499c233d3e979128afcc077ea1c6c01725ddf /src/cmd/internal/obj/ppc64/asm_test.go | |
parent | 68a2d6d0813d288a1149f79a7223284fa2f5559f (diff) | |
parent | db6097f8cbaceaed02051850d2411c88b763a0c3 (diff) | |
download | go-fbe2133b4d3417adc93daa3819fccf52d2bb66ea.tar.gz |
Bug: 330574836
Test: builds
Change-Id: Icaf805d49ad96dd3f2960c5f92b4eeb7c131291c
Diffstat (limited to 'src/cmd/internal/obj/ppc64/asm_test.go')
-rw-r--r-- | src/cmd/internal/obj/ppc64/asm_test.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/cmd/internal/obj/ppc64/asm_test.go b/src/cmd/internal/obj/ppc64/asm_test.go index b8995dc7e1..7167a6a947 100644 --- a/src/cmd/internal/obj/ppc64/asm_test.go +++ b/src/cmd/internal/obj/ppc64/asm_test.go @@ -7,6 +7,7 @@ package ppc64 import ( "bytes" "fmt" + "internal/buildcfg" "internal/testenv" "math" "os" @@ -198,11 +199,11 @@ func TestPfxAlign(t *testing.T) { t.Errorf("Failed to compile %v: %v\n", pgm, err) } if !strings.Contains(string(out), pgm.align) { - t.Errorf(fmt.Sprintf("Fatal, misaligned text with prefixed instructions:\n%s\n", string(out))) + t.Errorf("Fatal, misaligned text with prefixed instructions:\n%s", out) } hasNop := strings.Contains(string(out), "00 00 00 60") if hasNop != pgm.hasNop { - t.Errorf(fmt.Sprintf("Fatal, prefixed instruction is missing nop padding:\n%s\n", string(out))) + t.Errorf("Fatal, prefixed instruction is missing nop padding:\n%s", out) } } } @@ -464,7 +465,6 @@ func TestAddrClassifier(t *testing.T) { {obj.Addr{Type: obj.TYPE_REG, Reg: REG_CR1}, C_CREG}, {obj.Addr{Type: obj.TYPE_REG, Reg: REG_CR1SO}, C_CRBIT}, {obj.Addr{Type: obj.TYPE_REG, Reg: REG_SPR0}, C_SPR}, - {obj.Addr{Type: obj.TYPE_REG, Reg: REG_SPR0 + 1}, C_XER}, {obj.Addr{Type: obj.TYPE_REG, Reg: REG_SPR0 + 8}, C_LR}, {obj.Addr{Type: obj.TYPE_REG, Reg: REG_SPR0 + 9}, C_CTR}, {obj.Addr{Type: obj.TYPE_REG, Reg: REG_FPSCR}, C_FPSCR}, @@ -516,12 +516,10 @@ func TestAddrClassifier(t *testing.T) { {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 32}, C_U8CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 1 << 14}, C_U15CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 1 << 15}, C_U16CON}, - {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 1 << 16}, C_U3216CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 1 + 1<<16}, C_U32CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 1 << 32}, C_S34CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: 1 << 33}, C_64CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: -1}, C_S16CON}, - {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: -0x10000}, C_S3216CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: -0x10001}, C_S32CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: -(1 << 33)}, C_S34CON}, {obj.Addr{Type: obj.TYPE_CONST, Name: obj.NAME_NONE, Offset: -(1 << 34)}, C_64CON}, @@ -553,3 +551,18 @@ func TestAddrClassifier(t *testing.T) { } } } + +// The optab size should remain constant when reinitializing the PPC64 assembler backend. +func TestOptabReinit(t *testing.T) { + buildcfg.GOOS = "linux" + buildcfg.GOARCH = "ppc64le" + buildcfg.GOPPC64 = 8 + buildop(nil) + optabLen := len(optab) + buildcfg.GOPPC64 = 9 + buildop(nil) + reinitOptabLen := len(optab) + if reinitOptabLen != optabLen { + t.Errorf("rerunning buildop changes optab size from %d to %d", optabLen, reinitOptabLen) + } +} |