1 // RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-permutation="permutation-map=1,2,0" | FileCheck %s --check-prefix=CHECK-120
2 // RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-permutation="permutation-map=1,0,2" | FileCheck %s --check-prefix=CHECK-102
3 // RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-permutation="permutation-map=0,1,2" | FileCheck %s --check-prefix=CHECK-012
4 // RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-permutation="permutation-map=0,2,1" | FileCheck %s --check-prefix=CHECK-021
5 // RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-permutation="permutation-map=2,0,1" | FileCheck %s --check-prefix=CHECK-201
6 // RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-permutation="permutation-map=2,1,0" | FileCheck %s --check-prefix=CHECK-210
8 // CHECK-120-LABEL: func @permute
9 func.func @permute(%U0 : index, %U1 : index, %U2 : index) {
11 affine.for %arg0 = 0 to %U0 {
12 affine.for %arg1 = 0 to %U1 {
13 affine.for %arg2 = 0 to %U2 {
14 "foo"(%arg0, %arg1) : (index, index) -> ()
15 "bar"(%arg2) : (index) -> ()
23 // CHECK-120-NEXT: affine.for
24 // CHECK-120-NEXT: affine.for
25 // CHECK-120-NEXT: affine.for
26 // CHECK-120-NEXT: "foo"(%arg4, %arg5)
27 // CHECK-120-NEXT: "bar"(%arg3)
31 // CHECK-120-NEXT: "xyz"
32 // CHECK-120-NEXT: return
34 // CHECK-102: "foo"(%arg4, %arg3)
35 // CHECK-102-NEXT: "bar"(%arg5)
37 // CHECK-012: "foo"(%arg3, %arg4)
38 // CHECK-012-NEXT: "bar"(%arg5)
40 // CHECK-021: "foo"(%arg3, %arg5)
41 // CHECK-021-NEXT: "bar"(%arg4)
43 // CHECK-210: "foo"(%arg5, %arg4)
44 // CHECK-210-NEXT: "bar"(%arg3)
46 // CHECK-201: "foo"(%arg5, %arg3)
47 // CHECK-201-NEXT: "bar"(%arg4)