Skip to content

Commit f26ac73

Browse files
committed
[X86] Add test case simplified from PR51175. NFC
1 parent 99ed6ce commit f26ac73

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

llvm/test/CodeGen/X86/pr51175.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
3+
4+
; The and with -9 has multiple users which prevents
5+
; SimplifyDemandedBits from touching it. The truncate only
6+
; demands the lower 8 bits. X86ISelDAGToDAG.cpp wants form
7+
; a test instruction from the icmp+trunc+and, but needs to
8+
; mask the -9 to 8 bits since SimplifyDemandedBits didn't.
9+
10+
define i32 @foo(i16 signext %0, i32 %1, i32* nocapture %2) {
11+
; CHECK-LABEL: foo:
12+
; CHECK: # %bb.0:
13+
; CHECK-NEXT: incl %edi
14+
; CHECK-NEXT: movl %edi, %eax
15+
; CHECK-NEXT: andl $65527, %eax # imm = 0xFFF7
16+
; CHECK-NEXT: movl %eax, (%rdx)
17+
; CHECK-NEXT: xorl %eax, %eax
18+
; CHECK-NEXT: testl $-9, %edi
19+
; CHECK-NEXT: cmovel %esi, %eax
20+
; CHECK-NEXT: retq
21+
%4 = add i16 %0, 1
22+
%5 = and i16 %4, -9
23+
%6 = zext i16 %5 to i32
24+
store i32 %6, i32* %2, align 4
25+
%7 = trunc i16 %5 to i8
26+
%8 = icmp eq i8 %7, 0
27+
%9 = select i1 %8, i32 %1, i32 0
28+
ret i32 %9
29+
}

0 commit comments

Comments
 (0)