[llvm] 25cf5d9 - [InstCombine] add test for copysign; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 14:54:53 PST 2019


Author: Sanjay Patel
Date: 2019-12-23T17:54:31-05:00
New Revision: 25cf5d97ace15c6835f6ad222c5a3aaa02c99522

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

LOG: [InstCombine] add test for copysign; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/copysign.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/copysign.ll b/llvm/test/Transforms/InstCombine/copysign.ll
index cc68b195a7e2..79c13380d4c7 100644
--- a/llvm/test/Transforms/InstCombine/copysign.ll
+++ b/llvm/test/Transforms/InstCombine/copysign.ll
@@ -62,3 +62,17 @@ define <3 x double> @known_positive_sign_arg_vec(<3 x double> %x, <3 x i32> %y)
   %r = call arcp <3 x double> @llvm.copysign.v3f64(<3 x double> %x, <3 x double> %yf)
   ret <3 x double> %r
 }
+
+; TODO: The magnitude operand of the 1st copysign is irrelevant.
+; copysign(x, copysign(y, z)) --> copysign(x, z)
+
+define float @copysign_sign_arg(float %x, float %y, float %z) {
+; CHECK-LABEL: @copysign_sign_arg(
+; CHECK-NEXT:    [[S:%.*]] = call reassoc float @llvm.copysign.f32(float [[Y:%.*]], float [[Z:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call ninf float @llvm.copysign.f32(float [[X:%.*]], float [[S]])
+; CHECK-NEXT:    ret float [[R]]
+;
+  %s = call reassoc float @llvm.copysign.f32(float %y, float %z)
+  %r = call ninf float @llvm.copysign.f32(float %x, float %s)
+  ret float %r
+}


        


More information about the llvm-commits mailing list