+ else if (0) {
+ /* Generate a vector select.
+ *
+ * XXX: Using vector selects would avoid emitting intrinsics, but they aren't
+ * properly supported yet.
+ *
+ * LLVM 3.1 supports it, but it yields buggy code (e.g. lp_blend_test).
+ *
+ * LLVM 3.0 includes experimental support provided the -promote-elements
+ * options is passed to LLVM's command line (e.g., via
+ * llvm::cl::ParseCommandLineOptions), but resulting code quality is much
+ * worse, probably because some optimization passes don't know how to
+ * handle vector selects.
+ *
+ * See also:
+ * - http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-October/043659.html
+ */
+
+ /* Convert the mask to a vector of booleans.
+ * XXX: There are two ways to do this. Decide what's best.
+ */
+ if (1) {
+ LLVMTypeRef bool_vec_type = LLVMVectorType(LLVMInt1TypeInContext(lc), type.length);
+ mask = LLVMBuildTrunc(builder, mask, bool_vec_type, "");
+ } else {
+ mask = LLVMBuildICmp(builder, LLVMIntNE, mask, LLVMConstNull(bld->int_vec_type), "");
+ }
+ res = LLVMBuildSelect(builder, mask, a, b, "");
+ }
+ else if (((util_cpu_caps.has_sse4_1 &&
+ type.width * type.length == 128) ||
+ (util_cpu_caps.has_avx &&
+ type.width * type.length == 256 && type.width >= 32)) &&