39 lines · plain
1// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip %s | FileCheck %s2 3// RUN: %if spirv-tools %{ rm -rf %t %}4// RUN: %if spirv-tools %{ mkdir %t %}5// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}6// RUN: %if spirv-tools %{ spirv-val %t %}7 8spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {9 // CHECK-LABEL: @ret10 spirv.func @ret() -> () "None" {11 // CHECK: spirv.Return12 spirv.Return13 }14 15 // CHECK-LABEL: @ret_val16 spirv.func @ret_val() -> (i32) "None" {17 %0 = spirv.Variable : !spirv.ptr<i32, Function>18 %1 = spirv.Load "Function" %0 : i3219 // CHECK: spirv.ReturnValue {{.*}} : i3220 spirv.ReturnValue %1 : i3221 }22 23 // CHECK-LABEL: @unreachable24 spirv.func @unreachable() "None" {25 spirv.Return26 // CHECK-NOT: ^bb27 ^bb1:28 // Unreachable blocks will be dropped during serialization.29 // CHECK-NOT: spirv.Unreachable30 spirv.Unreachable31 }32 33 // CHECK-LABEL: @kill34 spirv.func @kill() -> () "None" {35 // CHECK: spirv.Kill36 spirv.Kill37 }38}39