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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 06:31:33 PDT 2025


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/148621

>From d69105acda41ba85c05f8037010bb5e65b651393 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 14 Jul 2025 21:43:07 +0900
Subject: [PATCH 1/2] XCore: Add test for sincos and exp10 intrinsics

---
 llvm/test/CodeGen/XCore/llvm.exp10.ll  |  71 +++++++++++++++++
 llvm/test/CodeGen/XCore/llvm.sincos.ll | 106 +++++++++++++++++++++++++
 2 files changed, 177 insertions(+)
 create mode 100644 llvm/test/CodeGen/XCore/llvm.exp10.ll
 create mode 100644 llvm/test/CodeGen/XCore/llvm.sincos.ll

diff --git a/llvm/test/CodeGen/XCore/llvm.exp10.ll b/llvm/test/CodeGen/XCore/llvm.exp10.ll
new file mode 100644
index 0000000000000..9304bcd126560
--- /dev/null
+++ b/llvm/test/CodeGen/XCore/llvm.exp10.ll
@@ -0,0 +1,71 @@
+; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck %s
+; RUN: llc -mtriple=xcore-none-linux < %s | FileCheck %s
+; RUN: llc -mtriple=xcore-none-linux-gnu < %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..65ecb7c9a642d
--- /dev/null
+++ b/llvm/test/CodeGen/XCore/llvm.sincos.ll
@@ -0,0 +1,106 @@
+; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck -check-prefixes=CHECK,OTHER %s
+; RUN: llc -mtriple=xcore-none-linux < %s | FileCheck -check-prefixes=CHECK,OTHER %s
+; RUN: llc -mtriple=xcore-none-linux-gnu < %s | FileCheck -check-prefixes=CHECK,GNU %s
+
+; CHECK-LABEL: test_sincos_f16:
+; CHECK: bl __extendhfsf2
+
+; OTHER: bl cosf
+; OTHER: bl sinf
+
+; GNU: bl sincosf
+
+; 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
+
+; OTHER: bl cosf
+; OTHER: bl cosf
+; OTHER: bl sinf
+; OTHER: bl sinf
+
+; GNU: bl sincosf
+; GNU: bl sincosf
+
+; 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:
+; OTHER: bl sinf
+; OTHER: bl sinf
+; OTHER: bl cosf
+; OTHER: bl cosf
+
+; GNU: bl sincosf
+; GNU: bl sincosf
+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:
+; OTHER: bl sin
+; OTHER: bl cos
+
+; GNU: bl sincos
+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:
+; OTHER: bl sin
+; OTHER: bl sin
+; OTHER: bl cos
+; OTHER: bl cos
+
+; GNU: bl sincos
+; GNU: bl sincos
+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:
+; OTHER: bl sinl
+; OTHER: bl cosl
+
+; GNU: bl sincosl
+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:
+; OTHER: bl sinl
+; OTHER: bl cosl
+; OTHER: bl cosl
+; OTHER: bl sinl
+
+; GNU: bl sincosl
+; GNU: bl sincosl
+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
+}

>From 04d216df9f4d80aed6aed0489cd302386ec3c7da Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 14 Jul 2025 22:31:14 +0900
Subject: [PATCH 2/2] drop linux triples

---
 llvm/test/CodeGen/XCore/llvm.exp10.ll  |  2 -
 llvm/test/CodeGen/XCore/llvm.sincos.ll | 71 +++++++++-----------------
 2 files changed, 23 insertions(+), 50 deletions(-)

diff --git a/llvm/test/CodeGen/XCore/llvm.exp10.ll b/llvm/test/CodeGen/XCore/llvm.exp10.ll
index 9304bcd126560..3cd6135d7562f 100644
--- a/llvm/test/CodeGen/XCore/llvm.exp10.ll
+++ b/llvm/test/CodeGen/XCore/llvm.exp10.ll
@@ -1,6 +1,4 @@
 ; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck %s
-; RUN: llc -mtriple=xcore-none-linux < %s | FileCheck %s
-; RUN: llc -mtriple=xcore-none-linux-gnu < %s | FileCheck %s
 
 ; CHECK-LABEL: exp10_f16:
 ; CHECK: bl __extendhfsf2
diff --git a/llvm/test/CodeGen/XCore/llvm.sincos.ll b/llvm/test/CodeGen/XCore/llvm.sincos.ll
index 65ecb7c9a642d..690c03897189a 100644
--- a/llvm/test/CodeGen/XCore/llvm.sincos.ll
+++ b/llvm/test/CodeGen/XCore/llvm.sincos.ll
@@ -1,15 +1,9 @@
-; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck -check-prefixes=CHECK,OTHER %s
-; RUN: llc -mtriple=xcore-none-linux < %s | FileCheck -check-prefixes=CHECK,OTHER %s
-; RUN: llc -mtriple=xcore-none-linux-gnu < %s | FileCheck -check-prefixes=CHECK,GNU %s
+; RUN: llc -mtriple=xcore-unknown-unknown < %s | FileCheck %s
 
 ; CHECK-LABEL: test_sincos_f16:
 ; CHECK: bl __extendhfsf2
-
-; OTHER: bl cosf
-; OTHER: bl sinf
-
-; GNU: bl sincosf
-
+; CHECK: bl cosf
+; CHECK: bl sinf
 ; CHECK: bl __truncsfhf2
 ; CHECK: bl __truncsfhf2
 define { half, half } @test_sincos_f16(half %a) nounwind {
@@ -20,15 +14,10 @@ define { half, half } @test_sincos_f16(half %a) nounwind {
 ; CHECK-LABEL: test_sincos_v2f16:
 ; CHECK: bl __extendhfsf2
 ; CHECK: bl __extendhfsf2
-
-; OTHER: bl cosf
-; OTHER: bl cosf
-; OTHER: bl sinf
-; OTHER: bl sinf
-
-; GNU: bl sincosf
-; GNU: bl sincosf
-
+; 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 {
@@ -39,7 +28,6 @@ define { <2 x half>, <2 x half> } @test_sincos_v2f16(<2 x half> %a) nounwind {
 ; 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)
@@ -47,59 +35,46 @@ define { float, float } @test_sincos_f32(float %a) nounwind {
 }
 
 ; CHECK-LABEL: test_sincos_v2f32:
-; OTHER: bl sinf
-; OTHER: bl sinf
-; OTHER: bl cosf
-; OTHER: bl cosf
-
-; GNU: bl sincosf
-; GNU: bl sincosf
+; 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:
-; OTHER: bl sin
-; OTHER: bl cos
-
-; GNU: bl sincos
+; 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:
-; OTHER: bl sin
-; OTHER: bl sin
-; OTHER: bl cos
-; OTHER: bl cos
-
-; GNU: bl sincos
-; GNU: bl sincos
+; 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:
-; OTHER: bl sinl
-; OTHER: bl cosl
-
-; GNU: bl sincosl
+; 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:
-; OTHER: bl sinl
-; OTHER: bl cosl
-; OTHER: bl cosl
-; OTHER: bl sinl
-
-; GNU: bl sincosl
-; GNU: bl sincosl
+; 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