Fix cttz{,_nonzero} intrinsics

This commit is contained in:
bjorn3 2019-02-16 15:42:20 +01:00
parent 5721542164
commit 26289edf1a
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,5 @@
#![feature(core_intrinsics)]
use std::io::Write; use std::io::Write;
fn main() { fn main() {
@ -7,5 +9,7 @@ fn main() {
writeln!(stderr, "some {} text", "<unknown>").unwrap(); writeln!(stderr, "some {} text", "<unknown>").unwrap();
std::process::Command::new("true").env("c", "d").spawn(); let _ = std::process::Command::new("true").env("c", "d").spawn();
println!("cargo:rustc-link-lib=z");
} }

View File

@ -330,7 +330,7 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>(
ret.write_cvalue(fx, res); ret.write_cvalue(fx, res);
}; };
cttz | cttz_nonzero, <T> (v arg) { cttz | cttz_nonzero, <T> (v arg) {
let res = CValue::ByVal(fx.bcx.ins().clz(arg), fx.layout_of(T)); let res = CValue::ByVal(fx.bcx.ins().ctz(arg), fx.layout_of(T));
ret.write_cvalue(fx, res); ret.write_cvalue(fx, res);
}; };
ctpop, <T> (v arg) { ctpop, <T> (v arg) {