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
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/SPIRV/FCmpFalse_Vec.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; 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: %[[#BoolTy:]] = OpTypeBool
; CHECK: %[[#VecTy:]] = OpTypeVector %[[#BoolTy]] 4
; CHECK: %[[#False:]] = OpConstantFalse %[[#BoolTy]]
; CHECK: %[[#Composite:]] = OpConstantComposite %[[#VecTy]] %[[#False]] %[[#False]] %[[#False]] %[[#False]]
; CHECK: OpReturnValue %[[#Composite]]

define spir_func <4 x i1> @test(<4 x float> %a) {
%compare = fcmp false <4 x float> %a, %a
ret <4 x i1> %compare
}
20 changes: 20 additions & 0 deletions llvm/test/CodeGen/SPIRV/builtin_duplicate.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
;; This test checks if we generate a single builtin variable for the following
;; LLVM IR.
;; @__spirv_BuiltInLocalInvocationId - A global variable
;; %3 = tail call i64 @_Z12get_local_idj(i32 0) - A function call

; 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: OpName %[[#]] "__spirv_BuiltInLocalInvocationId"
; CHECK-NOT: OpName %[[#]] "__spirv_BuiltInLocalInvocationId.1"

@__spirv_BuiltInLocalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32

declare spir_func i64 @_Z12get_local_idj(i32) local_unnamed_addr

define spir_kernel void @test(i32 %a) {
entry:
%builtin_call = tail call i64 @_Z12get_local_idj(i32 0)
ret void
}
21 changes: 21 additions & 0 deletions llvm/test/CodeGen/SPIRV/complex-constexpr.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; 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 %}

@.str.1 = private unnamed_addr addrspace(1) constant [1 x i8] zeroinitializer, align 1

define linkonce_odr hidden spir_func void @test() {
entry:
; CHECK: %[[#MinusOne:]] = OpConstant %[[#]] 18446744073709551615
; CHECK: %[[#Ptr:]] = OpConvertUToPtr %[[#]] %[[#MinusOne]]
; CHECK: %[[#PtrCast:]] = OpPtrCastToGeneric %[[#]] %[[#]]
; CHECK: %[[#]] = OpFunctionCall %[[#]] %[[#]] %[[#PtrCast]] %[[#Ptr]]

%cast = bitcast ptr addrspace(4) inttoptr (i64 -1 to ptr addrspace(4)) to ptr addrspace(4)
call spir_func void @bar(ptr addrspace(4) addrspacecast (ptr addrspace(1) @.str.1 to ptr addrspace(4)), ptr addrspace(4) %cast)
ret void
}

define linkonce_odr hidden spir_func void @bar(ptr addrspace(4) %begin, ptr addrspace(4) %end) {
entry:
ret void
}
25 changes: 25 additions & 0 deletions llvm/test/CodeGen/SPIRV/dominator-order.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
; 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 %}

; This test checks that basic blocks are reordered in SPIR-V so that dominators
; are emitted ahead of their dominated blocks as required by the SPIR-V
; specification.

; CHECK-DAG: OpName %[[#ENTRY:]] "entry"
; CHECK-DAG: OpName %[[#FOR_BODY137_LR_PH:]] "for.body137.lr.ph"
; CHECK-DAG: OpName %[[#FOR_BODY:]] "for.body"

; CHECK: %[[#ENTRY]] = OpLabel
; CHECK: %[[#FOR_BODY]] = OpLabel
; CHECK: %[[#FOR_BODY137_LR_PH]] = OpLabel

define spir_kernel void @test(ptr addrspace(1) %arg, i1 %cond) {
entry:
br label %for.body

for.body137.lr.ph: ; preds = %for.body
ret void

for.body: ; preds = %for.body, %entry
br i1 %cond, label %for.body, label %for.body137.lr.ph
}
Loading