@@ -382,6 +382,50 @@ def LoopNestOp : OpenMP_Op<"loop_nest", traits = [
382
382
// 2.9.2 Workshare Loop Construct
383
383
//===----------------------------------------------------------------------===//
384
384
385
+ def LoopOp : OpenMP_Op<"loop", traits = [
386
+ AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
387
+ NoTerminator, SingleBlock
388
+ ], clauses = [
389
+ OpenMP_BindClause, OpenMP_PrivateClause, OpenMP_OrderClause,
390
+ OpenMP_ReductionClause
391
+ ], singleRegion = true> {
392
+ let summary = "loop construct";
393
+ let description = [{
394
+ A loop construct specifies that the logical iterations of the associated loops
395
+ may execute concurrently and permits the encountering threads to execute the
396
+ loop accordingly. A loop construct can have 3 different types of binding:
397
+ 1. teams: in which case the binding region is the innermost enclosing `teams`
398
+ region.
399
+ 2. parallel: in which case the binding region is the innermost enclosing `parallel`
400
+ region.
401
+ 3. thread: in which case the binding region is not defined.
402
+
403
+ The body region can only contain a single block which must contain a single
404
+ operation, this operation must be an `omp.loop_nest`.
405
+
406
+ ```
407
+ omp.loop <clauses> {
408
+ omp.loop_nest (%i1, %i2) : index = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
409
+ %a = load %arrA[%i1, %i2] : memref<?x?xf32>
410
+ %b = load %arrB[%i1, %i2] : memref<?x?xf32>
411
+ %sum = arith.addf %a, %b : f32
412
+ store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
413
+ omp.yield
414
+ }
415
+ }
416
+ ```
417
+ }] # clausesDescription;
418
+
419
+ let assemblyFormat = clausesAssemblyFormat # [{
420
+ custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
421
+ $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
422
+ $reduction_syms) attr-dict
423
+ }];
424
+
425
+ let hasVerifier = 1;
426
+ let hasRegionVerifier = 1;
427
+ }
428
+
385
429
def WsloopOp : OpenMP_Op<"wsloop", traits = [
386
430
AttrSizedOperandSegments, DeclareOpInterfaceMethods<ComposableOpInterface>,
387
431
DeclareOpInterfaceMethods<LoopWrapperInterface>, NoTerminator,
0 commit comments