-
-static LLVMTypeRef
-type4f(struct gallivm_state *gallivm)
-{
- return LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4);
-}
-
-
-/* Equivalent of _mm_setr_ps(a,b,c,d)
- */
-static LLVMValueRef
-vec4f(struct gallivm_state *gallivm,
- LLVMValueRef a, LLVMValueRef b, LLVMValueRef c, LLVMValueRef d,
- const char *name)
-{
- LLVMBuilderRef bld = gallivm->builder;
- LLVMValueRef i0 = lp_build_const_int32(gallivm, 0);
- LLVMValueRef i1 = lp_build_const_int32(gallivm, 1);
- LLVMValueRef i2 = lp_build_const_int32(gallivm, 2);
- LLVMValueRef i3 = lp_build_const_int32(gallivm, 3);
-
- LLVMValueRef res = LLVMGetUndef(type4f(gallivm));
-
- res = LLVMBuildInsertElement(bld, res, a, i0, "");
- res = LLVMBuildInsertElement(bld, res, b, i1, "");
- res = LLVMBuildInsertElement(bld, res, c, i2, "");
- res = LLVMBuildInsertElement(bld, res, d, i3, name);
-
- return res;
-}
-
-/* Equivalent of _mm_set1_ps(a)
- */
-static LLVMValueRef
-vec4f_from_scalar(struct gallivm_state *gallivm,
- LLVMValueRef a,
- const char *name)
-{
- LLVMBuilderRef bld = gallivm->builder;
- LLVMValueRef res = LLVMGetUndef(type4f(gallivm));
- int i;
-
- for(i = 0; i < 4; ++i) {
- LLVMValueRef index = lp_build_const_int32(gallivm, i);
- res = LLVMBuildInsertElement(bld, res, a, index, i == 3 ? name : "");
- }
-
- return res;
-}
-