Skip to content

Commit aefe411

Browse files
committed
[LoongArch] Add a test for spurious mask removal. NFC
Link: #99272 (comment)
1 parent f1422a8 commit aefe411

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/test/CodeGen/LoongArch/andn-icmp.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,25 @@ define i1 @andn_icmp_ult_i8_nn(i8 %a, i8 %b) nounwind {
601601
%cmp = icmp ult i8 %and, %b
602602
ret i1 %cmp
603603
}
604+
605+
define i1 @andn_icmp_eq_i8_i32(i8 signext %a, i8 signext %b) nounwind {
606+
; LA32-LABEL: andn_icmp_eq_i8_i32:
607+
; LA32: # %bb.0:
608+
; LA32-NEXT: andn $a0, $a1, $a0
609+
; LA32-NEXT: andi $a0, $a0, 255
610+
; LA32-NEXT: sltui $a0, $a0, 1
611+
; LA32-NEXT: ret
612+
;
613+
; LA64-LABEL: andn_icmp_eq_i8_i32:
614+
; LA64: # %bb.0:
615+
; LA64-NEXT: andn $a0, $a1, $a0
616+
; LA64-NEXT: andi $a0, $a0, 255
617+
; LA64-NEXT: sltui $a0, $a0, 1
618+
; LA64-NEXT: ret
619+
%x = zext i8 %a to i32
620+
%y = zext i8 %b to i32
621+
%not = xor i32 %x, -1
622+
%and = and i32 %not, %y
623+
%cmp = icmp eq i32 %and, 0
624+
ret i1 %cmp
625+
}

0 commit comments

Comments
 (0)