[llvm] 8acddef - SimplifyLibCalls: Add missing testcase for sincospi
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 25 17:07:54 PDT 2022
Author: Matt Arsenault
Date: 2022-10-25T17:06:08-07:00
New Revision: 8acddef90d77ad530ae657cb68720a2c0b053e77
URL: https://github.com/llvm/llvm-project/commit/8acddef90d77ad530ae657cb68720a2c0b053e77
DIFF: https://github.com/llvm/llvm-project/commit/8acddef90d77ad530ae657cb68720a2c0b053e77.diff
LOG: SimplifyLibCalls: Add missing testcase for sincospi
Part of issue 58604. Test should have been part of
50fe87a5c8597eb72e6055356fa7dad364756ff7
Added:
Modified:
llvm/test/Transforms/InstCombine/sincospi.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/sincospi.ll b/llvm/test/Transforms/InstCombine/sincospi.ll
index 6bca9dc9bfc63..ee83f7709280a 100644
--- a/llvm/test/Transforms/InstCombine/sincospi.ll
+++ b/llvm/test/Transforms/InstCombine/sincospi.ll
@@ -51,8 +51,45 @@ define float @test_instbased_f32() {
%cos = call float @__cospif(float %val) #0
%res = fadd float %sin, %cos
ret float %res
+}
-
+define float @test_instbased_f32_other_user(float* %ptr) {
+; CHECK-FLOAT-IN-VEC-LABEL: @test_instbased_f32_other_user(
+; CHECK-FLOAT-IN-VEC-NEXT: [[VAL:%.*]] = load float, ptr @var32, align 4
+; CHECK-FLOAT-IN-VEC-NEXT: [[SINCOSPI:%.*]] = call <2 x float> @__sincospif_stret(float [[VAL]])
+; CHECK-FLOAT-IN-VEC-NEXT: [[SINPI:%.*]] = extractelement <2 x float> [[SINCOSPI]], i64 0
+; CHECK-FLOAT-IN-VEC-NEXT: [[COSPI:%.*]] = extractelement <2 x float> [[SINCOSPI]], i64 1
+; CHECK-FLOAT-IN-VEC-NEXT: store float [[VAL]], ptr [[PTR:%.*]], align 4
+; CHECK-FLOAT-IN-VEC-NEXT: [[SIN:%.*]] = call float @__sinpif(float [[VAL]]) #[[ATTR0]]
+; CHECK-FLOAT-IN-VEC-NEXT: [[COS:%.*]] = call float @__cospif(float [[VAL]]) #[[ATTR0]]
+; CHECK-FLOAT-IN-VEC-NEXT: [[RES:%.*]] = fadd float [[SINPI]], [[COSPI]]
+; CHECK-FLOAT-IN-VEC-NEXT: ret float [[RES]]
+;
+; CHECK-LABEL: @test_instbased_f32_other_user(
+; CHECK-NEXT: [[VAL:%.*]] = load float, ptr @var32, align 4
+; CHECK-NEXT: [[SINCOSPI:%.*]] = call { float, float } @__sincospif_stret(float [[VAL]])
+; CHECK-NEXT: [[SINPI:%.*]] = extractvalue { float, float } [[SINCOSPI]], 0
+; CHECK-NEXT: [[COSPI:%.*]] = extractvalue { float, float } [[SINCOSPI]], 1
+; CHECK-NEXT: store float [[VAL]], ptr [[PTR:%.*]], align 4
+; CHECK-NEXT: [[SIN:%.*]] = call float @__sinpif(float [[VAL]]) #[[ATTR0]]
+; CHECK-NEXT: [[COS:%.*]] = call float @__cospif(float [[VAL]]) #[[ATTR0]]
+; CHECK-NEXT: [[RES:%.*]] = fadd float [[SINPI]], [[COSPI]]
+; CHECK-NEXT: ret float [[RES]]
+;
+; CHECK-NO-SINCOS-LABEL: @test_instbased_f32_other_user(
+; CHECK-NO-SINCOS-NEXT: [[VAL:%.*]] = load float, ptr @var32, align 4
+; CHECK-NO-SINCOS-NEXT: store float [[VAL]], ptr [[PTR:%.*]], align 4
+; CHECK-NO-SINCOS-NEXT: [[SIN:%.*]] = call float @__sinpif(float [[VAL]]) #[[ATTR0]]
+; CHECK-NO-SINCOS-NEXT: [[COS:%.*]] = call float @__cospif(float [[VAL]]) #[[ATTR0]]
+; CHECK-NO-SINCOS-NEXT: [[RES:%.*]] = fadd float [[SIN]], [[COS]]
+; CHECK-NO-SINCOS-NEXT: ret float [[RES]]
+;
+ %val = load float, ptr @var32
+ store float %val, float* %ptr
+ %sin = call float @__sinpif(float %val) #0
+ %cos = call float @__cospif(float %val) #0
+ %res = fadd float %sin, %cos
+ ret float %res
}
define float @test_constant_f32() {
More information about the llvm-commits
mailing list