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 @buf = dso_local global [3072 x i8] zeroinitializer, align 64
6 define dso_local void @test_api(i16 signext %0, i16 signext %1) nounwind {
7 ; CHECK-LABEL: test_api:
9 ; CHECK-NEXT: pushq %rbp
10 ; CHECK-NEXT: pushq %r15
11 ; CHECK-NEXT: pushq %r14
12 ; CHECK-NEXT: pushq %rbx
13 ; CHECK-NEXT: subq $2120, %rsp # imm = 0x848
14 ; CHECK-NEXT: movl %esi, %ebx
15 ; CHECK-NEXT: movl %edi, %ebp
16 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
17 ; CHECK-NEXT: vmovups %zmm0, (%rsp)
18 ; CHECK-NEXT: movb $1, (%rsp)
19 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
20 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
21 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
22 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
23 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
24 ; CHECK-NEXT: movw %bx, {{[0-9]+}}(%rsp)
25 ; CHECK-NEXT: movb %bpl, {{[0-9]+}}(%rsp)
26 ; CHECK-NEXT: movw %bx, {{[0-9]+}}(%rsp)
27 ; CHECK-NEXT: movb %bpl, {{[0-9]+}}(%rsp)
28 ; CHECK-NEXT: movb %bpl, {{[0-9]+}}(%rsp)
29 ; CHECK-NEXT: movw %bx, {{[0-9]+}}(%rsp)
30 ; CHECK-NEXT: movb %bpl, {{[0-9]+}}(%rsp)
31 ; CHECK-NEXT: movw %bx, {{[0-9]+}}(%rsp)
32 ; CHECK-NEXT: movb %bpl, {{[0-9]+}}(%rsp)
33 ; CHECK-NEXT: ldtilecfg (%rsp)
34 ; CHECK-NEXT: movl $32, %r14d
35 ; CHECK-NEXT: movl $buf+2048, %r15d
36 ; CHECK-NEXT: tileloadd (%r15,%r14), %tmm5
37 ; CHECK-NEXT: xorl %eax, %eax
38 ; CHECK-NEXT: testb %al, %al
39 ; CHECK-NEXT: jne .LBB0_2
40 ; CHECK-NEXT: # %bb.1: # %if.true
41 ; CHECK-NEXT: movl $buf, %eax
42 ; CHECK-NEXT: movw $8, %cx
43 ; CHECK-NEXT: tileloadd (%rax,%r14), %tmm0
44 ; CHECK-NEXT: movl $buf+1024, %eax
45 ; CHECK-NEXT: tileloadd (%rax,%r14), %tmm1
46 ; CHECK-NEXT: movabsq $64, %rax
47 ; CHECK-NEXT: tilestored %tmm5, 1088(%rsp,%rax) # 1024-byte Folded Spill
48 ; CHECK-NEXT: tdpbssd %tmm1, %tmm0, %tmm5
49 ; CHECK-NEXT: tilestored %tmm5, 64(%rsp,%rax) # 1024-byte Folded Spill
50 ; CHECK-NEXT: xorl %eax, %eax
51 ; CHECK-NEXT: vzeroupper
52 ; CHECK-NEXT: callq foo
53 ; CHECK-NEXT: ldtilecfg (%rsp)
54 ; CHECK-NEXT: movabsq $64, %rax
55 ; CHECK-NEXT: tileloadd 64(%rsp,%rax), %tmm6 # 1024-byte Folded Reload
56 ; CHECK-NEXT: jmp .LBB0_3
57 ; CHECK-NEXT: .LBB0_2: # %if.false
58 ; CHECK-NEXT: movl $buf, %eax
59 ; CHECK-NEXT: movw $8, %cx
60 ; CHECK-NEXT: tileloadd (%rax,%r14), %tmm2
61 ; CHECK-NEXT: movl $buf+1024, %eax
62 ; CHECK-NEXT: tileloadd (%rax,%r14), %tmm3
63 ; CHECK-NEXT: movabsq $64, %rax
64 ; CHECK-NEXT: tilestored %tmm5, 1088(%rsp,%rax) # 1024-byte Folded Spill
65 ; CHECK-NEXT: tdpbssd %tmm3, %tmm2, %tmm5
66 ; CHECK-NEXT: tilestored %tmm5, 64(%rsp,%rax) # 1024-byte Folded Spill
67 ; CHECK-NEXT: xorl %eax, %eax
68 ; CHECK-NEXT: vzeroupper
69 ; CHECK-NEXT: callq foo
70 ; CHECK-NEXT: ldtilecfg (%rsp)
71 ; CHECK-NEXT: movabsq $64, %rax
72 ; CHECK-NEXT: tileloadd 64(%rsp,%rax), %tmm6 # 1024-byte Folded Reload
73 ; CHECK-NEXT: tilestored %tmm6, (%r15,%r14)
74 ; CHECK-NEXT: .LBB0_3: # %exit
75 ; CHECK-NEXT: movl $buf, %eax
76 ; CHECK-NEXT: movl $32, %ecx
77 ; CHECK-NEXT: movw $8, %dx
78 ; CHECK-NEXT: tileloadd (%rax,%rcx), %tmm4
79 ; CHECK-NEXT: movabsq $64, %rax
80 ; CHECK-NEXT: tileloadd 1088(%rsp,%rax), %tmm5 # 1024-byte Folded Reload
81 ; CHECK-NEXT: tdpbssd %tmm4, %tmm6, %tmm5
82 ; CHECK-NEXT: movl $buf+2048, %eax
83 ; CHECK-NEXT: tilestored %tmm5, (%rax,%rcx)
84 ; CHECK-NEXT: addq $2120, %rsp # imm = 0x848
85 ; CHECK-NEXT: popq %rbx
86 ; CHECK-NEXT: popq %r14
87 ; CHECK-NEXT: popq %r15
88 ; CHECK-NEXT: popq %rbp
89 ; CHECK-NEXT: tilerelease
91 %c = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 %1, ptr getelementptr inbounds ([3072 x i8], ptr @buf, i64 0, i64 2048), i64 32)
92 br i1 undef, label %if.true, label %if.false
94 %a1 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 8, ptr @buf, i64 32)
95 %b1 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 %1, ptr getelementptr inbounds ([3072 x i8], ptr @buf, i64 0, i64 1024), i64 32)
96 %d1 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 %0, i16 %1, i16 8, x86_amx %c, x86_amx %a1, x86_amx %b1)
97 tail call void (...) @foo()
100 %a2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 8, ptr @buf, i64 32)
101 %b2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 %1, ptr getelementptr inbounds ([3072 x i8], ptr @buf, i64 0, i64 1024), i64 32)
102 %d2 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 %0, i16 %1, i16 8, x86_amx %c, x86_amx %a2, x86_amx %b2)
103 tail call void (...) @foo()
104 tail call void @llvm.x86.tilestored64.internal(i16 %0, i16 %1, ptr getelementptr inbounds ([3072 x i8], ptr @buf, i64 0, i64 2048), i64 32, x86_amx %d2)
107 %d = phi x86_amx [ %d1, %if.true ], [ %d2, %if.false ]
108 %a = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 8, ptr @buf, i64 32)
109 %res = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 %0, i16 %1, i16 8, x86_amx %c, x86_amx %d, x86_amx %a)
110 tail call void @llvm.x86.tilestored64.internal(i16 %0, i16 %1, ptr getelementptr inbounds ([3072 x i8], ptr @buf, i64 0, i64 2048), i64 32, x86_amx %res)
114 define dso_local void @test3(ptr%buf) nounwind {
115 ; CHECK-LABEL: test3:
116 ; CHECK: # %bb.0: # %entry
117 ; CHECK-NEXT: pushq %rbp
118 ; CHECK-NEXT: pushq %r15
119 ; CHECK-NEXT: pushq %r14
120 ; CHECK-NEXT: pushq %rbx
121 ; CHECK-NEXT: subq $72, %rsp
122 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
123 ; CHECK-NEXT: vmovups %zmm0, {{[0-9]+}}(%rsp)
124 ; CHECK-NEXT: movb $1, {{[0-9]+}}(%rsp)
125 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
126 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
127 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
128 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
129 ; CHECK-NEXT: movb $8, {{[0-9]+}}(%rsp)
130 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
131 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
132 ; CHECK-NEXT: movw $8, %bp
133 ; CHECK-NEXT: tilezero %tmm0
134 ; CHECK-NEXT: xorl %eax, %eax
135 ; CHECK-NEXT: testb %al, %al
136 ; CHECK-NEXT: jne .LBB1_3
137 ; CHECK-NEXT: # %bb.1: # %loop.header.preheader
138 ; CHECK-NEXT: movq %rdi, %rbx
139 ; CHECK-NEXT: movl $32, %r14d
140 ; CHECK-NEXT: xorl %r15d, %r15d
141 ; CHECK-NEXT: .p2align 4, 0x90
142 ; CHECK-NEXT: .LBB1_2: # %loop.header
143 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
144 ; CHECK-NEXT: tilestored %tmm0, (%rbx,%r14)
145 ; CHECK-NEXT: xorl %eax, %eax
146 ; CHECK-NEXT: tilezero %tmm0
147 ; CHECK-NEXT: vzeroupper
148 ; CHECK-NEXT: callq foo
149 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
150 ; CHECK-NEXT: tilezero %tmm0
151 ; CHECK-NEXT: tileloadd (%rbx,%r14), %tmm1
152 ; CHECK-NEXT: tileloadd (%rbx,%r14), %tmm2
153 ; CHECK-NEXT: tdpbssd %tmm2, %tmm1, %tmm0
154 ; CHECK-NEXT: tilestored %tmm0, (%rbx,%r14)
155 ; CHECK-NEXT: tilezero %tmm0
156 ; CHECK-NEXT: incl %r15d
157 ; CHECK-NEXT: cmpw $100, %r15w
158 ; CHECK-NEXT: jl .LBB1_2
159 ; CHECK-NEXT: .LBB1_3: # %exit
160 ; CHECK-NEXT: addq $72, %rsp
161 ; CHECK-NEXT: popq %rbx
162 ; CHECK-NEXT: popq %r14
163 ; CHECK-NEXT: popq %r15
164 ; CHECK-NEXT: popq %rbp
165 ; CHECK-NEXT: tilerelease
166 ; CHECK-NEXT: vzeroupper
169 %t5 = tail call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
170 br i1 undef, label %loop.header, label %exit
173 %ivphi = phi i16 [0, %entry], [%iv, %loop.latch]
174 call void @llvm.x86.tilestored64.internal(i16 8, i16 8, ptr %buf, i64 32, x86_amx %t5)
175 call void (...) @foo()
179 %t1 = tail call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
180 %t2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 32)
181 %t3 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, ptr %buf, i64 32)
182 %t4 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %t1, x86_amx %t2, x86_amx %t3)
183 tail call void @llvm.x86.tilestored64.internal(i16 8, i16 8, ptr %buf, i64 32, x86_amx %t4)
187 %iv = add i16 %ivphi, 1
188 %c = icmp slt i16 %iv, 100
189 br i1 %c, label %loop.header, label %exit
195 declare dso_local void @foo(...) nounwind
197 declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
198 declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, ptr, i64)
199 declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
200 declare void @llvm.x86.tilestored64.internal(i16, i16, ptr, i64, x86_amx)