diff options
Diffstat (limited to 'src/cmd/asm')
| -rw-r--r-- | src/cmd/asm/internal/asm/testdata/386enc.s | 6 | ||||
| -rw-r--r-- | src/cmd/asm/internal/asm/testdata/amd64enc_extra.s | 3 | ||||
| -rw-r--r-- | src/cmd/asm/internal/asm/testdata/amd64error.s | 11 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/386enc.s b/src/cmd/asm/internal/asm/testdata/386enc.s index 94a06de69c..8fe20511d1 100644 --- a/src/cmd/asm/internal/asm/testdata/386enc.s +++ b/src/cmd/asm/internal/asm/testdata/386enc.s @@ -12,5 +12,11 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0 MOVQ 8(SP), M0 // 0f6f442408
MOVQ M0, (AX) // 0f7f00
MOVQ M0, (BX) // 0f7f03
+ // On non-64bit arch, Go asm allowed uint32 offsets instead of int32.
+ // These tests check that property for backwards-compatibility.
+ MOVL 2147483648(AX), AX // 8b8000000080
+ MOVL -2147483648(AX), AX // 8b8000000080
+ ADDL 2147483648(AX), AX // 038000000080
+ ADDL -2147483648(AX), AX // 038000000080
// End of tests.
RET
diff --git a/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s b/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s index ab2c7efe0b..d5aad5fe28 100644 --- a/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s +++ b/src/cmd/asm/internal/asm/testdata/amd64enc_extra.s @@ -296,5 +296,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0 // Test VPERMQ with both uint8 and int8 immediate args VPERMQ $-40, Y8, Y8 // c4407800c0d8 VPERMQ $216, Y8, Y8 // c443fd00c0d8 + // Check that LEAL is permitted to use overflowing offset. + LEAL 2400959708(BP)(R10*1), BP // 428dac15dcbc1b8f + LEAL 3395469782(AX)(R10*1), AX // 428d8410d6c162ca // End of tests. RET diff --git a/src/cmd/asm/internal/asm/testdata/amd64error.s b/src/cmd/asm/internal/asm/testdata/amd64error.s index 32512fc229..da325c9d98 100644 --- a/src/cmd/asm/internal/asm/testdata/amd64error.s +++ b/src/cmd/asm/internal/asm/testdata/amd64error.s @@ -34,4 +34,15 @@ TEXT errors(SB),$0 VPGATHERDQ X7, 664(X2*8), X2 // ERROR "mask, index, and destination registers should be distinct" // Non-X0 for Yxr0 should produce an error BLENDVPD X1, (BX), X2 // ERROR "invalid instruction" + // Check offset overflow. Must fit in int32. + MOVQ 2147483647+1(AX), AX // ERROR "offset too large" + MOVQ 3395469782(R10), R8 // ERROR "offset too large" + LEAQ 3395469782(AX), AX // ERROR "offset too large" + ADDQ 3395469782(AX), AX // ERROR "offset too large" + ADDL 3395469782(AX), AX // ERROR "offset too large" + ADDW 3395469782(AX), AX // ERROR "offset too large" + LEAQ 433954697820(AX), AX // ERROR "offset too large" + ADDQ 433954697820(AX), AX // ERROR "offset too large" + ADDL 433954697820(AX), AX // ERROR "offset too large" + ADDW 433954697820(AX), AX // ERROR "offset too large" RET |
