ac: add 16-bit support to ac_find_lsb()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 14 Sep 2018 10:52:37 +0000 (12:52 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 17 Sep 2018 13:18:32 +0000 (15:18 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_llvm_build.c

index 905146c9f2830acefbc1f49a3206b62370521db7..6955df48e003805c9c7d8612a834060599f748e8 100644 (file)
@@ -2499,14 +2499,25 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx,
        const char *intrin_name;
        LLVMTypeRef type;
        LLVMValueRef zero;
-       if (src0_bitsize == 64) {
+
+       switch (src0_bitsize) {
+       case 64:
                intrin_name = "llvm.cttz.i64";
                type = ctx->i64;
                zero = ctx->i64_0;
-       } else {
+               break;
+       case 32:
                intrin_name = "llvm.cttz.i32";
                type = ctx->i32;
                zero = ctx->i32_0;
+               break;
+       case 16:
+               intrin_name = "llvm.cttz.i16";
+               type = ctx->i16;
+               zero = ctx->i16_0;
+               break;
+       default:
+               unreachable(!"invalid bitsize");
        }
 
        LLVMValueRef params[2] = {