Skip to content

Commit 00ffc70

Browse files
committed
[SLP][NFC]Add a test with commutative instruction with non-commutative op, NFC
1 parent 091aece commit 00ffc70

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
2+
; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -slp-threshold=-5 < %s | FileCheck %s
3+
4+
declare float @llvm.fmuladd.f32(float, float, float)
5+
6+
define void @test(ptr %quat, float %call13) {
7+
; CHECK-LABEL: define void @test(
8+
; CHECK-SAME: ptr [[QUAT:%.*]], float [[CALL13:%.*]]) {
9+
; CHECK-NEXT: [[ENTRY:.*:]]
10+
; CHECK-NEXT: [[CALL121:%.*]] = load volatile float, ptr null, align 4
11+
; CHECK-NEXT: [[TMP0:%.*]] = call float @llvm.fmuladd.f32(float [[CALL13]], float 0.000000e+00, float 0.000000e+00)
12+
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fmuladd.f32(float [[CALL121]], float 0.000000e+00, float 0.000000e+00)
13+
; CHECK-NEXT: [[TMP2:%.*]] = fadd float [[TMP1]], 0.000000e+00
14+
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x float> poison, float [[CALL13]], i32 0
15+
; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <2 x float> [[TMP3]], <2 x float> poison, <2 x i32> zeroinitializer
16+
; CHECK-NEXT: [[TMP5:%.*]] = insertelement <2 x float> poison, float [[TMP2]], i32 0
17+
; CHECK-NEXT: [[TMP6:%.*]] = insertelement <2 x float> [[TMP5]], float [[TMP0]], i32 1
18+
; CHECK-NEXT: [[TMP7:%.*]] = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> [[TMP4]], <2 x float> zeroinitializer, <2 x float> [[TMP6]])
19+
; CHECK-NEXT: store <2 x float> [[TMP7]], ptr [[QUAT]], align 4
20+
; CHECK-NEXT: ret void
21+
;
22+
entry:
23+
%call121 = load volatile float, ptr null, align 4
24+
%0 = call float @llvm.fmuladd.f32(float %call13, float 0.000000e+00, float 0.000000e+00)
25+
%1 = call float @llvm.fmuladd.f32(float %call13, float 0.000000e+00, float %0)
26+
%2 = call float @llvm.fmuladd.f32(float %call121, float 0.000000e+00, float 0.000000e+00)
27+
%3 = fadd float %2, 0.000000e+00
28+
%4 = call float @llvm.fmuladd.f32(float %call13, float 0.000000e+00, float %3)
29+
%arrayidx43.i = getelementptr i8, ptr %quat, i64 4
30+
store float %1, ptr %arrayidx43.i, align 4
31+
store float %4, ptr %quat, align 4
32+
ret void
33+
}

0 commit comments

Comments
 (0)