mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-30 07:14:53 +00:00
add tests for De Morgan instcombines based on PR22723
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c832b3af78
commit
16098c386c
38
test/Transforms/InstCombine/demorgan-zext.ll
Normal file
38
test/Transforms/InstCombine/demorgan-zext.ll
Normal file
@ -0,0 +1,38 @@
|
||||
; RUN: opt < %s -instcombine -S | FileCheck %s
|
||||
|
||||
; PR22723: Recognize De Morgan's Laws when obfuscated by zexts.
|
||||
|
||||
define i32 @demorgan_or(i1 %X, i1 %Y) {
|
||||
%zextX = zext i1 %X to i32
|
||||
%zextY = zext i1 %Y to i32
|
||||
%notX = xor i32 %zextX, 1
|
||||
%notY = xor i32 %zextY, 1
|
||||
%or = or i32 %notX, %notY
|
||||
ret i32 %or
|
||||
|
||||
; CHECK-LABEL: demorgan_or(
|
||||
; CHECK-NEXT: = zext
|
||||
; CHECK-NEXT: = zext
|
||||
; CHECK-NEXT: = xor
|
||||
; CHECK-NEXT: = xor
|
||||
; CHECK-NEXT: = or
|
||||
; CHECK-NEXT: ret
|
||||
}
|
||||
|
||||
define i32 @demorgan_and(i1 %X, i1 %Y) {
|
||||
%zextX = zext i1 %X to i32
|
||||
%zextY = zext i1 %Y to i32
|
||||
%notX = xor i32 %zextX, 1
|
||||
%notY = xor i32 %zextY, 1
|
||||
%and = and i32 %notX, %notY
|
||||
ret i32 %and
|
||||
|
||||
; CHECK-LABEL: demorgan_and(
|
||||
; CHECK-NEXT: = zext
|
||||
; CHECK-NEXT: = zext
|
||||
; CHECK-NEXT: = xor
|
||||
; CHECK-NEXT: = xor
|
||||
; CHECK-NEXT: = and
|
||||
; CHECK-NEXT: ret
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user