[llvm] 4d5fdff - [InstCombine] add tests for copysign; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 16 06:24:40 PDT 2020
Author: Sanjay Patel
Date: 2020-08-16T08:53:47-04:00
New Revision: 4d5fdff43488445746dfea4cf0a5621cfd838c01
URL: https://github.com/llvm/llvm-project/commit/4d5fdff43488445746dfea4cf0a5621cfd838c01
DIFF: https://github.com/llvm/llvm-project/commit/4d5fdff43488445746dfea4cf0a5621cfd838c01.diff
LOG: [InstCombine] add tests 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 2d87c7b27166..f278be71b819 100644
--- a/llvm/test/Transforms/InstCombine/copysign.ll
+++ b/llvm/test/Transforms/InstCombine/copysign.ll
@@ -89,3 +89,25 @@ define float @copysign_sign_arg(float %x, float %y, float %z) {
%r = call ninf float @llvm.copysign.f32(float %x, float %s)
ret float %r
}
+
+define float @fneg_mag(float %x, float %y) {
+; CHECK-LABEL: @fneg_mag(
+; CHECK-NEXT: [[N:%.*]] = fneg float [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = call float @llvm.copysign.f32(float [[N]], float [[Y:%.*]])
+; CHECK-NEXT: ret float [[R]]
+;
+ %n = fneg float %x
+ %r = call float @llvm.copysign.f32(float %n, float %y)
+ ret float %r
+}
+
+define float @fabs_mag(float %x, float %y) {
+; CHECK-LABEL: @fabs_mag(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
+; CHECK-NEXT: [[R:%.*]] = call float @llvm.copysign.f32(float [[A]], float [[Y:%.*]])
+; CHECK-NEXT: ret float [[R]]
+;
+ %a = call float @llvm.fabs.f32(float %x)
+ %r = call float @llvm.copysign.f32(float %a, float %y)
+ ret float %r
+}
More information about the llvm-commits
mailing list