AMDGPU : Add Clang builtin intrinsics for compare with the full wavefront result.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Tests should be added for non-constant compare type operands being rejected in test/CodeGenOpenCL/builtins-amdgcn-error.cl
include/clang/Basic/BuiltinsAMDGPU.def | ||
---|---|---|
73–74 ↗ | (On Diff #65984) | There should be 4 intrinsics defined for icmp. We need uicmp, uicmpl, sicmp, sicmpl. I'm not sure what W is. |
74 ↗ | (On Diff #65984) | The bultin suffix for long should be l. The other builtins also use L instead of W for int64 |
75–76 ↗ | (On Diff #65984) | All of these intrinsics should have the final parameter marked with I to require it be an immediate |
test/CodeGenOpenCL/builtins-amdgcn.cl | ||
207 ↗ | (On Diff #65984) | Non-constant 3rd parameter is invalid |
include/clang/Basic/BuiltinsAMDGPU.def | ||
---|---|---|
73–74 ↗ | (On Diff #65984) | According to the definition on https://code.woboq.org/llvm/clang/include/clang/Basic/Builtins.def.html W is for int64_t |
test/CodeGenOpenCL/builtins-amdgcn.cl | ||
---|---|---|
207 ↗ | (On Diff #65984) | should the third constant be "const int c" ? |
- Modified intrinsic parameters' data type
- Modified the LIT test functions' last parameter to const uint.
include/clang/Basic/BuiltinsAMDGPU.def | ||
---|---|---|
73–78 ↗ | (On Diff #66044) | The return types look wrong. They should all be ulong, not signed |
test/CodeGenOpenCL/builtins-amdgcn.cl | ||
210 ↗ | (On Diff #66044) | The tests seem to be in a random order. Can you sort them so that the same operation on the same type is the next one? This is missing uicmp_i32 |
212 ↗ | (On Diff #66044) | The output type should be ulong |
214 ↗ | (On Diff #66044) | This isn't a valid icmp predicate type. Ideally there would be an error for this but that can be another patch |
228 ↗ | (On Diff #66044) | This test is using an unsigned predicate value for the signed version |
include/clang/Basic/BuiltinsAMDGPU.def | ||
---|---|---|
75–76 ↗ | (On Diff #66134) | This looks inconsistent. You don't need the 'S'es |
Still missing test that non-constants for 3rd operand are rejected
test/CodeGenOpenCL/builtins-amdgcn.cl | ||
---|---|---|
233 ↗ | (On Diff #66143) | Unused c parameter |
If I write a test with the third parameter as an non-constant, it fails at the compilation phase:
llvm/tools/clang/test/CodeGenOpenCL/builtins-amdgcn.cl:249:10: error: argument to '__builtin_amdgcn_fcmp' must be a constant integer
*out = __builtin_amdgcn_fcmp(a, b, c); ^ ~
1 error generated.
FileCheck error: '-' is empty.
So how to write a FileCheck to detect this? Thanks!
Yes, that's the point. The tests in builtins-amdgcn-error.cl do this, you should add these tests there
test/CodeGenOpenCL/builtins-amdgcn-error.cl | ||
---|---|---|
20–23 ↗ | (On Diff #66484) | All of the new builtins should be tested here |