================
@@ -3,7 +3,7 @@
typedef int int4 __attribute__((ext_vector_type(4)));
typedef float float4 __attribute__((ext_vector_type(4)));
-typedef half half4 __attribute__((ext_vector_type(4)));
+typedef _Float16 half4 __attribute__((ext_vector_type(4)));
----------------
jmmartinez wrote:
> adding a new case requires new builtin def. one for HIP and another for
> OpenCL.
Not necessarly. Instead of describing the builtin signature as
`"V4xiffQtV4ibii"` we add a new case, let's say `X` which becomes `__fp16` on
OpenCL and `_Float16` on HIP. The previous signature becomes `"V4XiffQtV4ibii"`.
And in the switch in `ASTContext.cpp:12405` we add a new case to handle it:
```cpp
case 'X':
assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers used with 'X'!");
Type = Type = Context.getLangOpts().OpenCL ? Context.HalfTy :
Context.Float16Ty;;
break;
```
At first sight, it looks strange to map one builtin to different types
depending on the language. But it's what we already do for pointer address
spaces (`v*3`, maps to `void __shared__*` on CUDA/HIP, `void __local__*` on
OpenCL and `void __attribute__((addrspace(3)))*` for the rest).
https://github.com/llvm/llvm-project/pull/164358
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits