[llvm] d5abaaf - [InstSimplify] add tests for copysign with fneg operand; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 13:23:51 PST 2019
Author: Sanjay Patel
Date: 2019-12-06T16:23:44-05:00
New Revision: d5abaaf140ac7f6d59ac11c0ecbdb8fa93972bf6
URL: https://github.com/llvm/llvm-project/commit/d5abaaf140ac7f6d59ac11c0ecbdb8fa93972bf6
DIFF: https://github.com/llvm/llvm-project/commit/d5abaaf140ac7f6d59ac11c0ecbdb8fa93972bf6.diff
LOG: [InstSimplify] add tests for copysign with fneg operand; NFC
Added:
Modified:
llvm/test/Transforms/InstSimplify/call.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 4736adb972d9..4a0dc41accc4 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -939,3 +939,47 @@ define <2 x double> @copysign_same_operand_vec(<2 x double> %x) {
%r = call <2 x double> @llvm.copysign.v2f64(<2 x double> %x, <2 x double> %x)
ret <2 x double> %r
}
+
+define float @negated_sign_arg(float %x) {
+; CHECK-LABEL: @negated_sign_arg(
+; CHECK-NEXT: [[NEGX:%.*]] = fsub ninf float -0.000000e+00, [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = call arcp float @llvm.copysign.f32(float [[X]], float [[NEGX]])
+; CHECK-NEXT: ret float [[R]]
+;
+ %negx = fsub ninf float -0.0, %x
+ %r = call arcp float @llvm.copysign.f32(float %x, float %negx)
+ ret float %r
+}
+
+define <2 x double> @negated_sign_arg_vec(<2 x double> %x) {
+; CHECK-LABEL: @negated_sign_arg_vec(
+; CHECK-NEXT: [[NEGX:%.*]] = fneg afn <2 x double> [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> [[X]], <2 x double> [[NEGX]])
+; CHECK-NEXT: ret <2 x double> [[R]]
+;
+ %negx = fneg afn <2 x double> %x
+ %r = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> %x, <2 x double> %negx)
+ ret <2 x double> %r
+}
+
+define float @negated_mag_arg(float %x) {
+; CHECK-LABEL: @negated_mag_arg(
+; CHECK-NEXT: [[NEGX:%.*]] = fneg nnan float [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.copysign.f32(float [[NEGX]], float [[X]])
+; CHECK-NEXT: ret float [[R]]
+;
+ %negx = fneg nnan float %x
+ %r = call ninf float @llvm.copysign.f32(float %negx, float %x)
+ ret float %r
+}
+
+define <2 x double> @negated_mag_arg_vec(<2 x double> %x) {
+; CHECK-LABEL: @negated_mag_arg_vec(
+; CHECK-NEXT: [[NEGX:%.*]] = fneg afn <2 x double> [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> [[NEGX]], <2 x double> [[X]])
+; CHECK-NEXT: ret <2 x double> [[R]]
+;
+ %negx = fneg afn <2 x double> %x
+ %r = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> %negx, <2 x double> %x)
+ ret <2 x double> %r
+}
More information about the llvm-commits
mailing list