summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/test/Transforms/InstSimplify/call.ll44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 4736adb972d..4a0dc41accc 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
+}
OpenPOWER on IntegriCloud