forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
When compiling the following code:
#![no_std]
#![no_main]
#![feature(lang_items, panic_handler)]
#[no_mangle]
pub extern fn main() {
unsafe {
let x: u8 = core::ptr::read_volatile(42 as *mut u8);
let y = x * 13;
core::ptr::write_volatile(42 as *mut u8, y);
}
}
pub mod std {
#[lang = "eh_personality"]
pub unsafe extern "C" fn rust_eh_personality(
_state: (),
_exception_object: *mut (),
_context: *mut (),
) -> () {
}
#[panic_handler]
fn panic(_info: &::core::panic::PanicInfo) -> ! {
loop { }
}
}
using rustc --target=avr-attiny85 main.rs --emit=asm
and the following target:
{
"llvm-target": "avr-unknown-unknown",
"cpu": "attiny85",
"target-endian": "little",
"target-pointer-width": "16",
"target-c-int-width": "16",
"os": "unknown",
"target-env": "",
"target-vendor": "unknown",
"arch": "avr",
"data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8",
"executables": true,
"linker": "avr-gcc",
"linker-flavor": "gcc",
"pre-link-args": {
"gcc": ["-Os", "-mmcu=attiny85"]
},
"exe-suffix": ".elf",
"post-link-args": {
"gcc": ["-Wl,--gc-sections"]
},
"singlethread": true,
"no-builtins": false,
"no-default-libraries": false
}
LLVM emits a mul
instruction, even though they are not supported on attiny85
.
Unfortunately I don't have llvm tools available right now, to reduce the IR. I guess this is the responsible line:
%1 = call addrspace(1) { i8, i1 } @llvm.umul.with.overflow.i8(i8 %0, i8 13)
Metadata
Metadata
Assignees
Labels
No labels