diff options
author | Marek Olšák <[email protected]> | 2019-07-23 23:11:40 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-07-30 22:06:23 -0400 |
commit | bfea7e4d2965269bff8f1f6449cb99c312fd7384 (patch) | |
tree | 74a25392712da361cd1444e211d9cfee3ca3f5e8 /src/amd/common | |
parent | 33a8eab7a95e99fafc702c697b47d9386996bd45 (diff) |
ac/nir: handle negate modifier
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 826a6377323..f3cb9e879ed 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -187,7 +187,18 @@ static LLVMValueRef get_alu_src(struct ac_nir_context *ctx, swizzle, ""); } } - assert(!src.negate); + + if (src.negate) { + LLVMTypeRef type = LLVMTypeOf(value); + if (LLVMGetTypeKind(type) == LLVMVectorTypeKind) + type = LLVMGetElementType(type); + + if (LLVMGetTypeKind(type) == LLVMIntegerTypeKind) + value = LLVMBuildNeg(ctx->ac.builder, value, ""); + else + value = LLVMBuildFNeg(ctx->ac.builder, value, ""); + } + assert(!src.abs); return value; } |