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:
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:
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)
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;
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
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;