[PATCH] D46015: [OpenCL] Add separate read_only and write_only pipe IR types

2018-04-24 Thread Stuart Brady via Phabricator via cfe-commits
stuart created this revision.
stuart added reviewers: Anastasia, yaxunl.
Herald added a subscriber: cfe-commits.

SPIR-V encodes the read_only and write_only access qualifiers of pipes,
so separate LLVM IR types are required to target SPIR-V.  Other backends
may also find this useful.

These new types are opencl.pipe_ro_t and opencl.pipe_wo_t, which replace
opencl.pipe_t.

This replaces __get_pipe_num_packets(...) and __get_pipe_max_packets(...)
which took a read_only pipe with separate versions for read_only and
write_only pipes, namely:

- __get_pipe_num_packets_ro(...)
- __get_pipe_num_packets_wo(...)
- __get_pipe_max_packets_ro(...)
- __get_pipe_max_packets_wo(...)


Repository:
  rC Clang

https://reviews.llvm.org/D46015

Files:
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenCLRuntime.h
  test/CodeGenOpenCL/opencl_types.cl
  test/CodeGenOpenCL/pipe_builtin.cl
  test/CodeGenOpenCL/pipe_types.cl
  test/Index/pipe-size.cl

Index: test/Index/pipe-size.cl
===
--- test/Index/pipe-size.cl
+++ test/Index/pipe-size.cl
@@ -5,12 +5,12 @@
 __kernel void testPipe( pipe int test )
 {
 int s = sizeof(test);
-// X86: store %opencl.pipe_t* %test, %opencl.pipe_t** %test.addr, align 8
+// X86: store %opencl.pipe_ro_t* %test, %opencl.pipe_ro_t** %test.addr, align 8
 // X86: store i32 8, i32* %s, align 4
-// SPIR: store %opencl.pipe_t addrspace(1)* %test, %opencl.pipe_t addrspace(1)** %test.addr, align 4
+// SPIR: store %opencl.pipe_ro_t addrspace(1)* %test, %opencl.pipe_ro_t addrspace(1)** %test.addr, align 4
 // SPIR: store i32 4, i32* %s, align 4
-// SPIR64: store %opencl.pipe_t addrspace(1)* %test, %opencl.pipe_t addrspace(1)** %test.addr, align 8
+// SPIR64: store %opencl.pipe_ro_t addrspace(1)* %test, %opencl.pipe_ro_t addrspace(1)** %test.addr, align 8
 // SPIR64: store i32 8, i32* %s, align 4
-// AMDGCN: store %opencl.pipe_t addrspace(1)* %test, %opencl.pipe_t addrspace(1)* addrspace(5)* %test.addr, align 8
+// AMDGCN: store %opencl.pipe_ro_t addrspace(1)* %test, %opencl.pipe_ro_t addrspace(1)* addrspace(5)* %test.addr, align 8
 // AMDGCN: store i32 8, i32 addrspace(5)* %s, align 4
 }
Index: test/CodeGenOpenCL/pipe_types.cl
===
--- test/CodeGenOpenCL/pipe_types.cl
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -1,34 +1,35 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
 
-// CHECK: %opencl.pipe_t = type opaque
+// CHECK: %opencl.pipe_ro_t = type opaque
+// CHECK: %opencl.pipe_wo_t = type opaque
 typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
 typedef int __attribute__((ext_vector_type(4))) int4;
 
 void test1(read_only pipe int p) {
-// CHECK: define void @test1(%opencl.pipe_t* %p)
+// CHECK: define void @test1(%opencl.pipe_ro_t* %p)
   reserve_id_t rid;
 // CHECK: %rid = alloca %opencl.reserve_id_t
 }
 
 void test2(write_only pipe float p) {
-// CHECK: define void @test2(%opencl.pipe_t* %p)
+// CHECK: define void @test2(%opencl.pipe_wo_t* %p)
 }
 
 void test3(read_only pipe const int p) {
-// CHECK: define void @test3(%opencl.pipe_t* %p)
+// CHECK: define void @test3(%opencl.pipe_ro_t* %p)
 }
 
 void test4(read_only pipe uchar3 p) {
-// CHECK: define void @test4(%opencl.pipe_t* %p)
+// CHECK: define void @test4(%opencl.pipe_ro_t* %p)
 }
 
 void test5(read_only pipe int4 p) {
-// CHECK: define void @test5(%opencl.pipe_t* %p)
+// CHECK: define void @test5(%opencl.pipe_ro_t* %p)
 }
 
 typedef read_only pipe int MyPipe;
 kernel void test6(MyPipe p) {
-// CHECK: define spir_kernel void @test6(%opencl.pipe_t* %p)
+// CHECK: define spir_kernel void @test6(%opencl.pipe_ro_t* %p)
 }
 
 struct Person {
@@ -41,7 +42,7 @@
  read_only pipe struct Person SPipe) {
 // CHECK: define void @test_reserved_read_pipe
   read_pipe (SPipe, SDst);
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
   read_pipe (SPipe, SDst);
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
 }
Index: test/CodeGenOpenCL/pipe_builtin.cl
===
--- test/CodeGenOpenCL/pipe_builtin.cl
+++ test/CodeGenOpenCL/pipe_builtin.cl
@@ -1,79 +1,93 @@
 // RUN: %clang_cc1 -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
 
-// CHECK: %opencl.pipe_t = type opaque
-// CHECK: %opencl.reserve_id_t = type opaque
+// CHECK-DAG: %opencl.pipe_ro_t = type opaque
+// CHECK-DAG: %opencl.pipe_wo_t = type opaque
+// CHECK-DAG: %opencl.reserve_id_t = type opaque
 
 #pragma OPENCL EXTENSION cl_khr_subgroups : enable
 
 void test

[PATCH] D46015: [OpenCL] Add separate read_only and write_only pipe IR types

2018-04-25 Thread Stuart Brady via Phabricator via cfe-commits
stuart updated this revision to Diff 143938.
stuart edited the summary of this revision.
stuart added a comment.

Changed new getPipeType() method to have protected visibility.

Updated summary to explain the need for the extra builtin implementation 
functions.


https://reviews.llvm.org/D46015

Files:
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenCLRuntime.h
  test/CodeGenOpenCL/opencl_types.cl
  test/CodeGenOpenCL/pipe_builtin.cl
  test/CodeGenOpenCL/pipe_types.cl
  test/Index/pipe-size.cl

Index: test/Index/pipe-size.cl
===
--- test/Index/pipe-size.cl
+++ test/Index/pipe-size.cl
@@ -5,12 +5,12 @@
 __kernel void testPipe( pipe int test )
 {
 int s = sizeof(test);
-// X86: store %opencl.pipe_t* %test, %opencl.pipe_t** %test.addr, align 8
+// X86: store %opencl.pipe_ro_t* %test, %opencl.pipe_ro_t** %test.addr, align 8
 // X86: store i32 8, i32* %s, align 4
-// SPIR: store %opencl.pipe_t addrspace(1)* %test, %opencl.pipe_t addrspace(1)** %test.addr, align 4
+// SPIR: store %opencl.pipe_ro_t addrspace(1)* %test, %opencl.pipe_ro_t addrspace(1)** %test.addr, align 4
 // SPIR: store i32 4, i32* %s, align 4
-// SPIR64: store %opencl.pipe_t addrspace(1)* %test, %opencl.pipe_t addrspace(1)** %test.addr, align 8
+// SPIR64: store %opencl.pipe_ro_t addrspace(1)* %test, %opencl.pipe_ro_t addrspace(1)** %test.addr, align 8
 // SPIR64: store i32 8, i32* %s, align 4
-// AMDGCN: store %opencl.pipe_t addrspace(1)* %test, %opencl.pipe_t addrspace(1)* addrspace(5)* %test.addr, align 8
+// AMDGCN: store %opencl.pipe_ro_t addrspace(1)* %test, %opencl.pipe_ro_t addrspace(1)* addrspace(5)* %test.addr, align 8
 // AMDGCN: store i32 8, i32 addrspace(5)* %s, align 4
 }
Index: test/CodeGenOpenCL/pipe_types.cl
===
--- test/CodeGenOpenCL/pipe_types.cl
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -1,34 +1,35 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
 
-// CHECK: %opencl.pipe_t = type opaque
+// CHECK: %opencl.pipe_ro_t = type opaque
+// CHECK: %opencl.pipe_wo_t = type opaque
 typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
 typedef int __attribute__((ext_vector_type(4))) int4;
 
 void test1(read_only pipe int p) {
-// CHECK: define void @test1(%opencl.pipe_t* %p)
+// CHECK: define void @test1(%opencl.pipe_ro_t* %p)
   reserve_id_t rid;
 // CHECK: %rid = alloca %opencl.reserve_id_t
 }
 
 void test2(write_only pipe float p) {
-// CHECK: define void @test2(%opencl.pipe_t* %p)
+// CHECK: define void @test2(%opencl.pipe_wo_t* %p)
 }
 
 void test3(read_only pipe const int p) {
-// CHECK: define void @test3(%opencl.pipe_t* %p)
+// CHECK: define void @test3(%opencl.pipe_ro_t* %p)
 }
 
 void test4(read_only pipe uchar3 p) {
-// CHECK: define void @test4(%opencl.pipe_t* %p)
+// CHECK: define void @test4(%opencl.pipe_ro_t* %p)
 }
 
 void test5(read_only pipe int4 p) {
-// CHECK: define void @test5(%opencl.pipe_t* %p)
+// CHECK: define void @test5(%opencl.pipe_ro_t* %p)
 }
 
 typedef read_only pipe int MyPipe;
 kernel void test6(MyPipe p) {
-// CHECK: define spir_kernel void @test6(%opencl.pipe_t* %p)
+// CHECK: define spir_kernel void @test6(%opencl.pipe_ro_t* %p)
 }
 
 struct Person {
@@ -41,7 +42,7 @@
  read_only pipe struct Person SPipe) {
 // CHECK: define void @test_reserved_read_pipe
   read_pipe (SPipe, SDst);
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
   read_pipe (SPipe, SDst);
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
 }
