summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-12-17 16:46:42 -0500
committerSanjay Patel <spatel@rotateright.com>2019-12-18 07:56:36 -0500
commitc7492fbd4e85632a05428bd0281fcfd06f1fff6c (patch)
tree01768414ae4b4df602904985f984abf56ea4ca63
parentd8a3194987301672fbd50f4e5703952381f0157c (diff)
downloadbcm5719-llvm-c7492fbd4e85632a05428bd0281fcfd06f1fff6c.tar.gz
bcm5719-llvm-c7492fbd4e85632a05428bd0281fcfd06f1fff6c.zip
[InstCombine] add tests for copysign; NFC
-rw-r--r--llvm/test/Transforms/InstCombine/copysign.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/copysign.ll b/llvm/test/Transforms/InstCombine/copysign.ll
index 49ca1b87d0d..c769ccedc3c 100644
--- a/llvm/test/Transforms/InstCombine/copysign.ll
+++ b/llvm/test/Transforms/InstCombine/copysign.ll
@@ -1,6 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -instcombine < %s | FileCheck %s
+declare float @llvm.fabs.f32(float)
declare float @llvm.copysign.f32(float, float)
declare <3 x double> @llvm.copysign.v3f64(<3 x double>, <3 x double>)
@@ -41,3 +42,25 @@ define <3 x double> @negative_sign_arg_vec_splat(<3 x double> %x) {
%r = call fast <3 x double> @llvm.copysign.v3f64(<3 x double> %x, <3 x double> <double -42.0, double -42.0, double -42.0>)
ret <3 x double> %r
}
+
+define float @known_positive_sign_arg(float %x, float %y) {
+; CHECK-LABEL: @known_positive_sign_arg(
+; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[Y:%.*]])
+; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.copysign.f32(float [[X:%.*]], float [[FABS]])
+; CHECK-NEXT: ret float [[R]]
+;
+ %fabs = call float @llvm.fabs.f32(float %y)
+ %r = call ninf float @llvm.copysign.f32(float %x, float %fabs)
+ ret float %r
+}
+
+define <3 x double> @known_positive_sign_arg_vec(<3 x double> %x, <3 x i32> %y) {
+; CHECK-LABEL: @known_positive_sign_arg_vec(
+; CHECK-NEXT: [[YF:%.*]] = uitofp <3 x i32> [[Y:%.*]] to <3 x double>
+; CHECK-NEXT: [[R:%.*]] = call arcp <3 x double> @llvm.copysign.v3f64(<3 x double> [[X:%.*]], <3 x double> [[YF]])
+; CHECK-NEXT: ret <3 x double> [[R]]
+;
+ %yf = uitofp <3 x i32> %y to <3 x double>
+ %r = call arcp <3 x double> @llvm.copysign.v3f64(<3 x double> %x, <3 x double> %yf)
+ ret <3 x double> %r
+}
OpenPOWER on IntegriCloud