Skip to content

Commit ee0818a

Browse files
authored
[X86] Add test coverage for #166744 (#166745)
1 parent 55fb1ca commit ee0818a

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

llvm/test/CodeGen/X86/pr166744.ll

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=POSTRA
3+
; RUN: llc < %s -mtriple=x86_64-- -mcpu=haswell | FileCheck %s --check-prefixes=NOPOSTRA
4+
; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64-v3 | FileCheck %s --check-prefixes=NOPOSTRA
5+
6+
; FIXME: Ensure reloads are after narrowed i512 -> i32 store
7+
define i1 @PR166744(ptr %v, i64 %idx, i1 zeroext %b) {
8+
; POSTRA-LABEL: PR166744:
9+
; POSTRA: # %bb.0:
10+
; POSTRA-NEXT: movl $1029, %eax # imm = 0x405
11+
; POSTRA-NEXT: shlxl %esi, %edx, %edx
12+
; POSTRA-NEXT: bextrl %eax, %esi, %eax
13+
; POSTRA-NEXT: movl (%rdi,%rax,4), %ecx
14+
; POSTRA-NEXT: btrl %esi, %ecx
15+
; POSTRA-NEXT: movq 8(%rdi), %rsi
16+
; POSTRA-NEXT: orq 40(%rdi), %rsi
17+
; POSTRA-NEXT: orl %ecx, %edx
18+
; POSTRA-NEXT: movl %edx, (%rdi,%rax,4)
19+
; POSTRA-NEXT: movq 16(%rdi), %rax
20+
; POSTRA-NEXT: movq 24(%rdi), %rdx
21+
; POSTRA-NEXT: orq 56(%rdi), %rdx
22+
; POSTRA-NEXT: orq 48(%rdi), %rax
23+
; POSTRA-NEXT: movq (%rdi), %rcx
24+
; POSTRA-NEXT: orq 32(%rdi), %rcx
25+
; POSTRA-NEXT: orq %rdx, %rsi
26+
; POSTRA-NEXT: orq %rax, %rcx
27+
; POSTRA-NEXT: orq %rsi, %rcx
28+
; POSTRA-NEXT: setne %al
29+
; POSTRA-NEXT: retq
30+
;
31+
; NOPOSTRA-LABEL: PR166744:
32+
; NOPOSTRA: # %bb.0:
33+
; NOPOSTRA-NEXT: movl %esi, %eax
34+
; NOPOSTRA-NEXT: shrl $3, %eax
35+
; NOPOSTRA-NEXT: andl $60, %eax
36+
; NOPOSTRA-NEXT: movl (%rdi,%rax), %ecx
37+
; NOPOSTRA-NEXT: btrl %esi, %ecx
38+
; NOPOSTRA-NEXT: shlxl %esi, %edx, %edx
39+
; NOPOSTRA-NEXT: orl %ecx, %edx
40+
; NOPOSTRA-NEXT: movl %edx, (%rdi,%rax)
41+
; NOPOSTRA-NEXT: movq 16(%rdi), %rax
42+
; NOPOSTRA-NEXT: movq (%rdi), %rcx
43+
; NOPOSTRA-NEXT: movq 8(%rdi), %rdx
44+
; NOPOSTRA-NEXT: movq 24(%rdi), %rsi
45+
; NOPOSTRA-NEXT: orq 56(%rdi), %rsi
46+
; NOPOSTRA-NEXT: orq 40(%rdi), %rdx
47+
; NOPOSTRA-NEXT: orq 48(%rdi), %rax
48+
; NOPOSTRA-NEXT: orq 32(%rdi), %rcx
49+
; NOPOSTRA-NEXT: orq %rsi, %rdx
50+
; NOPOSTRA-NEXT: orq %rax, %rcx
51+
; NOPOSTRA-NEXT: orq %rdx, %rcx
52+
; NOPOSTRA-NEXT: setne %al
53+
; NOPOSTRA-NEXT: retq
54+
%rem = and i64 %idx, 511
55+
%sh_prom = zext nneg i64 %rem to i512
56+
%shl = shl nuw i512 1, %sh_prom
57+
%not = xor i512 %shl, -1
58+
%load = load i512, ptr %v, align 8
59+
%and = and i512 %load, %not
60+
%conv2 = zext i1 %b to i512
61+
%shl4 = shl nuw i512 %conv2, %sh_prom
62+
%or = or i512 %and, %shl4
63+
store i512 %or, ptr %v, align 8
64+
%cmp = icmp ne i512 %or, 0
65+
ret i1 %cmp
66+
}

0 commit comments

Comments
 (0)