function write in C
#1

  1. Can someone tell me how to write the following function(in inc_common.cl)
  1. DECLSPEC u32 hc_byte_perm_S (const u32 a, const u32 b, const int c)
  1. with C language
  1. DECLSPEC u32 hc_byte_perm_S (const u32 a, const u32 b, const int c)
  1. {
  1.     u32 r = 0;
  1.     asm volatile ("V_PERM_B32 %0, %1, %2, %3;" : "=v"(r) : "v"(b), "v"(a), "v"(c));
  1.     return r;
  1. }
  1. DECLSPEC u32 hc_byte_perm_S (const u32 a, const u32 b, const int c)
  1. {
  1.     u32 r = 0;
  1.     asm volatile ("prmt.b32 %0, %1, %2, %3;" : "=r"(r) : "r"(a), "r"(b), "r"(c));
  1.     return r;
  1. }
  1. I not familiar with GPU asm
Reply


Messages In This Thread
function write in C - by hellohihi - 11-30-2021, 01:32 PM