1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2 | FileCheck %s --check-prefix=AVX2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=f16c,fma | FileCheck %s --check-prefix=F16C
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512vl | FileCheck %s --check-prefix=F16C
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512fp16 | FileCheck %s --check-prefix=FP16
7 define <2 x half> @foo(<2 x half> %0) "unsafe-fp-math"="true" nounwind {
10 ; AVX2-NEXT: subq $40, %rsp
11 ; AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
12 ; AVX2-NEXT: vpsrld $16, %xmm0, %xmm0
13 ; AVX2-NEXT: callq __extendhfsf2@PLT
14 ; AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
15 ; AVX2-NEXT: callq __truncsfhf2@PLT
16 ; AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
17 ; AVX2-NEXT: vmovaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
18 ; AVX2-NEXT: callq __extendhfsf2@PLT
19 ; AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
20 ; AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
21 ; AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
22 ; AVX2-NEXT: callq __extendhfsf2@PLT
23 ; AVX2-NEXT: vsubss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 4-byte Folded Reload
24 ; AVX2-NEXT: callq __truncsfhf2@PLT
25 ; AVX2-NEXT: addq $40, %rsp
30 ; F16C-NEXT: vpsrld $16, %xmm0, %xmm1
31 ; F16C-NEXT: vcvtph2ps %xmm1, %ymm1
32 ; F16C-NEXT: vmulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm1
33 ; F16C-NEXT: vcvtps2ph $4, %ymm1, %xmm1
34 ; F16C-NEXT: vcvtph2ps %xmm0, %ymm0
35 ; F16C-NEXT: vcvtph2ps %xmm1, %ymm1
36 ; F16C-NEXT: vsubps %ymm0, %ymm1, %ymm2
37 ; F16C-NEXT: vcvtps2ph $4, %ymm2, %xmm2
38 ; F16C-NEXT: vaddps %ymm0, %ymm1, %ymm0
39 ; F16C-NEXT: vcvtps2ph $4, %ymm0, %xmm0
40 ; F16C-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0],xmm0[1],xmm2[2,3,4,5,6,7]
41 ; F16C-NEXT: vzeroupper
46 ; FP16-NEXT: vpsrld $16, %xmm0, %xmm1
47 ; FP16-NEXT: vfmaddsub231ph {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm0
49 %2 = shufflevector <2 x half> %0, <2 x half> undef, <2 x i32> <i32 1, i32 2>
50 %3 = fmul fast <2 x half> %2, <half 0xH3D3A, half 0xH3854>
51 %4 = fsub fast <2 x half> %3, %0
52 %5 = fadd fast <2 x half> %3, %0
53 %6 = shufflevector <2 x half> %4, <2 x half> %5, <2 x i32> <i32 0, i32 3>
54 %7 = fadd fast <2 x half> %6, zeroinitializer
55 %8 = shufflevector <2 x half> undef, <2 x half> %7, <2 x i32> <i32 0, i32 3>
56 %9 = fsub fast <2 x half> %8, zeroinitializer