Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions llvm/test/CodeGen/SPIRV/llvm-intrinsics/tan.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; 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)
12 changes: 12 additions & 0 deletions llvm/test/CodeGen/SPIRV/zero-length-array.ll
Original file line number Diff line number Diff line change
@@ -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]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong: OpTypeRuntimeArray requires Shader capability, but the triple makes this run for Kernel. @aadeshps-mcw can you please help me understand what are you trying to test here? If we change the triple to spirv-unknown-vulkan-compute, which would run for Shader, there is no OpTypeRuntimeArray, instead there is an OpConstant, which I assume comes from some optimization/pass. @Keenuts can you confirm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked, mem2reg is getting rid of the alloca, so no array after that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize the mistake was on my part due to a misunderstanding of the test. I’ll address it and submit a new PR at the earliest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it in #149522. Let me know if that works for you, otherwise I can just mark it as XFAIL in the PR, so you can address it later in a different PR.

; CHECK: %[[#]] = OpTypePointer Function %[[#ext]]

define spir_func void @_Z3foov() {
entry:
%i = alloca [0 x i32], align 4
ret void
}
Loading