1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx512fp16 < %s | FileCheck %s
4 ; Verify that we're folding the load into the math instruction.
5 ; This pattern is generated out of the simplest intrinsics usage:
6 ; _mm_add_ss(a, _mm_load_ss(b));
8 define <8 x half> @addsh(<8 x half> %va, ptr %pb) {
11 ; CHECK-NEXT: vaddsh (%rdi), %xmm0, %xmm0
13 %a = extractelement <8 x half> %va, i32 0
14 %b = load half, ptr %pb
16 %vr = insertelement <8 x half> %va, half %r, i32 0
20 define <8 x half> @subsh(<8 x half> %va, ptr %pb) {
23 ; CHECK-NEXT: vsubsh (%rdi), %xmm0, %xmm0
25 %a = extractelement <8 x half> %va, i32 0
26 %b = load half, ptr %pb
28 %vr = insertelement <8 x half> %va, half %r, i32 0
32 define <8 x half> @mulsh(<8 x half> %va, ptr %pb) {
35 ; CHECK-NEXT: vmulsh (%rdi), %xmm0, %xmm0
37 %a = extractelement <8 x half> %va, i32 0
38 %b = load half, ptr %pb
40 %vr = insertelement <8 x half> %va, half %r, i32 0
44 define <8 x half> @divsh(<8 x half> %va, ptr %pb) {
47 ; CHECK-NEXT: vdivsh (%rdi), %xmm0, %xmm0
49 %a = extractelement <8 x half> %va, i32 0
50 %b = load half, ptr %pb
52 %vr = insertelement <8 x half> %va, half %r, i32 0
56 define <8 x half> @minsh(<8 x half> %va, ptr %pb) {
59 ; CHECK-NEXT: vminsh (%rdi), %xmm0, %xmm1
60 ; CHECK-NEXT: vmovsh %xmm1, %xmm0, %xmm0
62 %a = extractelement <8 x half> %va, i32 0
63 %b = load half, ptr %pb
64 %r = call nnan half @llvm.minnum.f16(half %a, half %b) readnone
65 %vr = insertelement <8 x half> %va, half %r, i32 0
69 define <8 x half> @maxsh(<8 x half> %va, ptr %pb) {
72 ; CHECK-NEXT: vminsh (%rdi), %xmm0, %xmm1
73 ; CHECK-NEXT: vmovsh %xmm1, %xmm0, %xmm0
75 %a = extractelement <8 x half> %va, i32 0
76 %b = load half, ptr %pb
77 %r = call nnan half @llvm.minnum.f16(half %a, half %b) readnone
78 %vr = insertelement <8 x half> %va, half %r, i32 0
82 declare half @llvm.minnum.f16(half, half)
83 declare half @llvm.maxnum.f16(half, half)