[llvm] c2c48f0 - [InstSimplify] add test for fsub with inf operand; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 06:18:46 PST 2022


Author: Sanjay Patel
Date: 2022-11-11T09:17:20-05:00
New Revision: c2c48f0c9693d2eda30a96660d4861bbd621d6ea

URL: https://github.com/llvm/llvm-project/commit/c2c48f0c9693d2eda30a96660d4861bbd621d6ea
DIFF: https://github.com/llvm/llvm-project/commit/c2c48f0c9693d2eda30a96660d4861bbd621d6ea.diff

LOG: [InstSimplify] add test for fsub with inf operand; NFC

Verify that constant negation works with a partial undef vector.
Also, remove a bogus TODO comment on a related test.

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
    llvm/test/Transforms/InstSimplify/fp-undef-poison.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
index 31025c128f94..3529da68a140 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
@@ -877,6 +877,14 @@ define double @fsub_nnan_inf_op1(double %x) {
   ret double %r
 }
 
+define <2 x double> @fsub_nnan_inf_op1_vec(<2 x double> %x) {
+; CHECK-LABEL: @fsub_nnan_inf_op1_vec(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF0000000000000, double poison>
+;
+  %r = fsub nnan <2 x double> %x, <double 0xfff0000000000000, double poison>
+  ret <2 x double> %r
+}
+
 define <2 x double> @fsub_nnan_neginf_op0(<2 x double> %x) {
 ; CHECK-LABEL: @fsub_nnan_neginf_op0(
 ; CHECK-NEXT:    ret <2 x double> <double 0xFFF0000000000000, double poison>

diff  --git a/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll b/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll
index 7da1c95121b4..cb2026df962c 100644
--- a/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll
+++ b/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll
@@ -283,7 +283,7 @@ define double @fsub_nnan_inf_op0(double %x) {
   ret double %r
 }
 
-; TODO: Should simplify to -inf.
+; This can't simplify - the result is infinity, but the sign is unknown.
 
 define double @fmul_nnan_inf_op1(double %x) {
 ; CHECK-LABEL: @fmul_nnan_inf_op1(


        


More information about the llvm-commits mailing list