44 lines · plain
1// RUN: mlir-opt --split-input-file --verify-diagnostics %s2 3//===----------------------------------------------------------------------===//4// spirv.LoadOp5//===----------------------------------------------------------------------===//6 7func.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] : f3211 return12}13 14// -----15 16func.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] : f3220 return21}22 23// -----24 25//===----------------------------------------------------------------------===//26// spirv.StoreOp27//===----------------------------------------------------------------------===//28 29func.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] : f3233 return34}35 36// -----37 38func.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] : f3242 return43}44