[llvm] d367695 - XCore: Add test for sincos and exp10 intrinsics (#148621)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 07:42:49 PDT 2025


Author: Matt Arsenault
Date: 2025-07-14T23:42:45+09:00
New Revision: d36769520014a5005a76c491a530048fc2d7ddb5

URL: https://github.com/llvm/llvm-project/commit/d36769520014a5005a76c491a530048fc2d7ddb5
DIFF: https://github.com/llvm/llvm-project/commit/d36769520014a5005a76c491a530048fc2d7ddb5.diff

LOG: XCore: Add test for sincos and exp10 intrinsics (#148621)

Added: 
    llvm/test/CodeGen/XCore/llvm.exp10.ll
    llvm/test/CodeGen/XCore/llvm.sincos.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/XCore/llvm.exp10.ll b/llvm/test/CodeGen/XCore/llvm.exp10.ll
new file mode 100644
index 0000000000000..3cd6135d7562f
--- /dev/null
+++ b/llvm/test/CodeGen/XCore/llvm.exp10.ll
@@ -0,0 +1,69 @@
+; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck %s
+
+; CHECK-LABEL: exp10_f16:
+; CHECK: bl __extendhfsf2
+; CHECK: bl exp10f
+; CHECK: bl __truncsfhf2
+define half @exp10_f16(half %x) #0 {
+  %r = call half @llvm.exp10.f16(half %x)
+  ret half %r
+}
+
+; CHECK-LABEL: exp10_v2f16:
+; CHECK: bl __extendhfsf2
+; CHECK: bl __extendhfsf2
+; CHECK: bl exp10f
+; CHECK: bl exp10f
+; CHECK: bl __truncsfhf2
+; CHECK: bl __truncsfhf2
+define <2 x half> @exp10_v2f16(<2 x half> %x) #0 {
+  %r = call <2 x half> @llvm.exp10.v2f16(<2 x half> %x)
+  ret <2 x half> %r
+}
+
+; CHECK-LABEL: exp10_f32:
+; CHECK: bl exp10f
+define float @exp10_f32(float %x) #0 {
+  %r = call float @llvm.exp10.f32(float %x)
+  ret float %r
+}
+
+; CHECK-LABEL: exp10_v2f32:
+; CHECK: bl exp10f
+; CHECK: bl exp10f
+define <2 x float> @exp10_v2f32(<2 x float> %x) #0 {
+  %r = call <2 x float> @llvm.exp10.v2f32(<2 x float> %x)
+  ret <2 x float> %r
+}
+
+; CHECK-LABEL: exp10_f64:
+; CHECK: bl exp10
+define double @exp10_f64(double %x) #0 {
+  %r = call double @llvm.exp10.f64(double %x)
+  ret double %r
+}
+
+; CHECK-LABEL: exp10_v2f64:
+; CHECK: bl exp10
+; CHECK: bl exp10
+define <2 x double> @exp10_v2f64(<2 x double> %x) #0 {
+  %r = call <2 x double> @llvm.exp10.v2f64(<2 x double> %x)
+  ret <2 x double> %r
+}
+
+; CHECK-LABEL: exp10_f128:
+; CHECK: bl exp10l
+define fp128 @exp10_f128(fp128 %x) #0 {
+  %r = call fp128 @llvm.exp10.f128(fp128 %x)
+  ret fp128 %r
+}
+
+; CHECK-LABEL: exp10_v2f128:
+; CHECK: bl exp10l
+; CHECK: bl exp10l
+define <2 x fp128> @exp10_v2f128(<2 x fp128> %x) #0 {
+  %r = call <2 x fp128> @llvm.exp10.v2f128(<2 x fp128> %x)
+  ret <2 x fp128> %r
+}
+
+attributes #0 = { nounwind }

diff  --git a/llvm/test/CodeGen/XCore/llvm.sincos.ll b/llvm/test/CodeGen/XCore/llvm.sincos.ll
new file mode 100644
index 0000000000000..690c03897189a
--- /dev/null
+++ b/llvm/test/CodeGen/XCore/llvm.sincos.ll
@@ -0,0 +1,81 @@
+; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck %s
+
+; CHECK-LABEL: test_sincos_f16:
+; CHECK: bl __extendhfsf2
+; CHECK: bl cosf
+; CHECK: bl sinf
+; CHECK: bl __truncsfhf2
+; CHECK: bl __truncsfhf2
+define { half, half } @test_sincos_f16(half %a) nounwind {
+  %result = call { half, half } @llvm.sincos.f16(half %a)
+  ret { half, half } %result
+}
+
+; CHECK-LABEL: test_sincos_v2f16:
+; CHECK: bl __extendhfsf2
+; CHECK: bl __extendhfsf2
+; CHECK: bl cosf
+; CHECK: bl cosf
+; CHECK: bl sinf
+; CHECK: bl sinf
+; CHECK: bl __truncsfhf2
+; CHECK: bl __truncsfhf2
+define { <2 x half>, <2 x half> } @test_sincos_v2f16(<2 x half> %a) nounwind {
+  %result = call { <2 x half>, <2 x half> } @llvm.sincos.v2f16(<2 x half> %a)
+  ret { <2 x half>, <2 x half> } %result
+}
+
+; CHECK-LABEL: test_sincos_f32:
+; OTHER: bl sinf
+; OTHER: bl cosf
+; GNU: bl sincosf
+define { float, float } @test_sincos_f32(float %a) nounwind {
+  %result = call { float, float } @llvm.sincos.f32(float %a)
+  ret { float, float } %result
+}
+
+; CHECK-LABEL: test_sincos_v2f32:
+; CHECK: bl sinf
+; CHECK: bl sinf
+; CHECK: bl cosf
+; CHECK: bl cosf
+define { <2 x float>, <2 x float> } @test_sincos_v2f32(<2 x float> %a) nounwind {
+  %result = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> %a)
+  ret { <2 x float>, <2 x float> } %result
+}
+
+; CHECK-LABEL: test_sincos_f64:
+; CHECK: bl sin
+; CHECK: bl cos
+define { double, double } @test_sincos_f64(double %a) nounwind {
+  %result = call { double, double } @llvm.sincos.f64(double %a)
+  ret { double, double } %result
+}
+
+; CHECK-LABEL: test_sincos_v2f64:
+; CHECK: bl sin
+; CHECK: bl sin
+; CHECK: bl cos
+; CHECK: bl cos
+define { <2 x double>, <2 x double> } @test_sincos_v2f64(<2 x double> %a) nounwind {
+  %result = call { <2 x double>, <2 x double> } @llvm.sincos.v2f64(<2 x double> %a)
+  ret { <2 x double>, <2 x double> } %result
+}
+
+; CHECK-LABEL: test_sincos_f128:
+; CHECK: bl sinl
+; CHECK: bl cosl
+define { fp128, fp128 } @test_sincos_f128(fp128 %a) nounwind {
+  %result = call { fp128, fp128 } @llvm.sincos.f128(fp128 %a)
+  ret { fp128, fp128 } %result
+}
+
+; CHECK-LABEL: test_sincos_v2f128:
+; CHECK: bl sinl
+; CHECK: bl cosl
+; CHECK: bl cosl
+; CHECK: bl sinl
+define { <2 x fp128>, <2 x fp128> } @test_sincos_v2f128(<2 x fp128> %a) nounwind {
+  %result = call { <2 x fp128>, <2 x fp128> } @llvm.sincos.v2f128(<2 x fp128> %a)
+  ret { <2 x fp128>, <2 x fp128> } %result
+}


        


More information about the llvm-commits mailing list