1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -mattr=avx512bf16 | FileCheck %s
4 define void @add(ptr %pa, ptr %pb, ptr %pc) nounwind {
7 ; CHECK-NEXT: pushq %rbx
8 ; CHECK-NEXT: movq %rdx, %rbx
9 ; CHECK-NEXT: movzwl (%rsi), %eax
10 ; CHECK-NEXT: shll $16, %eax
11 ; CHECK-NEXT: vmovd %eax, %xmm0
12 ; CHECK-NEXT: movzwl (%rdi), %eax
13 ; CHECK-NEXT: shll $16, %eax
14 ; CHECK-NEXT: vmovd %eax, %xmm1
15 ; CHECK-NEXT: vaddss %xmm0, %xmm1, %xmm0
16 ; CHECK-NEXT: callq __truncsfbf2@PLT
17 ; CHECK-NEXT: vpextrw $0, %xmm0, (%rbx)
18 ; CHECK-NEXT: popq %rbx
20 %a = load bfloat, ptr %pa
21 %b = load bfloat, ptr %pb
22 %add = fadd bfloat %a, %b
23 store bfloat %add, ptr %pc
27 define <4 x bfloat> @fptrunc_v4f32(<4 x float> %a) nounwind {
28 ; CHECK-LABEL: fptrunc_v4f32:
30 ; CHECK-NEXT: pushq %rbp
31 ; CHECK-NEXT: pushq %r15
32 ; CHECK-NEXT: pushq %r14
33 ; CHECK-NEXT: pushq %rbx
34 ; CHECK-NEXT: subq $72, %rsp
35 ; CHECK-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill
36 ; CHECK-NEXT: callq __truncsfbf2@PLT
37 ; CHECK-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
38 ; CHECK-NEXT: vpermilpd $1, (%rsp), %xmm0 # 16-byte Folded Reload
39 ; CHECK-NEXT: # xmm0 = mem[1,0]
40 ; CHECK-NEXT: callq __truncsfbf2@PLT
41 ; CHECK-NEXT: vmovapd %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
42 ; CHECK-NEXT: vpshufd $255, (%rsp), %xmm0 # 16-byte Folded Reload
43 ; CHECK-NEXT: # xmm0 = mem[3,3,3,3]
44 ; CHECK-NEXT: callq __truncsfbf2@PLT
45 ; CHECK-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
46 ; CHECK-NEXT: callq __truncsfbf2@PLT
47 ; CHECK-NEXT: vpextrw $0, %xmm0, %ebx
48 ; CHECK-NEXT: vmovdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
49 ; CHECK-NEXT: vpextrw $0, %xmm0, %ebp
50 ; CHECK-NEXT: vmovdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
51 ; CHECK-NEXT: vpextrw $0, %xmm0, %r14d
52 ; CHECK-NEXT: vmovdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
53 ; CHECK-NEXT: vpextrw $0, %xmm0, %r15d
54 ; CHECK-NEXT: vmovshdup (%rsp), %xmm0 # 16-byte Folded Reload
55 ; CHECK-NEXT: # xmm0 = mem[1,1,3,3]
56 ; CHECK-NEXT: callq __truncsfbf2@PLT
57 ; CHECK-NEXT: vpextrw $0, %xmm0, %eax
58 ; CHECK-NEXT: vmovd %r15d, %xmm0
59 ; CHECK-NEXT: vpinsrw $1, %eax, %xmm0, %xmm0
60 ; CHECK-NEXT: vpinsrw $2, %r14d, %xmm0, %xmm0
61 ; CHECK-NEXT: vpinsrw $3, %ebp, %xmm0, %xmm0
62 ; CHECK-NEXT: vpinsrw $4, %ebx, %xmm0, %xmm0
63 ; CHECK-NEXT: vpinsrw $5, %ebx, %xmm0, %xmm0
64 ; CHECK-NEXT: vpinsrw $6, %ebx, %xmm0, %xmm0
65 ; CHECK-NEXT: vpinsrw $7, %ebx, %xmm0, %xmm0
66 ; CHECK-NEXT: addq $72, %rsp
67 ; CHECK-NEXT: popq %rbx
68 ; CHECK-NEXT: popq %r14
69 ; CHECK-NEXT: popq %r15
70 ; CHECK-NEXT: popq %rbp
72 %b = fptrunc <4 x float> %a to <4 x bfloat>