diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2016-07-02 00:05:42 +0000 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2016-07-02 00:05:42 +0000 |
commit | 54a213d28052b136d375502da4232f71f03d5a53 (patch) | |
tree | 2fa9f2ce666008d742e839122e25a53d5db53f33 /clang/test/CodeGen/renderscript.c | |
parent | fa10f41f3eed1087ccd1c97c029ff3f5133b7df5 (diff) | |
download | bcm5719-llvm-54a213d28052b136d375502da4232f71f03d5a53.tar.gz bcm5719-llvm-54a213d28052b136d375502da4232f71f03d5a53.zip |
Add TargetInfo for 32-bit and 64-bit RenderScript
Summary:
The TargetInfo for 'renderscript32' and 'renderscript64' ArchTypes are
subclasses of ARMleTargetInfo and AArch64leTargetInfo respectively.
RenderScript32TargetInfo modifies the ARM ABI to set LongWidth and
LongAlign to be 64-bits. Other than this modification, the underlying
TargetInfo base classes is initialized as if they have "armv7" and
"aarch64" architecture type respectively.
Reviewers: rsmith, echristo
Subscribers: aemerson, tberghammer, cfe-commits, danalbert, mehdi_amini, srhines
Differential Revision: http://reviews.llvm.org/D21334
llvm-svn: 274409
Diffstat (limited to 'clang/test/CodeGen/renderscript.c')
-rw-r--r-- | clang/test/CodeGen/renderscript.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGen/renderscript.c b/clang/test/CodeGen/renderscript.c new file mode 100644 index 00000000000..d47750a7736 --- /dev/null +++ b/clang/test/CodeGen/renderscript.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 %s -triple=renderscript32-none-linux-gnueabi -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS32 +// RUN: %clang_cc1 %s -triple=renderscript64-none-linux-android -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS64 +// RUN: %clang_cc1 %s -triple=armv7-none-linux-gnueabi -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-ARM + +// Ensure that the bitcode has the correct triple +// CHECK-RS32: target triple = "armv7-none-linux-gnueabi" +// CHECK-RS64: target triple = "aarch64-none-linux-android" +// CHECK-ARM: target triple = "armv7-none-linux-gnueabi" + +// Ensure that long data type has 8-byte size and alignment in RenderScript +#ifdef __RENDERSCRIPT__ +#define LONG_WIDTH_AND_ALIGN 8 +#else +#define LONG_WIDTH_AND_ALIGN 4 +#endif + +_Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong"); +_Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong"); + +// CHECK-RS32: i64 @test_long(i64 %v) +// CHECK-RS64: i64 @test_long(i64 %v) +// CHECK-ARM: i32 @test_long(i32 %v) +long test_long(long v) { + return v + 1; +} |