diff options
author | Timothy Arceri <[email protected]> | 2018-02-26 16:12:41 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-02-28 09:23:49 +1100 |
commit | 3a0b4187ddeadc1fbeb0774540caa36a3a68974a (patch) | |
tree | 124f1ab9d1afaecc5fa0e2456450f1dd2024c9f0 /src | |
parent | cb309d27c52e9a6eeeedbddb82a0f6eb75a6f263 (diff) |
ac: fix f2b and i2b for doubles
Without this llvm was asserting in debug builds.
V2: use LLVMConstNull()
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 3f0bfedfa7d..96bbecd1100 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1437,8 +1437,9 @@ static LLVMValueRef emit_f2b(struct ac_llvm_context *ctx, LLVMValueRef src0) { src0 = ac_to_float(ctx, src0); + LLVMValueRef zero = LLVMConstNull(LLVMTypeOf(src0)); return LLVMBuildSExt(ctx->builder, - LLVMBuildFCmp(ctx->builder, LLVMRealUNE, src0, ctx->f32_0, ""), + LLVMBuildFCmp(ctx->builder, LLVMRealUNE, src0, zero, ""), ctx->i32, ""); } @@ -1457,8 +1458,9 @@ static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx, static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx, LLVMValueRef src0) { + LLVMValueRef zero = LLVMConstNull(LLVMTypeOf(src0)); return LLVMBuildSExt(ctx->builder, - LLVMBuildICmp(ctx->builder, LLVMIntNE, src0, ctx->i32_0, ""), + LLVMBuildICmp(ctx->builder, LLVMIntNE, src0, zero, ""), ctx->i32, ""); } |