This commit shuffles SPIR-V code around to better follow MLIR
convention. Specifically,
* Created IR/, Transforms/, Linking/, and Utils/ subdirectories and
moved suitable code inside.
* Created SPIRVEnums.{h|cpp} for SPIR-V C/C++ enums generated from
SPIR-V spec. Previously they are cluttered inside SPIRVTypes.{h|cpp}.
* Fixed include guards in various header files (both .h and .td).
* Moved serialization tests under test/Target/SPIRV.
* Renamed TableGen backend -gen-spirv-op-utils into -gen-spirv-attr-utils
as it is only generating utility functions for attributes.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D93407
28 lines
695 B
MLIR
28 lines
695 B
MLIR
// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
|
|
|
|
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
|
// CHECK-LABEL: @ret
|
|
spv.func @ret() -> () "None" {
|
|
// CHECK: spv.Return
|
|
spv.Return
|
|
}
|
|
|
|
// CHECK-LABEL: @ret_val
|
|
spv.func @ret_val() -> (i32) "None" {
|
|
%0 = spv.Variable : !spv.ptr<i32, Function>
|
|
%1 = spv.Load "Function" %0 : i32
|
|
// CHECK: spv.ReturnValue {{.*}} : i32
|
|
spv.ReturnValue %1 : i32
|
|
}
|
|
|
|
// CHECK-LABEL: @unreachable
|
|
spv.func @unreachable() "None" {
|
|
spv.Return
|
|
// CHECK-NOT: ^bb
|
|
^bb1:
|
|
// Unreachable blocks will be dropped during serialization.
|
|
// CHECK-NOT: spv.Unreachable
|
|
spv.Unreachable
|
|
}
|
|
}
|