-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This patch adds support for the `ctpop` intrinsic. gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (ctpop_hander): Add `ctpop`. gcc/testsuite/ChangeLog: * rust/execute/torture/ctpop.rs: New test. Signed-off-by: Yuao Ma <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![feature(intrinsics)] | ||
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/execute/torture/ctpop.rs GitHub Actions / build-and-check-ubuntu-32bitTest failure (FAIL)
|
||
|
||
#[lang = "sized"] | ||
pub trait Sized {} | ||
|
||
extern "rust-intrinsic" { | ||
pub fn ctpop<T>(x: T) -> u32; | ||
} | ||
|
||
fn main() -> i32 { | ||
let pop1 = ctpop(42i32) - 3; | ||
let pop2 = ctpop(42u32) - 3; | ||
let pop3 = ctpop(42i128) - 3; | ||
let pop4 = ctpop(42u128) - 3; | ||
let pop5 = ctpop(-42i32) - 29; | ||
let pop6 = ctpop(0x1234567812345678i64) - 26; | ||
|
||
(pop1 + pop2 + pop3 + pop4 + pop5 + pop6) as i32 | ||
} |