ac/nir: handle negate modifier

This commit is contained in:
Marek Olšák 2019-07-23 23:11:40 -04:00
parent 33a8eab7a9
commit bfea7e4d29
1 changed files with 12 additions and 1 deletions

View File

@ -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;
}