Index: test/CodeGenOpenCL/pipe_builtin.cl
===
--- test/CodeGenOpenCL/pipe_builtin.cl
+++ test/CodeGenOpenCL/pipe_builtin.cl
@@ -1,79 +1,93 @@
 // RUN: %clang_cc1 -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
 
-// CHECK: %opencl.pipe_t = type opaque
-// CHECK: %opencl.reserve_id_t = type opaque
+// CHECK-DAG: %opencl.pipe_ro_t = type opaque
+// CHECK-DAG: %opencl.pipe_wo_t = type opaque
+// CHECK-DAG: %opencl.reserve_id_t = type opaque
 
 #pragma OPENCL EXTENSION cl_khr_subgroups : enable
 
 void test1(read_only pipe int p, global int *ptr) {
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 4, i32 4)
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 4, i32 4)
   read_pipe(p, ptr);
-  // CHECK: call %opencl.reserve_id_t* @__reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}, i32 4, i32 4)
+  // CHECK: call %opencl.reserve_id_t* @__reserve_read_pipe(%opencl.pipe_ro_t* %

[PATCH] D46015: [OpenCL] Add separate read_only and write_only pipe IR types

2018-04-25 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

In https://reviews.llvm.org/D46015#1077401, @AlexeySotkin wrote:

> It is not clear why we need two versions of get_pipe_num_packets and 
> get_pipe_max_packets builtins. There is only one instruction per builtin in 
> the SPIR-V spec. I think splitting the IR type is enough for translation to 
> SPIR-V purposes.


This is so that when we emit the builtin expression, we can call a function 
that matches the access qualifier of the argument to the builtin, without the 
need for a bitcast of either the builtin's argument or the 
__get_pipe_max/num_packets() function itself.




Comment at: lib/CodeGen/CGOpenCLRuntime.h:65
   virtual llvm::Type *getPipeType(const PipeType *T);
+  virtual llvm::Type *getPipeType(const PipeType *T, StringRef Name,
+  llvm::Type *&PipeTy);

AlexeySotkin wrote:
> I'm not sure that it is a good idea to make this function public, as its 
> parameter supposed to be a reference to protected member.
That's a good point. I have changed the function to be protected, to match the 
visibility of the data member.


https://reviews.llvm.org/D46015



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46015: [OpenCL] Add separate read_only and write_only pipe IR types

2018-04-25 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

In https://reviews.llvm.org/D46015#1078217, @AlexeySotkin wrote:

> There should not be need for bitcast. Could give an example ? Thanks.


If I have a `write_only` pipe as the argument to `get_pipe_max_packets()`, and 
this uses a single `__get_pipe_num_packets()` function taking a `read_only` 
pipe, we will automatically get a bitcast:

  %20 = call i32 bitcast (i32 (%opencl.pipe_ro_t*, i32, i32)* 
@__get_pipe_max_packets to i32 (%opencl.pipe_wo_t*, i32, 
i32)*)(%opencl.pipe_wo_t* %19, i32 4, i32 4)


https://reviews.llvm.org/D46015



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46015: [OpenCL] Add separate read_only and write_only pipe IR types

2018-04-25 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

In https://reviews.llvm.org/D46015#1078260, @AlexeySotkin wrote:

> In https://reviews.llvm.org/D46015#1078235, @stuart wrote:
>
> > In https://reviews.llvm.org/D46015#1078217, @AlexeySotkin wrote:
> >
> > > There should not be need for bitcast. Could give an example ? Thanks.
> >
> >
> > If I have a `write_only` pipe as the argument to `get_pipe_max_packets()`, 
> > and this uses a single `__get_pipe_num_packets()` function taking a 
> > `read_only` pipe, we will automatically get a bitcast:
> >
> >   %20 = call i32 bitcast (i32 (%opencl.pipe_ro_t*, i32, i32)* 
> > @__get_pipe_max_packets to i32 (%opencl.pipe_wo_t*, i32, 
> > i32)*)(%opencl.pipe_wo_t* %19, i32 4, i32 4)
> >
>
>
> Sorry, but I don't quite understand what does  `get_pipe_max_packets()`, 
> **uses** `__get_pipe_num_packets()`  mean. Could you clarify? Possibly OpenCL 
> C source example could help.


I mean that without these two separate versions, the call to 
`__get_pipe_num_packets()` that is emitted can include a bitcast.

For example:

  void foo(read_only pipe int r, write_only pipe int w) {
get_pipe_num_packets(w);
get_pipe_num_packets(r);
  }

`get_pipe_num_packets(w)` is seen first, causing `i32 
@__get_pipe_num_packets(%opencl.pipe_wo_t*, i32, i32)` to be implicitly 
declared.

When the call to `__get_pipe_num_packets()` is emitted, this will be with an 
autogenerated bitcast from the type of the implicit declaration, i.e. `i32 
(%opencl.pipe_wo_t*, i32, i32)*` to the type in the emitted expression, i.e. 
`i32 (%opencl.pipe_ro_t*, i32, i32)*`.

Here is the relevant section of IR:

  %0 = load %opencl.pipe_wo_t*, %opencl.pipe_wo_t** %w.addr, align 8
  %1 = call i32 @__get_pipe_num_packets_ro(%opencl.pipe_wo_t* %0, i32 4, i32 4)
  %2 = load %opencl.pipe_ro_t*, %opencl.pipe_ro_t** %r.addr, align 8
  %3 = call i32 bitcast (i32 (%opencl.pipe_wo_t*, i32, i32)* 
@__get_pipe_num_packets_ro to i32 (%opencl.pipe_ro_t*, i32, 
i32)*)(%opencl.pipe_ro_t* %2, i32 4, i32 4)

If we swap the two calls to `__get_pipe_num_packets()` in the example above, 
then the type of the implicit declaration will be `i32 (%opencl.pipe_ro_t*, 
i32, i32)*` and bitcasts will instead be automatically generated when using 
`get_pipe_num_packets()` with a `write_only` pipe. It seems especially 
unfortunate that the type of the implicit declaration varies depending on the 
access qualifier of the first use.


https://reviews.llvm.org/D46015



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106434: [OpenCL] Add cl_khr_integer_dot_product

2021-07-22 Thread Stuart Brady via Phabricator via cfe-commits
stuart accepted this revision.
stuart added a comment.

LGTM, too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106434/new/

https://reviews.llvm.org/D106434

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D96151: [OpenCL] Fix pipe type printing in arg info metadata

2021-02-05 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

This looks like a really good cleanup, in addition to fixing the metadata for 
pipes.

Minor nit: "matadata" -> "metadata" in the description, and there's a StringRef 
construction that could be sunk.




Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1496-1507
+  auto getTypeSpelling = [&](QualType Ty) {
+auto typeName = Ty.getUnqualifiedType().getAsString(Policy);
+
+StringRef typeNameRef = typeName;
+// Turn "unsigned type" to "utype"
+if (Ty.isCanonical()) {
+  if (typeNameRef.consume_front("unsigned "))

This seems far cleaner than the code it replaces!



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1499
+
+StringRef typeNameRef = typeName;
+// Turn "unsigned type" to "utype"

Would it be better to sink this into the `if (Ty.isCanonical())` block?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96151/new/

https://reviews.llvm.org/D96151

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D96161: [OpenCL] Fix printing of types with signed prefix in arg info metadata

2021-02-05 Thread Stuart Brady via Phabricator via cfe-commits
stuart requested changes to this revision.
stuart added a comment.
This revision now requires changes to proceed.

Looks good.  Small nit about the test case.




Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1500
 StringRef typeNameRef = typeName;
 // Turn "unsigned type" to "utype"
 if (Ty.isCanonical()) {

It'd make sense to push this comment down one line, above the 
`consume_front("unsigned ")` call, as it doesn't apply to the 
`consume_front("signed ")` call - or reword it so it covers both substitutions.



Comment at: clang/test/CodeGenOpenCL/kernel-arg-info.cl:110
 
+kernel void foo9(signed int si1,  global const signed int* si2) {}
+// CHECK: define{{.*}} spir_kernel void @foo9{{[^!]+}}

`signed char` would be a better test case, here (although it may be good to 
test `signed int` as well).

I believe (but I haven't checked in detail) that for `int` the canonical naming 
is either `int` or `unsigned int` (i.e. `signed int` will not occur) whereas 
for `char`, the canonical naming is `unsigned char`, `signed char` (explicitly 
stated) or simply `char` (unstated signedness). (I am basing this on metadata 
that I have seen, and the understanding that in C, the signedness of `char` 
with no explicit `signed` or `unsigned` specifier is implementation-defined.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96161/new/

https://reviews.llvm.org/D96161

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110636: [OpenCL][NFC] Refactor vloada_half and vstorea_half decls

2021-09-28 Thread Stuart Brady via Phabricator via cfe-commits
stuart created this revision.
stuart added reviewers: svenvh, Anastasia, airlied, yaxunl.
Herald added a subscriber: ldrumm.
stuart requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Group them together with the vload_half and vstore_half decls for simplicity.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110636

Files:
  clang/lib/Sema/OpenCLBuiltins.td


Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -808,9 +808,6 @@
 def : Builtin, Size, 
PointerType, AS>]>;
 def : Builtin, Size, 
PointerType, AS>]>;
   }
-  foreach name = ["vloada_half" # VSize] in {
-def : Builtin, Size, 
PointerType, AS>]>;
-  }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
   def : Builtin, Size, 
PointerType]>;
@@ -825,12 +822,6 @@
   def : Builtin, Size, 
