diff options
author | Samuel Pitoiset <[email protected]> | 2018-09-14 12:52:36 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-09-17 15:18:30 +0200 |
commit | 5a6c8ca3e8efca5b9ef6cf8adbcede12c9552618 (patch) | |
tree | e74d4edf273c16eb4fc6c8cb8b91a01c349ad41e | |
parent | 3e7f3e2cd1e9f44eab840441af15a44883919717 (diff) |
ac: add 16-bit support to ac_build_umsb()
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 71723d5e91f..905146c9f28 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1393,17 +1393,31 @@ ac_build_umsb(struct ac_llvm_context *ctx, LLVMTypeRef type; LLVMValueRef highest_bit; LLVMValueRef zero; + unsigned bitsize; - if (ac_get_elem_bits(ctx, LLVMTypeOf(arg)) == 64) { + bitsize = ac_get_elem_bits(ctx, LLVMTypeOf(arg)); + switch (bitsize) { + case 64: intrin_name = "llvm.ctlz.i64"; type = ctx->i64; highest_bit = LLVMConstInt(ctx->i64, 63, false); zero = ctx->i64_0; - } else { + break; + case 32: intrin_name = "llvm.ctlz.i32"; type = ctx->i32; highest_bit = LLVMConstInt(ctx->i32, 31, false); zero = ctx->i32_0; + break; + case 16: + intrin_name = "llvm.ctlz.i16"; + type = ctx->i16; + highest_bit = LLVMConstInt(ctx->i16, 15, false); + zero = ctx->i16_0; + break; + default: + unreachable(!"invalid bitsize"); + break; } LLVMValueRef params[2] = { |