r348738 - [X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that matches gcc.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 9 22:07:59 PST 2018
Author: ctopper
Date: Sun Dec 9 22:07:59 2018
New Revision: 348738
URL: http://llvm.org/viewvc/llvm-project?rev=348738&view=rev
Log:
[X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that matches gcc.
The addcarry and addcarryx builtins do the same thing. The only difference is that addcarryx previously required adx feature.
This commit removes the adx feature check from addcarryx and removes the addcarry builtin. This matches the builtins that gcc has. We don't guarantee compatibility in builtins, but we generally try to be consistent if its not a burden.
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/adxintrin.h
cfe/trunk/test/CodeGen/adc-builtins.c
cfe/trunk/test/CodeGen/adx-builtins.c
Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=348738&r1=348737&r2=348738&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Dec 9 22:07:59 2018
@@ -719,8 +719,7 @@ TARGET_BUILTIN(__builtin_ia32_wbinvd, "v
TARGET_BUILTIN(__builtin_ia32_wbnoinvd, "v", "n", "wbnoinvd")
// ADX
-TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "n", "adx")
-TARGET_BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "n", "")
+TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "n", "")
TARGET_BUILTIN(__builtin_ia32_subborrow_u32, "UcUcUiUiUi*", "n", "")
// RDSEED
Modified: cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86_64.def?rev=348738&r1=348737&r2=348738&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86_64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86_64.def Sun Dec 9 22:07:59 2018
@@ -76,8 +76,7 @@ TARGET_BUILTIN(__builtin_ia32_incsspq, "
TARGET_BUILTIN(__builtin_ia32_rdsspq, "ULLiULLi", "n", "shstk")
TARGET_BUILTIN(__builtin_ia32_wrssq, "vULLiv*", "n", "shstk")
TARGET_BUILTIN(__builtin_ia32_wrussq, "vULLiv*", "n", "shstk")
-TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "n", "adx")
-TARGET_BUILTIN(__builtin_ia32_addcarry_u64, "UcUcULLiULLiULLi*", "n", "")
+TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "n", "")
TARGET_BUILTIN(__builtin_ia32_subborrow_u64, "UcUcULLiULLiULLi*", "n", "")
TARGET_BUILTIN(__builtin_ia32_rdrand64_step, "UiULLi*", "n", "rdrnd")
TARGET_BUILTIN(__builtin_ia32_rdseed64_step, "UiULLi*", "n", "rdseed")
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=348738&r1=348737&r2=348738&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sun Dec 9 22:07:59 2018
@@ -10930,30 +10930,22 @@ Value *CodeGenFunction::EmitX86BuiltinEx
}
case X86::BI__builtin_ia32_addcarryx_u32:
case X86::BI__builtin_ia32_addcarryx_u64:
- case X86::BI__builtin_ia32_addcarry_u32:
- case X86::BI__builtin_ia32_addcarry_u64:
case X86::BI__builtin_ia32_subborrow_u32:
case X86::BI__builtin_ia32_subborrow_u64: {
Intrinsic::ID IID;
switch (BuiltinID) {
default: llvm_unreachable("Unsupported intrinsic!");
case X86::BI__builtin_ia32_addcarryx_u32:
- IID = Intrinsic::x86_addcarryx_u32;
+ IID = Intrinsic::x86_addcarry_32;
break;
case X86::BI__builtin_ia32_addcarryx_u64:
- IID = Intrinsic::x86_addcarryx_u64;
- break;
- case X86::BI__builtin_ia32_addcarry_u32:
- IID = Intrinsic::x86_addcarry_u32;
- break;
- case X86::BI__builtin_ia32_addcarry_u64:
- IID = Intrinsic::x86_addcarry_u64;
+ IID = Intrinsic::x86_addcarry_64;
break;
case X86::BI__builtin_ia32_subborrow_u32:
- IID = Intrinsic::x86_subborrow_u32;
+ IID = Intrinsic::x86_subborrow_32;
break;
case X86::BI__builtin_ia32_subborrow_u64:
- IID = Intrinsic::x86_subborrow_u64;
+ IID = Intrinsic::x86_subborrow_64;
break;
}
Modified: cfe/trunk/lib/Headers/adxintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/adxintrin.h?rev=348738&r1=348737&r2=348738&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/adxintrin.h (original)
+++ cfe/trunk/lib/Headers/adxintrin.h Sun Dec 9 22:07:59 2018
@@ -53,7 +53,7 @@ static __inline unsigned char __DEFAULT_
_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
unsigned int *__p)
{
- return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
+ return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
}
#ifdef __x86_64__
@@ -61,7 +61,7 @@ static __inline unsigned char __DEFAULT_
_addcarry_u64(unsigned char __cf, unsigned long long __x,
unsigned long long __y, unsigned long long *__p)
{
- return __builtin_ia32_addcarry_u64(__cf, __x, __y, __p);
+ return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
}
#endif
Modified: cfe/trunk/test/CodeGen/adc-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/adc-builtins.c?rev=348738&r1=348737&r2=348738&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/adc-builtins.c (original)
+++ cfe/trunk/test/CodeGen/adc-builtins.c Sun Dec 9 22:07:59 2018
@@ -5,7 +5,7 @@
unsigned char test_addcarry_u32(unsigned char __cf, unsigned int __x,
unsigned int __y, unsigned int *__p) {
// CHECK-LABEL: test_addcarry_u32
-// CHECK: [[ADC:%.*]] = call { i8, i32 } @llvm.x86.addcarry.u32
+// CHECK: [[ADC:%.*]] = call { i8, i32 } @llvm.x86.addcarry.32
// CHECK: [[DATA:%.*]] = extractvalue { i8, i32 } [[ADC]], 1
// CHECK: store i32 [[DATA]], i32* %{{.*}}
// CHECK: [[CF:%.*]] = extractvalue { i8, i32 } [[ADC]], 0
@@ -16,7 +16,7 @@ unsigned char test_addcarry_u64(unsigned
unsigned long long __y,
unsigned long long *__p) {
// CHECK-LABEL: test_addcarry_u64
-// CHECK: [[ADC:%.*]] = call { i8, i64 } @llvm.x86.addcarry.u64
+// CHECK: [[ADC:%.*]] = call { i8, i64 } @llvm.x86.addcarry.64
// CHECK: [[DATA:%.*]] = extractvalue { i8, i64 } [[ADC]], 1
// CHECK: store i64 [[DATA]], i64* %{{.*}}
// CHECK: [[CF:%.*]] = extractvalue { i8, i64 } [[ADC]], 0
@@ -26,7 +26,7 @@ unsigned char test_addcarry_u64(unsigned
unsigned char test_subborrow_u32(unsigned char __cf, unsigned int __x,
unsigned int __y, unsigned int *__p) {
// CHECK-LABEL: test_subborrow_u32
-// CHECK: [[SBB:%.*]] = call { i8, i32 } @llvm.x86.subborrow.u32
+// CHECK: [[SBB:%.*]] = call { i8, i32 } @llvm.x86.subborrow.32
// CHECK: [[DATA:%.*]] = extractvalue { i8, i32 } [[SBB]], 1
// CHECK: store i32 [[DATA]], i32* %{{.*}}
// CHECK: [[CF:%.*]] = extractvalue { i8, i32 } [[SBB]], 0
@@ -37,7 +37,7 @@ unsigned char test_subborrow_u64(unsigne
unsigned long long __y,
unsigned long long *__p) {
// CHECK-LABEL: test_subborrow_u64
-// CHECK: [[SBB:%.*]] = call { i8, i64 } @llvm.x86.subborrow.u64
+// CHECK: [[SBB:%.*]] = call { i8, i64 } @llvm.x86.subborrow.64
// CHECK: [[DATA:%.*]] = extractvalue { i8, i64 } [[SBB]], 1
// CHECK: store i64 [[DATA]], i64* %{{.*}}
// CHECK: [[CF:%.*]] = extractvalue { i8, i64 } [[SBB]], 0
Modified: cfe/trunk/test/CodeGen/adx-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/adx-builtins.c?rev=348738&r1=348737&r2=348738&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/adx-builtins.c (original)
+++ cfe/trunk/test/CodeGen/adx-builtins.c Sun Dec 9 22:07:59 2018
@@ -5,7 +5,7 @@
unsigned char test_addcarryx_u32(unsigned char __cf, unsigned int __x,
unsigned int __y, unsigned int *__p) {
// CHECK-LABEL: test_addcarryx_u32
-// CHECK: [[ADC:%.*]] = call { i8, i32 } @llvm.x86.addcarryx.u32
+// CHECK: [[ADC:%.*]] = call { i8, i32 } @llvm.x86.addcarry.32
// CHECK: [[DATA:%.*]] = extractvalue { i8, i32 } [[ADC]], 1
// CHECK: store i32 [[DATA]], i32* %{{.*}}
// CHECK: [[CF:%.*]] = extractvalue { i8, i32 } [[ADC]], 0
@@ -16,7 +16,7 @@ unsigned char test_addcarryx_u64(unsigne
unsigned long long __y,
unsigned long long *__p) {
// CHECK-LABEL: test_addcarryx_u64
-// CHECK: [[ADC:%.*]] = call { i8, i64 } @llvm.x86.addcarryx.u64
+// CHECK: [[ADC:%.*]] = call { i8, i64 } @llvm.x86.addcarry.64
// CHECK: [[DATA:%.*]] = extractvalue { i8, i64 } [[ADC]], 1
// CHECK: store i64 [[DATA]], i64* %{{.*}}
// CHECK: [[CF:%.*]] = extractvalue { i8, i64 } [[ADC]], 0
More information about the cfe-commits
mailing list