|
| 1 | +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT |
| 2 | +// file at the top-level directory of this distribution and at |
| 3 | +// http://rust-lang.org/COPYRIGHT. |
| 4 | +// |
| 5 | +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | +// option. This file may not be copied, modified, or distributed |
| 9 | +// except according to those terms. |
| 10 | + |
| 11 | +#![feature(repr_simd, platform_intrinsics, rustc_attrs, core_intrinsics)] |
| 12 | +#![allow(warnings)] |
| 13 | + |
| 14 | +// Bad monomorphizations could previously cause LLVM asserts even though the |
| 15 | +// error was caught in the compiler. |
| 16 | + |
| 17 | +extern "platform-intrinsic" { |
| 18 | + fn simd_add<T>(x: T, y: T) -> T; |
| 19 | +} |
| 20 | + |
| 21 | +use std::intrinsics; |
| 22 | + |
| 23 | +#[derive(Copy, Clone)] |
| 24 | +struct Foo(i64); |
| 25 | + |
| 26 | +#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls. |
| 27 | +unsafe fn test_cttz(v: Foo) -> Foo { |
| 28 | + intrinsics::cttz(v) |
| 29 | + //~^ ERROR `cttz` intrinsic: expected basic integer type, found `Foo` |
| 30 | +} |
| 31 | + |
| 32 | +#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls. |
| 33 | +unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo { |
| 34 | + intrinsics::fadd_fast(a, b) |
| 35 | + //~^ ERROR `fadd_fast` intrinsic: expected basic float type, found `Foo` |
| 36 | +} |
| 37 | + |
| 38 | +#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls. |
| 39 | +unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo { |
| 40 | + simd_add(a, b) |
| 41 | + //~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` |
| 42 | +} |
| 43 | + |
| 44 | +fn main() {} |
0 commit comments