81
81
* XXX: I'm not sure if it wouldn't be easier/efficient to just recreate the
82
82
* type and check for identity.
85
85
lp_check_elem_type(struct lp_type type, LLVMTypeRef elem_type)
91
91
const LLVMTypeKind elem_kind = LLVMGetTypeKind(elem_type);
96
96
if (elem_kind != (lp_has_fp16()
97
97
? LLVMHalfTypeKind : LLVMIntegerTypeKind)) {
98
98
debug_printf("%s:%d: type is not 16 bits\n", __FILE__, __LINE__);
103
103
if (elem_kind != LLVMFloatTypeKind) {
104
104
debug_printf("%s:%d: type is not float\n", __FILE__, __LINE__);
109
109
if (elem_kind != LLVMDoubleTypeKind) {
110
110
debug_printf("%s:%d: type is not double\n", __FILE__, __LINE__);
120
120
if (elem_kind != LLVMIntegerTypeKind) {
121
121
debug_printf("%s:%d: element is not integer\n", __FILE__, __LINE__);
125
125
if (LLVMGetIntTypeWidth(elem_type) != type.width) {
126
126
debug_printf("%s:%d: type width mismatch %d != %d\n",
127
127
__FILE__, __LINE__,
128
128
LLVMGetIntTypeWidth(elem_type), type.width);
138
138
lp_check_vec_type(struct lp_type type, LLVMTypeRef vec_type)
140
140
assert(vec_type);
144
144
if (type.length == 1)
145
145
return lp_check_elem_type(type, vec_type);
147
147
if (LLVMGetTypeKind(vec_type) != LLVMVectorTypeKind) {
148
148
printf("%s:%d: kind is not vector\n", __FILE__, __LINE__);
152
152
if (LLVMGetVectorSize(vec_type) != type.length) {
153
153
printf("%s:%d: vector size mismatch %d != expected %d\n", __FILE__, __LINE__,
154
154
LLVMGetVectorSize(vec_type), type.length);
158
158
LLVMTypeRef elem_type = LLVMGetElementType(vec_type);