summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2018-10-10 01:09:09 +0000
committerThomas Lively <tlively@google.com>2018-10-10 01:09:09 +0000
commit108e98ec32ba61a19965611206633cd2ebb0d6ba (patch)
treecc305d99a793337c949539b0777858dc4e9f65bc /llvm/test/CodeGen/WebAssembly
parent5d900954bd33eee0749fbcee440f5ef65d8255a0 (diff)
downloadbcm5719-llvm-108e98ec32ba61a19965611206633cd2ebb0d6ba.tar.gz
bcm5719-llvm-108e98ec32ba61a19965611206633cd2ebb0d6ba.zip
[WebAssembly] Fix fneg lowering
Summary: Subtraction from zero and floating point negation do not have the same semantics, so fix lowering. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D52948 llvm-svn: 344107
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly')
-rw-r--r--llvm/test/CodeGen/WebAssembly/simd-arith.ll6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/simd-arith.ll b/llvm/test/CodeGen/WebAssembly/simd-arith.ll
index 0bda334cd98..f3e70156d8b 100644
--- a/llvm/test/CodeGen/WebAssembly/simd-arith.ll
+++ b/llvm/test/CodeGen/WebAssembly/simd-arith.ll
@@ -748,7 +748,8 @@ define <2 x i64> @bitselect_v2i64(<2 x i64> %c, <2 x i64> %v1, <2 x i64> %v2) {
; SIMD128-NEXT: f32x4.neg $push[[R:[0-9]+]]=, $0{{$}}
; SIMD128-NEXT: return $pop[[R]]{{$}}
define <4 x float> @neg_v4f32(<4 x float> %x) {
- %a = fsub <4 x float> <float 0., float 0., float 0., float 0.>, %x
+ ; nsz makes this semantically equivalent to flipping sign bit
+ %a = fsub nsz <4 x float> <float 0.0, float 0.0, float 0.0, float 0.0>, %x
ret <4 x float> %a
}
@@ -830,7 +831,8 @@ define <4 x float> @sqrt_v4f32(<4 x float> %x) {
; SIMD128-NEXT: f64x2.neg $push[[R:[0-9]+]]=, $0{{$}}
; SIMD128-NEXT: return $pop[[R]]{{$}}
define <2 x double> @neg_v2f64(<2 x double> %x) {
- %a = fsub <2 x double> <double 0., double 0.>, %x
+ ; nsz makes this semantically equivalent to flipping sign bit
+ %a = fsub nsz <2 x double> <double 0., double 0.>, %x
ret <2 x double> %a
}
OpenPOWER on IntegriCloud