libclc: Stop using asm declarations for r600 on amdgcn for get_global_size (#128692)

Comparing the case where each dimension is used alone, the only codegen
difference is a missed addressing mode fold for the constant offset in the old
version due to an ancient bug.
This commit is contained in:
Matt Arsenault 2025-02-25 18:23:04 +07:00 committed by GitHub
parent f95ad44068
commit b57e63b07a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,17 +1,13 @@
#include <clc/clc.h>
uint __clc_amdgcn_get_global_size_x(void) __asm("llvm.r600.read.global.size.x");
uint __clc_amdgcn_get_global_size_y(void) __asm("llvm.r600.read.global.size.y");
uint __clc_amdgcn_get_global_size_z(void) __asm("llvm.r600.read.global.size.z");
_CLC_DEF _CLC_OVERLOAD size_t get_global_size(uint dim) {
switch (dim) {
case 0:
return __clc_amdgcn_get_global_size_x();
return __builtin_amdgcn_grid_size_x();
case 1:
return __clc_amdgcn_get_global_size_y();
return __builtin_amdgcn_grid_size_y();
case 2:
return __clc_amdgcn_get_global_size_z();
return __builtin_amdgcn_grid_size_z();
default:
return 1;
}