[llvm] a23d6c7 - [NFC] Add test case for D154533.
Amaury Séchet via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 07:19:20 PDT 2023
Author: Amaury Séchet
Date: 2023-07-17T14:19:15Z
New Revision: a23d6c760ccc97eb57c7395e106a895cfd4ca536
URL: https://github.com/llvm/llvm-project/commit/a23d6c760ccc97eb57c7395e106a895cfd4ca536
DIFF: https://github.com/llvm/llvm-project/commit/a23d6c760ccc97eb57c7395e106a895cfd4ca536.diff
LOG: [NFC] Add test case for D154533.
Added:
Modified:
llvm/test/CodeGen/X86/addcarry.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/addcarry.ll b/llvm/test/CodeGen/X86/addcarry.ll
index 2c950a20078d80..6b9883ca50649a 100644
--- a/llvm/test/CodeGen/X86/addcarry.ll
+++ b/llvm/test/CodeGen/X86/addcarry.ll
@@ -704,6 +704,32 @@ define { i64, i1 } @addcarry_carry_not_i1(i64 %a, i64 %b, i8 %carryin) nounwind
ret { i64, i1 } %ret
}
+; Check that we can reconstruct a carry if it is masked.
+define { i64, i1 } @addcarry_carry_and_1(i64 %a, i64 %b, i64 %carryin) nounwind {
+; CHECK-LABEL: addcarry_carry_and_1:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq %rdx, %rax
+; CHECK-NEXT: addq %rsi, %rdi
+; CHECK-NEXT: setb %cl
+; CHECK-NEXT: andl $1, %eax
+; CHECK-NEXT: addq %rdi, %rax
+; CHECK-NEXT: setb %dl
+; CHECK-NEXT: orb %cl, %dl
+; CHECK-NEXT: retq
+ %t1 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
+ %partial = extractvalue { i64, i1 } %t1, 0
+ %k1 = extractvalue { i64, i1 } %t1, 1
+
+ %mcarryin = and i64 %carryin, 1
+ %sum = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %partial, i64 %mcarryin)
+ %k2 = extractvalue { i64, i1 } %sum, 1
+
+ %carryout = or i1 %k1, %k2
+
+ %ret = insertvalue { i64, i1 } %sum, i1 %carryout, 1
+ ret { i64, i1 } %ret
+}
+
; negative test for combineCarryDiamond(): uaddo mixed with usubo
define { i64, i64, i1 } @addcarry_mixed_2x64(i64 %x0, i64 %x1, i64 %y0, i64 %y1) nounwind {
; CHECK-LABEL: addcarry_mixed_2x64:
More information about the llvm-commits
mailing list