PointerType]>;
   def : Builtin, Size, 
PointerType]>;
 }
-foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-  foreach name = ["vstorea_half" # VSize # rnd] in {
-def : Builtin, Size, 
PointerType]>;
-def : Builtin, Size, 
PointerType]>;
-  }
-}
   }
 }
   }
@@ -849,7 +840,7 @@
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, 
AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vload_half" # VSize] in {
+  foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
 def : Builtin, Size, 
PointerType, AS>]>;
   }
 }
@@ -860,7 +851,7 @@
   def : Builtin]>;
 }
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vstore_half" # VSize # rnd] in {
+  foreach name = ["vstore_half" # VSize # rnd, "vstorea_half" # VSize 
# rnd] in {
 def : Builtin, Size, 
PointerType]>;
 def : Builtin, Size, 
PointerType]>;
   }


Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -808,9 +808,6 @@
 def : Builtin, Size, PointerType, AS>]>;
 def : Builtin, Size, PointerType, AS>]>;
   }
-  foreach name = ["vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-  }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
   def : Builtin, Size, PointerType]>;
@@ -825,12 +822,6 @@
   def : Builtin, Size, PointerType]>;
   def : Builtin, Size, PointerType]>;
 }
-foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-  foreach name = ["vstorea_half" # VSize # rnd] in {
-def : Builtin, Size, PointerType]>;
-def : Builtin, Size, PointerType]>;
-  }
-}
   }
 }
   }
@@ -849,7 +840,7 @@
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vload_half" # VSize] in {
+  foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
 def : Builtin, Size, PointerType, AS>]>;
   }
 }
@@ -860,7 +851,7 @@
   def : Builtin]>;
 }
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vstore_half" # VSize # rnd] in {
+  foreach name = ["vstore_half" # VSize # rnd, "vstorea_half" # VSize # rnd] in {
 def : Builtin, Size, PointerType]>;
 def : Builtin, Size, PointerType]>;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110636: [OpenCL][NFC] Refactor vloada_half and vstorea_half decls

2021-09-29 Thread Stuart Brady via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG26db178cc2b3: [OpenCL][NFC] Refactor vloada_half and 
vstorea_half decls (authored by stuart).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110636/new/

https://reviews.llvm.org/D110636

Files:
  clang/lib/Sema/OpenCLBuiltins.td


Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -808,9 +808,6 @@
 def : Builtin, Size, 
PointerType, AS>]>;
 def : Builtin, Size, 
PointerType, AS>]>;
   }
-  foreach name = ["vloada_half" # VSize] in {
-def : Builtin, Size, 
PointerType, AS>]>;
-  }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
   def : Builtin, Size, 
PointerType]>;
@@ -825,12 +822,6 @@
   def : Builtin, Size, 
PointerType]>;
   def : Builtin, Size, 
PointerType]>;
 }
-foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-  foreach name = ["vstorea_half" # VSize # rnd] in {
-def : Builtin, Size, 
PointerType]>;
-def : Builtin, Size, 
PointerType]>;
-  }
-}
   }
 }
   }
@@ -849,7 +840,7 @@
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, 
AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vload_half" # VSize] in {
+  foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
 def : Builtin, Size, 
PointerType, AS>]>;
   }
 }
@@ -860,7 +851,7 @@
   def : Builtin]>;
 }
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vstore_half" # VSize # rnd] in {
+  foreach name = ["vstore_half" # VSize # rnd, "vstorea_half" # VSize 
# rnd] in {
 def : Builtin, Size, 
PointerType]>;
 def : Builtin, Size, 
PointerType]>;
   }


Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -808,9 +808,6 @@
 def : Builtin, Size, PointerType, AS>]>;
 def : Builtin, Size, PointerType, AS>]>;
   }
-  foreach name = ["vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-  }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
   def : Builtin, Size, PointerType]>;
@@ -825,12 +822,6 @@
   def : Builtin, Size, PointerType]>;
   def : Builtin, Size, PointerType]>;
 }
-foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-  foreach name = ["vstorea_half" # VSize # rnd] in {
-def : Builtin, Size, PointerType]>;
-def : Builtin, Size, PointerType]>;
-  }
-}
   }
 }
   }
@@ -849,7 +840,7 @@
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vload_half" # VSize] in {
+  foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
 def : Builtin, Size, PointerType, AS>]>;
   }
 }
