xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/RISCV/revec-getGatherCost.ll (revision cb5046da26399c0ab545c3ed764e0e68e997ff89)
100629752SHan-Kuan Chen; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
206176293SHan-Kuan Chen; RUN: opt -mtriple=riscv64 -mcpu=sifive-x280 -passes=slp-vectorizer -S -slp-revec -slp-max-reg-size=1024 -slp-threshold=-20 -pass-remarks-output=%t %s | FileCheck %s
300629752SHan-Kuan Chen; RUN: FileCheck --input-file=%t --check-prefix=YAML %s
400629752SHan-Kuan Chen
500629752SHan-Kuan Chen; YAML: --- !Passed
600629752SHan-Kuan Chen; YAML: Pass:            slp-vectorizer
700629752SHan-Kuan Chen; YAML: Name:            StoresVectorized
806176293SHan-Kuan Chen; YAML: Function:        test1
900629752SHan-Kuan Chen; YAML: Args:
1000629752SHan-Kuan Chen; YAML:   - String:          'Stores SLP vectorized with cost '
1112bcea32SHan-Kuan Chen; YAML:   - Cost:            '4'
1200629752SHan-Kuan Chen; YAML:   - String:          ' and with tree size '
1300629752SHan-Kuan Chen; YAML:   - TreeSize:        '5'
1400629752SHan-Kuan Chen
1506176293SHan-Kuan Chendefine void @test1(<4 x float> %load6, <4 x float> %load7, <4 x float> %load8, <4 x float> %load17, <4 x float> %fmuladd7, <4 x float> %fmuladd16, ptr %out_ptr) {
1606176293SHan-Kuan Chen; CHECK-LABEL: @test1(
1700629752SHan-Kuan Chen; CHECK-NEXT:  entry:
1800629752SHan-Kuan Chen; CHECK-NEXT:    [[VEXT165_I:%.*]] = shufflevector <4 x float> [[LOAD6:%.*]], <4 x float> [[LOAD7:%.*]], <4 x i32> <i32 2, i32 3, i32 4, i32 5>
1900629752SHan-Kuan Chen; CHECK-NEXT:    [[VEXT309_I:%.*]] = shufflevector <4 x float> [[LOAD7]], <4 x float> [[LOAD8:%.*]], <4 x i32> <i32 2, i32 3, i32 4, i32 5>
2000629752SHan-Kuan Chen; CHECK-NEXT:    [[TMP0:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v4f32(<8 x float> poison, <4 x float> [[VEXT165_I]], i64 0)
2100629752SHan-Kuan Chen; CHECK-NEXT:    [[TMP1:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v4f32(<8 x float> [[TMP0]], <4 x float> [[VEXT309_I]], i64 4)
22*cb5046daSAlexey Bataev; CHECK-NEXT:    [[TMP3:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v4f32(<8 x float> poison, <4 x float> [[LOAD17:%.*]], i64 0)
2300629752SHan-Kuan Chen; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <8 x float> [[TMP3]], <8 x float> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
2400629752SHan-Kuan Chen; CHECK-NEXT:    [[TMP5:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v4f32(<8 x float> poison, <4 x float> [[FMULADD7:%.*]], i64 0)
2500629752SHan-Kuan Chen; CHECK-NEXT:    [[TMP6:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v4f32(<8 x float> [[TMP5]], <4 x float> [[FMULADD16:%.*]], i64 4)
2600629752SHan-Kuan Chen; CHECK-NEXT:    [[TMP7:%.*]] = call <8 x float> @llvm.fmuladd.v8f32(<8 x float> [[TMP1]], <8 x float> [[TMP4]], <8 x float> [[TMP6]])
2700629752SHan-Kuan Chen; CHECK-NEXT:    store <8 x float> [[TMP7]], ptr [[OUT_PTR:%.*]], align 4
2800629752SHan-Kuan Chen; CHECK-NEXT:    ret void
2900629752SHan-Kuan Chen;
3000629752SHan-Kuan Chenentry:
3100629752SHan-Kuan Chen  %vext165.i = shufflevector <4 x float> %load6, <4 x float> %load7, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
3200629752SHan-Kuan Chen  %vext309.i = shufflevector <4 x float> %load7, <4 x float> %load8, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
3300629752SHan-Kuan Chen  %fmuladd8 = tail call noundef <4 x float> @llvm.fmuladd.v4f32(<4 x float> %vext165.i, <4 x float> %load17, <4 x float> %fmuladd7)
3400629752SHan-Kuan Chen  %fmuladd17 = tail call noundef <4 x float> @llvm.fmuladd.v4f32(<4 x float> %vext309.i, <4 x float> %load17, <4 x float> %fmuladd16)
3500629752SHan-Kuan Chen  %add.ptr.i.i = getelementptr inbounds i8, ptr %out_ptr, i64 16
3600629752SHan-Kuan Chen  store <4 x float> %fmuladd8, ptr %out_ptr, align 4
3700629752SHan-Kuan Chen  store <4 x float> %fmuladd17, ptr %add.ptr.i.i, align 4
3800629752SHan-Kuan Chen  ret void
3900629752SHan-Kuan Chen}
4000629752SHan-Kuan Chen
4100629752SHan-Kuan Chendeclare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>)
4206176293SHan-Kuan Chen
4306176293SHan-Kuan Chen; YAML: --- !Passed
4406176293SHan-Kuan Chen; YAML: Pass:            slp-vectorizer
4506176293SHan-Kuan Chen; YAML: Name:            StoresVectorized
4606176293SHan-Kuan Chen; YAML: Function:        test2
4706176293SHan-Kuan Chen; YAML: Args:
4806176293SHan-Kuan Chen; YAML:   - String:          'Stores SLP vectorized with cost '
4912bcea32SHan-Kuan Chen; YAML:   - Cost:            '12'
5006176293SHan-Kuan Chen; YAML:   - String:          ' and with tree size '
5106176293SHan-Kuan Chen; YAML:   - TreeSize:        '5'
5206176293SHan-Kuan Chen
5306176293SHan-Kuan Chendefine void @test2(<8 x float> %load6, <8 x float> %load7, <8 x float> %load8, <8 x float> %load17, <8 x float> %fmuladd7, <8 x float> %fmuladd16, ptr %out_ptr) {
5406176293SHan-Kuan Chen; CHECK-LABEL: @test2(
5506176293SHan-Kuan Chen; CHECK-NEXT:  entry:
5606176293SHan-Kuan Chen; CHECK-NEXT:    [[VEXT165_I:%.*]] = shufflevector <8 x float> [[LOAD6:%.*]], <8 x float> [[LOAD7:%.*]], <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
5706176293SHan-Kuan Chen; CHECK-NEXT:    [[VEXT309_I:%.*]] = shufflevector <8 x float> [[LOAD7]], <8 x float> [[LOAD8:%.*]], <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
5806176293SHan-Kuan Chen; CHECK-NEXT:    [[TMP0:%.*]] = call <16 x float> @llvm.vector.insert.v16f32.v8f32(<16 x float> poison, <8 x float> [[VEXT165_I]], i64 0)
5906176293SHan-Kuan Chen; CHECK-NEXT:    [[TMP1:%.*]] = call <16 x float> @llvm.vector.insert.v16f32.v8f32(<16 x float> [[TMP0]], <8 x float> [[VEXT309_I]], i64 8)
60*cb5046daSAlexey Bataev; CHECK-NEXT:    [[TMP3:%.*]] = call <16 x float> @llvm.vector.insert.v16f32.v8f32(<16 x float> poison, <8 x float> [[LOAD17:%.*]], i64 0)
6106176293SHan-Kuan Chen; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <16 x float> [[TMP3]], <16 x float> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
6206176293SHan-Kuan Chen; CHECK-NEXT:    [[TMP5:%.*]] = call <16 x float> @llvm.vector.insert.v16f32.v8f32(<16 x float> poison, <8 x float> [[FMULADD7:%.*]], i64 0)
6306176293SHan-Kuan Chen; CHECK-NEXT:    [[TMP6:%.*]] = call <16 x float> @llvm.vector.insert.v16f32.v8f32(<16 x float> [[TMP5]], <8 x float> [[FMULADD16:%.*]], i64 8)
6406176293SHan-Kuan Chen; CHECK-NEXT:    [[TMP7:%.*]] = call <16 x float> @llvm.fmuladd.v16f32(<16 x float> [[TMP1]], <16 x float> [[TMP4]], <16 x float> [[TMP6]])
6506176293SHan-Kuan Chen; CHECK-NEXT:    store <16 x float> [[TMP7]], ptr [[OUT_PTR:%.*]], align 4
6606176293SHan-Kuan Chen; CHECK-NEXT:    ret void
6706176293SHan-Kuan Chen;
6806176293SHan-Kuan Chenentry:
6906176293SHan-Kuan Chen  %vext165.i = shufflevector <8 x float> %load6, <8 x float> %load7, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
7006176293SHan-Kuan Chen  %vext309.i = shufflevector <8 x float> %load7, <8 x float> %load8, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
7106176293SHan-Kuan Chen  %fmuladd8 = tail call noundef <8 x float> @llvm.fmuladd.v8f32(<8 x float> %vext165.i, <8 x float> %load17, <8 x float> %fmuladd7)
7206176293SHan-Kuan Chen  %fmuladd17 = tail call noundef <8 x float> @llvm.fmuladd.v8f32(<8 x float> %vext309.i, <8 x float> %load17, <8 x float> %fmuladd16)
7306176293SHan-Kuan Chen  %add.ptr.i.i = getelementptr inbounds i8, ptr %out_ptr, i64 32
7406176293SHan-Kuan Chen  store <8 x float> %fmuladd8, ptr %out_ptr, align 4
7506176293SHan-Kuan Chen  store <8 x float> %fmuladd17, ptr %add.ptr.i.i, align 4
7606176293SHan-Kuan Chen  ret void
7706176293SHan-Kuan Chen}
7806176293SHan-Kuan Chen
7906176293SHan-Kuan Chendeclare <8 x float> @llvm.fmuladd.v8f32(<8 x float>, <8 x float>, <8 x float>)
80