diff options
author | fanzha02 <fannie.zhang@arm.com> | 2019-02-20 11:38:16 +0000 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2019-03-07 21:23:52 +0000 |
commit | 6efd51c6b768ecb55cd39b0dcb8a43d9a6c8e1b2 (patch) | |
tree | b1f5e0905b6d4718610e91b75a9c5322f438036d /src/cmd/compile/internal/ssa/gen/ARM64Ops.go | |
parent | a77f85a61874c05097a60f08d9dda71512d9dcc3 (diff) | |
download | go-6efd51c6b768ecb55cd39b0dcb8a43d9a6c8e1b2.tar.gz go-6efd51c6b768ecb55cd39b0dcb8a43d9a6c8e1b2.zip |
cmd/compile: change the condition flags of floating-point comparisons in arm64 backend
Current compiler reverses operands to work around NaN in
"less than" and "less equal than" comparisons. But if we
want to use "FCMPD/FCMPS $(0.0), Fn" to do some optimization,
the workaround way does not work. Because assembler does
not support instruction "FCMPD/FCMPS Fn, $(0.0)".
This CL sets condition flags for floating-point comparisons
to resolve this problem.
Change-Id: Ia48076a1da95da64596d6e68304018cb301ebe33
Reviewed-on: https://go-review.googlesource.com/c/go/+/164718
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/gen/ARM64Ops.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/gen/ARM64Ops.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/ARM64Ops.go b/src/cmd/compile/internal/ssa/gen/ARM64Ops.go index fc0a41527b..2a65d547bd 100644 --- a/src/cmd/compile/internal/ssa/gen/ARM64Ops.go +++ b/src/cmd/compile/internal/ssa/gen/ARM64Ops.go @@ -466,7 +466,10 @@ func init() { {name: "LessEqualU", argLength: 1, reg: readflags}, // bool, true flags encode unsigned x<=y false otherwise. {name: "GreaterThanU", argLength: 1, reg: readflags}, // bool, true flags encode unsigned x>y false otherwise. {name: "GreaterEqualU", argLength: 1, reg: readflags}, // bool, true flags encode unsigned x>=y false otherwise. - + {name: "LessThanF", argLength: 1, reg: readflags}, // bool, true flags encode floating-point x<y false otherwise. + {name: "LessEqualF", argLength: 1, reg: readflags}, // bool, true flags encode floating-point x<=y false otherwise. + {name: "GreaterThanF", argLength: 1, reg: readflags}, // bool, true flags encode floating-point x>y false otherwise. + {name: "GreaterEqualF", argLength: 1, reg: readflags}, // bool, true flags encode floating-point x>=y false otherwise. // duffzero // arg0 = address of memory to zero // arg1 = mem @@ -663,6 +666,10 @@ func init() { {name: "NZW"}, // Control != 0, 32-bit {name: "TBZ"}, // Control & (1 << Aux.(int64)) == 0 {name: "TBNZ"}, // Control & (1 << Aux.(int64)) != 0 + {name: "FLT"}, + {name: "FLE"}, + {name: "FGT"}, + {name: "FGE"}, } archs = append(archs, arch{ |