diff options
Diffstat (limited to 'compiler/rustc_target')
| -rw-r--r-- | compiler/rustc_target/src/callconv/sparc64.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_target/src/callconv/x86.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_target/src/callconv/x86_64.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_target/src/callconv/xtensa.rs | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_target/src/callconv/sparc64.rs b/compiler/rustc_target/src/callconv/sparc64.rs index 186826c08fc..ecc9067ced3 100644 --- a/compiler/rustc_target/src/callconv/sparc64.rs +++ b/compiler/rustc_target/src/callconv/sparc64.rs @@ -90,7 +90,7 @@ where _ => {} } - if (offset.bytes() % 4) != 0 + if !offset.bytes().is_multiple_of(4) && matches!(scalar2.primitive(), Primitive::Float(Float::F32 | Float::F64)) { offset += Size::from_bytes(4 - (offset.bytes() % 4)); @@ -181,7 +181,7 @@ where // Structure { float, int, int } doesn't like to be handled like // { float, long int }. Other way around it doesn't mind. if data.last_offset < arg.layout.size - && (data.last_offset.bytes() % 8) != 0 + && !data.last_offset.bytes().is_multiple_of(8) && data.prefix_index < data.prefix.len() { data.prefix[data.prefix_index] = Some(Reg::i32()); @@ -190,7 +190,7 @@ where } let mut rest_size = arg.layout.size - data.last_offset; - if (rest_size.bytes() % 8) != 0 && data.prefix_index < data.prefix.len() { + if !rest_size.bytes().is_multiple_of(8) && data.prefix_index < data.prefix.len() { data.prefix[data.prefix_index] = Some(Reg::i32()); rest_size = rest_size - Reg::i32().size; } diff --git a/compiler/rustc_target/src/callconv/x86.rs b/compiler/rustc_target/src/callconv/x86.rs index 8328f818f9b..bdf116ff303 100644 --- a/compiler/rustc_target/src/callconv/x86.rs +++ b/compiler/rustc_target/src/callconv/x86.rs @@ -171,7 +171,7 @@ pub(crate) fn fill_inregs<'a, Ty, C>( continue; } - let size_in_regs = (arg.layout.size.bits() + 31) / 32; + let size_in_regs = arg.layout.size.bits().div_ceil(32); if size_in_regs == 0 { continue; diff --git a/compiler/rustc_target/src/callconv/x86_64.rs b/compiler/rustc_target/src/callconv/x86_64.rs index 700ee73c8fd..d8db7ed6e4c 100644 --- a/compiler/rustc_target/src/callconv/x86_64.rs +++ b/compiler/rustc_target/src/callconv/x86_64.rs @@ -95,7 +95,7 @@ where Ok(()) } - let n = ((arg.layout.size.bytes() + 7) / 8) as usize; + let n = arg.layout.size.bytes().div_ceil(8) as usize; if n > MAX_EIGHTBYTES { return Err(Memory); } diff --git a/compiler/rustc_target/src/callconv/xtensa.rs b/compiler/rustc_target/src/callconv/xtensa.rs index b687f0e20c6..a73a70a1a0c 100644 --- a/compiler/rustc_target/src/callconv/xtensa.rs +++ b/compiler/rustc_target/src/callconv/xtensa.rs @@ -54,7 +54,7 @@ where // Determine the number of GPRs needed to pass the current argument // according to the ABI. 2*XLen-aligned varargs are passed in "aligned" // register pairs, so may consume 3 registers. - let mut needed_arg_gprs = (size + 32 - 1) / 32; + let mut needed_arg_gprs = size.div_ceil(32); if needed_align == 64 { needed_arg_gprs += *arg_gprs_left % 2; } |
