Files
clang-p2996/mlir/test/Target/SPIRV/undef.mlir
Lei Zhang 0117865412 [mlir][spirv] NFC: Shuffle code around to better follow convention
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
2020-12-17 11:03:26 -05:00

34 lines
1.2 KiB
MLIR

// RUN: mlir-translate -split-input-file -test-spirv-roundtrip %s | FileCheck %s
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
spv.func @foo() -> () "None" {
// CHECK: {{%.*}} = spv.undef : f32
// CHECK-NEXT: {{%.*}} = spv.undef : f32
%0 = spv.undef : f32
%1 = spv.undef : f32
%2 = spv.FAdd %0, %1 : f32
// CHECK: {{%.*}} = spv.undef : vector<4xi32>
%3 = spv.undef : vector<4xi32>
%4 = spv.CompositeExtract %3[1 : i32] : vector<4xi32>
// CHECK: {{%.*}} = spv.undef : !spv.array<4 x !spv.array<4 x i32>>
%5 = spv.undef : !spv.array<4x!spv.array<4xi32>>
%6 = spv.CompositeExtract %5[1 : i32, 2 : i32] : !spv.array<4x!spv.array<4xi32>>
// CHECK: {{%.*}} = spv.undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
%7 = spv.undef : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>
%8 = spv.constant 0 : i32
%9 = spv.AccessChain %7[%8] : !spv.ptr<!spv.struct<(f32)>, StorageBuffer>, i32
spv.Return
}
}
// -----
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// CHECK: spv.func {{@.*}}
spv.func @ignore_unused_undef() -> () "None" {
// CHECK-NEXT: spv.Return
%0 = spv.undef : f32
spv.Return
}
}