about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/common.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-27 00:03:09 +0000
committerbors <bors@rust-lang.org>2023-01-27 00:03:09 +0000
commita2d002afe70015f621771d00c9cb4fe115f8cb11 (patch)
tree74229ed29090d8ee41ed826ae61e610e727e2397 /compiler/rustc_codegen_cranelift/src/common.rs
parentd7948c843de94245c794e8c63dd4301a78bb5ba3 (diff)
parent3808bc4639468018b1e5c30e1cd2e6905485ce67 (diff)
downloadrust-a2d002afe70015f621771d00c9cb4fe115f8cb11.tar.gz
rust-a2d002afe70015f621771d00c9cb4fe115f8cb11.zip
Auto merge of #107269 - bjorn3:sync_cg_clif-2023-01-24, r=bjorn3
Sync rustc_codegen_cranelift

For cg_clif itself there have been a couple of bug fixes since the last sync, a Cranelift update and implemented all remaining simd platform intrinsics used by `std::simd`. (`std::arch` still misses a lot though) Most of the diff is from reworking of the cg_clif build system though.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/common.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/common.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs
index 63ed10cdfcc..f41af3a9e63 100644
--- a/compiler/rustc_codegen_cranelift/src/common.rs
+++ b/compiler/rustc_codegen_cranelift/src/common.rs
@@ -168,6 +168,15 @@ pub(crate) fn codegen_icmp_imm(
     }
 }
 
+pub(crate) fn codegen_bitcast(fx: &mut FunctionCx<'_, '_, '_>, dst_ty: Type, val: Value) -> Value {
+    let mut flags = MemFlags::new();
+    flags.set_endianness(match fx.tcx.data_layout.endian {
+        rustc_target::abi::Endian::Big => cranelift_codegen::ir::Endianness::Big,
+        rustc_target::abi::Endian::Little => cranelift_codegen::ir::Endianness::Little,
+    });
+    fx.bcx.ins().bitcast(dst_ty, flags, val)
+}
+
 pub(crate) fn type_zero_value(bcx: &mut FunctionBuilder<'_>, ty: Type) -> Value {
     if ty == types::I128 {
         let zero = bcx.ins().iconst(types::I64, 0);