summaryrefslogtreecommitdiff
path: root/test/CodeGenOpenCLCXX
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2019-03-19 16:50:21 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2019-03-19 16:50:21 +0000
commit32be13ac51be3fffbc4a5888a989c2073e002885 (patch)
tree68753ba7ed47713d222f6ad765a7c23568a9522b /test/CodeGenOpenCLCXX
parenteaba54eacac4dc55ecd5a5bd8b32d3cc679542e6 (diff)
downloadclang-32be13ac51be3fffbc4a5888a989c2073e002885.tar.gz
[Sema] Adjust addr space of reference operand in compound assignment
When we create overloads for the builtin compound assignment operators we need to preserve address space for the reference operand taking it from the argument that is passed in. Differential Revision: https://reviews.llvm.org/D59367 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenOpenCLCXX')
-rw-r--r--test/CodeGenOpenCLCXX/addrspace-operators.cl17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/CodeGenOpenCLCXX/addrspace-operators.cl b/test/CodeGenOpenCLCXX/addrspace-operators.cl
index d212c233d1..1f3389defd 100644
--- a/test/CodeGenOpenCLCXX/addrspace-operators.cl
+++ b/test/CodeGenOpenCLCXX/addrspace-operators.cl
@@ -14,6 +14,8 @@ public:
};
__global E globE;
+volatile __global int globVI;
+__global int globI;
//CHECK-LABEL: define spir_func void @_Z3barv()
void bar() {
C c;
@@ -25,13 +27,18 @@ void bar() {
c.OrAssign(a);
E e;
- // CHECK: store i32 1, i32* %e
+ //CHECK: store i32 1, i32* %e
e = b;
- // CHECK: store i32 0, i32 addrspace(1)* @globE
+ //CHECK: store i32 0, i32 addrspace(1)* @globE
globE = a;
- // FIXME: Sema fails here because it thinks the types are incompatible.
- //e = b;
- //globE = a;
+ //CHECK: store i32 %or, i32 addrspace(1)* @globI
+ globI |= b;
+ //CHECK: store i32 %add, i32 addrspace(1)* @globI
+ globI += a;
+ //CHECK: store volatile i32 %and, i32 addrspace(1)* @globVI
+ globVI &= b;
+ //CHECK: store volatile i32 %sub, i32 addrspace(1)* @globVI
+ globVI -= a;
}
//CHECK: define linkonce_odr void @_ZNU3AS41C6AssignE1E(%class.C addrspace(4)* %this, i32 %e)