@@ -13,22 +13,34 @@ use stdsimd_test::assert_instr;
1313///
1414/// `val` is a compile-time constant integer whose range is:
1515///
16- /// - `0...65535` if you are compiling source as A32 code.
16+ /// - `0...65535` if you are compiling source as A32 or A64 code.
1717/// - `0...255` if you are compiling source as T32 code.
1818///
1919/// [ARM's documentation](https://developer.arm.com/docs/100067/latest/compiler-specific-intrinsics/__breakpoint-intrinsic)
2020///
21- /// **NOTE**: Due to compiler limitations this function only supports the range `0...255` in A32
22- /// mode.
23- #[ cfg_attr( test, assert_instr( bkpt, val = 0 ) ) ]
21+ /// **NOTE**: Due to compiler limitations this function only supports the range `0...255` in A32 and
22+ /// A64 mode.
23+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( bkpt, val = 0 ) ) ]
24+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( brk, val = 0 ) ) ]
2425#[ inline( always) ]
2526#[ rustc_args_required_const( 0 ) ]
2627pub unsafe fn __breakpoint ( val : i32 ) {
28+ #[ cfg( target_arch = "arm" ) ]
2729 macro_rules! call {
2830 ( $imm8: expr) => {
2931 asm!( concat!( "BKPT " , stringify!( $imm8) ) : : : : "volatile" )
3032 }
3133 }
3234
35+ #[ cfg( target_arch = "aarch64" ) ]
36+ macro_rules! call {
37+ ( $imm8: expr) => {
38+ asm!( concat!( "BRK " , stringify!( $imm8) ) : : : : "volatile" )
39+ }
40+ }
41+
42+ // validate range
43+ assert ! ( val >= 0 && val <= 255 ) ;
44+
3345 constify_imm8 ! ( val, call) ;
3446}
0 commit comments