xref: /llvm-project/llvm/test/CodeGen/X86/amx-fp8-internal.ll (revision abbfed9be7e0a247ac0ca248b4b7304d879b026a)
11b63f47eSFeng Zou; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
21b63f47eSFeng Zou; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-tile,+avx512f \
31b63f47eSFeng Zou; RUN: -mattr=+amx-fp8 -verify-machineinstrs | FileCheck %s
41b63f47eSFeng Zou
51b63f47eSFeng Zoudefine void @test_amx(i8* %pointer, i8* %base, i64 %stride) {
61b63f47eSFeng Zou; CHECK-LABEL: test_amx:
71b63f47eSFeng Zou; CHECK:       # %bb.0:
81b63f47eSFeng Zou; CHECK-NEXT:    pushq %rbp
91b63f47eSFeng Zou; CHECK-NEXT:    .cfi_def_cfa_offset 16
101b63f47eSFeng Zou; CHECK-NEXT:    subq $3952, %rsp # imm = 0xF70
111b63f47eSFeng Zou; CHECK-NEXT:    .cfi_def_cfa_offset 3968
121b63f47eSFeng Zou; CHECK-NEXT:    .cfi_offset %rbp, -16
131b63f47eSFeng Zou; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
141b63f47eSFeng Zou; CHECK-NEXT:    vmovups %zmm0, {{[0-9]+}}(%rsp)
151b63f47eSFeng Zou; CHECK-NEXT:    movb $1, {{[0-9]+}}(%rsp)
161b63f47eSFeng Zou; CHECK-NEXT:    movb $8, {{[0-9]+}}(%rsp)
171b63f47eSFeng Zou; CHECK-NEXT:    movw $8, {{[0-9]+}}(%rsp)
181b63f47eSFeng Zou; CHECK-NEXT:    movb $8, {{[0-9]+}}(%rsp)
191b63f47eSFeng Zou; CHECK-NEXT:    movw $8, {{[0-9]+}}(%rsp)
201b63f47eSFeng Zou; CHECK-NEXT:    movb $8, {{[0-9]+}}(%rsp)
211b63f47eSFeng Zou; CHECK-NEXT:    movw $8, {{[0-9]+}}(%rsp)
221b63f47eSFeng Zou; CHECK-NEXT:    movb $8, {{[0-9]+}}(%rsp)
231b63f47eSFeng Zou; CHECK-NEXT:    movw $8, {{[0-9]+}}(%rsp)
241b63f47eSFeng Zou; CHECK-NEXT:    movb $8, {{[0-9]+}}(%rsp)
251b63f47eSFeng Zou; CHECK-NEXT:    movw $8, {{[0-9]+}}(%rsp)
261b63f47eSFeng Zou; CHECK-NEXT:    ldtilecfg {{[0-9]+}}(%rsp)
271b63f47eSFeng Zou; CHECK-NEXT:    movw $8, %ax
281b63f47eSFeng Zou; CHECK-NEXT:    tileloadd (%rsi,%rdx), %tmm0
291b63f47eSFeng Zou; CHECK-NEXT:    tilezero %tmm1
301b63f47eSFeng Zou; CHECK-NEXT:    tilezero %tmm2
311b63f47eSFeng Zou; CHECK-NEXT:    movabsq $64, %rbp
321b63f47eSFeng Zou; CHECK-NEXT:    tilestored %tmm2, 896(%rsp,%rbp) # 1024-byte Folded Spill
331b63f47eSFeng Zou; CHECK-NEXT:    tileloadd 896(%rsp,%rbp), %tmm3 # 1024-byte Folded Reload
341b63f47eSFeng Zou; CHECK-NEXT:    tdpbf8ps %tmm1, %tmm0, %tmm3
351b63f47eSFeng Zou; CHECK-NEXT:    tdpbhf8ps %tmm1, %tmm0, %tmm3
361b63f47eSFeng Zou; CHECK-NEXT:    tilestored %tmm2, 1920(%rsp,%rbp) # 1024-byte Folded Spill
371b63f47eSFeng Zou; CHECK-NEXT:    tileloadd 1920(%rsp,%rbp), %tmm4 # 1024-byte Folded Reload
381b63f47eSFeng Zou; CHECK-NEXT:    tdphbf8ps %tmm1, %tmm0, %tmm4
391b63f47eSFeng Zou; CHECK-NEXT:    tdphf8ps %tmm1, %tmm0, %tmm2
401b63f47eSFeng Zou; CHECK-NEXT:    tilestored %tmm3, (%rdi,%rdx)
411b63f47eSFeng Zou; CHECK-NEXT:    addq $3952, %rsp # imm = 0xF70
421b63f47eSFeng Zou; CHECK-NEXT:    .cfi_def_cfa_offset 16
431b63f47eSFeng Zou; CHECK-NEXT:    popq %rbp
441b63f47eSFeng Zou; CHECK-NEXT:    .cfi_def_cfa_offset 8
451b63f47eSFeng Zou; CHECK-NEXT:    tilerelease
461b63f47eSFeng Zou; CHECK-NEXT:    vzeroupper
471b63f47eSFeng Zou; CHECK-NEXT:    retq
481b63f47eSFeng Zou
491b63f47eSFeng Zou  %a = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
501b63f47eSFeng Zou  %b = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
511b63f47eSFeng Zou  %c = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
521b63f47eSFeng Zou
531b63f47eSFeng Zou  %c1 = call x86_amx @llvm.x86.tdpbf8ps.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
541b63f47eSFeng Zou  %c2 = call x86_amx @llvm.x86.tdpbhf8ps.internal(i16 8, i16 8, i16 8, x86_amx %c1, x86_amx %a, x86_amx %b)
551b63f47eSFeng Zou  %c3 = call x86_amx @llvm.x86.tdphbf8ps.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
561b63f47eSFeng Zou  %c4 = call x86_amx @llvm.x86.tdphf8ps.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
571b63f47eSFeng Zou
581b63f47eSFeng Zou  call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %pointer, i64 %stride, x86_amx %c2)
591b63f47eSFeng Zou  ret void
601b63f47eSFeng Zou}
611b63f47eSFeng Zou
62*abbfed9bSFeng Zou; Function Attrs: nounwind
63*abbfed9bSFeng Zoudefine dso_local void @__tile_dpbf8ps(ptr %dst, ptr %src1, ptr %src2) #0 {
64*abbfed9bSFeng Zou; CHECK-LABEL: __tile_dpbf8ps:
65*abbfed9bSFeng Zou; CHECK:       # %bb.0: # %entry
66*abbfed9bSFeng Zou; CHECK-NEXT:    pushq %rbp
67*abbfed9bSFeng Zou; CHECK-NEXT:    subq $4976, %rsp # imm = 0x1370
68*abbfed9bSFeng Zou; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
69*abbfed9bSFeng Zou; CHECK-NEXT:    vmovups %zmm0, {{[0-9]+}}(%rsp)
70*abbfed9bSFeng Zou; CHECK-NEXT:    movb $1, {{[0-9]+}}(%rsp)
71*abbfed9bSFeng Zou; CHECK-NEXT:    movzwl (%rsi), %eax
72*abbfed9bSFeng Zou; CHECK-NEXT:    movb %al, {{[0-9]+}}(%rsp)
73*abbfed9bSFeng Zou; CHECK-NEXT:    movb %al, {{[0-9]+}}(%rsp)
74*abbfed9bSFeng Zou; CHECK-NEXT:    movb %al, {{[0-9]+}}(%rsp)
75*abbfed9bSFeng Zou; CHECK-NEXT:    movswq 2(%rdx), %rcx
76*abbfed9bSFeng Zou; CHECK-NEXT:    movw %cx, {{[0-9]+}}(%rsp)
77*abbfed9bSFeng Zou; CHECK-NEXT:    movw %cx, {{[0-9]+}}(%rsp)
78*abbfed9bSFeng Zou; CHECK-NEXT:    movw %cx, {{[0-9]+}}(%rsp)
79*abbfed9bSFeng Zou; CHECK-NEXT:    movswq 2(%rsi), %r8
80*abbfed9bSFeng Zou; CHECK-NEXT:    movw %r8w, {{[0-9]+}}(%rsp)
81*abbfed9bSFeng Zou; CHECK-NEXT:    movzwl %r8w, %r9d
82*abbfed9bSFeng Zou; CHECK-NEXT:    movb %r9b, {{[0-9]+}}(%rsp)
83*abbfed9bSFeng Zou; CHECK-NEXT:    shrl $2, %r9d
84*abbfed9bSFeng Zou; CHECK-NEXT:    movb %r9b, {{[0-9]+}}(%rsp)
85*abbfed9bSFeng Zou; CHECK-NEXT:    ldtilecfg {{[0-9]+}}(%rsp)
86*abbfed9bSFeng Zou; CHECK-NEXT:    addq $64, %rdi
87*abbfed9bSFeng Zou; CHECK-NEXT:    tileloadd (%rdi,%rcx), %tmm0
88*abbfed9bSFeng Zou; CHECK-NEXT:    addq $64, %rsi
89*abbfed9bSFeng Zou; CHECK-NEXT:    tileloadd (%rsi,%r8), %tmm1
90*abbfed9bSFeng Zou; CHECK-NEXT:    addq $64, %rdx
91*abbfed9bSFeng Zou; CHECK-NEXT:    tileloadd (%rdx,%rcx), %tmm2
92*abbfed9bSFeng Zou; CHECK-NEXT:    movabsq $64, %rbp
93*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm0, 896(%rsp,%rbp) # 1024-byte Folded Spill
94*abbfed9bSFeng Zou; CHECK-NEXT:    tileloadd 896(%rsp,%rbp), %tmm3 # 1024-byte Folded Reload
95*abbfed9bSFeng Zou; CHECK-NEXT:    tdpbf8ps %tmm2, %tmm1, %tmm3
96*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm3, (%rdi,%rcx)
97*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm0, 1920(%rsp,%rbp) # 1024-byte Folded Spill
98*abbfed9bSFeng Zou; CHECK-NEXT:    tileloadd 1920(%rsp,%rbp), %tmm3 # 1024-byte Folded Reload
99*abbfed9bSFeng Zou; CHECK-NEXT:    tdpbhf8ps %tmm2, %tmm1, %tmm3
100*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm3, (%rdi,%rcx)
101*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm0, 2944(%rsp,%rbp) # 1024-byte Folded Spill
102*abbfed9bSFeng Zou; CHECK-NEXT:    tileloadd 2944(%rsp,%rbp), %tmm3 # 1024-byte Folded Reload
103*abbfed9bSFeng Zou; CHECK-NEXT:    tdphbf8ps %tmm2, %tmm1, %tmm3
104*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm3, (%rdi,%rcx)
105*abbfed9bSFeng Zou; CHECK-NEXT:    tdphf8ps %tmm2, %tmm1, %tmm0
106*abbfed9bSFeng Zou; CHECK-NEXT:    tilestored %tmm0, (%rdi,%rcx)
107*abbfed9bSFeng Zou; CHECK-NEXT:    addq $4976, %rsp # imm = 0x1370
108*abbfed9bSFeng Zou; CHECK-NEXT:    popq %rbp
109*abbfed9bSFeng Zou; CHECK-NEXT:    tilerelease
110*abbfed9bSFeng Zou; CHECK-NEXT:    vzeroupper
111*abbfed9bSFeng Zou; CHECK-NEXT:    retq
112*abbfed9bSFeng Zouentry:
113*abbfed9bSFeng Zou  %0 = load i16, ptr %src1, align 64
114*abbfed9bSFeng Zou  %col = getelementptr inbounds nuw i8, ptr %src2, i64 2
115*abbfed9bSFeng Zou  %1 = load i16, ptr %col, align 2
116*abbfed9bSFeng Zou  %col1 = getelementptr inbounds nuw i8, ptr %src1, i64 2
117*abbfed9bSFeng Zou  %2 = load i16, ptr %col1, align 2
118*abbfed9bSFeng Zou  %tile = getelementptr inbounds nuw i8, ptr %dst, i64 64
119*abbfed9bSFeng Zou  %3 = load <256 x i32>, ptr %tile, align 64
120*abbfed9bSFeng Zou  %tile2 = getelementptr inbounds nuw i8, ptr %src1, i64 64
121*abbfed9bSFeng Zou  %4 = load <256 x i32>, ptr %tile2, align 64
122*abbfed9bSFeng Zou  %tile3 = getelementptr inbounds nuw i8, ptr %src2, i64 64
123*abbfed9bSFeng Zou  %5 = load <256 x i32>, ptr %tile3, align 64
124*abbfed9bSFeng Zou  %6 = tail call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> %3)
125*abbfed9bSFeng Zou  %7 = tail call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> %4)
126*abbfed9bSFeng Zou  %8 = tail call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> %5)
127*abbfed9bSFeng Zou
128*abbfed9bSFeng Zou  %9 = tail call x86_amx @llvm.x86.tdpbf8ps.internal(i16 %0, i16 %1, i16 %2, x86_amx %6, x86_amx %7, x86_amx %8)
129*abbfed9bSFeng Zou  %10 = tail call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx %9)
130*abbfed9bSFeng Zou  store <256 x i32> %10, ptr %tile, align 64
131*abbfed9bSFeng Zou
132*abbfed9bSFeng Zou  %11 = tail call x86_amx @llvm.x86.tdpbhf8ps.internal(i16 %0, i16 %1, i16 %2, x86_amx %6, x86_amx %7, x86_amx %8)
133*abbfed9bSFeng Zou  %12 = tail call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx %11)
134*abbfed9bSFeng Zou  store <256 x i32> %12, ptr %tile, align 64
135*abbfed9bSFeng Zou
136*abbfed9bSFeng Zou  %13 = tail call x86_amx @llvm.x86.tdphbf8ps.internal(i16 %0, i16 %1, i16 %2, x86_amx %6, x86_amx %7, x86_amx %8)
137*abbfed9bSFeng Zou  %14 = tail call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx %13)
138*abbfed9bSFeng Zou  store <256 x i32> %14, ptr %tile, align 64
139*abbfed9bSFeng Zou
140*abbfed9bSFeng Zou  %15 = tail call x86_amx @llvm.x86.tdphf8ps.internal(i16 %0, i16 %1, i16 %2, x86_amx %6, x86_amx %7, x86_amx %8)
141*abbfed9bSFeng Zou  %16 = tail call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx %15)
142*abbfed9bSFeng Zou  store <256 x i32> %16, ptr %tile, align 64
143*abbfed9bSFeng Zou
144*abbfed9bSFeng Zou  ret void
145*abbfed9bSFeng Zou}
146*abbfed9bSFeng Zou
1471b63f47eSFeng Zoudeclare x86_amx @llvm.x86.tilezero.internal(i16, i16)
1481b63f47eSFeng Zoudeclare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
1491b63f47eSFeng Zoudeclare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)
1501b63f47eSFeng Zou
1511b63f47eSFeng Zoudeclare x86_amx @llvm.x86.tdpbf8ps.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
1521b63f47eSFeng Zoudeclare x86_amx @llvm.x86.tdpbhf8ps.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
1531b63f47eSFeng Zoudeclare x86_amx @llvm.x86.tdphbf8ps.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
1541b63f47eSFeng Zoudeclare x86_amx @llvm.x86.tdphf8ps.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
155*abbfed9bSFeng Zou
156*abbfed9bSFeng Zouattributes #0 = { nounwind }
157*abbfed9bSFeng Zou
158