summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2019-12-19 15:27:02 -0500
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2019-12-27 11:29:04 -0500
commit134ef0fb4b92718477a1dc9da0118f9b2dd77237 (patch)
tree15a2e92f4fbe9432c39ee9b9f2fed1cb2e6b8577
parentdc2c9b0fcf28d1d3d6f19ec15cb29dbbf1f43f9d (diff)
downloadbcm5719-llvm-134ef0fb4b92718477a1dc9da0118f9b2dd77237.tar.gz
bcm5719-llvm-134ef0fb4b92718477a1dc9da0118f9b2dd77237.zip
[OpenCL] Fix inconsistency between opencl and c11 atomic fetch max/min
There is some inconsistency between opencl and c11 atomic fetch max/min after https://reviews.llvm.org/D46386 https://reviews.llvm.org/D55562 It is not reasonable to have such inconsistencies. This patch fixes that. Differential Revision: https://reviews.llvm.org/D71725
-rw-r--r--clang/lib/Sema/SemaChecking.cpp4
-rw-r--r--clang/test/SemaOpenCL/atomic-ops.cl4
2 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b8295bc741e..d8711fb6bca 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4642,8 +4642,6 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
case AtomicExpr::AO__c11_atomic_fetch_sub:
case AtomicExpr::AO__opencl_atomic_fetch_add:
case AtomicExpr::AO__opencl_atomic_fetch_sub:
- case AtomicExpr::AO__opencl_atomic_fetch_min:
- case AtomicExpr::AO__opencl_atomic_fetch_max:
case AtomicExpr::AO__atomic_fetch_add:
case AtomicExpr::AO__atomic_fetch_sub:
case AtomicExpr::AO__atomic_add_fetch:
@@ -4666,6 +4664,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
case AtomicExpr::AO__atomic_nand_fetch:
case AtomicExpr::AO__c11_atomic_fetch_min:
case AtomicExpr::AO__c11_atomic_fetch_max:
+ case AtomicExpr::AO__opencl_atomic_fetch_min:
+ case AtomicExpr::AO__opencl_atomic_fetch_max:
case AtomicExpr::AO__atomic_min_fetch:
case AtomicExpr::AO__atomic_max_fetch:
case AtomicExpr::AO__atomic_fetch_min:
diff --git a/clang/test/SemaOpenCL/atomic-ops.cl b/clang/test/SemaOpenCL/atomic-ops.cl
index c95c73d52e5..5a8c6fc4fbd 100644
--- a/clang/test/SemaOpenCL/atomic-ops.cl
+++ b/clang/test/SemaOpenCL/atomic-ops.cl
@@ -77,8 +77,8 @@ void f(atomic_int *i, const atomic_int *ci,
__opencl_atomic_fetch_min(i, 1, memory_order_seq_cst, memory_scope_work_group);
__opencl_atomic_fetch_max(i, 1, memory_order_seq_cst, memory_scope_work_group);
- __opencl_atomic_fetch_min(d, 1, memory_order_seq_cst, memory_scope_work_group); // expected-error {{address argument to atomic operation must be a pointer to atomic integer or pointer ('__generic atomic_float *' (aka '__generic _Atomic(float) *') invalid)}}
- __opencl_atomic_fetch_max(d, 1, memory_order_seq_cst, memory_scope_work_group); // expected-error {{address argument to atomic operation must be a pointer to atomic integer or pointer ('__generic atomic_float *' (aka '__generic _Atomic(float) *') invalid)}}
+ __opencl_atomic_fetch_min(d, 1, memory_order_seq_cst, memory_scope_work_group); // expected-error {{address argument to atomic operation must be a pointer to atomic integer ('__generic atomic_float *' (aka '__generic _Atomic(float) *') invalid)}}
+ __opencl_atomic_fetch_max(d, 1, memory_order_seq_cst, memory_scope_work_group); // expected-error {{address argument to atomic operation must be a pointer to atomic integer ('__generic atomic_float *' (aka '__generic _Atomic(float) *') invalid)}}
bool cmpexch_1 = __opencl_atomic_compare_exchange_strong(i, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group);
bool cmpexch_2 = __opencl_atomic_compare_exchange_strong(p, P, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group);
OpenPOWER on IntegriCloud