brintos

brintos / llvm-project-archived public Read only

0
0
Text · 985 B · 2bccfde Raw
24 lines · plain
1; This test case checks that LLVM -> SPIR-V translation produces valid2; SPIR-V module, where a global variable, defined with non-default3; address space, have correct non-function storage class.4;5; No additional checks are needed in addition to simple translation6; to SPIR-V. In case of an error newly produced SPIR-V module validation7; would fail due to spirv-val that detects problematic SPIR-V code from8; translator and reports it as the following error:9;10; "Variables can not have a function[7] storage class outside of a function".11;12; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s13; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}14 15; CHECK: %[[#Ptr:]] = OpTypePointer CrossWorkgroup %[[#]]16; CHECK: %[[#]] = OpVariable %[[#Ptr]] CrossWorkgroup %[[#]]17 18@G = addrspace(1) global i1 true19 20define spir_func i1 @f(i1 %0) {21 store i1 %0, ptr addrspace(1) @G, align 122 ret i1 %023}24