[llvm] 5e6b728 - [InstCombine] add tests for copysign; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 27 08:32:37 PST 2019
Author: Sanjay Patel
Date: 2019-11-27T11:32:23-05:00
New Revision: 5e6b728763e46eb2ec7a55b7f5586dae90c5aadf
URL: https://github.com/llvm/llvm-project/commit/5e6b728763e46eb2ec7a55b7f5586dae90c5aadf
DIFF: https://github.com/llvm/llvm-project/commit/5e6b728763e46eb2ec7a55b7f5586dae90c5aadf.diff
LOG: [InstCombine] add tests for copysign; NFC
Added:
llvm/test/Transforms/InstCombine/copysign.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/copysign.ll b/llvm/test/Transforms/InstCombine/copysign.ll
new file mode 100644
index 000000000000..5d30f346807d
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/copysign.ll
@@ -0,0 +1,41 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -instcombine < %s | FileCheck %s
+
+declare float @llvm.copysign.f32(float, float)
+declare <3 x double> @llvm.copysign.v3f64(<3 x double>, <3 x double>)
+
+define float @positive_sign_arg(float %x) {
+; CHECK-LABEL: @positive_sign_arg(
+; CHECK-NEXT: [[R:%.*]] = call arcp float @llvm.copysign.f32(float [[X:%.*]], float 0.000000e+00)
+; CHECK-NEXT: ret float [[R]]
+;
+ %r = call arcp float @llvm.copysign.f32(float %x, float 0.0)
+ ret float %r
+}
+
+define <3 x double> @positive_sign_arg_vec_splat(<3 x double> %x) {
+; CHECK-LABEL: @positive_sign_arg_vec_splat(
+; CHECK-NEXT: [[R:%.*]] = call ninf <3 x double> @llvm.copysign.v3f64(<3 x double> [[X:%.*]], <3 x double> <double 4.200000e+01, double 4.200000e+01, double 4.200000e+01>)
+; CHECK-NEXT: ret <3 x double> [[R]]
+;
+ %r = call ninf <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 @negative_sign_arg(float %x) {
+; CHECK-LABEL: @negative_sign_arg(
+; CHECK-NEXT: [[R:%.*]] = call nnan float @llvm.copysign.f32(float [[X:%.*]], float -0.000000e+00)
+; CHECK-NEXT: ret float [[R]]
+;
+ %r = call nnan float @llvm.copysign.f32(float %x, float -0.0)
+ ret float %r
+}
+
+define <3 x double> @negative_sign_arg_vec_splat(<3 x double> %x) {
+; CHECK-LABEL: @negative_sign_arg_vec_splat(
+; CHECK-NEXT: [[R:%.*]] = call fast <3 x double> @llvm.copysign.v3f64(<3 x double> [[X:%.*]], <3 x double> <double -4.200000e+01, double -4.200000e+01, double -4.200000e+01>)
+; CHECK-NEXT: ret <3 x double> [[R]]
+;
+ %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
+}
More information about the llvm-commits
mailing list