@@ -860,7 +851,7 @@
   def : Builtin]>;
 }
 foreach VSize = [2, 3, 4, 8, 16] in {
-  foreach name = ["vstore_half" # VSize # rnd] in {
+  foreach name = ["vstore_half" # VSize # rnd, "vstorea_half" # VSize # rnd] in {
 def : Builtin, Size, PointerType]>;
 def : Builtin, Size, PointerType]>;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110742: [OpenCL] Add pure and const attributes to vload builtins

2021-09-29 Thread Stuart Brady via Phabricator via cfe-commits
stuart created this revision.
stuart added reviewers: svenvh, Anastasia, airlied, yaxunl.
Herald added a subscriber: ldrumm.
stuart requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Use the `pure` and `const` attributes for the `vload`, `vload_half` and 
`vloada_half` builtins.

For the //global//, //local//, //private// and //generic// address spaces, the 
`pure` attribute (or `readonly`) can be used.

For the //constant// address space, the `const` attribute (or `readnone`) can 
be used.  As memory in the //constant// address space is immutable, the 
statement in the langref that: "if a `readnone` function reads or writes memory 
visible to the program, or has other side-effects, the behavior is undefined" 
does not apply.  The reading of immutable memory does not have side-effects, 
nor can it be affected by side-effects.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110742

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -792,21 +792,21 @@
 // OpenCL v1.1 s6.11.7, v1.2 s6.12.7, v2.0 s6.13.7 - Vector Data Load and Store Functions
 // OpenCL Extension v1.1 s9.3.6 and s9.6.6, v1.2 s9.5.6, v2.0 s5.1.6 and s6.1.6 - Vector Data Load and Store Functions
 // --- Table 15 ---
-multiclass VloadVstore addrspaces, bit defStores> {
+multiclass VloadVstore addrspaces, bit defStores, list LoadAttr = Attr.Pure> {
   foreach AS = addrspaces in {
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
   }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
@@ -834,14 +834,14 @@
   defm : VloadVstore<[GenericAS], 1>;
 }
 // vload with constant address space is available regardless of version.
-defm : VloadVstore<[ConstantAS], 0>;
+defm : VloadVstore<[ConstantAS], 0, Attr.Const>;
 
-multiclass VloadVstoreHalf addrspaces, bit defStores> {
+multiclass VloadVstoreHalf addrspaces, bit defStores, list LoadAttr = Attr.Pure> {
   foreach AS = addrspaces in {
-def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
+def : Builtin<"vload_half", [Float, Size, PointerType, AS>], LoadAttr>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], LoadAttr>;
   }
 }
 if defStores then {
@@ -867,8 +867,8 @@
 let MinVersion = CL20 in {
   defm : VloadVstoreHalf<[GenericAS], 1>;
 }
-// vload with constant address space is available regardless of version.
-defm : VloadVstoreHalf<[ConstantAS], 0>;
+// vload_half and vloada_half with constant address space are available regardless of version.
+defm : VloadVstoreHalf<[ConstantAS], 0, Attr.Const>;
 
 // OpenCL v3.0 s6.15.8 - Synchronization Functions.
 def : Builtin<"barrier", [Void, MemFenceFlags], Attr.Convergent>;
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -11187,305 +11187,305 @@
  * 64-bit aligned if gentype is long, ulong, double.
  */
 
-char2 __ovld vload2(size_t offset, const __constant char *p);
-uchar2 __ovld vload2(size_t offset, const __constant uchar *p);
-short2 __ovld vload2(size_t offset, const __constant short *p);
-ushort2 __ovld vload2(size_t offset, const __constant ushort *p);
-int2 __ovld vload2(size_t offset, const __constant int *p);
-uint2 __ovld vload2(size_t offset, const __constant uint *p);
-long2 __ovld vload2(size_t offset, 

[PATCH] D96161: [OpenCL] Fix printing of types with signed prefix in arg info metadata

2021-02-09 Thread Stuart Brady via Phabricator via cfe-commits
stuart requested changes to this revision.
stuart added a comment.
This revision now requires changes to proceed.

Looks good, just some suggestions about the test.




Comment at: clang/test/CodeGenOpenCL/kernel-arg-info.cl:110
 
+kernel void foo9(signed char si1,  global const signed char* si2) {}
+// CHECK: define{{.*}} spir_kernel void @foo9{{[^!]+}}

Suggest `sc1` and `sc2` as these are now signed chars, not signed ints.



Comment at: clang/test/CodeGenOpenCL/kernel-arg-info.cl:112-118
+// CHECK: !kernel_arg_addr_space ![[SINT_AS_QUAL:[0-9]+]]
+// CHECK: !kernel_arg_access_qual ![[MD42]]
+// CHECK: !kernel_arg_type ![[SINT_TY:[0-9]+]]
+// CHECK: !kernel_arg_base_type ![[SINT_TY]]
+// CHECK: !kernel_arg_type_qual ![[SINT_QUAL:[0-9]+]]
+// CHECK-NOT: !kernel_arg_name
+// ARGINFO: !kernel_arg_name ![[SINT_ARG_NAMES:[0-9]+]]

Would suggest `SCHAR_AS_QUAL` and `SCHAR_TY` now that this is using a signed 
char.



Comment at: clang/test/CodeGenOpenCL/kernel-arg-info.cl:159-162
+// CHECK: ![[SINT_AS_QUAL]] = !{i32 0, i32 1}
+// CHECK: ![[SINT_TY]] = !{!"char", !"char*"}
+// CHECK: ![[SINT_QUAL]] = !{!"", !"const"}
+// ARGINFO: ![[SINT_ARG_NAMES]] = !{!"si1", !"si2"}

... and here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96161/new/

https://reviews.llvm.org/D96161

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103097: Add DWARF address spaces mapping for SPIR

2021-06-04 Thread Stuart Brady via Phabricator via cfe-commits
stuart added inline comments.



Comment at: clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl:22
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar5", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_GLOBAL]], 
isLocal: false, isDefinition: true)
+global int *global FileVar5;
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar6", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_CONSTANT]], 
isLocal: false, isDefinition: true)

Anastasia wrote:
> btw this variable is a duplicate of `FileVar0` for your change. In clang 
> parser:
> `global int *ptr;`
> is the same as 
> `global int *global ptr;`
> 
> 
> The same applies to local variables of `Type *` and `Type *private` as they 
> are equivalent on AST level too.
> 
> This is due to the address space inference rules if you are interested in 
> more details: 
> https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#addr-spaces-inference
> 
> Perhaps you could reduce the test case a bit by removing the duplicate 
> testing?
> 
> Also I would suggest separating with empty lines every variable declaration 
> with its corresponding CHECK line to improve the readability.
> 
> 
> ```
> CHECK: <...>
> Type var1;
> 
> CHECK: <...>
> Type var2;
> ```
> 
In case this review feeds into changes made for other test files, it may be 
worth noting that the test in question uses OpenCL C 2.0 (`-cl-std=CL2.0`), and 
therefore the generic address space as the default in many contexts, rather 
than `private`. (This comment is made not for direct benefit for this review 
itself, but for the benefit of anyone who may be reading who is not already 
especially familiar with OpenCL address spaces.)

The duplicated testing has now been removed from the newly added test, though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103097/new/

https://reviews.llvm.org/D103097

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103097: Add DWARF address spaces mapping for SPIR

2021-06-04 Thread Stuart Brady via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG333987b04589: [OpenCL] Add DWARF address spaces mapping for 
SPIR (authored by jzzheng22, committed by stuart).

Changed prior to commit:
  https://reviews.llvm.org/D103097?vs=348910&id=349910#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103097/new/

https://reviews.llvm.org/D103097

Files:
  clang/lib/Basic/Targets/SPIR.h
  clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl


Index: clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -debug-info-kind=limited -dwarf-version=5 
-emit-llvm -O0 -triple spir-unknown-unknown -o - %s | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -debug-info-kind=limited -dwarf-version=5 
-emit-llvm -O0 -triple spir64-unknown-unknown -o - %s | FileCheck %s
+
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_GLOBAL:[0-9]+]] = !DIDerivedType(tag: 
DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, 
dwarfAddressSpace: 1)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_CONSTANT:[0-9]+]] = !DIDerivedType(tag: 
DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, 
dwarfAddressSpace: 2)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_LOCAL:[0-9]+]] = !DIDerivedType(tag: 
DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, 
dwarfAddressSpace: 3)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_PRIVATE:[0-9]+]] = !DIDerivedType(tag: 
DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, 
dwarfAddressSpace: 0)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_GENERIC:[0-9]+]] = !DIDerivedType(tag: 
DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, 
dwarfAddressSpace: 4)
+
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar0", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_GLOBAL]], 
isLocal: false, isDefinition: true)
+global int *FileVar0;
+
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar1", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_CONSTANT]], 
isLocal: false, isDefinition: true)
+constant int *FileVar1;
+
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar2", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_LOCAL]], 
isLocal: false, isDefinition: true)
+local int *FileVar2;
+
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar3", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_PRIVATE]], 
isLocal: false, isDefinition: true)
+private int *FileVar3;
+
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar4", scope: !{{[0-9]+}}, 
file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[DWARF_ADDRESS_SPACE_GENERIC]], 
isLocal: false, isDefinition: true)
+int *FileVar4;
Index: clang/lib/Basic/Targets/SPIR.h
===
--- clang/lib/Basic/Targets/SPIR.h
+++ clang/lib/Basic/Targets/SPIR.h
@@ -117,6 +117,11 @@
 return TargetInfo::VoidPtrBuiltinVaList;
   }
 
+  Optional
+  getDWARFAddressSpace(unsigned AddressSpace) const override {
+return AddressSpace;
+  }
+
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override 
{
 return (CC == CC_SpirFunction || CC == CC_OpenCLKernel) ? CCCR_OK
 : CCCR_Warning;


Index: clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -debug-info-kind=limited -dwarf-version=5 -emit-llvm -O0 -triple spir-unknown-unknown -o - %s | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -debug-info-kind=limited -dwarf-version=5 -emit-llvm -O0 -triple spir64-unknown-unknown -o - %s | FileCheck %s
+
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_GLOBAL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, dwarfAddressSpace: 1)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_CONSTANT:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, dwarfAddressSpace: 2)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_LOCAL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, dwarfAddressSpace: 3)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_PRIVATE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, dwarfAddressSpace: 0)
+// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_GENERIC:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, dwarfAddressSpace: 4)
+
+// CHECK-DAG: distinct !DIGlobalVariable(name: "FileVar0", scope: !{{[0-9]+}}, file: !{{

[PATCH] D97725: [OpenCL] Add const attribute to ctz() builtin

2021-06-07 Thread Stuart Brady via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9b14670f3ca2: [OpenCL] Add const attribute to ctz() builtins 
(authored by stuart).
Herald added subscribers: cfe-commits, ldrumm.

Changed prior to commit:
  https://reviews.llvm.org/D97725?vs=327261&id=350232#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97725/new/

https://reviews.llvm.org/D97725

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -606,7 +606,7 @@
 }
 let MinVersion = CL20 in {
   foreach name = ["ctz"] in {
-def : Builtin;
+def : Builtin;
   }
 }
 
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -9354,54 +9354,54 @@
  * component type of x, if x is a vector.
  */
 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-char __ovld ctz(char x);
