diff options
author | Craig Topper <craig.topper@intel.com> | 2017-08-12 20:19:44 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-08-12 20:19:44 +0000 |
commit | 44cb1ffb6a57b43ac281bf686aa7ae6a1dbdfa52 (patch) | |
tree | 19b690bd8ab99dfa3f5f53cbaea4f7cdc2425367 /llvm/test/CodeGen/X86/adx-intrinsics.ll | |
parent | 7c87ebf3cd825e5375041614d7a3361051536b6a (diff) | |
download | bcm5719-llvm-44cb1ffb6a57b43ac281bf686aa7ae6a1dbdfa52.tar.gz bcm5719-llvm-44cb1ffb6a57b43ac281bf686aa7ae6a1dbdfa52.zip |
[X86] When handling addcarry intrinsic, create the flag result with the correct type so we don't crash if we use a memory instruction
Summary:
Previously we were creating the flag result with MVT::Other which is interpretted as a Chain node. If we used a memory form of the instruction we would end up with a copyToReg that consumed the chain result of the adcx instruction instead of the flag result.
Pretty sure we should be using MVT::i32 here, that's what we do other places we create these node types.
We should probably consider this for 5.0 as well.
Reviewers: RKSimon, zvi, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36645
llvm-svn: 310784
Diffstat (limited to 'llvm/test/CodeGen/X86/adx-intrinsics.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/adx-intrinsics.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/adx-intrinsics.ll b/llvm/test/CodeGen/X86/adx-intrinsics.ll index 0498177a9c1..819a5df14e6 100644 --- a/llvm/test/CodeGen/X86/adx-intrinsics.ll +++ b/llvm/test/CodeGen/X86/adx-intrinsics.ll @@ -75,3 +75,30 @@ define i8 @test_subborrow_u64(i8 %c, i64 %a, i64 %b, i8* %ptr) { ret i8 %ret; } +; Try a version with loads. Previously we crashed on this. +define i32 @load_crash(i64* nocapture readonly %a, i64* nocapture readonly %b, i64* %res) { +; CHECK-LABEL: load_crash +; CHECK: addb +; ADX: adcxq +; CHECK: setb +; CHECK: retq + %1 = load i64, i64* %a, align 8 + %2 = load i64, i64* %b, align 8 + %3 = bitcast i64* %res to i8* + %4 = tail call i8 @llvm.x86.addcarryx.u64(i8 0, i64 %1, i64 %2, i8* %3) + %conv = zext i8 %4 to i32 + ret i32 %conv +} + +; Try a really simple all zero input case, which also used to crash +define void @allzeros() { +; CHECK-LABEL: allzeros +; CHECK: xorl +; CHECK: addb +; CHECK: sbbq +; CHECK: andl +; CHECK: retq +entry: + %0 = tail call i8 @llvm.x86.addcarryx.u64(i8 0, i64 0, i64 0, i8* null) + ret void +} |