1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-unknown-linux -mattr=+avx2 -pass-remarks-output=%t | FileCheck %s
3; RUN: FileCheck %s --input-file=%t --check-prefix=YAML
4
5; YAML: --- !Passed
6; YAML: Pass:            slp-vectorizer
7; YAML: Name:            VectorizedList
8; YAML: Function:        multi_uses
9; YAML: Args:
10; YAML:  - String:          'SLP vectorized with cost '
11; YAML:  - Cost:            '-1'
12; YAML:  - String:          ' and with tree size '
13; YAML:  - TreeSize:        '3'
14
15define float @multi_uses(<2 x float> %x, <2 x float> %y) {
16; CHECK-LABEL: @multi_uses(
17; CHECK-NEXT:    [[Y1:%.*]] = extractelement <2 x float> [[Y:%.*]], i32 1
18; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <2 x float> poison, float [[Y1]], i32 0
19; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <2 x float> [[TMP1]], float [[Y1]], i32 1
20; CHECK-NEXT:    [[TMP3:%.*]] = fmul <2 x float> [[X:%.*]], [[TMP2]]
21; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <2 x float> [[TMP3]], i32 0
22; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <2 x float> [[TMP3]], i32 1
23; CHECK-NEXT:    [[ADD:%.*]] = fadd float [[TMP4]], [[TMP5]]
24; CHECK-NEXT:    ret float [[ADD]]
25;
26  %x0 = extractelement <2 x float> %x, i32 0
27  %x1 = extractelement <2 x float> %x, i32 1
28  %y1 = extractelement <2 x float> %y, i32 1
29  %x0x0 = fmul float %x0, %y1
30  %x1x1 = fmul float %x1, %y1
31  %add = fadd float %x0x0, %x1x1
32  ret float %add
33}
34