Skip to content

Commit

Permalink
[LoongArch] Add a test for spurious mask removal. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher authored and yuxuanchen1997 committed Jul 25, 2024
1 parent 66e7651 commit 87ce812
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions llvm/test/CodeGen/LoongArch/andn-icmp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -601,3 +601,25 @@ define i1 @andn_icmp_ult_i8_nn(i8 %a, i8 %b) nounwind {
%cmp = icmp ult i8 %and, %b
ret i1 %cmp
}

define i1 @andn_icmp_eq_i8_i32(i8 signext %a, i8 signext %b) nounwind {
; LA32-LABEL: andn_icmp_eq_i8_i32:
; LA32: # %bb.0:
; LA32-NEXT: andn $a0, $a1, $a0
; LA32-NEXT: andi $a0, $a0, 255
; LA32-NEXT: sltui $a0, $a0, 1
; LA32-NEXT: ret
;
; LA64-LABEL: andn_icmp_eq_i8_i32:
; LA64: # %bb.0:
; LA64-NEXT: andn $a0, $a1, $a0
; LA64-NEXT: andi $a0, $a0, 255
; LA64-NEXT: sltui $a0, $a0, 1
; LA64-NEXT: ret
%x = zext i8 %a to i32
%y = zext i8 %b to i32
%not = xor i32 %x, -1
%and = and i32 %not, %y
%cmp = icmp eq i32 %and, 0
ret i1 %cmp
}

0 comments on commit 87ce812

Please sign in to comment.