Skip to content

Commit 3ec3c4e

Browse files
committed
Deleted asm signed bit field extract -- it did not work. Changed xtract32 to use amdgcn_builtin with proper #if defined.
1 parent 2ab3a3e commit 3ec3c4e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/cl/carryutil.cl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ void updateStats(global uint *bufROE, u32 posROE, float roundMax) {
1515
}
1616
#endif
1717

18-
#if 0 && HAS_ASM
19-
i32 lowBits(i32 u, u32 bits) { i32 tmp; __asm("v_bfe_i32 %0, %1, 0, %2" : "=v" (tmp) : "v" (u), "v" (bits)); return tmp; }
20-
i32 xtract32(i64 x, u32 bits) { i32 tmp; __asm("v_alignbit_b32 %0, %1, %2, %3" : "=v"(tmp) : "v"(as_int2(x).y), "v"(as_int2(x).x), "v"(bits)); return tmp; }
18+
i32 lowBits(i32 u, u32 bits) { return ((u << (32 - bits)) >> (32 - bits)); }
19+
#if defined(__has_builtin) && __has_builtin(__builtin_amdgcn_alignbit)
20+
i32 xtract32(i64 x, u32 bits) { return __builtin_amdgcn_alignbit(as_int2(x).y, as_int2(x).x, bits); }
2121
#else
22-
i32 lowBits(i32 u, u32 bits) { return ((u << (32 - bits)) >> (32 - bits)); }
2322
i32 xtract32(i64 x, u32 bits) { return x >> bits; }
2423
#endif
2524

0 commit comments

Comments
 (0)