File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Auto-generated. Do not modify this file! Instead modify examples/fpu.rs
2
+ //! You can do fast, single precision, floating point math as well
3
+ //!
4
+ //! ``` rust,no_run
5
+ //! #![feature(asm)]
6
+ //! #![no_main]
7
+ //! #![no_std]
8
+ //!
9
+ //! #[macro_use]
10
+ //! extern crate f3;
11
+ //!
12
+ //! #[export_name = "main"]
13
+ //! pub extern "C" fn main() -> ! {
14
+ //! let x = black_box(2_f32);
15
+ //! let y = black_box(3_f32);
16
+ //! let z = black_box(x * y);
17
+ //!
18
+ //! iprintln!("{} * {} = {}", x, y, z);
19
+ //!
20
+ //! loop {}
21
+ //! }
22
+ //!
23
+ //! // Magic to prevent optimizations like "constant folding" which is when LLVM
24
+ //! // performs arithmetic at compile time. This is a copy of `test::black_box`.
25
+ //! fn black_box<T>(x: T) -> T {
26
+ //! unsafe {
27
+ //! asm!("" :: "r"(&x));
28
+ //! }
29
+ //!
30
+ //! x
31
+ //! }
32
+ //! ```
Original file line number Diff line number Diff line change 2
2
//! Examples
3
3
4
4
pub mod exception;
5
+ pub mod fpu;
5
6
pub mod itm;
6
7
pub mod led_roulette;
7
8
pub mod minimal;
You can’t perform that action at this time.
0 commit comments