// -----
-def SPV_UndefOp : SPV_Op<"undef", []> {
+def SPV_UndefOp : SPV_Op<"Undef", []> {
let summary = "Make an intermediate object whose value is undefined.";
let description = [{
<!-- End of AutoGen section -->
```
- undef-op ::= `spv.undef` `:` spirv-type
+ undef-op ::= `spv.Undef` `:` spirv-type
```
#### Example:
```mlir
- %0 = spv.undef : f32
- %1 = spv.undef : !spv.struct<!spv.array<4 x vector<4xi32>>>
+ %0 = spv.Undef : f32
+ %1 = spv.Undef : !spv.struct<!spv.array<4 x vector<4xi32>>>
```
}];
- A symbol referring of another spec constant.
- The SSA ID of a non-specialization constant (i.e. defined through
`spv.SpecConstant`).
- - The SSA ID of a `spv.undef`.
+ - The SSA ID of a `spv.Undef`.
```
spv-spec-constant-composite-op ::= `spv.SpecConstantComposite` symbol-ref-id ` (`
// CHECK-LABEL: @undef_scalar
spv.func @undef_scalar() "None" {
// CHECK: llvm.mlir.undef : f32
- %0 = spv.undef : f32
+ %0 = spv.Undef : f32
spv.Return
}
// CHECK-LABEL: @undef_vector
spv.func @undef_vector() "None" {
// CHECK: llvm.mlir.undef : vector<2xi32>
- %0 = spv.undef : vector<2xi32>
+ %0 = spv.Undef : vector<2xi32>
spv.Return
}
// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
//===----------------------------------------------------------------------===//
-// spv.undef
+// spv.Undef
//===----------------------------------------------------------------------===//
func @undef() -> () {
- // CHECK: %{{.*}} = spv.undef : f32
- %0 = spv.undef : f32
- // CHECK: %{{.*}} = spv.undef : vector<4xf32>
- %1 = spv.undef : vector<4xf32>
+ // CHECK: %{{.*}} = spv.Undef : f32
+ %0 = spv.Undef : f32
+ // CHECK: %{{.*}} = spv.Undef : vector<4xf32>
+ %1 = spv.Undef : vector<4xf32>
spv.Return
}
func @undef() -> () {
// expected-error @+2{{expected non-function type}}
- %0 = spv.undef :
+ %0 = spv.Undef :
spv.Return
}
func @undef() -> () {
// expected-error @+2{{expected ':'}}
- %0 = spv.undef
+ %0 = spv.Undef
spv.Return
}
spv.module Logical GLSL450 {
spv.func @rewrite(%value0 : f32, %value1 : f32, %value2 : f32, %value3 : i32, %value4: !spv.array<3xf32>) -> vector<3xf32> "None" {
- %0 = spv.undef : vector<3xf32>
+ %0 = spv.Undef : vector<3xf32>
// CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : vector<3xf32>
%1 = spv.CompositeInsert %value0, %0[0 : i32] : f32 into vector<3xf32>
%2 = spv.CompositeInsert %value1, %1[1 : i32] : f32 into vector<3xf32>
%3 = spv.CompositeInsert %value2, %2[2 : i32] : f32 into vector<3xf32>
- %4 = spv.undef : !spv.array<4xf32>
+ %4 = spv.Undef : !spv.array<4xf32>
// CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : !spv.array<4 x f32>
%5 = spv.CompositeInsert %value0, %4[0 : i32] : f32 into !spv.array<4xf32>
%6 = spv.CompositeInsert %value1, %5[1 : i32] : f32 into !spv.array<4xf32>
%7 = spv.CompositeInsert %value2, %6[2 : i32] : f32 into !spv.array<4xf32>
%8 = spv.CompositeInsert %value0, %7[3 : i32] : f32 into !spv.array<4xf32>
- %9 = spv.undef : !spv.struct<(f32, i32, f32)>
+ %9 = spv.Undef : !spv.struct<(f32, i32, f32)>
// CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : !spv.struct<(f32, i32, f32)>
%10 = spv.CompositeInsert %value0, %9[0 : i32] : f32 into !spv.struct<(f32, i32, f32)>
%11 = spv.CompositeInsert %value3, %10[1 : i32] : i32 into !spv.struct<(f32, i32, f32)>
%12 = spv.CompositeInsert %value1, %11[2 : i32] : f32 into !spv.struct<(f32, i32, f32)>
- %13 = spv.undef : !spv.struct<(f32, !spv.array<3xf32>)>
+ %13 = spv.Undef : !spv.struct<(f32, !spv.array<3xf32>)>
// CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}} : !spv.struct<(f32, !spv.array<3 x f32>)>
%14 = spv.CompositeInsert %value0, %13[0 : i32] : f32 into !spv.struct<(f32, !spv.array<3xf32>)>
%15 = spv.CompositeInsert %value4, %14[1 : i32] : !spv.array<3xf32> into !spv.struct<(f32, !spv.array<3xf32>)>
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
+ // 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>
+ // 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>>
+ // 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>
+ // 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
// CHECK: spv.func {{@.*}}
spv.func @ignore_unused_undef() -> () "None" {
// CHECK-NEXT: spv.Return
- %0 = spv.undef : f32
+ %0 = spv.Undef : f32
spv.Return
}
}