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: vpxord %zmm0, %zmm0, %zmm0
17 ; CHECK-NEXT: vmovdqu64 %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: movabsq $64, %rax
50 ; CHECK-NEXT: tilestored %tmm5, 64(%rsp,%rax) # 1024-byte Folded Spill
51 ; CHECK-NEXT: xorl %eax, %eax
52 ; CHECK-NEXT: vzeroupper
53 ; CHECK-NEXT: callq foo
54 ; CHECK-NEXT: ldtilecfg (%rsp)
55 ; CHECK-NEXT: movabsq $64, %rax
56 ; CHECK-NEXT: tileloadd 64(%rsp,%rax), %tmm6 # 1024-byte Folded Reload
57 ; CHECK-NEXT: jmp .LBB0_3
58 ; CHECK-NEXT: .LBB0_2: # %if.false
59 ; CHECK-NEXT: movl $buf, %eax
60 ; CHECK-NEXT: movw $8, %cx
61 ; CHECK-NEXT: tileloadd (%rax,%r14), %tmm2
62 ; CHECK-NEXT: movl $buf+1024, %eax
63 ; CHECK-NEXT: tileloadd (%rax,%r14), %tmm3
64 ; CHECK-NEXT: movabsq $64, %rax
65 ; CHECK-NEXT: tilestored %tmm5, 1088(%rsp,%rax) # 1024-byte Folded Spill
66 ; CHECK-NEXT: tdpbssd %tmm3, %tmm2, %tmm5
67 ; CHECK-NEXT: movabsq $64, %rax
68 ; CHECK-NEXT: tilestored %tmm5, 64(%rsp,%rax) # 1024-byte Folded Spill
69 ; CHECK-NEXT: xorl %eax, %eax
70 ; CHECK-NEXT: vzeroupper
71 ; CHECK-NEXT: callq foo
72 ; CHECK-NEXT: ldtilecfg (%rsp)
73 ; CHECK-NEXT: movabsq $64, %rax
74 ; CHECK-NEXT: tileloadd 64(%rsp,%rax), %tmm6 # 1024-byte Folded Reload
75 ; CHECK-NEXT: tilestored %tmm6, (%r15,%r14)
76 ; CHECK-NEXT: .LBB0_3: # %exit
77 ; CHECK-NEXT: movl $buf, %eax
78 ; CHECK-NEXT: movl $32, %ecx
79 ; CHECK-NEXT: movw $8, %dx
80 ; CHECK-NEXT: tileloadd (%rax,%rcx), %tmm4
81 ; CHECK-NEXT: movabsq $64, %rax
82 ; CHECK-NEXT: tileloadd 1088(%rsp,%rax), %tmm5 # 1024-byte Folded Reload
83 ; CHECK-NEXT: tdpbssd %tmm4, %tmm6, %tmm5
84 ; CHECK-NEXT: movl $buf+2048, %eax
85 ; CHECK-NEXT: tilestored %tmm5, (%rax,%rcx)
86 ; CHECK-NEXT: addq $2120, %rsp # imm = 0x848
87 ; CHECK-NEXT: popq %rbx
88 ; CHECK-NEXT: popq %r14
89 ; CHECK-NEXT: popq %r15
90 ; CHECK-NEXT: popq %rbp
91 ; CHECK-NEXT: tilerelease
93 %c = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 %1, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 2048), i64 32)
94 br i1 undef, label %if.true, label %if.false
96 %a1 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 8, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 0), i64 32)
97 %b1 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 %1, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 1024), i64 32)
98 %d1 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 %0, i16 %1, i16 8, x86_amx %c, x86_amx %a1, x86_amx %b1)
99 tail call void (...) @foo()
102 %a2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 8, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 0), i64 32)
103 %b2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 %1, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 1024), i64 32)
104 %d2 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 %0, i16 %1, i16 8, x86_amx %c, x86_amx %a2, x86_amx %b2)
105 tail call void (...) @foo()
106 tail call void @llvm.x86.tilestored64.internal(i16 %0, i16 %1, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 2048), i64 32, x86_amx %d2)
109 %d = phi x86_amx [ %d1, %if.true ], [ %d2, %if.false ]
110 %a = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 %0, i16 8, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 0), i64 32)
111 %res = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 %0, i16 %1, i16 8, x86_amx %c, x86_amx %d, x86_amx %a)
112 tail call void @llvm.x86.tilestored64.internal(i16 %0, i16 %1, i8* getelementptr inbounds ([3072 x i8], [3072 x i8]* @buf, i64 0, i64 2048), i64 32, x86_amx %res)
116 define dso_local void @test3(i8 *%buf) nounwind {
117 ; CHECK-LABEL: test3:
118 ; CHECK: # %bb.0: # %entry
119 ; CHECK-NEXT: pushq %rbp
120 ; CHECK-NEXT: pushq %r15
121 ; CHECK-NEXT: pushq %r14
122 ; CHECK-NEXT: pushq %rbx
123 ; CHECK-NEXT: subq $72, %rsp
124 ; CHECK-NEXT: vpxord %zmm0, %zmm0, %zmm0
125 ; CHECK-NEXT: vmovdqu64 %zmm0, {{[0-9]+}}(%rsp)
126 ; CHECK-NEXT: movb $1, {{[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: movb $8, {{[0-9]+}}(%rsp)
132 ; CHECK-NEXT: movw $8, {{[0-9]+}}(%rsp)
133 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
134 ; CHECK-NEXT: movw $8, %r15w
135 ; CHECK-NEXT: tilezero %tmm0
136 ; CHECK-NEXT: xorl %eax, %eax
137 ; CHECK-NEXT: testb %al, %al
138 ; CHECK-NEXT: jne .LBB1_3
139 ; CHECK-NEXT: # %bb.1: # %loop.header.preheader
140 ; CHECK-NEXT: movq %rdi, %rbx
141 ; CHECK-NEXT: movl $32, %r14d
142 ; CHECK-NEXT: xorl %ebp, %ebp
143 ; CHECK-NEXT: .p2align 4, 0x90
144 ; CHECK-NEXT: .LBB1_2: # %loop.header
145 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
146 ; CHECK-NEXT: tilestored %tmm0, (%rbx,%r14)
147 ; CHECK-NEXT: xorl %eax, %eax
148 ; CHECK-NEXT: tilezero %tmm0
149 ; CHECK-NEXT: vzeroupper
150 ; CHECK-NEXT: callq foo
151 ; CHECK-NEXT: ldtilecfg {{[0-9]+}}(%rsp)
152 ; CHECK-NEXT: tilezero %tmm0
153 ; CHECK-NEXT: tileloadd (%rbx,%r14), %tmm1
154 ; CHECK-NEXT: tileloadd (%rbx,%r14), %tmm2
155 ; CHECK-NEXT: tdpbssd %tmm2, %tmm1, %tmm0
156 ; CHECK-NEXT: tilestored %tmm0, (%rbx,%r14)
157 ; CHECK-NEXT: tilezero %tmm0
158 ; CHECK-NEXT: incl %ebp
159 ; CHECK-NEXT: cmpw $100, %bp
160 ; CHECK-NEXT: jl .LBB1_2
161 ; CHECK-NEXT: .LBB1_3: # %exit
162 ; CHECK-NEXT: addq $72, %rsp
163 ; CHECK-NEXT: popq %rbx
164 ; CHECK-NEXT: popq %r14
165 ; CHECK-NEXT: popq %r15
166 ; CHECK-NEXT: popq %rbp
167 ; CHECK-NEXT: tilerelease
168 ; CHECK-NEXT: vzeroupper
171 %t5 = tail call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
172 br i1 undef, label %loop.header, label %exit
175 %ivphi = phi i16 [0, %entry], [%iv, %loop.latch]
176 call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %buf, i64 32, x86_amx %t5)
177 call void (...) @foo()
181 %t1 = tail call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
182 %t2 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %buf, i64 32)
183 %t3 = tail call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %buf, i64 32)
184 %t4 = tail call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %t1, x86_amx %t2, x86_amx %t3)
185 tail call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %buf, i64 32, x86_amx %t4)
189 %iv = add i16 %ivphi, 1
190 %c = icmp slt i16 %iv, 100
191 br i1 %c, label %loop.header, label %exit
197 declare dso_local void @foo(...) nounwind
199 declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
200 declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
201 declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
202 declare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)