|
| 1 | +// RUN: mlir-opt -split-input-file -verify-diagnostics %s |
| 2 | + |
| 3 | +//===----------------------------------------------------------------------===// |
| 4 | +// spirv.LoadOp |
| 5 | +//===----------------------------------------------------------------------===// |
| 6 | + |
| 7 | +func.func @aligned_load_non_positive() -> () { |
| 8 | + %0 = spirv.Variable : !spirv.ptr<f32, Function> |
| 9 | + // expected-error@below {{'spirv.Load' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} |
| 10 | + %1 = spirv.Load "Function" %0 ["Aligned", 0] : f32 |
| 11 | + return |
| 12 | +} |
| 13 | + |
| 14 | +// ----- |
| 15 | + |
| 16 | +func.func @aligned_load_non_power_of_two() -> () { |
| 17 | + %0 = spirv.Variable : !spirv.ptr<f32, Function> |
| 18 | + // expected-error@below {{'spirv.Load' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} |
| 19 | + %1 = spirv.Load "Function" %0 ["Aligned", 3] : f32 |
| 20 | + return |
| 21 | +} |
| 22 | + |
| 23 | +// ----- |
| 24 | + |
| 25 | +//===----------------------------------------------------------------------===// |
| 26 | +// spirv.StoreOp |
| 27 | +//===----------------------------------------------------------------------===// |
| 28 | + |
| 29 | +func.func @aligned_store_non_positive(%arg0 : f32) -> () { |
| 30 | + %0 = spirv.Variable : !spirv.ptr<f32, Function> |
| 31 | + // expected-error@below {{'spirv.Store' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} |
| 32 | + spirv.Store "Function" %0, %arg0 ["Aligned", 0] : f32 |
| 33 | + return |
| 34 | +} |
| 35 | + |
| 36 | +// ----- |
| 37 | + |
| 38 | +func.func @aligned_store_non_power_of_two(%arg0 : f32) -> () { |
| 39 | + %0 = spirv.Variable : !spirv.ptr<f32, Function> |
| 40 | + // expected-error@below {{'spirv.Store' op attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} |
| 41 | + spirv.Store "Function" %0, %arg0 ["Aligned", 3] : f32 |
| 42 | + return |
| 43 | +} |
0 commit comments