@@ -3260,6 +3260,10 @@ func.func @omp_workshare_loop_wrapper_attrs(%idx : index) {
3260
3260
return
3261
3261
}
3262
3262
3263
+ func.func @omp_init_allocator (%custom_allocator : i64 ) -> i64 {
3264
+ return %custom_allocator : i64
3265
+ }
3266
+
3263
3267
// CHECK-LABEL: func.func @omp_allocate_dir(
3264
3268
// CHECK-SAME: %[[ARG0:.*]]: memref<i32>,
3265
3269
// CHECK-SAME: %[[ARG1:.*]]: memref<i32>) {
@@ -3278,16 +3282,29 @@ func.func @omp_allocate_dir(%arg0 : memref<i32>, %arg1 : memref<i32>) -> () {
3278
3282
omp.allocate_dir (%arg0 : memref <i32 >) align (2 )
3279
3283
3280
3284
// Test with one data var and allocator clause
3281
- // CHECK: omp.allocate_dir(%[[ARG0]] : memref<i32>) allocator(omp_pteam_mem_alloc)
3282
- omp.allocate_dir (%arg0 : memref <i32 >) allocator (omp_pteam_mem_alloc )
3285
+ // CHECK: %[[VAL_1:.*]] = arith.constant 1 : i64
3286
+ %omp_default_mem_alloc = arith.constant 1 : i64
3287
+ // CHECK: omp.allocate_dir(%[[ARG0]] : memref<i32>) allocator(%[[VAL_1:.*]])
3288
+ omp.allocate_dir (%arg0 : memref <i32 >) allocator (%omp_default_mem_alloc )
3283
3289
3284
3290
// Test with one data var, align clause and allocator clause
3285
- // CHECK: omp.allocate_dir(%[[ARG0]] : memref<i32>) align(2) allocator(omp_thread_mem_alloc)
3286
- omp.allocate_dir (%arg0 : memref <i32 >) align (2 ) allocator (omp_thread_mem_alloc )
3291
+ // CHECK: %[[VAL_2:.*]] = arith.constant 7 : i64
3292
+ %omp_pteam_mem_alloc = arith.constant 7 : i64
3293
+ // CHECK: omp.allocate_dir(%[[ARG0]] : memref<i32>) align(4) allocator(%[[VAL_2:.*]])
3294
+ omp.allocate_dir (%arg0 : memref <i32 >) align (4 ) allocator (%omp_pteam_mem_alloc )
3287
3295
3288
3296
// Test with two data vars, align clause and allocator clause
3289
- // CHECK: omp.allocate_dir(%[[ARG0]], %[[ARG1]] : memref<i32>, memref<i32>) align(2) allocator(omp_cgroup_mem_alloc)
3290
- omp.allocate_dir (%arg0 , %arg1 : memref <i32 >, memref <i32 >) align (2 ) allocator (omp_cgroup_mem_alloc )
3297
+ // CHECK: %[[VAL_3:.*]] = arith.constant 6 : i64
3298
+ %omp_cgroup_mem_alloc = arith.constant 6 : i64
3299
+ // CHECK: omp.allocate_dir(%[[ARG0]], %[[ARG1]] : memref<i32>, memref<i32>) align(8) allocator(%[[VAL_3:.*]])
3300
+ omp.allocate_dir (%arg0 , %arg1 : memref <i32 >, memref <i32 >) align (8 ) allocator (%omp_cgroup_mem_alloc )
3301
+
3302
+ // Test with one data var and user defined allocator clause
3303
+ // CHECK: %[[VAL_4:.*]] = arith.constant 9 : i64
3304
+ %custom_allocator = arith.constant 9 : i64
3305
+ %custom_mem_alloc = func.call @omp_init_allocator (%custom_allocator ) : (i64 ) -> (i64 )
3306
+ // CHECK: omp.allocate_dir(%[[ARG0]] : memref<i32>) allocator(%[[VAL_5:.*]])
3307
+ omp.allocate_dir (%arg0 : memref <i32 >) allocator (%custom_mem_alloc )
3291
3308
3292
3309
return
3293
3310
}
0 commit comments