Skip to content

Commit

Permalink
[ARM] Add load/store co-processor intrinsics.
Browse files Browse the repository at this point in the history
Differential Revision: http://reviews.llvm.org/D20563

llvm-svn: 271275
  • Loading branch information
rs-arm committed May 31, 2016
1 parent eb6ce06 commit 61c47fd
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clang/include/clang/Basic/BuiltinsARM.def
Expand Up @@ -48,6 +48,16 @@ BUILTIN(__builtin_arm_vcvtr_f, "ffi", "nc")
BUILTIN(__builtin_arm_vcvtr_d, "fdi", "nc")

// Coprocessor
BUILTIN(__builtin_arm_ldc, "vUIiUIivC*", "")
BUILTIN(__builtin_arm_ldcl, "vUIiUIivC*", "")
BUILTIN(__builtin_arm_ldc2, "vUIiUIivC*", "")
BUILTIN(__builtin_arm_ldc2l, "vUIiUIivC*", "")

BUILTIN(__builtin_arm_stc, "vUIiUIiv*", "")
BUILTIN(__builtin_arm_stcl, "vUIiUIiv*", "")
BUILTIN(__builtin_arm_stc2, "vUIiUIiv*", "")
BUILTIN(__builtin_arm_stc2l, "vUIiUIiv*", "")

BUILTIN(__builtin_arm_mcr, "vUIiUIiUiUIiUIiUIi", "")
BUILTIN(__builtin_arm_mcr2, "vUIiUIiUiUIiUIiUIi", "")
BUILTIN(__builtin_arm_mrc, "UiUIiUIiUIiUIiUIi", "")
Expand Down
56 changes: 56 additions & 0 deletions clang/test/CodeGen/builtins-arm.c
Expand Up @@ -84,6 +84,62 @@ void prefetch(int i) {
// CHECK: call {{.*}} @llvm.prefetch(i8* %{{.*}}, i32 1, i32 3, i32 0)
}

void ldc(const void *i) {
// CHECK: define void @ldc(i8* %i)
// CHECK: call void @llvm.arm.ldc(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_ldc(1, 2, i);
}

void ldcl(const void *i) {
// CHECK: define void @ldcl(i8* %i)
// CHECK: call void @llvm.arm.ldcl(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_ldcl(1, 2, i);
}

void ldc2(const void *i) {
// CHECK: define void @ldc2(i8* %i)
// CHECK: call void @llvm.arm.ldc2(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_ldc2(1, 2, i);
}

void ldc2l(const void *i) {
// CHECK: define void @ldc2l(i8* %i)
// CHECK: call void @llvm.arm.ldc2l(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_ldc2l(1, 2, i);
}

void stc(void *i) {
// CHECK: define void @stc(i8* %i)
// CHECK: call void @llvm.arm.stc(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_stc(1, 2, i);
}

void stcl(void *i) {
// CHECK: define void @stcl(i8* %i)
// CHECK: call void @llvm.arm.stcl(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_stcl(1, 2, i);
}

void stc2(void *i) {
// CHECK: define void @stc2(i8* %i)
// CHECK: call void @llvm.arm.stc2(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_stc2(1, 2, i);
}

void stc2l(void *i) {
// CHECK: define void @stc2l(i8* %i)
// CHECK: call void @llvm.arm.stc2l(i32 1, i32 2, i8* %i)
// CHECK-NEXT: ret void
__builtin_arm_stc2l(1, 2, i);
}

void cdp() {
// CHECK: define void @cdp()
// CHECK: call void @llvm.arm.cdp(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6)
Expand Down
32 changes: 32 additions & 0 deletions clang/test/Sema/builtins-arm.c
Expand Up @@ -48,6 +48,38 @@ void test5() {
}

void test6(int a, int b, int c) {
__builtin_arm_ldc(1, 2, &a);
__builtin_arm_ldc(a, 2, &a); // expected-error {{argument to '__builtin_arm_ldc' must be a constant integer}}
__builtin_arm_ldc(1, a, &a); // expected-error {{argument to '__builtin_arm_ldc' must be a constant integer}}

__builtin_arm_ldcl(1, 2, &a);
__builtin_arm_ldcl(a, 2, &a); // expected-error {{argument to '__builtin_arm_ldcl' must be a constant integer}}
__builtin_arm_ldcl(1, a, &a); // expected-error {{argument to '__builtin_arm_ldcl' must be a constant integer}}

__builtin_arm_ldc2(1, 2, &a);
__builtin_arm_ldc2(a, 2, &a); // expected-error {{argument to '__builtin_arm_ldc2' must be a constant integer}}
__builtin_arm_ldc2(1, a, &a); // expected-error {{argument to '__builtin_arm_ldc2' must be a constant integer}}

__builtin_arm_ldc2l(1, 2, &a);
__builtin_arm_ldc2l(a, 2, &a); // expected-error {{argument to '__builtin_arm_ldc2l' must be a constant integer}}
__builtin_arm_ldc2l(1, a, &a); // expected-error {{argument to '__builtin_arm_ldc2l' must be a constant integer}}

__builtin_arm_stc(1, 2, &a);
__builtin_arm_stc(a, 2, &a); // expected-error {{argument to '__builtin_arm_stc' must be a constant integer}}
__builtin_arm_stc(1, a, &a); // expected-error {{argument to '__builtin_arm_stc' must be a constant integer}}

__builtin_arm_stcl(1, 2, &a);
__builtin_arm_stcl(a, 2, &a); // expected-error {{argument to '__builtin_arm_stcl' must be a constant integer}}
__builtin_arm_stcl(1, a, &a); // expected-error {{argument to '__builtin_arm_stcl' must be a constant integer}}

__builtin_arm_stc2(1, 2, &a);
__builtin_arm_stc2(a, 2, &a); // expected-error {{argument to '__builtin_arm_stc2' must be a constant integer}}
__builtin_arm_stc2(1, a, &a); // expected-error {{argument to '__builtin_arm_stc2' must be a constant integer}}

__builtin_arm_stc2l(1, 2, &a);
__builtin_arm_stc2l(a, 2, &a); // expected-error {{argument to '__builtin_arm_stc2l' must be a constant integer}}
__builtin_arm_stc2l(1, a, &a); // expected-error {{argument to '__builtin_arm_stc2l' must be a constant integer}}

__builtin_arm_cdp(a, 2, 3, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
__builtin_arm_cdp(1, a, 3, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
__builtin_arm_cdp(1, 2, a, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
Expand Down

0 comments on commit 61c47fd

Please sign in to comment.