gallivm: Simplify intrinsic name construction.
Just noticed this could be slightly shortened when fixing MSVC build. Trivial.
This commit is contained in:
@@ -66,10 +66,8 @@ build_binary_int_overflow(struct gallivm_state *gallivm,
|
|||||||
char intr_str[256];
|
char intr_str[256];
|
||||||
LLVMTypeRef type_ref;
|
LLVMTypeRef type_ref;
|
||||||
LLVMTypeKind type_kind;
|
LLVMTypeKind type_kind;
|
||||||
LLVMTypeRef oelems[2] = {
|
unsigned type_width;
|
||||||
LLVMInt32TypeInContext(gallivm->context),
|
LLVMTypeRef oelems[2];
|
||||||
LLVMInt1TypeInContext(gallivm->context)
|
|
||||||
};
|
|
||||||
LLVMValueRef oresult;
|
LLVMValueRef oresult;
|
||||||
LLVMTypeRef otype;
|
LLVMTypeRef otype;
|
||||||
|
|
||||||
@@ -78,26 +76,15 @@ build_binary_int_overflow(struct gallivm_state *gallivm,
|
|||||||
type_kind = LLVMGetTypeKind(type_ref);
|
type_kind = LLVMGetTypeKind(type_ref);
|
||||||
|
|
||||||
debug_assert(type_kind == LLVMIntegerTypeKind);
|
debug_assert(type_kind == LLVMIntegerTypeKind);
|
||||||
|
type_width = LLVMGetIntTypeWidth(type_ref);
|
||||||
|
|
||||||
switch (LLVMGetIntTypeWidth(type_ref)) {
|
debug_assert(type_width == 16 || type_width == 32 || type_width == 64);
|
||||||
case 16:
|
|
||||||
util_snprintf(intr_str, sizeof intr_str, "%s.i16",
|
util_snprintf(intr_str, sizeof intr_str, "%s.i%u",
|
||||||
intr_prefix);
|
intr_prefix, type_width);
|
||||||
oelems[0] = LLVMInt16TypeInContext(gallivm->context);
|
|
||||||
break;
|
oelems[0] = type_ref;
|
||||||
case 32:
|
oelems[1] = LLVMInt1TypeInContext(gallivm->context);
|
||||||
util_snprintf(intr_str, sizeof intr_str, "%s.i32",
|
|
||||||
intr_prefix);
|
|
||||||
oelems[0] = LLVMInt32TypeInContext(gallivm->context);
|
|
||||||
break;
|
|
||||||
case 64:
|
|
||||||
util_snprintf(intr_str, sizeof intr_str, "%s.i64",
|
|
||||||
intr_prefix);
|
|
||||||
oelems[0] = LLVMInt64TypeInContext(gallivm->context);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
debug_assert(!"Unsupported integer width in overflow computation!");
|
|
||||||
}
|
|
||||||
|
|
||||||
otype = LLVMStructTypeInContext(gallivm->context, oelems, 2, FALSE);
|
otype = LLVMStructTypeInContext(gallivm->context, oelems, 2, FALSE);
|
||||||
oresult = lp_build_intrinsic_binary(builder, intr_str,
|
oresult = lp_build_intrinsic_binary(builder, intr_str,
|
||||||
|
Reference in New Issue
Block a user