diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/CodeGen/builtins-multiprecision.c | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/CodeGen/builtins-multiprecision.c')
-rw-r--r-- | test/CodeGen/builtins-multiprecision.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/CodeGen/builtins-multiprecision.c b/test/CodeGen/builtins-multiprecision.c index 172f683..4d19608 100644 --- a/test/CodeGen/builtins-multiprecision.c +++ b/test/CodeGen/builtins-multiprecision.c @@ -2,6 +2,25 @@ // RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - -O3 | FileCheck %s // RUN: %clang_cc1 -triple "x86_64-mingw32" -emit-llvm -x c %s -o - -O3 | FileCheck %s +unsigned char test_addcb(unsigned char x, unsigned char y, + unsigned char carryin, unsigned char *z) { + // CHECK: @test_addcb + // CHECK: %{{.+}} = {{.*}} call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %x, i8 %y) + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 1 + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 0 + // CHECK: %{{.+}} = {{.*}} call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %{{.+}}, i8 %carryin) + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 1 + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 0 + // CHECK: %{{.+}} = or i1 %{{.+}}, %{{.+}} + // CHECK: %{{.+}} = zext i1 %{{.+}} to i8 + // CHECK: store i8 %{{.+}}, i8* %z, align 1 + + unsigned char carryout; + *z = __builtin_addcb(x, y, carryin, &carryout); + + return carryout; +} + unsigned short test_addcs(unsigned short x, unsigned short y, unsigned short carryin, unsigned short *z) { // CHECK: @test_addcs @@ -76,6 +95,25 @@ unsigned long long test_addcll(unsigned long long x, unsigned long long y, return carryout; } +unsigned char test_subcb(unsigned char x, unsigned char y, + unsigned char carryin, unsigned char *z) { + // CHECK: @test_subcb + // CHECK: %{{.+}} = {{.*}} call { i8, i1 } @llvm.usub.with.overflow.i8(i8 %x, i8 %y) + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 1 + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 0 + // CHECK: %{{.+}} = {{.*}} call { i8, i1 } @llvm.usub.with.overflow.i8(i8 %{{.+}}, i8 %carryin) + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 1 + // CHECK: %{{.+}} = extractvalue { i8, i1 } %{{.+}}, 0 + // CHECK: %{{.+}} = or i1 %{{.+}}, %{{.+}} + // CHECK: %{{.+}} = zext i1 %{{.+}} to i8 + // CHECK: store i8 %{{.+}}, i8* %z, align 1 + + unsigned char carryout; + *z = __builtin_subcb(x, y, carryin, &carryout); + + return carryout; +} + unsigned short test_subcs(unsigned short x, unsigned short y, unsigned short carryin, unsigned short *z) { // CHECK: @test_subcs |