-uchar __ovld ctz(uchar x);
-char2 __ovld ctz(char2 x);
-uchar2 __ovld ctz(uchar2 x);
-char3 __ovld ctz(char3 x);
-uchar3 __ovld ctz(uchar3 x);
-char4 __ovld ctz(char4 x);
-uchar4 __ovld ctz(uchar4 x);
-char8 __ovld ctz(char8 x);
-uchar8 __ovld ctz(uchar8 x);
-char16 __ovld ctz(char16 x);
-uchar16 __ovld ctz(uchar16 x);
-short __ovld ctz(short x);
-ushort __ovld ctz(ushort x);
-short2 __ovld ctz(short2 x);
-ushort2 __ovld ctz(ushort2 x);
-short3 __ovld ctz(short3 x);
-ushort3 __ovld ctz(ushort3 x);
-short4 __ovld ctz(short4 x);
-ushort4 __ovld ctz(ushort4 x);
-short8 __ovld ctz(short8 x);
-ushort8 __ovld ctz(ushort8 x);
-short16 __ovld ctz(short16 x);
-ushort16 __ovld ctz(ushort16 x);
-int __ovld ctz(int x);
-uint __ovld ctz(uint x);
-int2 __ovld ctz(int2 x);
-uint2 __ovld ctz(uint2 x);
-int3 __ovld ctz(int3 x);
-uint3 __ovld ctz(uint3 x);
-int4 __ovld ctz(int4 x);
-uint4 __ovld ctz(uint4 x);
-int8 __ovld ctz(int8 x);
-uint8 __ovld ctz(uint8 x);
-int16 __ovld ctz(int16 x);
-uint16 __ovld ctz(uint16 x);
-long __ovld ctz(long x);
-ulong __ovld ctz(ulong x);
-long2 __ovld ctz(long2 x);
-ulong2 __ovld ctz(ulong2 x);
-long3 __ovld ctz(long3 x);
-ulong3 __ovld ctz(ulong3 x);
-long4 __ovld ctz(long4 x);
-ulong4 __ovld ctz(ulong4 x);
-long8 __ovld ctz(long8 x);
-ulong8 __ovld ctz(ulong8 x);
-long16 __ovld ctz(long16 x);
-ulong16 __ovld ctz(ulong16 x);
+char __ovld __cnfn ctz(char x);
+uchar __ovld __cnfn ctz(uchar x);
+char2 __ovld __cnfn ctz(char2 x);
+uchar2 __ovld __cnfn ctz(uchar2 x);
+char3 __ovld __cnfn ctz(char3 x);
+uchar3 __ovld __cnfn ctz(uchar3 x);
+char4 __ovld __cnfn ctz(char4 x);
+uchar4 __ovld __cnfn ctz(uchar4 x);
+char8 __ovld __cnfn ctz(char8 x);
+uchar8 __ovld __cnfn ctz(uchar8 x);
+char16 __ovld __cnfn ctz(char16 x);
+uchar16 __ovld __cnfn ctz(uchar16 x);
+short __ovld __cnfn ctz(short x);
+ushort __ovld __cnfn ctz(ushort x);
+short2 __ovld __cnfn ctz(short2 x);
+ushort2 __ovld __cnfn ctz(ushort2 x);
+short3 __ovld __cnfn ctz(short3 x);
+ushort3 __ovld __cnfn ctz(ushort3 x);
+short4 __ovld __cnfn ctz(short4 x);
+ushort4 __ovld __cnfn ctz(ushort4 x);
+short8 __ovld __cnfn ctz(short8 x);
+ushort8 __ovld __cnfn ctz(ushort8 x);
+short16 __ovld __cnfn ctz(short16 x);
+ushort16 __ovld __cnfn ctz(ushort16 x);
+int __ovld __cnfn ctz(int x);
+uint __ovld __cnfn ctz(uint x);
+int2 __ovld __cnfn ctz(int2 x);
+uint2 __ovld __cnfn ctz(uint2 x);
+int3 __ovld __cnfn ctz(int3 x);
+uint3 __ovld __cnfn ctz(uint3 x);
+int4 __ovld __cnfn ctz(int4 x);
+uint4 __ovld __cnfn ctz(uint4 x);
+int8 __ovld __cnfn ctz(int8 x);
+uint8 __ovld __cnfn ctz(uint8 x);
+int16 __ovld __cnfn ctz(int16 x);
+uint16 __ovld __cnfn ctz(uint16 x);
+long __ovld __cnfn ctz(long x);
+ulong __ovld __cnfn ctz(ulong x);
+long2 __ovld __cnfn ctz(long2 x);
+ulong2 __ovld __cnfn ctz(ulong2 x);
+long3 __ovld __cnfn ctz(long3 x);
+ulong3 __ovld __cnfn ctz(ulong3 x);
+long4 __ovld __cnfn ctz(long4 x);
+ulong4 __ovld __cnfn ctz(ulong4 x);
+long8 __ovld __cnfn ctz(long8 x);
+ulong8 __ovld __cnfn ctz(ulong8 x);
+long16 __ovld __cnfn ctz(long16 x);
+ulong16 __ovld __cnfn ctz(ulong16 x);
 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
 
 /**
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-11 Thread Stuart Brady via Phabricator via cfe-commits
stuart created this revision.
stuart added reviewers: Anastasia, keith.walker.arm, svenvh, aprantl, SouraVX, 
shchenz, jzzheng22.
Herald added subscribers: ldrumm, yaxunl.
stuart requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104118

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenOpenCL/debug-info-programming-language.cl


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF5 %s
+// RUN: %clang_cc1 -dwarf-version=3  -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF3 %s
+
+kernel void empty() {}
+
+// CHECK-DWARF5: distinct !DICompileUnit(language: DW_LANG_OpenCL
+// CHECK-DWARF3: distinct !DICompileUnit(language: DW_LANG_C99
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -576,6 +576,8 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && CGM.getCodeGenOpts().DwarfVersion >= 5) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF5 %s
+// RUN: %clang_cc1 -dwarf-version=3  -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF3 %s
+
+kernel void empty() {}
+
+// CHECK-DWARF5: distinct !DICompileUnit(language: DW_LANG_OpenCL
+// CHECK-DWARF3: distinct !DICompileUnit(language: DW_LANG_C99
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -576,6 +576,8 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && CGM.getCodeGenOpts().DwarfVersion >= 5) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-11 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

Note: there is currently no DWARF language code defined for //C++ for OpenCL//, 
so we must use DW_LANG_C_plus_plus* if we wish to be able to determine whether 
output has been generated from //C++ for OpenCL// source or from //OpenCL C// 
source. I have raised DWARF issue 210514.1 
 to add a dedicated //C++ for 
OpenCL// code in the next version of DWARF, but for now I believe that it is 
best to use DW_LANG_OpenCL for //OpenCL C// only, and not for //C++ for 
OpenCL//.

I could perhaps add a note regarding this to the commit message but am 
concerned about overcomplicating the message.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-11 Thread Stuart Brady via Phabricator via cfe-commits
stuart updated this revision to Diff 351454.
stuart added a comment.

Add missing trailing commas to CHECK lines of FileCheck test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenOpenCL/debug-info-programming-language.cl


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF5 %s
+// RUN: %clang_cc1 -dwarf-version=3  -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF3 %s
+
+kernel void empty() {}
+
+// CHECK-DWARF5: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-DWARF3: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -576,6 +576,8 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && CGM.getCodeGenOpts().DwarfVersion >= 5) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF5 %s
+// RUN: %clang_cc1 -dwarf-version=3  -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-DWARF3 %s
+
+kernel void empty() {}
+
+// CHECK-DWARF5: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-DWARF3: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -576,6 +576,8 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && CGM.getCodeGenOpts().DwarfVersion >= 5) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-15 Thread Stuart Brady via Phabricator via cfe-commits
stuart added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:579
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && CGM.getCodeGenOpts().DwarfVersion >= 5) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;

shchenz wrote:
> I think for non-strict DWARF mode, we still can generate `DW_LANG_OpenCL` for 
> the DWARF version lower than 5? Seems we also need to fix above 
> `DW_LANG_C_plus_plus_14` and `DW_LANG_C_plus_plus_11`
If we have a `-gstrict-dwarf` option for this, then it would seem better to add 
`DW_LANG_C_plus_plus_17` and `DW_LANG_C_plus_plus_20` definitions and generate 
those for the `!CGM.getCodeGenOpts().DebugStrictDwarf` case. //C++ for OpenCL// 
would then use one of the more recent language tag values for the time being 
(without any special logic).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-15 Thread Stuart Brady via Phabricator via cfe-commits
stuart marked an inline comment as done.
stuart added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:579
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && CGM.getCodeGenOpts().DwarfVersion >= 5) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;

shchenz wrote:
> stuart wrote:
> > shchenz wrote:
> > > I think for non-strict DWARF mode, we still can generate `DW_LANG_OpenCL` 
> > > for the DWARF version lower than 5? Seems we also need to fix above 
> > > `DW_LANG_C_plus_plus_14` and `DW_LANG_C_plus_plus_11`
> > If we have a `-gstrict-dwarf` option for this, then it would seem better to 
> > add `DW_LANG_C_plus_plus_17` and `DW_LANG_C_plus_plus_20` definitions and 
> > generate those for the `!CGM.getCodeGenOpts().DebugStrictDwarf` case. //C++ 
> > for OpenCL// would then use one of the more recent language tag values for 
> > the time being (without any special logic).
> I added a patch https://reviews.llvm.org/D104291 for `DW_LANG_C_plus_plus_14` 
> and `DW_LANG_C_plus_plus_11`.
> I think `DW_LANG_OpenCL` should be in the same situation?
Thanks. I will wait until D104291 is accepted, and then update this change 
correspondingly. Yes, I believe `DW_LANG_OpenCL` is in the same situation.

Looking more closely, I notice that `DW_LANG_RenderScript` was also introduced 
in DWARF 5, and we don't use it (at all) in Clang, but instead use the 
vendor-specific `DW_LANG_GOOGLE_RenderScript` value. It should probably fall 
back to the vendor-specific value if the DWARF 5 value is not available, 
instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104291: [Debug-Info] strict dwarf for DW_LANG_C_plus_plus_14

2021-06-15 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

This looks good to me.

@jzzheng22 informs me there was a comment in D99250 
 to the effect that DW_LANG_C_plus_plus_03 is 
not emitted, at all - it too was introduced in DWARF 5.  I wonder if this 
should be addressed in a separate commit?

As mentioned in D104118 , there are language 
codes of DW_LANG_C_plus_plus_17 and DW_LANG_C_plus_plus_20 that will be 
introduced in DWARF 6, which it would be good to use in non-strict mode.  This 
would allow us to emit the more proper code of DW_LANG_C_plus_plus_17 (instead 
of DW_LANG_C_plus_plus_14) for //C++ for OpenCL//, while we wait for 
DW_LANG_CPP_for_OpenCL to get added, as requested at 
http://dwarfstd.org/ShowIssue.php?issue=210514.1.  Should this be addressed in 
a third commit?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104291/new/

https://reviews.llvm.org/D104291

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-15 Thread Stuart Brady via Phabricator via cfe-commits
stuart planned changes to this revision.
stuart added a comment.

Changes will be required to align this with D104291 
.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104291: [Debug-Info] strict dwarf for DW_LANG_C_plus_plus_14

2021-06-16 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

> There is no `CPlusPlus03` in `LangOptions`, so it is better not to merge 
> `DW_LANG_C_plus_plus_03` support with D99250 
> .

Oh - I see, `c++03` is defined in LangStandards.def an alias for `c++98`, as 
the former essentially consists of bugfixes for the latter. This loosely 
suggests to me that C++03 implementations are (likely to be / mostly?) 
conformant to C++98, but that C++98 implementations may not be fully conformant 
to C++03. Given this alias, it doesn't seem at all clear to me which of 
DW_LANG_C_plus_plus_98 and DW_LANG_C_plus_plus_03 would be the better choice, 
if both C++98 and C++03 must share a language tag... but I presume this has 
been discussed before. (It also doesn't seem clear whether it would be better 
to model "c++98" as an alias for "c++03".)

> Yes, we don't have `DW_LANG_C_plus_plus_17` and `DW_LANG_C_plus_plus_20` in 
> clang for now. I guess this is because clang does not support DWARF 6. DWARF 
> 6 is not officially released? Once DWARF 6 is released and clang starts to 
> support DWARF 6, I think we should add the support for 
> `DW_LANG_C_plus_plus_17` and `DW_LANG_C_plus_plus_20` in the place that this 
> patch changes.

New DWARF language codes  are published 
ahead of the release of the next version of DWARF, so that they may be used by 
implementations without having to wait for new DWARF version.

It would therefore make sense to go ahead and add `DW_LANG_C_plus_plus_17` and 
`DW_LANG_C_plus_plus_20` now, without waiting, but only in the non-strict DWARF 
mode. (There would be the question of whether it would still make sense in the 
code to say "DwarfVersion >= 6" given that DWARF 6 would be otherwise 
unsupported... but I don't have a strong view on that question.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104291/new/

https://reviews.llvm.org/D104291

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-23 Thread Stuart Brady via Phabricator via cfe-commits
stuart updated this revision to Diff 353988.
stuart added a comment.

Added handling of `-gstrict-dwarf` and updated tests accordingly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenOpenCL/debug-info-programming-language.cl


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple 
%itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple 
%itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+
+kernel void empty() {}
+
+// CHECK-OPENCL: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-C99: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,6 +578,9 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+   CGM.getCodeGenOpts().DwarfVersion >= 5)) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+
+kernel void empty() {}
+
+// CHECK-OPENCL: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-C99: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,6 +578,9 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+   CGM.getCodeGenOpts().DwarfVersion >= 5)) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-25 Thread Stuart Brady via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe47027d091de: [OpenCL] Use DW_LANG_OpenCL language tag for 
OpenCL C (authored by stuart).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenOpenCL/debug-info-programming-language.cl


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s 
-o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple 
%itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple 
%itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+
+kernel void empty() {}
+
+// CHECK-OPENCL: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-C99: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,6 +578,9 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+   CGM.getCodeGenOpts().DwarfVersion >= 5)) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+
+kernel void empty() {}
+
+// CHECK-OPENCL: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-C99: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,6 +578,9 @@
   LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
 LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+   CGM.getCodeGenOpts().DwarfVersion >= 5)) {
+LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
 LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

2021-06-25 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

On reflection, I don't think it makes sense to make use of 
DW_LANG_C_plus_plus_17 or DW_LANG_C_plus_plus_20 in Clang just yet, as these 
are generally not supported by other tooling. I am a bit confused by DWARF 
publishing these tags ahead of time, yet tooling having not been updated to 
recognize them. Regardless, it is clear that support in debuggers needs to come 
first, which is something that I am not planning to add.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104118/new/

https://reviews.llvm.org/D104118

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98418: [OpenCL] Remove mixed signedness atomic_fetch_ from opencl-c.h

2021-03-11 Thread Stuart Brady via Phabricator via cfe-commits
stuart accepted this revision.
stuart added a comment.
This revision is now accepted and ready to land.

Looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98418/new/

https://reviews.llvm.org/D98418

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110742: [OpenCL] Add pure attributes to vload builtins

2021-12-15 Thread Stuart Brady via Phabricator via cfe-commits
stuart updated this revision to Diff 394580.
stuart retitled this revision from "[OpenCL] Add pure and const attributes to 
vload builtins" to "[OpenCL] Add pure attributes to vload builtins".
stuart edited the summary of this revision.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110742/new/

https://reviews.llvm.org/D110742

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -806,17 +806,17 @@
   foreach AS = addrspaces in {
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
@@ -848,10 +848,10 @@
 
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
-def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
+def : Builtin<"vload_half", [Float, Size, PointerType, AS>], Attr.Pure>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
 }
 if defStores then {
@@ -877,7 +877,7 @@
 let MinVersion = CL20 in {
   defm : VloadVstoreHalf<[GenericAS], 1>;
 }
-// vload with constant address space is available regardless of version.
+// vload_half and vloada_half with constant address space are available regardless of version.
 defm : VloadVstoreHalf<[ConstantAS], 0>;
 
 // OpenCL v3.0 s6.15.8 - Synchronization Functions.
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -11190,305 +11190,305 @@
  * 64-bit aligned if gentype is long, ulong, double.
  */
 
