aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/builtins-overflow.c
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2021-12-06 12:46:54 -0500
committerAaron Ballman <aaron@aaronballman.com>2021-12-06 12:52:01 -0500
commit6c75ab5f66b403f7ca67e86aeed3a58abe10570b (patch)
tree08a85a30d4be191d1d0dd512f718b8b3d940a500 /clang/test/CodeGen/builtins-overflow.c
parenta6816b957d28ab7855f2af1277c72a6d65b600b4 (diff)
downloadllvm-6c75ab5f66b403f7ca67e86aeed3a58abe10570b.zip
llvm-6c75ab5f66b403f7ca67e86aeed3a58abe10570b.tar.gz
llvm-6c75ab5f66b403f7ca67e86aeed3a58abe10570b.tar.bz2
Introduce _BitInt, deprecate _ExtInt
WG14 adopted the _ExtInt feature from Clang for C23, but renamed the type to be _BitInt. This patch does the vast majority of the work to rename _ExtInt to _BitInt, which accounts for most of its size. The new type is exposed in older C modes and all C++ modes as a conforming extension. However, there are functional changes worth calling out: * Deprecates _ExtInt with a fix-it to help users migrate to _BitInt. * Updates the mangling for the type. * Updates the documentation and adds a release note to warn users what is going on. * Adds new diagnostics for use of _BitInt to call out when it's used as a Clang extension or as a pre-C23 compatibility concern. * Adds new tests for the new diagnostic behaviors. I want to call out the ABI break specifically. We do not believe that this break will cause a significant imposition for early adopters of the feature, and so this is being done as a full break. If it turns out there are critical uses where recompilation is not an option for some reason, we can consider using ABI tags to ease the transition.
Diffstat (limited to 'clang/test/CodeGen/builtins-overflow.c')
-rw-r--r--clang/test/CodeGen/builtins-overflow.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/test/CodeGen/builtins-overflow.c b/clang/test/CodeGen/builtins-overflow.c
index 636a571..614a939 100644
--- a/clang/test/CodeGen/builtins-overflow.c
+++ b/clang/test/CodeGen/builtins-overflow.c
@@ -41,7 +41,7 @@ int test_add_overflow_int_int_int(int x, int y) {
return r;
}
-int test_add_overflow_xint31_xint31_xint31(_ExtInt(31) x, _ExtInt(31) y) {
+int test_add_overflow_xint31_xint31_xint31(_BitInt(31) x, _BitInt(31) y) {
// CHECK-LABEL: define {{(dso_local )?}}i32 @test_add_overflow_xint31_xint31_xint31({{.+}})
// CHECK-NOT: ext
// CHECK: [[S:%.+]] = call { i31, i1 } @llvm.sadd.with.overflow.i31(i31 %{{.+}}, i31 %{{.+}})
@@ -49,7 +49,7 @@ int test_add_overflow_xint31_xint31_xint31(_ExtInt(31) x, _ExtInt(31) y) {
// CHECK-DAG: [[Q:%.+]] = extractvalue { i31, i1 } [[S]], 0
// CHECK: store i31 [[Q]], i31*
// CHECK: br i1 [[C]]
- _ExtInt(31) r;
+ _BitInt(31) r;
if (__builtin_add_overflow(x, y, &r))
overflowed();
return r;
@@ -83,7 +83,7 @@ int test_sub_overflow_int_int_int(int x, int y) {
return r;
}
-int test_sub_overflow_xint31_xint31_xint31(_ExtInt(31) x, _ExtInt(31) y) {
+int test_sub_overflow_xint31_xint31_xint31(_BitInt(31) x, _BitInt(31) y) {
// CHECK-LABEL: define {{(dso_local )?}}i32 @test_sub_overflow_xint31_xint31_xint31({{.+}})
// CHECK-NOT: ext
// CHECK: [[S:%.+]] = call { i31, i1 } @llvm.ssub.with.overflow.i31(i31 %{{.+}}, i31 %{{.+}})
@@ -91,7 +91,7 @@ int test_sub_overflow_xint31_xint31_xint31(_ExtInt(31) x, _ExtInt(31) y) {
// CHECK-DAG: [[Q:%.+]] = extractvalue { i31, i1 } [[S]], 0
// CHECK: store i31 [[Q]], i31*
// CHECK: br i1 [[C]]
- _ExtInt(31) r;
+ _BitInt(31) r;
if (__builtin_sub_overflow(x, y, &r))
overflowed();
return r;
@@ -170,7 +170,7 @@ int test_mul_overflow_int_int_int(int x, int y) {
return r;
}
-int test_mul_overflow_xint31_xint31_xint31(_ExtInt(31) x, _ExtInt(31) y) {
+int test_mul_overflow_xint31_xint31_xint31(_BitInt(31) x, _BitInt(31) y) {
// CHECK-LABEL: define {{(dso_local )?}}i32 @test_mul_overflow_xint31_xint31_xint31({{.+}})
// CHECK-NOT: ext
// CHECK: [[S:%.+]] = call { i31, i1 } @llvm.smul.with.overflow.i31(i31 %{{.+}}, i31 %{{.+}})
@@ -178,13 +178,13 @@ int test_mul_overflow_xint31_xint31_xint31(_ExtInt(31) x, _ExtInt(31) y) {
// CHECK-DAG: [[Q:%.+]] = extractvalue { i31, i1 } [[S]], 0
// CHECK: store i31 [[Q]], i31*
// CHECK: br i1 [[C]]
- _ExtInt(31) r;
+ _BitInt(31) r;
if (__builtin_mul_overflow(x, y, &r))
overflowed();
return r;
}
-int test_mul_overflow_xint127_xint127_xint127(_ExtInt(127) x, _ExtInt(127) y) {
+int test_mul_overflow_xint127_xint127_xint127(_BitInt(127) x, _BitInt(127) y) {
// CHECK-LABEL: define {{(dso_local )?}}i32 @test_mul_overflow_xint127_xint127_xint127({{.+}})
// CHECK-NOT: ext
// CHECK: [[S:%.+]] = call { i127, i1 } @llvm.smul.with.overflow.i127(i127 %{{.+}}, i127 %{{.+}})
@@ -192,13 +192,13 @@ int test_mul_overflow_xint127_xint127_xint127(_ExtInt(127) x, _ExtInt(127) y) {
// CHECK-DAG: [[Q:%.+]] = extractvalue { i127, i1 } [[S]], 0
// CHECK: store i127 [[Q]], i127*
// CHECK: br i1 [[C]]
- _ExtInt(127) r;
+ _BitInt(127) r;
if (__builtin_mul_overflow(x, y, &r))
overflowed();
return r;
}
-int test_mul_overflow_xint128_xint128_xint128(_ExtInt(128) x, _ExtInt(128) y) {
+int test_mul_overflow_xint128_xint128_xint128(_BitInt(128) x, _BitInt(128) y) {
// CHECK-LABEL: define {{(dso_local )?}}i32 @test_mul_overflow_xint128_xint128_xint128({{.+}})
// CHECK-NOT: ext
// CHECK: [[S:%.+]] = call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %{{.+}}, i128 %{{.+}})
@@ -206,7 +206,7 @@ int test_mul_overflow_xint128_xint128_xint128(_ExtInt(128) x, _ExtInt(128) y) {
// CHECK-DAG: [[Q:%.+]] = extractvalue { i128, i1 } [[S]], 0
// CHECK: store i128 [[Q]], i128*
// CHECK: br i1 [[C]]
- _ExtInt(128) r;
+ _BitInt(128) r;
if (__builtin_mul_overflow(x, y, &r))
overflowed();
return r;