const vector passed to codegen
This commit is contained in:
@@ -635,7 +635,24 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
self.codegen_consume(bx, place.as_ref())
|
||||
}
|
||||
|
||||
mir::Operand::Constant(ref constant) => self.eval_mir_constant_to_operand(bx, constant),
|
||||
mir::Operand::Constant(ref constant) => {
|
||||
let constant_ty = self.monomorphize(constant.ty());
|
||||
// Most SIMD vector constants should be passed as immediates.
|
||||
// (In particular, some intrinsics really rely on this.)
|
||||
if constant_ty.is_simd() {
|
||||
// However, some SIMD types do not actually use the vector ABI
|
||||
// (in particular, packed SIMD types do not). Ensure we exclude those.
|
||||
let layout = bx.layout_of(constant_ty);
|
||||
if let Abi::Vector { .. } = layout.abi {
|
||||
let (llval, ty) = self.immediate_const_vector(bx, constant);
|
||||
return OperandRef {
|
||||
val: OperandValue::Immediate(llval),
|
||||
layout: bx.layout_of(ty),
|
||||
};
|
||||
}
|
||||
}
|
||||
self.eval_mir_constant_to_operand(bx, constant)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user