[PATCH 1/2] selftests/arm64: Implement cmpbr_sigill() to hwcap test

Yifan Wu wuyifan50 at huawei.com
Thu Feb 26 19:19:32 PST 2026


The function executes a CBEQ instruction which is valid if the CPU
supports the CMPBR extension. The CBEQ branches to skip the following
UDF instruction, and no SIGILL is generated. Otherwise, it will
generate a SIGILL.

Signed-off-by: Yifan Wu <wuyifan50 at huawei.com>
---
 tools/testing/selftests/arm64/abi/hwcap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
index 9d2df1f3e6bb..0d229804a857 100644
--- a/tools/testing/selftests/arm64/abi/hwcap.c
+++ b/tools/testing/selftests/arm64/abi/hwcap.c
@@ -56,7 +56,10 @@ static void atomics_sigill(void)
 
 static void cmpbr_sigill(void)
 {
-	/* Not implemented, too complicated and unreliable anyway */
+	/* CBEQ x0, x0, +8 */
+	asm volatile(".inst 0x74C00040" : : : "x0");
+	/* UDF #0 */
+	asm volatile("udf #0" : : : );
 }
 
 static void crc32_sigill(void)
-- 
2.33.0




More information about the linux-arm-kernel mailing list