diff options
Diffstat (limited to 'test/codegen/bits.go')
-rw-r--r-- | test/codegen/bits.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go index e7826b8e65..71ed7905c9 100644 --- a/test/codegen/bits.go +++ b/test/codegen/bits.go @@ -363,3 +363,27 @@ func issue48467(x, y uint64) uint64 { d, borrow := bits.Sub64(x, y, 0) return x - d&(-borrow) } + +// Verify sign-extended values are not zero-extended under a bit mask (#61297) +func signextendAndMask8to64(a int8) (s, z uint64) { + // ppc64: "MOVB", "ANDCC\t[$]1015," + // ppc64le: "MOVB", "ANDCC\t[$]1015," + s = uint64(a) & 0x3F7 + // ppc64: -"MOVB", "ANDCC\t[$]247," + // ppc64le: -"MOVB", "ANDCC\t[$]247," + z = uint64(uint8(a)) & 0x3F7 + return + +} + +// Verify zero-extended values are not sign-extended under a bit mask (#61297) +func zeroextendAndMask8to64(a int8, b int16) (x, y uint64) { + // ppc64: -"MOVB\t", -"ANDCC", "MOVBZ" + // ppc64le: -"MOVB\t", -"ANDCC", "MOVBZ" + x = uint64(a) & 0xFF + // ppc64: -"MOVH\t", -"ANDCC", "MOVHZ" + // ppc64le: -"MOVH\t", -"ANDCC", "MOVHZ" + y = uint64(b) & 0xFFFF + return + +} |