AMDGPU : Add Clang builtin intrinsics for compare with the full wavefront result.
Details
Diff Detail
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 | There should be 4 intrinsics defined for icmp. We need uicmp, uicmpl, sicmp, sicmpl. I'm not sure what W is. | |
74 | The bultin suffix for long should be l. The other builtins also use L instead of W for int64 | |
75–76 | All of these intrinsics should have the final parameter marked with I to require it be an immediate | |
test/CodeGenOpenCL/builtins-amdgcn.cl | ||
207 | Non-constant 3rd parameter is invalid |
include/clang/Basic/BuiltinsAMDGPU.def | ||
---|---|---|
73–74 | 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 | 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 | The return types look wrong. They should all be ulong, not signed | |
test/CodeGenOpenCL/builtins-amdgcn.cl | ||
210 | 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 | The output type should be ulong | |
214 | This isn't a valid icmp predicate type. Ideally there would be an error for this but that can be another patch | |
228 | This test is using an unsigned predicate value for the signed version |
include/clang/Basic/BuiltinsAMDGPU.def | ||
---|---|---|
75–76 | 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 | 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 |
The bultin suffix for long should be l. The other builtins also use L instead of W for int64