diff options
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/bits.go | 12 | ||||
| -rw-r--r-- | test/codegen/mathbits.go | 4 | ||||
| -rw-r--r-- | test/codegen/memops.go | 29 |
3 files changed, 37 insertions, 8 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go index 018f5b909e..88d5ebe9cf 100644 --- a/test/codegen/bits.go +++ b/test/codegen/bits.go @@ -220,10 +220,10 @@ func biton32(a, b uint32) (n uint32) { // amd64:"BTSL" n += b | (1 << (a & 31)) - // amd64:"BTSL\t[$]31" + // amd64:"ORL\t[$]-2147483648" n += a | (1 << 31) - // amd64:"BTSL\t[$]28" + // amd64:"ORL\t[$]268435456" n += a | (1 << 28) // amd64:"ORL\t[$]1" @@ -236,10 +236,10 @@ func bitoff32(a, b uint32) (n uint32) { // amd64:"BTRL" n += b &^ (1 << (a & 31)) - // amd64:"BTRL\t[$]31" + // amd64:"ANDL\t[$]2147483647" n += a &^ (1 << 31) - // amd64:"BTRL\t[$]28" + // amd64:"ANDL\t[$]-268435457" n += a &^ (1 << 28) // amd64:"ANDL\t[$]-2" @@ -252,10 +252,10 @@ func bitcompl32(a, b uint32) (n uint32) { // amd64:"BTCL" n += b ^ (1 << (a & 31)) - // amd64:"BTCL\t[$]31" + // amd64:"XORL\t[$]-2147483648" n += a ^ (1 << 31) - // amd64:"BTCL\t[$]28" + // amd64:"XORL\t[$]268435456" n += a ^ (1 << 28) // amd64:"XORL\t[$]1" diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 797aa23b67..d80bfaeec0 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -335,7 +335,7 @@ func TrailingZeros32(n uint32) int { } func TrailingZeros16(n uint16) int { - // amd64:"BSFL","BTSL\\t\\$16" + // amd64:"BSFL","ORL\\t\\$65536" // 386:"BSFL\t" // arm:"ORR\t\\$65536","CLZ",-"MOVHU\tR" // arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t" @@ -347,7 +347,7 @@ func TrailingZeros16(n uint16) int { } func TrailingZeros8(n uint8) int { - // amd64:"BSFL","BTSL\\t\\$8" + // amd64:"BSFL","ORL\\t\\$256" // 386:"BSFL" // arm:"ORR\t\\$256","CLZ",-"MOVBU\tR" // arm64:"ORR\t\\$256","RBITW","CLZW",-"MOVBU\tR",-"RBIT\t",-"CLZ\t" diff --git a/test/codegen/memops.go b/test/codegen/memops.go index f6cf9450a1..e5e89c2acc 100644 --- a/test/codegen/memops.go +++ b/test/codegen/memops.go @@ -372,3 +372,32 @@ func storeTest(a []bool, v int, i int) { // amd64: `BTL\t\$1,`,`SETCS\t3\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` a[3+i] = v&2 != 0 } + +func bitOps(p *[12]uint64) { + // amd64: `ORQ\t\$8, \(AX\)` + p[0] |= 8 + // amd64: `ORQ\t\$1073741824, 8\(AX\)` + p[1] |= 1 << 30 + // amd64: `BTSQ\t\$31, 16\(AX\)` + p[2] |= 1 << 31 + // amd64: `BTSQ\t\$63, 24\(AX\)` + p[3] |= 1 << 63 + + // amd64: `ANDQ\t\$-9, 32\(AX\)` + p[4] &^= 8 + // amd64: `ANDQ\t\$-1073741825, 40\(AX\)` + p[5] &^= 1 << 30 + // amd64: `BTRQ\t\$31, 48\(AX\)` + p[6] &^= 1 << 31 + // amd64: `BTRQ\t\$63, 56\(AX\)` + p[7] &^= 1 << 63 + + // amd64: `XORQ\t\$8, 64\(AX\)` + p[8] ^= 8 + // amd64: `XORQ\t\$1073741824, 72\(AX\)` + p[9] ^= 1 << 30 + // amd64: `BTCQ\t\$31, 80\(AX\)` + p[10] ^= 1 << 31 + // amd64: `BTCQ\t\$63, 88\(AX\)` + p[11] ^= 1 << 63 +} |
