Acked-by: Roland Scheidegger <sroland@vmware.com>master
| break; | break; | ||||
| case nir_type_int: | case nir_type_int: | ||||
| switch (bit_size) { | 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: | case 32: | ||||
| return LLVMBuildBitCast(builder, val, bld_base->int_bld.vec_type, ""); | return LLVMBuildBitCast(builder, val, bld_base->int_bld.vec_type, ""); | ||||
| case 64: | case 64: | ||||
| break; | break; | ||||
| case nir_type_uint: | case nir_type_uint: | ||||
| switch (bit_size) { | 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: | case 32: | ||||
| return LLVMBuildBitCast(builder, val, bld_base->uint_bld.vec_type, ""); | return LLVMBuildBitCast(builder, val, bld_base->uint_bld.vec_type, ""); | ||||
| case 64: | case 64: | ||||
| return NULL; | 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, | static struct lp_build_context *get_flt_bld(struct lp_build_nir_context *bld_base, | ||||
| unsigned op_bit_size) | unsigned op_bit_size) |
| struct lp_build_context base; | struct lp_build_context base; | ||||
| struct lp_build_context uint_bld; | struct lp_build_context uint_bld; | ||||
| struct lp_build_context int_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 dbl_bld; | ||||
| struct lp_build_context uint64_bld; | struct lp_build_context uint64_bld; | ||||
| struct lp_build_context int64_bld; | struct lp_build_context int64_bld; | ||||
| return arr; | 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 | #endif |
| int64_type.width *= 2; | int64_type.width *= 2; | ||||
| lp_build_context_init(&bld.bld_base.int64_bld, gallivm, int64_type); | 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.load_var = emit_load_var; | ||||
| bld.bld_base.store_var = emit_store_var; | bld.bld_base.store_var = emit_store_var; | ||||
| bld.bld_base.load_reg = emit_load_reg; | bld.bld_base.load_reg = emit_load_reg; |