From 108e98ec32ba61a19965611206633cd2ebb0d6ba Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 10 Oct 2018 01:09:09 +0000 Subject: [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 --- llvm/test/CodeGen/WebAssembly/simd-arith.ll | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/test/CodeGen/WebAssembly') 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> , %x + ; nsz makes this semantically equivalent to flipping sign bit + %a = fsub nsz <4 x float> , %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> , %x + ; nsz makes this semantically equivalent to flipping sign bit + %a = fsub nsz <2 x double> , %x ret <2 x double> %a } -- cgit v1.2.3