From 79112707bb27bfe28aeb57ac427af244d6d20b96 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Sat, 17 Feb 2018 13:54:03 +0100 Subject: cmd/compile: add patterns for bit set/clear/complement on amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch completes implementation of BT(Q|L), and adds support for BT(S|R|C)(Q|L). Example of code changes from time.(*Time).addSec: if t.wall&hasMonotonic != 0 { 0x1073465 488b08 MOVQ 0(AX), CX 0x1073468 4889ca MOVQ CX, DX 0x107346b 48c1e93f SHRQ $0x3f, CX 0x107346f 48c1e13f SHLQ $0x3f, CX 0x1073473 48f7c1ffffffff TESTQ $-0x1, CX 0x107347a 746b JE 0x10734e7 if t.wall&hasMonotonic != 0 { 0x1073435 488b08 MOVQ 0(AX), CX 0x1073438 480fbae13f BTQ $0x3f, CX 0x107343d 7363 JAE 0x10734a2 Another example: t.wall = t.wall&nsecMask | uint64(dsec)< TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- test/codegen/mathbits.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/codegen/mathbits.go') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 964949e33c..bc1f4e1b5a 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -199,19 +199,19 @@ func TrailingZeros64(n uint64) int { } func TrailingZeros32(n uint32) int { - // amd64:"MOVQ\t\\$4294967296","ORQ\t[^$]","BSFQ" + // amd64:"BTSQ\\t\\$32","BSFQ" // s390x:"FLOGR","MOVWZ" return bits.TrailingZeros32(n) } func TrailingZeros16(n uint16) int { - // amd64:"BSFQ","ORQ\t\\$65536" + // amd64:"BSFQ","BTSQ\\t\\$16" // s390x:"FLOGR","OR\t\\$65536" return bits.TrailingZeros16(n) } func TrailingZeros8(n uint8) int { - // amd64:"BSFQ","ORQ\t\\$256" + // amd64:"BSFQ","BTSQ\\t\\$8" // s390x:"FLOGR","OR\t\\$256" return bits.TrailingZeros8(n) } -- cgit v1.3-5-g9baa