Add test case for D46505 . NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333341 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Amaury Sechet 2018-05-26 12:28:23 +00:00
parent 5af80c626e
commit 1c5fb8ed95
2 changed files with 77 additions and 0 deletions

View File

@ -382,3 +382,65 @@ entry:
store i64 %b, i64* %a
ret void
}
define i32 @inc_not(i32 %a) {
; X32-LABEL: inc_not:
; X32: # %bb.0:
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; X32-NEXT: notl %eax
; X32-NEXT: incl %eax
; X32-NEXT: retl
;
; X64-LINUX-LABEL: inc_not:
; X64-LINUX: # %bb.0:
; X64-LINUX-NEXT: # kill: def $edi killed $edi def $rdi
; X64-LINUX-NEXT: notl %edi
; X64-LINUX-NEXT: leal 1(%rdi), %eax
; X64-LINUX-NEXT: retq
;
; X64-WIN32-LABEL: inc_not:
; X64-WIN32: # %bb.0:
; X64-WIN32-NEXT: # kill: def $ecx killed $ecx def $rcx
; X64-WIN32-NEXT: notl %ecx
; X64-WIN32-NEXT: leal 1(%rcx), %eax
; X64-WIN32-NEXT: retq
%nota = xor i32 %a, -1
%r = add i32 %nota, 1
ret i32 %r
}
define void @uaddo1_not(i32 %a, i32* %p0, i1* %p1) {
; X32-LABEL: uaddo1_not:
; X32: # %bb.0:
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
; X32-NEXT: notl %edx
; X32-NEXT: addl $1, %edx
; X32-NEXT: movl %edx, (%ecx)
; X32-NEXT: setb (%eax)
; X32-NEXT: retl
;
; X64-LINUX-LABEL: uaddo1_not:
; X64-LINUX: # %bb.0:
; X64-LINUX-NEXT: notl %edi
; X64-LINUX-NEXT: addl $1, %edi
; X64-LINUX-NEXT: movl %edi, (%rsi)
; X64-LINUX-NEXT: setb (%rdx)
; X64-LINUX-NEXT: retq
;
; X64-WIN32-LABEL: uaddo1_not:
; X64-WIN32: # %bb.0:
; X64-WIN32-NEXT: notl %ecx
; X64-WIN32-NEXT: addl $1, %ecx
; X64-WIN32-NEXT: movl %ecx, (%rdx)
; X64-WIN32-NEXT: setb (%r8)
; X64-WIN32-NEXT: retq
%nota = xor i32 %a, -1
%uaddo = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %nota, i32 1)
%r0 = extractvalue {i32, i1} %uaddo, 0
%r1 = extractvalue {i32, i1} %uaddo, 1
store i32 %r0, i32* %p0
store i1 %r1, i1* %p1
ret void
}

View File

@ -317,3 +317,18 @@ entry:
%35 = insertvalue %S undef, [4 x i64] %34, 0
ret %S %35
}
define i128 @addcarry1_not(i128 %n) {
; CHECK-LABEL: addcarry1_not:
; CHECK: # %bb.0:
; CHECK-NEXT: notq %rsi
; CHECK-NEXT: notq %rdi
; CHECK-NEXT: addq $1, %rdi
; CHECK-NEXT: adcq $0, %rsi
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: movq %rsi, %rdx
; CHECK-NEXT: retq
%1 = xor i128 %n, -1
%2 = add i128 %1, 1
ret i128 %2
}