makepad/libs/relax/compiler/tests/n01_round32_legacy_const.rs
Admin b22a714840 makepad run: the Rust JIT (libs/relax) and makepad-remote
The JIT that runs makepad apps from source: lexer, front end, type checker,
lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and
warm/cold caches keyed by compiler stamp, provided crates bound late,
startup images, live patching. User-facing name is `makepad run` (binary
`makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal
library name. `makepad check` reports rustc-style diagnostics with rustc
error codes and checks a whole workspace (`--workspace`). Runs on macOS,
Linux, Windows and Android. makepad-remote: one tool schema for apps and the
WM (app/1): grabs, captures, traces, frame profiles and tweaks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

27 lines
915 B
Rust

use std::arch::x86_64::{_mm_slli_epi32 as shift, _mm_set1_epi32, _mm_cvtsi128_si32};
#[test]
fn legacy_paths_and_explicit_args() {
unsafe {
let a = _mm_set1_epi32(3);
assert_eq!(_mm_cvtsi128_si32(shift(a, 1 + 1)), 12);
assert_eq!(_mm_cvtsi128_si32(std::arch::x86_64::_mm_slli_epi32(a, 2)), 12);
assert_eq!(_mm_cvtsi128_si32(shift::<2>(a)), 12);
let nested = || shift(a, 2);
assert_eq!(_mm_cvtsi128_si32(nested()), 12);
}
}
#[test]
fn local_bindings_and_macro_hygiene() {
let shift = |a: i32, b: i32| a + b;
assert_eq!(shift(3, 2), 5);
{
use std::arch::x86_64::_mm_slli_epi32 as shift;
unsafe { assert_eq!(_mm_cvtsi128_si32(shift(_mm_set1_epi32(3), 2)), 12); }
}
macro_rules! call_local { () => { shift(3, 2) }; }
let shift = |a: i32, b: i32| a * b;
assert_eq!(call_local!(), 5);
assert_eq!(shift(3, 2), 6);
}