llvm-project/clang/test/Sema/builtins-microsoft-arm64.c
Amy Huang ae7ab043f2
Add __hlt intrinsic for Windows ARM. (#96578)
Add __hlt, which is a MSVC ARM64 intrinsic. 

This intrinsic is just the HLT instruction. MSVC's version seems to
return something undefined; in this patch
it will just return zero. 

MSVC intrinsics are defined here
https://learn.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics.
I used unsigned int as the return type, because that is what the MSVC
intrin.h header uses, even though
it conflicts with the documentation.
2024-07-08 12:59:02 -07:00

27 lines
1.1 KiB
C

// RUN: %clang_cc1 -triple arm64-windows -fsyntax-only -verify \
// RUN: -fms-compatibility -ffreestanding -fms-compatibility-version=17.00 %s
#include <intrin.h>
void check__break(int x) {
__break(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__break(65536); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__break(x); // expected-error {{argument to '__break' must be a constant integer}}
}
void check__hlt() {
__hlt(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__hlt(65536); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void check__getReg(void) {
__getReg(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__getReg(32); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void check_ReadWriteStatusReg(int v) {
int x;
_ReadStatusReg(x); // expected-error {{argument to '_ReadStatusReg' must be a constant integer}}
_WriteStatusReg(x, v); // expected-error {{argument to '_WriteStatusReg' must be a constant integer}}
}