[ARM] Mark mcr/mrc builtin operands as required-immediate.
An early error message is better than the "cannot select" alternative. llvm-svn: 246094
This commit is contained in:
parent
2af8f46030
commit
5946ca4fc4
|
@ -48,14 +48,14 @@ BUILTIN(__builtin_arm_vcvtr_f, "ffi", "nc")
|
||||||
BUILTIN(__builtin_arm_vcvtr_d, "fdi", "nc")
|
BUILTIN(__builtin_arm_vcvtr_d, "fdi", "nc")
|
||||||
|
|
||||||
// Coprocessor
|
// Coprocessor
|
||||||
BUILTIN(__builtin_arm_mcr, "vUiUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_mcr, "vUIiUIiUiUIiUIiUIi", "")
|
||||||
BUILTIN(__builtin_arm_mcr2, "vUiUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_mcr2, "vUIiUIiUiUIiUIiUIi", "")
|
||||||
BUILTIN(__builtin_arm_mrc, "UiUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_mrc, "UiUIiUIiUIiUIiUIi", "")
|
||||||
BUILTIN(__builtin_arm_mrc2, "UiUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_mrc2, "UiUIiUIiUIiUIiUIi", "")
|
||||||
BUILTIN(__builtin_arm_cdp, "vUiUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_cdp, "vUiUiUiUiUiUi", "")
|
||||||
BUILTIN(__builtin_arm_cdp2, "vUiUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_cdp2, "vUiUiUiUiUiUi", "")
|
||||||
BUILTIN(__builtin_arm_mcrr, "vUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_mcrr, "vUIiUIiUiUiUIi", "")
|
||||||
BUILTIN(__builtin_arm_mcrr2, "vUiUiUiUiUi", "")
|
BUILTIN(__builtin_arm_mcrr2, "vUIiUIiUiUiUIi", "")
|
||||||
|
|
||||||
// CRC32
|
// CRC32
|
||||||
BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc")
|
BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc")
|
||||||
|
|
|
@ -85,6 +85,44 @@ void prefetch(int i) {
|
||||||
// CHECK: call {{.*}} @llvm.prefetch(i8* %{{.*}}, i32 1, i32 3, i32 0)
|
// CHECK: call {{.*}} @llvm.prefetch(i8* %{{.*}}, i32 1, i32 3, i32 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned mrc() {
|
||||||
|
// CHECK: define i32 @mrc()
|
||||||
|
// CHECK: [[R:%.*]] = {{.*}} call i32 @llvm.arm.mrc(i32 15, i32 0, i32 13, i32 0, i32 3)
|
||||||
|
// CHECK-NEXT: ret i32 [[R]]
|
||||||
|
return __builtin_arm_mrc(15, 0, 13, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned mrc2() {
|
||||||
|
// CHECK: define i32 @mrc2()
|
||||||
|
// CHECK: [[R:%.*]] = {{.*}} call i32 @llvm.arm.mrc2(i32 15, i32 0, i32 13, i32 0, i32 3)
|
||||||
|
// CHECK-NEXT: ret i32 [[R]]
|
||||||
|
return __builtin_arm_mrc2(15, 0, 13, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mcr(unsigned a) {
|
||||||
|
// CHECK: define void @mcr(i32 [[A:%.*]])
|
||||||
|
// CHECK: call void @llvm.arm.mcr(i32 15, i32 0, i32 [[A]], i32 13, i32 0, i32 3)
|
||||||
|
__builtin_arm_mcr(15, 0, a, 13, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mcr2(unsigned a) {
|
||||||
|
// CHECK: define void @mcr2(i32 [[A:%.*]])
|
||||||
|
// CHECK: call void @llvm.arm.mcr2(i32 15, i32 0, i32 [[A]], i32 13, i32 0, i32 3)
|
||||||
|
__builtin_arm_mcr2(15, 0, a, 13, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mcrr(unsigned a, unsigned b) {
|
||||||
|
// CHECK: define void @mcrr(i32 [[A:%.*]], i32 [[B:%.*]])
|
||||||
|
// CHECK: call void @llvm.arm.mcrr(i32 15, i32 0, i32 [[A]], i32 [[B]], i32 0)
|
||||||
|
__builtin_arm_mcrr(15, 0, a, b, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mcrr2(unsigned a, unsigned b) {
|
||||||
|
// CHECK: define void @mcrr2(i32 [[A:%.*]], i32 [[B:%.*]])
|
||||||
|
// CHECK: call void @llvm.arm.mcrr2(i32 15, i32 0, i32 [[A]], i32 [[B]], i32 0)
|
||||||
|
__builtin_arm_mcrr2(15, 0, a, b, 0);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned rsr() {
|
unsigned rsr() {
|
||||||
// CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i32 @llvm.read_register.i32(metadata !7)
|
// CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i32 @llvm.read_register.i32(metadata !7)
|
||||||
// CHECK-NEXT: ret i32 [[V0]]
|
// CHECK-NEXT: ret i32 [[V0]]
|
||||||
|
|
|
@ -46,3 +46,37 @@ void test4() {
|
||||||
void test5() {
|
void test5() {
|
||||||
__builtin_arm_dbg(16); // expected-error {{argument should be a value from 0 to 15}}
|
__builtin_arm_dbg(16); // expected-error {{argument should be a value from 0 to 15}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test6(int a, int b, int c) {
|
||||||
|
__builtin_arm_mrc( a, 0, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mrc' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc(15, a, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mrc' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc(15, 0, a, 0, 3); // expected-error {{argument to '__builtin_arm_mrc' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc(15, 0, 13, a, 3); // expected-error {{argument to '__builtin_arm_mrc' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc(15, 0, 13, 0, a); // expected-error {{argument to '__builtin_arm_mrc' must be a constant integer}}
|
||||||
|
|
||||||
|
__builtin_arm_mrc2( a, 0, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mrc2' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc2(15, a, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mrc2' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc2(15, 0, a, 0, 3); // expected-error {{argument to '__builtin_arm_mrc2' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc2(15, 0, 13, a, 3); // expected-error {{argument to '__builtin_arm_mrc2' must be a constant integer}}
|
||||||
|
__builtin_arm_mrc2(15, 0, 13, 0, a); // expected-error {{argument to '__builtin_arm_mrc2' must be a constant integer}}
|
||||||
|
|
||||||
|
__builtin_arm_mcr( a, 0, b, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mcr' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr(15, a, b, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mcr' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr(15, 0, b, a, 0, 3); // expected-error {{argument to '__builtin_arm_mcr' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr(15, 0, b, 13, a, 3); // expected-error {{argument to '__builtin_arm_mcr' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr(15, 0, b, 13, 0, a); // expected-error {{argument to '__builtin_arm_mcr' must be a constant integer}}
|
||||||
|
|
||||||
|
__builtin_arm_mcr2( a, 0, b, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr2(15, a, b, 13, 0, 3); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr2(15, 0, b, a, 0, 3); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr2(15, 0, b, 13, a, 3); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}}
|
||||||
|
__builtin_arm_mcr2(15, 0, b, 13, 0, a); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}}
|
||||||
|
|
||||||
|
__builtin_arm_mcrr( a, 0, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}}
|
||||||
|
__builtin_arm_mcrr(15, a, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}}
|
||||||
|
__builtin_arm_mcrr(15, 0, b, c, a); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}}
|
||||||
|
|
||||||
|
__builtin_arm_mcrr2( a, 0, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}}
|
||||||
|
__builtin_arm_mcrr2(15, a, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}}
|
||||||
|
__builtin_arm_mcrr2(15, 0, b, c, a); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue