@@ -13,22 +13,34 @@ use stdsimd_test::assert_instr;
13
13
///
14
14
/// `val` is a compile-time constant integer whose range is:
15
15
///
16
- /// - `0...65535` if you are compiling source as A32 code.
16
+ /// - `0...65535` if you are compiling source as A32 or A64 code.
17
17
/// - `0...255` if you are compiling source as T32 code.
18
18
///
19
19
/// [ARM's documentation](https://developer.arm.com/docs/100067/latest/compiler-specific-intrinsics/__breakpoint-intrinsic)
20
20
///
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 ) ) ]
24
25
#[ inline( always) ]
25
26
#[ rustc_args_required_const( 0 ) ]
26
27
pub unsafe fn __breakpoint ( val : i32 ) {
28
+ #[ cfg( target_arch = "arm" ) ]
27
29
macro_rules! call {
28
30
( $imm8: expr) => {
29
31
asm!( concat!( "BKPT " , stringify!( $imm8) ) : : : : "volatile" )
30
32
}
31
33
}
32
34
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
+
33
45
constify_imm8 ! ( val, call) ;
34
46
}
0 commit comments