-char2 __ovld vload2(size_t offset, const __constant char *p);
-uchar2 __ovld vload2(size_t offset, const __constant uchar *p);
-short2 __ovld vload2(size_t offset, const __constant short *p);
-ushort2 __ovld vload2(size_t offset, const __constant ushort *p);
-int2 __ovld vload2(size_t offset, const __constant int *p);
-uint2 __ovld vload2(size_t offset, const __constant uint *p);
-long2 __ovld vload2(size_t offset, const __constant long *p);
-ulong2 __ovld vload2(size_t offset, const __constant ulong *p);
-float2 __ovld vload2(size_t offset, const __constant float *p);
-char3 __ovld vload3(size_t offset, const __constant char *p);
-uchar3 __ovld vload3(size_t offset, const __constant uchar *p);
-short3 __ovld vload3(size_t offset, const __constant short *p);
-ushort3 __ovld vload3(size_t offset, const __constant ushort *p);
-int3 __ovld vload3(size_t offset, const __constant int *p);
-uint3 __ovld vload3(size_t offset, const __constant uint *p);
-long3 __ovld vload3(size_t offset, const __constant long *p);
-ulong3 __ovld vload3(size_t offset, const __constant ulong *p);
-float3 __ovld vload3(size_t offset, const __constant float *p);
-char4 __ovld vload4(size_t offset, const __constant char *p);
-uchar4 __ovld vload4(size_t offset, const __constant uchar *p);
-short4 __ovld vload4(size_t offset, const __constant short *p);
-ushort4 __ovld vload4(size_t offset, const __constant ushort *p);
-int4 __ovld vload4(size_t offset, const __constant int *p);
-uint4 __ovld vload4(size_t offset, const __constant uint *p);
-long4 __ovld vload4(size_t offset, const __constant long *p);
-ulong4 __ovld vload4(size_t offset, const __constant ulong *p);
-float4 __ovld vload4(size_t offset, const __constant float *p);
-char8 __ovld vload8(size_t offset, const

[PATCH] D110742: [OpenCL] Add pure attributes to vload builtins

2021-12-16 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

In D110742#3194608 , @svenvh wrote:

> Apologies for the late reply...  I'd prefer to get the langref updated first, 
> for the sake of consistency and to ensure other stakeholders agree with the 
> interpretation.  You can still go ahead with the `__attribute__((pure))` 
> changes of course.

Thanks!  I have updated the review to use `__attribute__((pure))` only (i.e. it 
no longer uses `__attribute__((const))`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110742/new/

https://reviews.llvm.org/D110742

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110742: [OpenCL] Add pure attributes to vload builtins

2021-12-16 Thread Stuart Brady via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a376bc28535: [OpenCL] Add pure attribute to vload builtins 
(authored by stuart).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110742/new/

https://reviews.llvm.org/D110742

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -806,17 +806,17 @@
   foreach AS = addrspaces in {
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
@@ -848,10 +848,10 @@
 
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
-def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
+def : Builtin<"vload_half", [Float, Size, PointerType, AS>], Attr.Pure>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
 }
 if defStores then {
@@ -877,7 +877,7 @@
 let MinVersion = CL20 in {
   defm : VloadVstoreHalf<[GenericAS], 1>;
 }
-// vload with constant address space is available regardless of version.
+// vload_half and vloada_half with constant address space are available regardless of version.
 defm : VloadVstoreHalf<[ConstantAS], 0>;
 
 // OpenCL v3.0 s6.15.8 - Synchronization Functions.
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -11190,305 +11190,305 @@
  * 64-bit aligned if gentype is long, ulong, double.
  */
 
-char2 __ovld vload2(size_t offset, const __constant char *p);
-uchar2 __ovld vload2(size_t offset, const __constant uchar *p);
-short2 __ovld vload2(size_t offset, const __constant short *p);
-ushort2 __ovld vload2(size_t offset, const __constant ushort *p);
-int2 __ovld vload2(size_t offset, const __constant int *p);
-uint2 __ovld vload2(size_t offset, const __constant uint *p);
-long2 __ovld vload2(size_t offset, const __constant long *p);
-ulong2 __ovld vload2(size_t offset, const __constant ulong *p);
-float2 __ovld vload2(size_t offset, const __constant float *p);
-char3 __ovld vload3(size_t offset, const __constant char *p);
-uchar3 __ovld vload3(size_t offset, const __constant uchar *p);
-short3 __ovld vload3(size_t offset, const __constant short *p);
-ushort3 __ovld vload3(size_t offset, const __constant ushort *p);
-int3 __ovld vload3(size_t offset, const __constant int *p);
-uint3 __ovld vload3(size_t offset, const __constant uint *p);
-long3 __ovld vload3(size_t offset, const __constant long *p);
-ulong3 __ovld vload3(size_t offset, const __constant ulong *p);
-float3 __ovld vload3(size_t offset, const __constant float *p);
-char4 __ovld vload4(size_t offset, const __constant char *p);
-uchar4 __ovld vload4(size_t offset, const __constant uchar *p);
-short4 __ovld vload4(size_t offset, const __constant short *p);
-ushort4 __ovld vload4(size_t offset, const __constant ushort *p);
-int4 __ovld vload4(size_t offset, const __constant int *p);
-uint4 __ovld vload4(size_t offset, const __constant uint *p);
-long4 __ovld vload4(size_t offset, const __constant long *p);
-ulong4 __ovld vload4(size_t offset, const __constant ulong *p);
-float4 __ovld vload4(size_t offset, const __constant float *p);
-char8 __ovld vload8(size_t offset, const __co

[PATCH] D110742: [OpenCL] Add pure attributes to vload builtins

2021-12-16 Thread Stuart Brady via Phabricator via cfe-commits
stuart updated this revision to Diff 394878.
stuart added a comment.

I've updated the review to include test changes that are required for 
check-clang-semaopencl to pass.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110742/new/

https://reviews.llvm.org/D110742

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td
  clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl

Index: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
===
--- clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -46,12 +46,19 @@
 typedef char char2 __attribute__((ext_vector_type(2)));
 typedef char char4 __attribute__((ext_vector_type(4)));
 typedef uchar uchar4 __attribute__((ext_vector_type(4)));
+typedef uchar uchar16 __attribute__((ext_vector_type(16)));
 typedef float float4 __attribute__((ext_vector_type(4)));
+typedef float float16 __attribute__((ext_vector_type(16)));
 typedef half half4 __attribute__((ext_vector_type(4)));
 typedef int int2 __attribute__((ext_vector_type(2)));
 typedef int int4 __attribute__((ext_vector_type(4)));
+typedef uint uint2 __attribute__((ext_vector_type(2)));
 typedef uint uint4 __attribute__((ext_vector_type(4)));
 typedef long long2 __attribute__((ext_vector_type(2)));
+typedef long long8 __attribute__((ext_vector_type(8)));
+typedef ulong ulong4 __attribute__((ext_vector_type(4)));
+typedef short short16 __attribute__((ext_vector_type(16)));
+typedef ushort ushort3 __attribute__((ext_vector_type(3)));
 
 typedef int clk_profiling_info;
 #define CLK_PROFILING_COMMAND_EXEC_TIME 0x1
@@ -284,18 +291,27 @@
   global void *global_p;
   private void *private_p;
   size_t s;
+  ulong4 ul4;
+  short16 s16;
+#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
+  ushort3 us3;
+  uchar16 uc16;
+#endif
+  long8 l8;
+  uint2 ui2;
+  float16 f16;
 
-  vload4(s, (const __constant ulong *) constant_p);
-  vload16(s, (const __constant short *) constant_p);
+  ul4 = vload4(s, (const __constant ulong *) constant_p);
+  s16 = vload16(s, (const __constant short *) constant_p);
 
 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
-  vload3(s, (const __generic ushort *) generic_p);
-  vload16(s, (const __generic uchar *) generic_p);
+  us3 = vload3(s, (const __generic ushort *) generic_p);
+  uc16 = vload16(s, (const __generic uchar *) generic_p);
 #endif
 
-  vload8(s, (const __global long *) global_p);
-  vload2(s, (const __local uint *) local_p);
-  vload16(s, (const __private float *) private_p);
+  l8 = vload8(s, (const __global long *) global_p);
+  ui2 = vload2(s, (const __local uint *) local_p);
+  f16 = vload16(s, (const __private float *) private_p);
 }
 
 kernel void basic_work_item() {
Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -806,17 +806,17 @@
   foreach AS = addrspaces in {
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
@@ -848,10 +848,10 @@
 
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
-def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
+def : Builtin<"vload_half", [Float, Size, PointerType, AS>], Attr.Pure>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
 }
 if defStores then {
@@ -877,7 +877,7 @@
 let MinVersion = CL20 in {
   defm : VloadVstoreHalf<[Gene

[PATCH] D110742: [OpenCL] Add pure attributes to vload builtins

2021-12-16 Thread Stuart Brady via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGceb80557e523: [OpenCL] Add pure attribute to vload builtins 
(authored by stuart).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110742/new/

https://reviews.llvm.org/D110742

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td
  clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl

Index: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
===
--- clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -46,12 +46,19 @@
 typedef char char2 __attribute__((ext_vector_type(2)));
 typedef char char4 __attribute__((ext_vector_type(4)));
 typedef uchar uchar4 __attribute__((ext_vector_type(4)));
+typedef uchar uchar16 __attribute__((ext_vector_type(16)));
 typedef float float4 __attribute__((ext_vector_type(4)));
+typedef float float16 __attribute__((ext_vector_type(16)));
 typedef half half4 __attribute__((ext_vector_type(4)));
 typedef int int2 __attribute__((ext_vector_type(2)));
 typedef int int4 __attribute__((ext_vector_type(4)));
+typedef uint uint2 __attribute__((ext_vector_type(2)));
 typedef uint uint4 __attribute__((ext_vector_type(4)));
 typedef long long2 __attribute__((ext_vector_type(2)));
+typedef long long8 __attribute__((ext_vector_type(8)));
+typedef ulong ulong4 __attribute__((ext_vector_type(4)));
+typedef short short16 __attribute__((ext_vector_type(16)));
+typedef ushort ushort3 __attribute__((ext_vector_type(3)));
 
 typedef int clk_profiling_info;
 #define CLK_PROFILING_COMMAND_EXEC_TIME 0x1
@@ -284,18 +291,27 @@
   global void *global_p;
   private void *private_p;
   size_t s;
+  ulong4 ul4;
+  short16 s16;
+#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
+  ushort3 us3;
+  uchar16 uc16;
+#endif
+  long8 l8;
+  uint2 ui2;
+  float16 f16;
 
-  vload4(s, (const __constant ulong *) constant_p);
-  vload16(s, (const __constant short *) constant_p);
+  ul4 = vload4(s, (const __constant ulong *) constant_p);
+  s16 = vload16(s, (const __constant short *) constant_p);
 
 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
-  vload3(s, (const __generic ushort *) generic_p);
-  vload16(s, (const __generic uchar *) generic_p);
+  us3 = vload3(s, (const __generic ushort *) generic_p);
+  uc16 = vload16(s, (const __generic uchar *) generic_p);
 #endif
 
-  vload8(s, (const __global long *) global_p);
-  vload2(s, (const __local uint *) local_p);
-  vload16(s, (const __private float *) private_p);
+  l8 = vload8(s, (const __global long *) global_p);
+  ui2 = vload2(s, (const __local uint *) local_p);
+  f16 = vload16(s, (const __private float *) private_p);
 }
 
 kernel void basic_work_item() {
Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -806,17 +806,17 @@
   foreach AS = addrspaces in {
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
   if defStores then {
 foreach name = ["vstore" # VSize] in {
@@ -848,10 +848,10 @@
 
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
-def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
+def : Builtin<"vload_half", [Float, Size, PointerType, AS>], Attr.Pure>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize, "vloada_half" # VSize] in {
-def : Builtin, Size, PointerType, AS>]>;
+def : Builtin, Size, PointerType, AS>], Attr.Pure>;
   }
 }
 if

[PATCH] D110742: [OpenCL] Add pure and const attributes to vload builtins

2021-10-08 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

In D110742#3048301 , @svenvh wrote:

>> For the constant address space, the const attribute (or readnone) can be 
>> used. As memory in the constant address space is immutable, the statement in 
>> the langref that: "if a readnone function reads or writes memory visible to 
>> the program, or has other side-effects, the behavior is undefined" does not 
>> apply. The reading of immutable memory does not have side-effects, nor can 
>> it be affected by side-effects.
>
> I think `readnone` might be too strong, because the pointer argument will 
> still be dereferenced (while `readnone` implies that "the function computes 
> its result [...] based strictly on its arguments, without dereferencing any 
> pointer arguments").

That may be so, but the function does not have its own side-effects, nor can it 
depend upon any side-effects, as the memory in question is truly immutable 
(i.e. it cannot even be changed by another process, thread, or shared memory 
interface in such a way that would be observable).

All functions, with or without `__attribute__((const))` can be said to require 
memory reads in the form of the instruction fetches needed to execute the 
instructions that comprise the compiled function. It is also quite normal for 
constant pools to be generated for a function, from which memory reads will be 
performed despite no pointer being dereferenced in the original C source.

Both `__attribute__((const))` and `readnone` are intended to permit arbitrary 
code motion, and so in my opinion the langref misstates the true nature of the 
`readnone` attribute. (The Clang manual does not even document 
`__attribute__((const))`.) From a cursory examination of the LLVM source, I did 
not find any use of `readnone` that conflicts with this interpretation of the 
`readnone` attribute.

Does the langref need to be amended, first, or is it okay to interpret the 
`readnone` attribute as it was clearly intended, without going through the 
process of updating the langref first?

I can update this review to use `__attribute__((pure))` for all address spaces, 
for the time being, but it seems a shame that the poor wording in the langref 
might (necessarily) prevent us from making the optimal change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110742/new/

https://reviews.llvm.org/D110742

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108761: [OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns

2021-08-26 Thread Stuart Brady via Phabricator via cfe-commits
stuart created this revision.
stuart added reviewers: svenvh, Anastasia, airlied, yaxunl.
Herald added a subscriber: ldrumm.
stuart requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

These functions are not part of the OpenCL C specification.

See https://github.com/KhronosGroup/OpenCL-Docs/issues/648 for a clarification 
regarding the vloada_half declaration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108761

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -836,7 +836,6 @@
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
-def : Builtin<"vloada_half", [Float, Size, PointerType, AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize] in {
 def : Builtin, Size, PointerType, AS>]>;
@@ -844,7 +843,7 @@
 }
 if defStores then {
   foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-foreach name = ["vstore_half" # rnd, "vstorea_half" # rnd] in {
+foreach name = ["vstore_half" # rnd] in {
   def : Builtin]>;
   def : Builtin]>;
 }
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -12070,33 +12070,28 @@
  * The address computed as (p + (offset * 4))
  * must be aligned to sizeof (half) * 4 bytes.
  */
-float __ovld vloada_half(size_t offset, const __constant half *p);
 float2 __ovld vloada_half2(size_t offset, const __constant half *p);
 float3 __ovld vloada_half3(size_t offset, const __constant half *p);
 float4 __ovld vloada_half4(size_t offset, const __constant half *p);
 float8 __ovld vloada_half8(size_t offset, const __constant half *p);
 float16 __ovld vloada_half16(size_t offset, const __constant half *p);
 #if defined(__opencl_c_generic_address_space)
-float __ovld vloada_half(size_t offset, const half *p);
 float2 __ovld vloada_half2(size_t offset, const half *p);
 float3 __ovld vloada_half3(size_t offset, const half *p);
 float4 __ovld vloada_half4(size_t offset, const half *p);
 float8 __ovld vloada_half8(size_t offset, const half *p);
 float16 __ovld vloada_half16(size_t offset, const half *p);
 #else
-float __ovld vloada_half(size_t offset, const __global half *p);
 float2 __ovld vloada_half2(size_t offset, const __global half *p);
 float3 __ovld vloada_half3(size_t offset, const __global half *p);
 float4 __ovld vloada_half4(size_t offset, const __global half *p);
 float8 __ovld vloada_half8(size_t offset, const __global half *p);
 float16 __ovld vloada_half16(size_t offset, const __global half *p);
-float __ovld vloada_half(size_t offset, const __local half *p);
 float2 __ovld vloada_half2(size_t offset, const __local half *p);
 float3 __ovld vloada_half3(size_t offset, const __local half *p);
 float4 __ovld vloada_half4(size_t offset, const __local half *p);
 float8 __ovld vloada_half8(size_t offset, const __local half *p);
 float16 __ovld vloada_half16(size_t offset, const __local half *p);
-float __ovld vloada_half(size_t offset, const __private half *p);
 float2 __ovld vloada_half2(size_t offset, const __private half *p);
 float3 __ovld vloada_half3(size_t offset, const __private half *p);
 float4 __ovld vloada_half4(size_t offset, const __private half *p);
@@ -12121,35 +12116,30 @@
  * round to nearest even.
  */
 #if defined(__opencl_c_generic_address_space)
-void __ovld vstorea_half(float data, size_t offset, half *p);
 void __ovld vstorea_half2(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rte(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rte(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rte(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rte(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rte(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rte(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtz(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtz(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtz(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rtz(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rtz(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rtz(float16 data, size_t offset, half *p);
 
-void __ovld vstore

[PATCH] D104858: [OpenCL][ARM] Fix ICE when compiling a kernel

2021-08-26 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

> Unfortunately I cannot look at this in detail right now, but I'll reply 
> quickly for a heads up: The problem was not how to detect kernels, but the 
> ABI/CC mismatch to the
> clSetKerneArg() with (user facing) arguments that get split to multiple args 
> or vice versa. E.g. x86 ABI had a CC where 2xfloat gets to 1xdouble in the 
> generated function
> finger print, thus there was no 1:1 match of the kernel arguments to the 
> OpenCL-facing ones (making clSetKernelArg calls difficult to implement 
> robustly).

Could you not just use libffi?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104858/new/

https://reviews.llvm.org/D104858

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108761: [OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns

2021-09-02 Thread Stuart Brady via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32955be6bf7d: [OpenCL] Remove decls for scalar vloada_half 
and vstorea_half* fns (authored by stuart).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108761/new/

https://reviews.llvm.org/D108761

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -836,7 +836,6 @@
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
-def : Builtin<"vloada_half", [Float, Size, PointerType, AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize] in {
 def : Builtin, Size, PointerType, AS>]>;
@@ -844,7 +843,7 @@
 }
 if defStores then {
   foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-foreach name = ["vstore_half" # rnd, "vstorea_half" # rnd] in {
+foreach name = ["vstore_half" # rnd] in {
   def : Builtin]>;
   def : Builtin]>;
 }
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -12070,33 +12070,28 @@
  * The address computed as (p + (offset * 4))
  * must be aligned to sizeof (half) * 4 bytes.
  */
-float __ovld vloada_half(size_t offset, const __constant half *p);
 float2 __ovld vloada_half2(size_t offset, const __constant half *p);
 float3 __ovld vloada_half3(size_t offset, const __constant half *p);
 float4 __ovld vloada_half4(size_t offset, const __constant half *p);
 float8 __ovld vloada_half8(size_t offset, const __constant half *p);
 float16 __ovld vloada_half16(size_t offset, const __constant half *p);
 #if defined(__opencl_c_generic_address_space)
-float __ovld vloada_half(size_t offset, const half *p);
 float2 __ovld vloada_half2(size_t offset, const half *p);
 float3 __ovld vloada_half3(size_t offset, const half *p);
 float4 __ovld vloada_half4(size_t offset, const half *p);
 float8 __ovld vloada_half8(size_t offset, const half *p);
 float16 __ovld vloada_half16(size_t offset, const half *p);
 #else
-float __ovld vloada_half(size_t offset, const __global half *p);
 float2 __ovld vloada_half2(size_t offset, const __global half *p);
 float3 __ovld vloada_half3(size_t offset, const __global half *p);
 float4 __ovld vloada_half4(size_t offset, const __global half *p);
 float8 __ovld vloada_half8(size_t offset, const __global half *p);
 float16 __ovld vloada_half16(size_t offset, const __global half *p);
-float __ovld vloada_half(size_t offset, const __local half *p);
 float2 __ovld vloada_half2(size_t offset, const __local half *p);
 float3 __ovld vloada_half3(size_t offset, const __local half *p);
 float4 __ovld vloada_half4(size_t offset, const __local half *p);
 float8 __ovld vloada_half8(size_t offset, const __local half *p);
 float16 __ovld vloada_half16(size_t offset, const __local half *p);
-float __ovld vloada_half(size_t offset, const __private half *p);
 float2 __ovld vloada_half2(size_t offset, const __private half *p);
 float3 __ovld vloada_half3(size_t offset, const __private half *p);
 float4 __ovld vloada_half4(size_t offset, const __private half *p);
@@ -12121,35 +12116,30 @@
  * round to nearest even.
  */
 #if defined(__opencl_c_generic_address_space)
-void __ovld vstorea_half(float data, size_t offset, half *p);
 void __ovld vstorea_half2(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rte(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rte(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rte(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rte(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rte(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rte(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtz(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtz(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtz(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rtz(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rtz(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rtz(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtp(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtp(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtp(float3 d