diff options
author | Rhys Perry <[email protected]> | 2018-12-06 14:27:01 +0000 |
---|---|---|
committer | Rhys Perry <[email protected]> | 2019-02-19 11:04:20 +0000 |
commit | 6790b3a8dbf609ee5093ac4b6194a30a17192433 (patch) | |
tree | 26b2f2da3b8f0ae84f3cf3e998a65c630cca5428 /src/amd | |
parent | bbbfdef6833610c6812e722ff3f86ba07c92d9a1 (diff) |
ac/nir: make ac_build_isign work on all bit sizes
v2: don't use ac_get_zero(), ac_get_one() and ac_int_of_size()
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 92e3dc4c25f..f033fde6da1 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -2078,30 +2078,11 @@ LLVMValueRef ac_build_fract(struct ac_llvm_context *ctx, LLVMValueRef src0, LLVMValueRef ac_build_isign(struct ac_llvm_context *ctx, LLVMValueRef src0, unsigned bitsize) { - LLVMValueRef cmp, val, zero, one; - LLVMTypeRef type; - - 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; - } + LLVMTypeRef type = LLVMIntTypeInContext(ctx->context, bitsize); + LLVMValueRef zero = LLVMConstInt(type, 0, false); + LLVMValueRef one = LLVMConstInt(type, 1, false); + LLVMValueRef cmp, val; cmp = LLVMBuildICmp(ctx->builder, LLVMIntSGT, src0, zero, ""); val = LLVMBuildSelect(ctx->builder, cmp, one, src0, ""); cmp = LLVMBuildICmp(ctx->builder, LLVMIntSGE, val, zero, ""); |