ac: add 16-bit support to ac_build_isign()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 14 Sep 2018 10:52:35 +0000 (12:52 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 17 Sep 2018 13:18:28 +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 011cea5cd0fe9fe2b6ac020524ef66c94a5a8976..71723d5e91f03b22460151238a8271a925eec278 100644 (file)
@@ -2069,14 +2069,25 @@ LLVMValueRef ac_build_isign(struct ac_llvm_context *ctx, LLVMValueRef src0,
        LLVMValueRef cmp, val, zero, one;
        LLVMTypeRef type;
 
-       if (bitsize == 32) {
-               type = ctx->i32;
-               zero = ctx->i32_0;
-               one = ctx->i32_1;
-       } else {
+       switch (bitsize) {
+       case 64:
                type = ctx->i64;
                zero = ctx->i64_0;
                one = ctx->i64_1;
+               break;
+       case 32:
+               type = ctx->i32;
+               zero = ctx->i32_0;
+               one = ctx->i32_1;
+               break;
+       case 16:
+               type = ctx->i16;
+               zero = ctx->i16_0;
+               one = ctx->i16_1;
+               break;
+       default:
+               unreachable(!"invalid bitsize");
+               break;
        }
 
        cmp = LLVMBuildICmp(ctx->builder, LLVMIntSGT, src0, zero, "");