return result;
}
+LLVMValueRef
+lp_build_bitfield_reverse(struct lp_build_context *bld, LLVMValueRef a)
+{
+ LLVMBuilderRef builder = bld->gallivm->builder;
+ LLVMValueRef result;
+ char intr_str[256];
+
+ lp_format_intrinsic(intr_str, sizeof(intr_str), "llvm.bitreverse", bld->vec_type);
+ result = lp_build_intrinsic_unary(builder, intr_str, bld->vec_type, a);
+ return result;
+}
+
LLVMValueRef
lp_build_cttz(struct lp_build_context *bld, LLVMValueRef a)
{
result = lp_build_intrinsic_binary(builder, intr_str, bld->vec_type, a, undef_val);
return result;
}
+
+LLVMValueRef
+lp_build_ctlz(struct lp_build_context *bld, LLVMValueRef a)
+{
+ LLVMBuilderRef builder = bld->gallivm->builder;
+ LLVMValueRef result;
+ char intr_str[256];
+
+ lp_format_intrinsic(intr_str, sizeof(intr_str), "llvm.ctlz", bld->vec_type);
+
+ LLVMValueRef undef_val = LLVMConstNull(LLVMInt1TypeInContext(bld->gallivm->context));
+ result = lp_build_intrinsic_binary(builder, intr_str, bld->vec_type, a, undef_val);
+ return result;
+}
LLVMValueRef
lp_build_popcount(struct lp_build_context *bld, LLVMValueRef a);
+LLVMValueRef
+lp_build_bitfield_reverse(struct lp_build_context *bld, LLVMValueRef a);
+
LLVMValueRef
lp_build_cttz(struct lp_build_context *bld, LLVMValueRef a);
+
+LLVMValueRef
+lp_build_ctlz(struct lp_build_context *bld, LLVMValueRef a);
#endif /* !LP_BLD_ARIT_H */
case nir_op_bitfield_select:
result = lp_build_xor(&bld_base->uint_bld, src[2], lp_build_and(&bld_base->uint_bld, src[0], lp_build_xor(&bld_base->uint_bld, src[1], src[2])));
break;
+ case nir_op_bitfield_reverse:
+ result = lp_build_bitfield_reverse(get_int_bld(bld_base, false, src_bit_size[0]), src[0]);
+ break;
case nir_op_f2b32:
result = flt_to_bool32(bld_base, src_bit_size[0], src[0]);
break;
result = lp_build_div(&bld_base->uint_bld,
src[0], src[1]);
break;
+ case nir_op_ufind_msb: {
+ struct lp_build_context *uint_bld = get_int_bld(bld_base, true, src_bit_size[0]);
+ result = lp_build_ctlz(uint_bld, src[0]);
+ result = lp_build_sub(uint_bld, lp_build_const_int_vec(gallivm, uint_bld->type, src_bit_size[0] - 1), result);
+ break;
+ }
case nir_op_uge32:
result = icmp32(bld_base, PIPE_FUNC_GEQUAL, true, src_bit_size[0], src);
break;