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 7 8// CHECK-120-LABEL: func @permute 9func @permute(%U0 : index, %U1 : index, %U2 : index) { 10 "abc"() : () -> () 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) -> () 16 } 17 } 18 } 19 "xyz"() : () -> () 20 return 21} 22// CHECK-120: "abc" 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) 28// CHECK-120-NEXT: } 29// CHECK-120-NEXT: } 30// CHECK-120-NEXT: } 31// CHECK-120-NEXT: "xyz" 32// CHECK-120-NEXT: return 33 34// CHECK-102: "foo"(%arg4, %arg3) 35// CHECK-102-NEXT: "bar"(%arg5) 36 37// CHECK-012: "foo"(%arg3, %arg4) 38// CHECK-012-NEXT: "bar"(%arg5) 39 40// CHECK-021: "foo"(%arg3, %arg5) 41// CHECK-021-NEXT: "bar"(%arg4) 42 43// CHECK-210: "foo"(%arg5, %arg4) 44// CHECK-210-NEXT: "bar"(%arg3) 45 46// CHECK-201: "foo"(%arg5, %arg3) 47// CHECK-201-NEXT: "bar"(%arg4) 48