Skip to content

Commit e838471

Browse files
committed
[X86] Add regression test case from pr64593
This is the case which triggered the revert of 660b740. Note that the test is extremely fragile as it depends on getting a truncating store at the right moment rather than folding the constant to a narrower bitwidth. This appears to happen on skylake, but not e.g. plain avx.
1 parent 0e2c1cb commit e838471

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

llvm/test/CodeGen/X86/pr64593.ll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2+
; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=skx < %s | FileCheck %s
3+
4+
; If we have a truncating store, we need to truncate the elements when
5+
; when combining the constants.
6+
define void @pr64593(ptr %p) {
7+
; CHECK-LABEL: pr64593:
8+
; CHECK: # %bb.0:
9+
; CHECK-NEXT: vpxor %xmm0, %xmm0, %xmm0
10+
; CHECK-NEXT: vpmovqb %zmm0, (%rdi)
11+
; CHECK-NEXT: movq $0, 8(%rdi)
12+
; CHECK-NEXT: vzeroupper
13+
; CHECK-NEXT: retq
14+
%v = insertelement <8 x i64> zeroinitializer, i64 0, i32 1
15+
%trunc = trunc <8 x i64> %v to <8 x i8>
16+
%p1 = getelementptr i8, ptr %p, i32 0
17+
%p2 = getelementptr i8, ptr %p, i32 8
18+
store <8 x i8> %trunc, ptr %p1
19+
store <8 x i8> zeroinitializer, ptr %p2
20+
ret void
21+
}

0 commit comments

Comments
 (0)