[llvm] [SPIRV] Addition of test files for @llvm.tan and zero_length_array.ll (PR #142097)

Aadesh Premkumar via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 00:11:46 PDT 2025


https://github.com/aadeshps-mcw created https://github.com/llvm/llvm-project/pull/142097

None

>From 0718d2c6e5721692ec36513c14b5d4177228624b Mon Sep 17 00:00:00 2001
From: Aadesh PremKumar <aadesh.premkumar at multicorewareinc.com>
Date: Fri, 30 May 2025 12:38:58 +0530
Subject: [PATCH] --Addition of test files for @llvm.tan and zero length array
 test

---
 .../test/CodeGen/SPIRV/llvm-intrinsics/tan.ll | 24 +++++++++++++++++++
 llvm/test/CodeGen/SPIRV/zero-length-array.ll  | 12 ++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 llvm/test/CodeGen/SPIRV/llvm-intrinsics/tan.ll
 create mode 100644 llvm/test/CodeGen/SPIRV/zero-length-array.ll

diff --git a/llvm/test/CodeGen/SPIRV/llvm-intrinsics/tan.ll b/llvm/test/CodeGen/SPIRV/llvm-intrinsics/tan.ll
new file mode 100644
index 0000000000000..6d28816d86bc2
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/llvm-intrinsics/tan.ll
@@ -0,0 +1,24 @@
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+; CHECK-DAG: %[[#ext:]] = OpExtInstImport "OpenCL.std"
+
+; CHECK-DAG: %[[#type_f32:]] = OpTypeFloat 32
+; CHECK-DAG: %[[#type_f64:]] = OpTypeFloat 64
+
+; CHECK: %[[#extinst_f32:]] = OpExtInst %[[#type_f32]] %[[#ext]] tan %[[#]]
+; CHECK: %[[#extinst_f64:]] = OpExtInst %[[#type_f64]] %[[#ext]] tan %[[#]]
+
+
+define float @test_tan_f32(float %x) {
+  %res = call float @llvm.tan.f32(float %x)
+  ret float %res
+}
+
+define double @test_tan_f64(double %x) {
+  %res = call double @llvm.tan.f64(double %x)
+  ret double %res
+}
+
+declare float @llvm.tan.f32(float)
+declare double @llvm.tan.f64(double)
diff --git a/llvm/test/CodeGen/SPIRV/zero-length-array.ll b/llvm/test/CodeGen/SPIRV/zero-length-array.ll
new file mode 100644
index 0000000000000..668bf2018dec7
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/zero-length-array.ll
@@ -0,0 +1,12 @@
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+; CHECK: %[[#type:]] = OpTypeInt 32 0
+; CHECK: %[[#ext:]] = OpTypeRuntimeArray %[[#type]]
+; CHECK: %[[#]] = OpTypePointer Function %[[#ext]]
+
+define spir_func void @_Z3foov() {
+entry:
+  %i = alloca [0 x i32], align 4
+  ret void
+}



More information about the llvm-commits mailing list