1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Helper functions for swizzling/shuffling.
32 * @author Jose Fonseca <jfonseca@vmware.com>
35 #include <inttypes.h> /* for PRIx64 macro */
36 #include "util/u_debug.h"
38 #include "lp_bld_type.h"
39 #include "lp_bld_const.h"
40 #include "lp_bld_init.h"
41 #include "lp_bld_logic.h"
42 #include "lp_bld_swizzle.h"
43 #include "lp_bld_pack.h"
47 lp_build_broadcast(struct gallivm_state
*gallivm
,
53 if (LLVMGetTypeKind(vec_type
) != LLVMVectorTypeKind
) {
55 assert(vec_type
== LLVMTypeOf(scalar
));
58 LLVMBuilderRef builder
= gallivm
->builder
;
59 const unsigned length
= LLVMGetVectorSize(vec_type
);
60 LLVMValueRef undef
= LLVMGetUndef(vec_type
);
61 /* The shuffle vector is always made of int32 elements */
62 LLVMTypeRef i32_type
= LLVMInt32TypeInContext(gallivm
->context
);
63 LLVMTypeRef i32_vec_type
= LLVMVectorType(i32_type
, length
);
65 assert(LLVMGetElementType(vec_type
) == LLVMTypeOf(scalar
));
67 res
= LLVMBuildInsertElement(builder
, undef
, scalar
, LLVMConstNull(i32_type
), "");
68 res
= LLVMBuildShuffleVector(builder
, res
, undef
, LLVMConstNull(i32_vec_type
), "");
79 lp_build_broadcast_scalar(struct lp_build_context
*bld
,
82 assert(lp_check_elem_type(bld
->type
, LLVMTypeOf(scalar
)));
84 return lp_build_broadcast(bld
->gallivm
, bld
->vec_type
, scalar
);
89 * Combined extract and broadcast (mere shuffle in most cases)
92 lp_build_extract_broadcast(struct gallivm_state
*gallivm
,
93 struct lp_type src_type
,
94 struct lp_type dst_type
,
98 LLVMTypeRef i32t
= LLVMInt32TypeInContext(gallivm
->context
);
101 assert(src_type
.floating
== dst_type
.floating
);
102 assert(src_type
.width
== dst_type
.width
);
104 assert(lp_check_value(src_type
, vector
));
105 assert(LLVMTypeOf(index
) == i32t
);
107 if (src_type
.length
== 1) {
108 if (dst_type
.length
== 1) {
110 * Trivial scalar -> scalar.
117 * Broadcast scalar -> vector.
120 res
= lp_build_broadcast(gallivm
,
121 lp_build_vec_type(gallivm
, dst_type
),
126 if (dst_type
.length
> 1) {
128 * shuffle - result can be of different length.
131 LLVMValueRef shuffle
;
132 shuffle
= lp_build_broadcast(gallivm
,
133 LLVMVectorType(i32t
, dst_type
.length
),
135 res
= LLVMBuildShuffleVector(gallivm
->builder
, vector
,
136 LLVMGetUndef(lp_build_vec_type(gallivm
, src_type
)),
141 * Trivial extract scalar from vector.
143 res
= LLVMBuildExtractElement(gallivm
->builder
, vector
, index
, "");
152 * Swizzle one channel into other channels.
155 lp_build_swizzle_scalar_aos(struct lp_build_context
*bld
,
158 unsigned num_channels
)
160 LLVMBuilderRef builder
= bld
->gallivm
->builder
;
161 const struct lp_type type
= bld
->type
;
162 const unsigned n
= type
.length
;
165 if(a
== bld
->undef
|| a
== bld
->zero
|| a
== bld
->one
|| num_channels
== 1)
168 assert(num_channels
== 2 || num_channels
== 4);
170 /* XXX: SSE3 has PSHUFB which should be better than bitmasks, but forcing
171 * using shuffles here actually causes worst results. More investigation is
173 if (LLVMIsConstant(a
) ||
178 LLVMTypeRef elem_type
= LLVMInt32TypeInContext(bld
->gallivm
->context
);
179 LLVMValueRef shuffles
[LP_MAX_VECTOR_LENGTH
];
181 for(j
= 0; j
< n
; j
+= num_channels
)
182 for(i
= 0; i
< num_channels
; ++i
)
183 shuffles
[j
+ i
] = LLVMConstInt(elem_type
, j
+ channel
, 0);
185 return LLVMBuildShuffleVector(builder
, a
, bld
->undef
, LLVMConstVector(shuffles
, n
), "");
187 else if (num_channels
== 2) {
189 * Bit mask and shifts
191 * XY XY .... XY <= input
194 * YY YY .... YY <= output
196 struct lp_type type2
;
197 LLVMValueRef tmp
= NULL
;
200 a
= LLVMBuildAnd(builder
, a
,
201 lp_build_const_mask_aos(bld
->gallivm
,
202 type
, 1 << channel
, num_channels
), "");
205 type2
.floating
= FALSE
;
209 a
= LLVMBuildBitCast(builder
, a
, lp_build_vec_type(bld
->gallivm
, type2
), "");
212 * Vector element 0 is always channel X.
214 * 76 54 32 10 (array numbering)
215 * Little endian reg in: YX YX YX YX
216 * Little endian reg out: YY YY YY YY if shift right (shift == -1)
217 * XX XX XX XX if shift left (shift == 1)
219 * 01 23 45 67 (array numbering)
220 * Big endian reg in: XY XY XY XY
221 * Big endian reg out: YY YY YY YY if shift left (shift == 1)
222 * XX XX XX XX if shift right (shift == -1)
225 #ifdef PIPE_ARCH_LITTLE_ENDIAN
226 shift
= channel
== 0 ? 1 : -1;
228 shift
= channel
== 0 ? -1 : 1;
232 tmp
= LLVMBuildShl(builder
, a
, lp_build_const_int_vec(bld
->gallivm
, type2
, shift
* type
.width
), "");
233 } else if (shift
< 0) {
234 tmp
= LLVMBuildLShr(builder
, a
, lp_build_const_int_vec(bld
->gallivm
, type2
, -shift
* type
.width
), "");
239 a
= LLVMBuildOr(builder
, a
, tmp
, "");
242 return LLVMBuildBitCast(builder
, a
, lp_build_vec_type(bld
->gallivm
, type
), "");
246 * Bit mask and recursive shifts
248 * Little-endian registers:
251 * WZYX WZYX .... WZYX <= input
252 * 00Y0 00Y0 .... 00Y0 <= mask
253 * 00YY 00YY .... 00YY <= shift right 1 (shift amount -1)
254 * YYYY YYYY .... YYYY <= shift left 2 (shift amount 2)
256 * Big-endian registers:
259 * XYZW XYZW .... XYZW <= input
260 * 0Y00 0Y00 .... 0Y00 <= mask
261 * YY00 YY00 .... YY00 <= shift left 1 (shift amount 1)
262 * YYYY YYYY .... YYYY <= shift right 2 (shift amount -2)
264 * shifts[] gives little-endian shift amounts; we need to negate for big-endian.
266 struct lp_type type4
;
267 const int shifts
[4][2] = {
275 a
= LLVMBuildAnd(builder
, a
,
276 lp_build_const_mask_aos(bld
->gallivm
,
277 type
, 1 << channel
, 4), "");
280 * Build a type where each element is an integer that cover the four
285 type4
.floating
= FALSE
;
289 a
= LLVMBuildBitCast(builder
, a
, lp_build_vec_type(bld
->gallivm
, type4
), "");
291 for(i
= 0; i
< 2; ++i
) {
292 LLVMValueRef tmp
= NULL
;
293 int shift
= shifts
[channel
][i
];
295 /* See endianness diagram above */
296 #ifdef PIPE_ARCH_BIG_ENDIAN
301 tmp
= LLVMBuildShl(builder
, a
, lp_build_const_int_vec(bld
->gallivm
, type4
, shift
*type
.width
), "");
303 tmp
= LLVMBuildLShr(builder
, a
, lp_build_const_int_vec(bld
->gallivm
, type4
, -shift
*type
.width
), "");
307 a
= LLVMBuildOr(builder
, a
, tmp
, "");
310 return LLVMBuildBitCast(builder
, a
, lp_build_vec_type(bld
->gallivm
, type
), "");
316 * Swizzle a vector consisting of an array of XYZW structs.
318 * This fills a vector of dst_len length with the swizzled channels from src.
320 * e.g. with swizzles = { 2, 1, 0 } and swizzle_count = 6 results in
321 * RGBA RGBA = BGR BGR BG
323 * @param swizzles the swizzle array
324 * @param num_swizzles the number of elements in swizzles
325 * @param dst_len the length of the result
328 lp_build_swizzle_aos_n(struct gallivm_state
* gallivm
,
330 const unsigned char* swizzles
,
331 unsigned num_swizzles
,
334 LLVMBuilderRef builder
= gallivm
->builder
;
335 LLVMValueRef shuffles
[LP_MAX_VECTOR_WIDTH
];
338 assert(dst_len
< LP_MAX_VECTOR_WIDTH
);
340 for (i
= 0; i
< dst_len
; ++i
) {
341 int swizzle
= swizzles
[i
% num_swizzles
];
343 if (swizzle
== LP_BLD_SWIZZLE_DONTCARE
) {
344 shuffles
[i
] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm
->context
));
346 shuffles
[i
] = lp_build_const_int32(gallivm
, swizzle
);
350 return LLVMBuildShuffleVector(builder
, src
, LLVMGetUndef(LLVMTypeOf(src
)), LLVMConstVector(shuffles
, dst_len
), "");
355 lp_build_swizzle_aos(struct lp_build_context
*bld
,
357 const unsigned char swizzles
[4])
359 LLVMBuilderRef builder
= bld
->gallivm
->builder
;
360 const struct lp_type type
= bld
->type
;
361 const unsigned n
= type
.length
;
364 if (swizzles
[0] == PIPE_SWIZZLE_RED
&&
365 swizzles
[1] == PIPE_SWIZZLE_GREEN
&&
366 swizzles
[2] == PIPE_SWIZZLE_BLUE
&&
367 swizzles
[3] == PIPE_SWIZZLE_ALPHA
) {
371 if (swizzles
[0] == swizzles
[1] &&
372 swizzles
[1] == swizzles
[2] &&
373 swizzles
[2] == swizzles
[3]) {
374 switch (swizzles
[0]) {
375 case PIPE_SWIZZLE_RED
:
376 case PIPE_SWIZZLE_GREEN
:
377 case PIPE_SWIZZLE_BLUE
:
378 case PIPE_SWIZZLE_ALPHA
:
379 return lp_build_swizzle_scalar_aos(bld
, a
, swizzles
[0], 4);
380 case PIPE_SWIZZLE_ZERO
:
382 case PIPE_SWIZZLE_ONE
:
384 case LP_BLD_SWIZZLE_DONTCARE
:
392 if (LLVMIsConstant(a
) ||
397 LLVMValueRef undef
= LLVMGetUndef(lp_build_elem_type(bld
->gallivm
, type
));
398 LLVMTypeRef i32t
= LLVMInt32TypeInContext(bld
->gallivm
->context
);
399 LLVMValueRef shuffles
[LP_MAX_VECTOR_LENGTH
];
400 LLVMValueRef aux
[LP_MAX_VECTOR_LENGTH
];
402 memset(aux
, 0, sizeof aux
);
404 for(j
= 0; j
< n
; j
+= 4) {
405 for(i
= 0; i
< 4; ++i
) {
407 switch (swizzles
[i
]) {
411 case PIPE_SWIZZLE_RED
:
412 case PIPE_SWIZZLE_GREEN
:
413 case PIPE_SWIZZLE_BLUE
:
414 case PIPE_SWIZZLE_ALPHA
:
415 shuffle
= j
+ swizzles
[i
];
416 shuffles
[j
+ i
] = LLVMConstInt(i32t
, shuffle
, 0);
418 case PIPE_SWIZZLE_ZERO
:
419 shuffle
= type
.length
+ 0;
420 shuffles
[j
+ i
] = LLVMConstInt(i32t
, shuffle
, 0);
422 aux
[0] = lp_build_const_elem(bld
->gallivm
, type
, 0.0);
425 case PIPE_SWIZZLE_ONE
:
426 shuffle
= type
.length
+ 1;
427 shuffles
[j
+ i
] = LLVMConstInt(i32t
, shuffle
, 0);
429 aux
[1] = lp_build_const_elem(bld
->gallivm
, type
, 1.0);
432 case LP_BLD_SWIZZLE_DONTCARE
:
433 shuffles
[j
+ i
] = LLVMGetUndef(i32t
);
439 for (i
= 0; i
< n
; ++i
) {
445 return LLVMBuildShuffleVector(builder
, a
,
446 LLVMConstVector(aux
, n
),
447 LLVMConstVector(shuffles
, n
), "");
450 * Bit mask and shifts.
452 * For example, this will convert BGRA to RGBA by doing
455 * rgba = (bgra & 0x00ff0000) >> 16
456 * | (bgra & 0xff00ff00)
457 * | (bgra & 0x000000ff) << 16
460 * rgba = (bgra & 0x0000ff00) << 16
461 * | (bgra & 0x00ff00ff)
462 * | (bgra & 0xff000000) >> 16
464 * This is necessary not only for faster cause, but because X86 backend
465 * will refuse shuffles of <4 x i8> vectors
468 struct lp_type type4
;
474 * Start with a mixture of 1 and 0.
476 for (chan
= 0; chan
< 4; ++chan
) {
477 if (swizzles
[chan
] == PIPE_SWIZZLE_ONE
) {
481 res
= lp_build_select_aos(bld
, cond
, bld
->one
, bld
->zero
, 4);
484 * Build a type where each element is an integer that cover the four
488 type4
.floating
= FALSE
;
492 a
= LLVMBuildBitCast(builder
, a
, lp_build_vec_type(bld
->gallivm
, type4
), "");
493 res
= LLVMBuildBitCast(builder
, res
, lp_build_vec_type(bld
->gallivm
, type4
), "");
496 * Mask and shift the channels, trying to group as many channels in the
497 * same shift as possible. The shift amount is positive for shifts left
498 * and negative for shifts right.
500 for (shift
= -3; shift
<= 3; ++shift
) {
503 assert(type4
.width
<= sizeof(mask
)*8);
506 * Vector element numbers follow the XYZW order, so 0 is always X, etc.
507 * After widening 4 times we have:
510 * Little-endian register layout: WZYX
513 * Big-endian register layout: XYZW
515 * For little-endian, higher-numbered channels are obtained by a shift right
516 * (negative shift amount) and lower-numbered channels by a shift left
517 * (positive shift amount). The opposite is true for big-endian.
519 for (chan
= 0; chan
< 4; ++chan
) {
520 if (swizzles
[chan
] < 4) {
521 /* We need to move channel swizzles[chan] into channel chan */
522 #ifdef PIPE_ARCH_LITTLE_ENDIAN
523 if (swizzles
[chan
] - chan
== -shift
) {
524 mask
|= ((1ULL << type
.width
) - 1) << (swizzles
[chan
] * type
.width
);
527 if (swizzles
[chan
] - chan
== shift
) {
528 mask
|= ((1ULL << type
.width
) - 1) << (type4
.width
- type
.width
) >> (swizzles
[chan
] * type
.width
);
536 LLVMValueRef shifted
;
538 debug_printf("shift = %i, mask = %" PRIx64
"\n", shift
, mask
);
540 masked
= LLVMBuildAnd(builder
, a
,
541 lp_build_const_int_vec(bld
->gallivm
, type4
, mask
), "");
543 shifted
= LLVMBuildShl(builder
, masked
,
544 lp_build_const_int_vec(bld
->gallivm
, type4
, shift
*type
.width
), "");
545 } else if (shift
< 0) {
546 shifted
= LLVMBuildLShr(builder
, masked
,
547 lp_build_const_int_vec(bld
->gallivm
, type4
, -shift
*type
.width
), "");
552 res
= LLVMBuildOr(builder
, res
, shifted
, "");
556 return LLVMBuildBitCast(builder
, res
,
557 lp_build_vec_type(bld
->gallivm
, type
), "");
563 * Extended swizzle of a single channel of a SoA vector.
565 * @param bld building context
566 * @param unswizzled array with the 4 unswizzled values
567 * @param swizzle one of the PIPE_SWIZZLE_*
569 * @return the swizzled value.
572 lp_build_swizzle_soa_channel(struct lp_build_context
*bld
,
573 const LLVMValueRef
*unswizzled
,
577 case PIPE_SWIZZLE_RED
:
578 case PIPE_SWIZZLE_GREEN
:
579 case PIPE_SWIZZLE_BLUE
:
580 case PIPE_SWIZZLE_ALPHA
:
581 return unswizzled
[swizzle
];
582 case PIPE_SWIZZLE_ZERO
:
584 case PIPE_SWIZZLE_ONE
:
594 * Extended swizzle of a SoA vector.
596 * @param bld building context
597 * @param unswizzled array with the 4 unswizzled values
598 * @param swizzles array of PIPE_SWIZZLE_*
599 * @param swizzled output swizzled values
602 lp_build_swizzle_soa(struct lp_build_context
*bld
,
603 const LLVMValueRef
*unswizzled
,
604 const unsigned char swizzles
[4],
605 LLVMValueRef
*swizzled
)
609 for (chan
= 0; chan
< 4; ++chan
) {
610 swizzled
[chan
] = lp_build_swizzle_soa_channel(bld
, unswizzled
,
617 * Do an extended swizzle of a SoA vector inplace.
619 * @param bld building context
620 * @param values intput/output array with the 4 values
621 * @param swizzles array of PIPE_SWIZZLE_*
624 lp_build_swizzle_soa_inplace(struct lp_build_context
*bld
,
625 LLVMValueRef
*values
,
626 const unsigned char swizzles
[4])
628 LLVMValueRef unswizzled
[4];
631 for (chan
= 0; chan
< 4; ++chan
) {
632 unswizzled
[chan
] = values
[chan
];
635 lp_build_swizzle_soa(bld
, unswizzled
, swizzles
, values
);
640 * Transpose from AOS <-> SOA
642 * @param single_type_lp type of pixels
643 * @param src the 4 * n pixel input
644 * @param dst the 4 * n pixel output
647 lp_build_transpose_aos(struct gallivm_state
*gallivm
,
648 struct lp_type single_type_lp
,
649 const LLVMValueRef src
[4],
652 struct lp_type double_type_lp
= single_type_lp
;
653 LLVMTypeRef single_type
;
654 LLVMTypeRef double_type
;
655 LLVMValueRef t0
, t1
, t2
, t3
;
657 double_type_lp
.length
>>= 1;
658 double_type_lp
.width
<<= 1;
660 double_type
= lp_build_vec_type(gallivm
, double_type_lp
);
661 single_type
= lp_build_vec_type(gallivm
, single_type_lp
);
663 /* Interleave x, y, z, w -> xy and zw */
664 t0
= lp_build_interleave2_half(gallivm
, single_type_lp
, src
[0], src
[1], 0);
665 t1
= lp_build_interleave2_half(gallivm
, single_type_lp
, src
[2], src
[3], 0);
666 t2
= lp_build_interleave2_half(gallivm
, single_type_lp
, src
[0], src
[1], 1);
667 t3
= lp_build_interleave2_half(gallivm
, single_type_lp
, src
[2], src
[3], 1);
669 /* Cast to double width type for second interleave */
670 t0
= LLVMBuildBitCast(gallivm
->builder
, t0
, double_type
, "t0");
671 t1
= LLVMBuildBitCast(gallivm
->builder
, t1
, double_type
, "t1");
672 t2
= LLVMBuildBitCast(gallivm
->builder
, t2
, double_type
, "t2");
673 t3
= LLVMBuildBitCast(gallivm
->builder
, t3
, double_type
, "t3");
675 /* Interleave xy, zw -> xyzw */
676 dst
[0] = lp_build_interleave2_half(gallivm
, double_type_lp
, t0
, t1
, 0);
677 dst
[1] = lp_build_interleave2_half(gallivm
, double_type_lp
, t0
, t1
, 1);
678 dst
[2] = lp_build_interleave2_half(gallivm
, double_type_lp
, t2
, t3
, 0);
679 dst
[3] = lp_build_interleave2_half(gallivm
, double_type_lp
, t2
, t3
, 1);
681 /* Cast back to original single width type */
682 dst
[0] = LLVMBuildBitCast(gallivm
->builder
, dst
[0], single_type
, "dst0");
683 dst
[1] = LLVMBuildBitCast(gallivm
->builder
, dst
[1], single_type
, "dst1");
684 dst
[2] = LLVMBuildBitCast(gallivm
->builder
, dst
[2], single_type
, "dst2");
685 dst
[3] = LLVMBuildBitCast(gallivm
->builder
, dst
[3], single_type
, "dst3");
690 * Transpose from AOS <-> SOA for num_srcs
693 lp_build_transpose_aos_n(struct gallivm_state
*gallivm
,
695 const LLVMValueRef
* src
,
706 /* Note: we must use a temporary incase src == dst */
709 lo
= lp_build_interleave2_half(gallivm
, type
, src
[0], src
[1], 0);
710 hi
= lp_build_interleave2_half(gallivm
, type
, src
[0], src
[1], 1);
718 lp_build_transpose_aos(gallivm
, type
, src
, dst
);
728 * Pack n-th element of aos values,
729 * pad out to destination size.
730 * i.e. x1 y1 _ _ x2 y2 _ _ will become x1 x2 _ _
733 lp_build_pack_aos_scalars(struct gallivm_state
*gallivm
,
734 struct lp_type src_type
,
735 struct lp_type dst_type
,
736 const LLVMValueRef src
,
739 LLVMTypeRef i32t
= LLVMInt32TypeInContext(gallivm
->context
);
740 LLVMValueRef undef
= LLVMGetUndef(i32t
);
741 LLVMValueRef shuffles
[LP_MAX_VECTOR_LENGTH
];
742 unsigned num_src
= src_type
.length
/ 4;
743 unsigned num_dst
= dst_type
.length
;
746 assert(num_src
<= num_dst
);
748 for (i
= 0; i
< num_src
; i
++) {
749 shuffles
[i
] = LLVMConstInt(i32t
, i
* 4 + channel
, 0);
751 for (i
= num_src
; i
< num_dst
; i
++) {
756 return LLVMBuildExtractElement(gallivm
->builder
, src
, shuffles
[0], "");
759 return LLVMBuildShuffleVector(gallivm
->builder
, src
, src
,
760 LLVMConstVector(shuffles
, num_dst
), "");
766 * Unpack and broadcast packed aos values consisting of only the
767 * first value, i.e. x1 x2 _ _ will become x1 x1 x1 x1 x2 x2 x2 x2
770 lp_build_unpack_broadcast_aos_scalars(struct gallivm_state
*gallivm
,
771 struct lp_type src_type
,
772 struct lp_type dst_type
,
773 const LLVMValueRef src
)
775 LLVMTypeRef i32t
= LLVMInt32TypeInContext(gallivm
->context
);
776 LLVMValueRef shuffles
[LP_MAX_VECTOR_LENGTH
];
777 unsigned num_dst
= dst_type
.length
;
778 unsigned num_src
= dst_type
.length
/ 4;
781 assert(num_dst
/ 4 <= src_type
.length
);
783 for (i
= 0; i
< num_src
; i
++) {
784 shuffles
[i
*4] = LLVMConstInt(i32t
, i
, 0);
785 shuffles
[i
*4+1] = LLVMConstInt(i32t
, i
, 0);
786 shuffles
[i
*4+2] = LLVMConstInt(i32t
, i
, 0);
787 shuffles
[i
*4+3] = LLVMConstInt(i32t
, i
, 0);
791 return lp_build_extract_broadcast(gallivm
, src_type
, dst_type
,
795 return LLVMBuildShuffleVector(gallivm
->builder
, src
, src
,
796 LLVMConstVector(shuffles
, num_dst
), "");