Put the NONTEMPORAL case first

That's how it was in `store_with_flags` before this PR, so let's do that here too just to be sure we get the right thing.
This commit is contained in:
Scott McMurray 2024-04-03 22:07:44 -07:00
parent b5376ba601
commit c6dde9d8a7

View File

@ -293,16 +293,17 @@ pub trait BuilderMethods<'a, 'tcx>:
debug_assert!(src.llextra.is_none(), "cannot directly copy from unsized values"); debug_assert!(src.llextra.is_none(), "cannot directly copy from unsized values");
debug_assert!(dst.llextra.is_none(), "cannot directly copy into unsized values"); debug_assert!(dst.llextra.is_none(), "cannot directly copy into unsized values");
debug_assert_eq!(dst.layout.size, src.layout.size); debug_assert_eq!(dst.layout.size, src.layout.size);
if self.sess().opts.optimize == OptLevel::No && self.is_backend_immediate(dst.layout) { if flags.contains(MemFlags::NONTEMPORAL) {
// If we're not optimizing, the aliasing information from `memcpy`
// isn't useful, so just load-store the value for smaller code.
let temp = self.load_operand(src);
temp.val.store_with_flags(self, dst, flags);
} else if flags.contains(MemFlags::NONTEMPORAL) {
// HACK(nox): This is inefficient but there is no nontemporal memcpy. // HACK(nox): This is inefficient but there is no nontemporal memcpy.
let ty = self.backend_type(dst.layout); let ty = self.backend_type(dst.layout);
let val = self.load(ty, src.llval, src.align); let val = self.load(ty, src.llval, src.align);
self.store_with_flags(val, dst.llval, dst.align, flags); self.store_with_flags(val, dst.llval, dst.align, flags);
} else if self.sess().opts.optimize == OptLevel::No && self.is_backend_immediate(dst.layout)
{
// If we're not optimizing, the aliasing information from `memcpy`
// isn't useful, so just load-store the value for smaller code.
let temp = self.load_operand(src);
temp.val.store_with_flags(self, dst, flags);
} else if !dst.layout.is_zst() { } else if !dst.layout.is_zst() {
let bytes = self.const_usize(dst.layout.size.bytes()); let bytes = self.const_usize(dst.layout.size.bytes());
self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags); self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags);