1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-int8 -mattr=+avx512f -verify-machineinstrs | FileCheck %s
4 define dso_local void @test1(ptr%buf) nounwind {
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: pushq %rbp
8 ; CHECK-NEXT: pushq %r15
9 ; CHECK-NEXT: pushq %r14
10 ; CHECK-NEXT: pushq %rbx
11 ; CHECK-NEXT: subq $4056, %rsp # imm = 0xFD8
12 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
13 ; CHECK-NEXT: vmovups %zmm0, {{[0-9]+}}(%rsp)
14 ; CHECK-NEXT: movb $1, {{[0-9]+}}(%rsp)
15 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
16 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
17 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
18 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
19 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
20 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
21 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
22 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
23 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
24 ; CHECK-NEXT: movl $64, %eax
25 ; CHECK-NEXT: movw $8, %bp
26 ; CHECK-NEXT: tileloadd (%rdi,%rax), %tmm3
27 ; CHECK-NEXT: xorl %eax, %eax
28 ; CHECK-NEXT: testb %al, %al
29 ; CHECK-NEXT: jne .LBB0_3
30 ; CHECK-NEXT: # %bb.1: # %loop.header.preheader
31 ; CHECK-NEXT: movq %rdi, %rbx
32 ; CHECK-NEXT: xorl %r14d, %r14d
33 ; CHECK-NEXT: movl $32, %r15d
34 ; CHECK-NEXT: .p2align 4, 0x90
35 ; CHECK-NEXT: .LBB0_2: # %loop.header
36 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
37 ; CHECK-NEXT: movabsq $64, %rax
38 ; CHECK-NEXT: tilestored %tmm3, 3024(%rsp,%rax) # 1024-byte Folded Spill
39 ; CHECK-NEXT: vzeroupper
40 ; CHECK-NEXT: callq foo
41 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
42 ; CHECK-NEXT: movabsq $64, %rax
43 ; CHECK-NEXT: tileloadd 3024(%rsp,%rax), %tmm3 # 1024-byte Folded Reload
44 ; CHECK-NEXT: tileloadd (%rbx,%r15), %tmm0
45 ; CHECK-NEXT: tileloadd (%rbx,%r15), %tmm1
46 ; CHECK-NEXT: # implicit-def: $rax
47 ; CHECK-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
48 ; CHECK-NEXT: movabsq $64, %rax
49 ; CHECK-NEXT: tilestored %tmm3, 1024(%rsp,%rax) # 1024-byte Folded Spill
50 ; CHECK-NEXT: tileloadd {{[-0-9]+}}(%r{{[sb]}}p), %tmm2 # 1024-byte Folded Reload
51 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
52 ; CHECK-NEXT: tdpbssd %tmm1, %tmm0, %tmm2
53 ; CHECK-NEXT: tilestored %tmm2, (%rbx,%r15)
54 ; CHECK-NEXT: incl %r14d
55 ; CHECK-NEXT: cmpw $100, %r14w
56 ; CHECK-NEXT: jl .LBB0_2
57 ; CHECK-NEXT: .LBB0_3: # %exit
58 ; CHECK-NEXT: addq $4056, %rsp # imm = 0xFD8
59 ; CHECK-NEXT: popq %rbx
60 ; CHECK-NEXT: popq %r14
61 ; CHECK-NEXT: popq %r15
62 ; CHECK-NEXT: popq %rbp
63 ; CHECK-NEXT: tilerelease
64 ; CHECK-NEXT: vzeroupper
67 %t1 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 64)
68 br i1 undef, label %loop.header, label %exit
71 %ivphi = phi i16 [0, %entry], [%iv, %loop.latch]
76 %t2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 32)
77 %t3 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 32)
78 %t4 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %t1, x86_amx %t2, x86_amx %t3)
79 tail call void @llvm.x86.tilestored64.internal(i16 8, i16 8, ptr %buf, i64 32, x86_amx %t4)
83 %iv = add i16 %ivphi, 1
84 %c = icmp slt i16 %iv, 100
85 br i1 %c, label %loop.header, label %exit
91 define dso_local void @test2(ptr%buf) nounwind {
93 ; CHECK: # %bb.0: # %entry
94 ; CHECK-NEXT: pushq %rbp
95 ; CHECK-NEXT: pushq %r15
96 ; CHECK-NEXT: pushq %r14
97 ; CHECK-NEXT: pushq %rbx
98 ; CHECK-NEXT: subq $72, %rsp
99 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
100 ; CHECK-NEXT: vmovups %zmm0, {{[0-9]+}}(%rsp)
101 ; CHECK-NEXT: movb $1, {{[0-9]+}}(%rsp)
102 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
103 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
104 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
105 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
106 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
107 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
108 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
109 ; CHECK-NEXT: movw $8, %bp
110 ; CHECK-NEXT: tilezero %tmm0
111 ; CHECK-NEXT: xorl %eax, %eax
112 ; CHECK-NEXT: testb %al, %al
113 ; CHECK-NEXT: jne .LBB1_3
114 ; CHECK-NEXT: # %bb.1: # %loop.header.preheader
115 ; CHECK-NEXT: movq %rdi, %rbx
116 ; CHECK-NEXT: xorl %r14d, %r14d
117 ; CHECK-NEXT: movl $32, %r15d
118 ; CHECK-NEXT: .p2align 4, 0x90
119 ; CHECK-NEXT: .LBB1_2: # %loop.header
120 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
121 ; CHECK-NEXT: tilezero %tmm0
122 ; CHECK-NEXT: vzeroupper
123 ; CHECK-NEXT: callq foo
124 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
125 ; CHECK-NEXT: tilezero %tmm2
126 ; CHECK-NEXT: tileloadd (%rbx,%r15), %tmm0
127 ; CHECK-NEXT: tileloadd (%rbx,%r15), %tmm1
128 ; CHECK-NEXT: tdpbssd %tmm1, %tmm0, %tmm2
129 ; CHECK-NEXT: tilestored %tmm2, (%rbx,%r15)
130 ; CHECK-NEXT: incl %r14d
131 ; CHECK-NEXT: cmpw $100, %r14w
132 ; CHECK-NEXT: jl .LBB1_2
133 ; CHECK-NEXT: .LBB1_3: # %exit
134 ; CHECK-NEXT: addq $72, %rsp
135 ; CHECK-NEXT: popq %rbx
136 ; CHECK-NEXT: popq %r14
137 ; CHECK-NEXT: popq %r15
138 ; CHECK-NEXT: popq %rbp
139 ; CHECK-NEXT: tilerelease
140 ; CHECK-NEXT: vzeroupper
143 %t1 = tail call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
144 br i1 undef, label %loop.header, label %exit
147 %ivphi = phi i16 [0, %entry], [%iv, %loop.latch]
152 %t2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 32)
153 %t3 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 32)
154 %t4 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %t1, x86_amx %t2, x86_amx %t3)
155 tail call void @llvm.x86.tilestored64.internal(i16 8, i16 8, ptr %buf, i64 32, x86_amx %t4)
159 %iv = add i16 %ivphi, 1
160 %c = icmp slt i16 %iv, 100
161 br i1 %c, label %loop.header, label %exit
167 declare dso_local void @foo()
168 declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
169 declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, ptr, i64)
170 declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
171 declare void @llvm.x86.tilestored64.internal(i16, i16, ptr, i64, x86_amx)