diff options
| author | Ilya Tocar <ilya.tocar@intel.com> | 2018-03-14 21:02:20 +0000 |
|---|---|---|
| committer | Ilya Tocar <ilya.tocar@intel.com> | 2018-03-14 21:21:23 +0000 |
| commit | 644d14ea0f3d99863a033f66543ce0346bf20831 (patch) | |
| tree | 8f4d1f31ef8ee0701b8f769dd453dc6046e89865 /test/codegen/condmove.go | |
| parent | 44e65f2c94bbae463314382fd77ce690c81b413e (diff) | |
| download | go-644d14ea0f3d99863a033f66543ce0346bf20831.tar.xz | |
Revert "cmd/compile: implement CMOV on amd64"
This reverts commit 080187f4f72bd6594e3c2efc35cf51bf61378552.
It broke build of golang.org/x/exp/shiny/iconvg
See issue 24395 for details
Change-Id: Ifd6134f6214e6cee40bd3c63c32941d5fc96ae8b
Reviewed-on: https://go-review.googlesource.com/100755
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen/condmove.go')
| -rw-r--r-- | test/codegen/condmove.go | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go deleted file mode 100644 index 1f51505f61..0000000000 --- a/test/codegen/condmove.go +++ /dev/null @@ -1,178 +0,0 @@ -// asmcheck - -package codegen - -func cmovint(c int) int { - x := c + 4 - if x < 0 { - x = 182 - } - // amd64:"CMOVQLT" - // arm64:"CSEL\tLT" - return x -} - -func cmovchan(x, y chan int) chan int { - if x != y { - x = y - } - // amd64:"CMOVQNE" - // arm64:"CSEL\tNE" - return x -} - -func cmovuintptr(x, y uintptr) uintptr { - if x < y { - x = -y - } - // amd64:"CMOVQCS" - // arm64:"CSEL\tLO" - return x -} - -func cmov32bit(x, y uint32) uint32 { - if x < y { - x = -y - } - // amd64:"CMOVLCS" - // arm64:"CSEL\tLO" - return x -} - -func cmov16bit(x, y uint16) uint16 { - if x < y { - x = -y - } - // amd64:"CMOVWCS" - // arm64:"CSEL\tLO" - return x -} - -// Floating point comparison. For EQ/NE, we must -// generate special code to handle NaNs. -func cmovfloateq(x, y float64) int { - a := 128 - if x == y { - a = 256 - } - // amd64:"CMOVQNE","CMOVQPC" - // arm64:"CSEL\tEQ" - return a -} - -func cmovfloatne(x, y float64) int { - a := 128 - if x != y { - a = 256 - } - // amd64:"CMOVQNE","CMOVQPS" - // arm64:"CSEL\tNE" - return a -} - -//go:noinline -func frexp(f float64) (frac float64, exp int) { - return 1.0, 4 -} - -//go:noinline -func ldexp(frac float64, exp int) float64 { - return 1.0 -} - -// Generate a CMOV with a floating comparison and integer move. -func cmovfloatint2(x, y float64) float64 { - yfr, yexp := 4.0, 5 - - r := x - for r >= y { - rfr, rexp := frexp(r) - if rfr < yfr { - rexp = rexp - 1 - } - // amd64:"CMOVQHI" - // arm64:"CSEL\tGT" - r = r - ldexp(y, (rexp-yexp)) - } - return r -} - -func cmovloaded(x [4]int, y int) int { - if x[2] != 0 { - y = x[2] - } else { - y = y >> 2 - } - // amd64:"CMOVQNE" - // arm64:"CSEL\tNE" - return y -} - -func cmovuintptr2(x, y uintptr) uintptr { - a := x * 2 - if a == 0 { - a = 256 - } - // amd64:"CMOVQEQ" - // arm64:"CSEL\tEQ" - return a -} - -// Floating point CMOVs are not supported by amd64/arm64 -func cmovfloatmove(x, y int) float64 { - a := 1.0 - if x <= y { - a = 2.0 - } - // amd64:-"CMOV" - // arm64:-"CSEL" - return a -} - -// On amd64, the following patterns trigger comparison inversion. -// Test that we correctly invert the CMOV condition -var gsink int64 -var gusink uint64 - -func cmovinvert1(x, y int64) int64 { - if x < gsink { - y = -y - } - // amd64:"CMOVQGT" - return y -} -func cmovinvert2(x, y int64) int64 { - if x <= gsink { - y = -y - } - // amd64:"CMOVQGE" - return y -} -func cmovinvert3(x, y int64) int64 { - if x == gsink { - y = -y - } - // amd64:"CMOVQEQ" - return y -} -func cmovinvert4(x, y int64) int64 { - if x != gsink { - y = -y - } - // amd64:"CMOVQNE" - return y -} -func cmovinvert5(x, y uint64) uint64 { - if x > gusink { - y = -y - } - // amd64:"CMOVQCS" - return y -} -func cmovinvert6(x, y uint64) uint64 { - if x >= gusink { - y = -y - } - // amd64:"CMOVQLS" - return y -} |
