Mercurial > hg > CbC > CbC_llvm
comparison mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
1 // RUN: mlir-translate -mlir-to-llvmir %s -split-input-file -verify-diagnostics | 1 // RUN: mlir-translate -mlir-to-llvmir %s -split-input-file -verify-diagnostics |
2 | 2 |
3 // Checking translation when the update is carried out by using more than one op | 3 // Checking translation when the update is carried out by using more than one op |
4 // in the region. | 4 // in the region. |
5 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32) { | 5 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32) { |
6 // expected-error @+2 {{exactly two operations are allowed inside an atomic update region while lowering to LLVM IR}} | |
7 // expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.update}} | |
8 omp.atomic.update %x : !llvm.ptr<i32> { | 6 omp.atomic.update %x : !llvm.ptr<i32> { |
9 ^bb0(%xval: i32): | 7 ^bb0(%xval: i32): |
10 %t1 = llvm.mul %xval, %expr : i32 | 8 %t1 = llvm.mul %xval, %expr : i32 |
11 %t2 = llvm.sdiv %t1, %expr : i32 | 9 %t2 = llvm.sdiv %t1, %expr : i32 |
12 %newval = llvm.add %xval, %t2 : i32 | 10 %newval = llvm.add %xval, %t2 : i32 |
18 // ----- | 16 // ----- |
19 | 17 |
20 // Checking translation when the captured variable is not used in the inner | 18 // Checking translation when the captured variable is not used in the inner |
21 // update operation | 19 // update operation |
22 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32) { | 20 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32) { |
23 // expected-error @+2 {{the update operation inside the region must be a binary operation and that update operation must have the region argument as an operand}} | 21 // expected-error @+2 {{no atomic update operation with region argument as operand found inside atomic.update region}} |
24 // expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.update}} | 22 // expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.update}} |
25 omp.atomic.update %x : !llvm.ptr<i32> { | 23 omp.atomic.update %x : !llvm.ptr<i32> { |
26 ^bb0(%xval: i32): | 24 ^bb0(%xval: i32): |
27 %newval = llvm.mul %expr, %expr : i32 | 25 %newval = llvm.mul %expr, %expr : i32 |
28 omp.yield(%newval : i32) | 26 omp.yield(%newval : i32) |
35 // Checking translation when the update is carried out by using more than one | 33 // Checking translation when the update is carried out by using more than one |
36 // operations in the atomic capture region. | 34 // operations in the atomic capture region. |
37 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.ptr<i32>, %expr: i32) { | 35 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.ptr<i32>, %expr: i32) { |
38 // expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.capture}} | 36 // expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.capture}} |
39 omp.atomic.capture memory_order(seq_cst) { | 37 omp.atomic.capture memory_order(seq_cst) { |
40 omp.atomic.read %v = %x : !llvm.ptr<i32> | 38 omp.atomic.read %v = %x : !llvm.ptr<i32>, i32 |
41 // expected-error @+1 {{the update operation inside the region must be a binary operation and that update operation must have the region argument as an operand}} | 39 // expected-error @+1 {{no atomic update operation with region argument as operand found inside atomic.update region}} |
42 omp.atomic.update %x : !llvm.ptr<i32> { | 40 omp.atomic.update %x : !llvm.ptr<i32> { |
43 ^bb0(%xval: i32): | 41 ^bb0(%xval: i32): |
44 %newval = llvm.mul %expr, %expr : i32 | 42 %newval = llvm.mul %expr, %expr : i32 |
45 omp.yield(%newval : i32) | 43 omp.yield(%newval : i32) |
46 } | 44 } |
51 // ----- | 49 // ----- |
52 | 50 |
53 // Checking translation when the captured variable is not used in the inner | 51 // Checking translation when the captured variable is not used in the inner |
54 // update operation | 52 // update operation |
55 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.ptr<i32>, %expr: i32) { | 53 llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.ptr<i32>, %expr: i32) { |
56 // expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.capture}} | |
57 omp.atomic.capture memory_order(seq_cst) { | 54 omp.atomic.capture memory_order(seq_cst) { |
58 omp.atomic.read %v = %x : !llvm.ptr<i32> | 55 omp.atomic.read %v = %x : !llvm.ptr<i32>, i32 |
59 // expected-error @+1 {{exactly two operations are allowed inside an atomic update region while lowering to LLVM IR}} | |
60 omp.atomic.update %x : !llvm.ptr<i32> { | 56 omp.atomic.update %x : !llvm.ptr<i32> { |
61 ^bb0(%xval: i32): | 57 ^bb0(%xval: i32): |
62 %t1 = llvm.mul %xval, %expr : i32 | 58 %t1 = llvm.mul %xval, %expr : i32 |
63 %t2 = llvm.sdiv %t1, %expr : i32 | 59 %t2 = llvm.sdiv %t1, %expr : i32 |
64 %newval = llvm.add %xval, %t2 : i32 | 60 %newval = llvm.add %xval, %t2 : i32 |