File: asmtest.rs

package info (click to toggle)
clamav 1.0.9%2Bdfsg-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 262,900 kB
  • sloc: ansic: 182,912; cpp: 6,947; python: 4,133; sh: 2,679; javascript: 2,195; yacc: 1,357; asm: 1,245; lex: 716; makefile: 108; perl: 17
file content (29 lines) | stat: -rw-r--r-- 1,377 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! This example is mean to be used for inspecting the generated assembly.
//! This can be interesting when working with simd intrinsics.
//!
//! To use:
//! - Mark the function that should be investigated with `#[inline(never)]`.
//! - If needed, add any required feature to the function, for example `#[target_feature(enable = "sse4.1")]`
//! - Change the code below to use the changed function.
//!   Currently it is set up to look at the f32 version of the SSE 4-point butterfly.  
//!   It uses the FftPlannerSse to plan a length 4 FFT, that will use the modified butterfly.
//! - Ask rustc to output assembly code:
//!   `cargo rustc --release --features sse --example asmtest -- --emit=asm`
//! - This will create a file at `target/release/examples/asmtest-0123456789abcdef.s` (with a random number in the filename).
//! - Open this file and search for the function.

use rustfft::num_complex::Complex32;
//use rustfft::num_complex::Complex64;
//use rustfft::FftPlannerScalar;
use rustfft::FftPlannerSse;
//use rustfft::FftPlannerNeon;

fn main() {
    //let mut planner = FftPlannerScalar::new();
    let mut planner = FftPlannerSse::new().unwrap();
    //let mut planner = FftPlannerNeon::new().unwrap();
    let fft = planner.plan_fft_forward(4);

    let mut buffer = vec![Complex32::new(0.0, 0.0); 100];
    fft.process(&mut buffer);
}