Acked-by: Roland Scheidegger <sroland@vmware.com>master
| @@ -57,6 +57,10 @@ static LLVMValueRef cast_type(struct lp_build_nir_context *bld_base, LLVMValueRe | |||
| break; | |||
| case nir_type_int: | |||
| switch (bit_size) { | |||
| case 8: | |||
| return LLVMBuildBitCast(builder, val, bld_base->int8_bld.vec_type, ""); | |||
| case 16: | |||
| return LLVMBuildBitCast(builder, val, bld_base->int16_bld.vec_type, ""); | |||
| case 32: | |||
| return LLVMBuildBitCast(builder, val, bld_base->int_bld.vec_type, ""); | |||
| case 64: | |||
| @@ -68,6 +72,10 @@ static LLVMValueRef cast_type(struct lp_build_nir_context *bld_base, LLVMValueRe | |||
| break; | |||
| case nir_type_uint: | |||
| switch (bit_size) { | |||
| case 8: | |||
| return LLVMBuildBitCast(builder, val, bld_base->uint8_bld.vec_type, ""); | |||
| case 16: | |||
| return LLVMBuildBitCast(builder, val, bld_base->uint16_bld.vec_type, ""); | |||
| case 32: | |||
| return LLVMBuildBitCast(builder, val, bld_base->uint_bld.vec_type, ""); | |||
| case 64: | |||
| @@ -85,20 +93,6 @@ static LLVMValueRef cast_type(struct lp_build_nir_context *bld_base, LLVMValueRe | |||
| return NULL; | |||
| } | |||
| static struct lp_build_context *get_int_bld(struct lp_build_nir_context *bld_base, | |||
| bool is_unsigned, | |||
| unsigned op_bit_size) | |||
| { | |||
| if (is_unsigned) | |||
| if (op_bit_size == 64) | |||
| return &bld_base->uint64_bld; | |||
| else | |||
| return &bld_base->uint_bld; | |||
| else if (op_bit_size == 64) | |||
| return &bld_base->int64_bld; | |||
| else | |||
| return &bld_base->int_bld; | |||
| } | |||
| static struct lp_build_context *get_flt_bld(struct lp_build_nir_context *bld_base, | |||
| unsigned op_bit_size) | |||
| @@ -45,6 +45,10 @@ struct lp_build_nir_context | |||
| struct lp_build_context base; | |||
| struct lp_build_context uint_bld; | |||
| struct lp_build_context int_bld; | |||
| struct lp_build_context uint8_bld; | |||
| struct lp_build_context int8_bld; | |||
| struct lp_build_context uint16_bld; | |||
| struct lp_build_context int16_bld; | |||
| struct lp_build_context dbl_bld; | |||
| struct lp_build_context uint64_bld; | |||
| struct lp_build_context int64_bld; | |||
| @@ -218,4 +222,36 @@ lp_nir_array_build_gather_values(LLVMBuilderRef builder, | |||
| return arr; | |||
| } | |||
| static inline struct lp_build_context *get_int_bld(struct lp_build_nir_context *bld_base, | |||
| bool is_unsigned, | |||
| unsigned op_bit_size) | |||
| { | |||
| if (is_unsigned) { | |||
| switch (op_bit_size) { | |||
| case 64: | |||
| return &bld_base->uint64_bld; | |||
| case 32: | |||
| default: | |||
| return &bld_base->uint_bld; | |||
| case 16: | |||
| return &bld_base->uint16_bld; | |||
| case 8: | |||
| return &bld_base->uint8_bld; | |||
| } | |||
| } else { | |||
| switch (op_bit_size) { | |||
| case 64: | |||
| return &bld_base->int64_bld; | |||
| default: | |||
| case 32: | |||
| return &bld_base->int_bld; | |||
| case 16: | |||
| return &bld_base->int16_bld; | |||
| case 8: | |||
| return &bld_base->int8_bld; | |||
| } | |||
| } | |||
| } | |||
| #endif | |||
| @@ -1238,6 +1238,30 @@ void lp_build_nir_soa(struct gallivm_state *gallivm, | |||
| int64_type.width *= 2; | |||
| lp_build_context_init(&bld.bld_base.int64_bld, gallivm, int64_type); | |||
| } | |||
| { | |||
| struct lp_type uint16_type; | |||
| uint16_type = lp_uint_type(type); | |||
| uint16_type.width /= 2; | |||
| lp_build_context_init(&bld.bld_base.uint16_bld, gallivm, uint16_type); | |||
| } | |||
| { | |||
| struct lp_type int16_type; | |||
| int16_type = lp_int_type(type); | |||
| int16_type.width /= 2; | |||
| lp_build_context_init(&bld.bld_base.int16_bld, gallivm, int16_type); | |||
| } | |||
| { | |||
| struct lp_type uint8_type; | |||
| uint8_type = lp_uint_type(type); | |||
| uint8_type.width /= 4; | |||
| lp_build_context_init(&bld.bld_base.uint8_bld, gallivm, uint8_type); | |||
| } | |||
| { | |||
| struct lp_type int8_type; | |||
| int8_type = lp_int_type(type); | |||
| int8_type.width /= 4; | |||
| lp_build_context_init(&bld.bld_base.int8_bld, gallivm, int8_type); | |||
| } | |||
| bld.bld_base.load_var = emit_load_var; | |||
| bld.bld_base.store_var = emit_store_var; | |||
| bld.bld_base.load_reg = emit_load_reg; | |||