* The other side of this is that we need to be able convert between several
* types accurately and efficiently.
*
- * Conversion between types of different bit width is quite complex since a
+ * Conversion between types of different bit width is quite complex since a
*
* To remember there are a few invariants in type conversions:
*
{
LLVMBuilderRef builder = gallivm->builder;
LLVMTypeRef src_type = LLVMTypeOf(src);
- unsigned src_length = LLVMGetTypeKind(src_type) == LLVMVectorTypeKind ?
+ unsigned src_length = LLVMGetTypeKind(src_type) == LLVMFixedVectorTypeKind ?
LLVMGetVectorSize(src_type) : 1;
struct lp_type f32_type = lp_type_float_vec(32, 32 * src_length);
{
LLVMBuilderRef builder = gallivm->builder;
LLVMTypeRef f32_vec_type = LLVMTypeOf(src);
- unsigned length = LLVMGetTypeKind(f32_vec_type) == LLVMVectorTypeKind
+ unsigned length = LLVMGetTypeKind(f32_vec_type) == LLVMFixedVectorTypeKind
? LLVMGetVectorSize(f32_vec_type) : 1;
struct lp_type i32_type = lp_type_int_vec(32, 32 * length);
struct lp_type i16_type = lp_type_int_vec(16, 16 * length);
dst[0] = lp_build_extract_range(gallivm, dst[0], 0, dst_type.length);
}
- return;
+ return;
}
/* Special case 2x8x32 --> 1x16x8, 1x8x32 ->1x8x8
LLVMValueRef dst, rcomp, bcomp, gcomp;
struct lp_build_context i32_bld;
LLVMTypeRef src_type = LLVMTypeOf(*src);
- unsigned src_length = LLVMGetTypeKind(src_type) == LLVMVectorTypeKind ?
+ unsigned src_length = LLVMGetTypeKind(src_type) == LLVMFixedVectorTypeKind ?
LLVMGetVectorSize(src_type) : 1;
struct lp_type i32_type = lp_type_int_vec(32, 32 * src_length);
LLVMValueRef *dst)
{
LLVMTypeRef src_type = LLVMTypeOf(src);
- unsigned src_length = LLVMGetTypeKind(src_type) == LLVMVectorTypeKind ?
+ unsigned src_length = LLVMGetTypeKind(src_type) == LLVMFixedVectorTypeKind ?
LLVMGetVectorSize(src_type) : 1;
struct lp_type f32_type = lp_type_float_vec(32, 32 * src_length);
LLVMBuilderRef builder = gallivm->builder;
LLVMTypeRef src_type = LLVMTypeOf(src);
LLVMValueRef shift, scale, bias, exp;
- unsigned src_length = LLVMGetTypeKind(src_type) == LLVMVectorTypeKind ?
+ unsigned src_length = LLVMGetTypeKind(src_type) == LLVMFixedVectorTypeKind ?
LLVMGetVectorSize(src_type) : 1;
struct lp_type i32_type = lp_type_int_vec(32, 32 * src_length);
struct lp_type u32_type = lp_type_uint_vec(32, 32 * src_length);
char c;
LLVMTypeKind kind = LLVMGetTypeKind(type);
- if (kind == LLVMVectorTypeKind) {
+ if (kind == LLVMFixedVectorTypeKind) {
length = LLVMGetVectorSize(type);
type = LLVMGetElementType(type);
kind = LLVMGetTypeKind(type);
type = LLVMTypeOf(src);
- if (LLVMGetTypeKind(type) != LLVMVectorTypeKind) {
+ if (LLVMGetTypeKind(type) != LLVMFixedVectorTypeKind) {
/* Can't use ShuffleVector on non-vector type */
undef = LLVMGetUndef(LLVMVectorType(type, dst_length));
return LLVMBuildInsertElement(gallivm->builder, undef, src, lp_build_const_int32(gallivm, 0), "");
type_ref = LLVMTypeOf(value);
type_kind = LLVMGetTypeKind(type_ref);
- if (type_kind == LLVMVectorTypeKind) {
+ if (type_kind == LLVMFixedVectorTypeKind) {
length = LLVMGetVectorSize(type_ref);
type_ref = LLVMGetElementType(type_ref);
{
LLVMValueRef res;
- if (LLVMGetTypeKind(vec_type) != LLVMVectorTypeKind) {
+ if (LLVMGetTypeKind(vec_type) != LLVMFixedVectorTypeKind) {
/* scalar */
assert(vec_type == LLVMTypeOf(scalar));
res = scalar;
* type and check for identity.
*/
boolean
-lp_check_elem_type(struct lp_type type, LLVMTypeRef elem_type)
+lp_check_elem_type(struct lp_type type, LLVMTypeRef elem_type)
{
LLVMTypeKind elem_kind;
return FALSE;
}
- return TRUE;
+ return TRUE;
}
boolean
-lp_check_vec_type(struct lp_type type, LLVMTypeRef vec_type)
+lp_check_vec_type(struct lp_type type, LLVMTypeRef vec_type)
{
LLVMTypeRef elem_type;
if (type.length == 1)
return lp_check_elem_type(type, vec_type);
- if(LLVMGetTypeKind(vec_type) != LLVMVectorTypeKind)
+ if(LLVMGetTypeKind(vec_type) != LLVMFixedVectorTypeKind)
return FALSE;
if(LLVMGetVectorSize(vec_type) != type.length)
boolean
-lp_check_value(struct lp_type type, LLVMValueRef val)
+lp_check_value(struct lp_type type, LLVMValueRef val)
{
LLVMTypeRef vec_type;
return 8 * sizeof(float);
case LLVMDoubleTypeKind:
return 8 * sizeof(double);
- case LLVMVectorTypeKind:
+ case LLVMFixedVectorTypeKind:
{
LLVMTypeRef elem = LLVMGetElementType(t);
unsigned len = LLVMGetVectorSize(t);
return "LLVMArrayTypeKind";
case LLVMPointerTypeKind:
return "LLVMPointerTypeKind";
- case LLVMVectorTypeKind:
+ case LLVMFixedVectorTypeKind:
+ #if LLVM_VERSION_MAJOR >= 11
+ return "LLVMFixedVectorTypeKind";
+ #else
return "LLVMVectorTypeKind";
+ #endif
case LLVMMetadataTypeKind:
return "LLVMMetadataTypeKind";
default:
{
LLVMTypeKind k = LLVMGetTypeKind(t);
- if (k == LLVMVectorTypeKind) {
+ if (k == LLVMFixedVectorTypeKind) {
LLVMTypeRef te = LLVMGetElementType(t);
LLVMTypeKind ke = LLVMGetTypeKind(te);
unsigned len = LLVMGetVectorSize(t);
#ifndef LP_BLD_TYPE_H
#define LP_BLD_TYPE_H
+#if LLVM_VERSION_MAJOR < 11
+#define LLVMFixedVectorTypeKind LLVMVectorTypeKind
+#endif
#include "util/format/u_format.h"
#include "pipe/p_compiler.h"