Skip to content

Commit 4d8ba5c

Browse files
committed
Precommit tests
1 parent eb79e34 commit 4d8ba5c

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

llvm/test/Transforms/VectorCombine/intrinsic-scalarize.ll

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,62 @@ define <4 x i32> @non_trivially_vectorizable(i32 %x, i32 %y) {
9696
ret <4 x i32> %v
9797
}
9898

99+
define <4 x float> @fabs_fixed(float %x) {
100+
; CHECK-LABEL: define <4 x float> @fabs_fixed(
101+
; CHECK-SAME: float [[X:%.*]]) {
102+
; CHECK-NEXT: [[X_INSERT:%.*]] = insertelement <4 x float> poison, float [[X]], i32 0
103+
; CHECK-NEXT: [[V:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[X_INSERT]])
104+
; CHECK-NEXT: ret <4 x float> [[V]]
105+
;
106+
%x.insert = insertelement <4 x float> poison, float %x, i32 0
107+
%v = call <4 x float> @llvm.fabs(<4 x float> %x.insert)
108+
ret <4 x float> %v
109+
}
110+
111+
define <vscale x 4 x float> @fabs_scalable(float %x) {
112+
; CHECK-LABEL: define <vscale x 4 x float> @fabs_scalable(
113+
; CHECK-SAME: float [[X:%.*]]) {
114+
; CHECK-NEXT: [[X_INSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[X]], i32 0
115+
; CHECK-NEXT: [[V:%.*]] = call <vscale x 4 x float> @llvm.fabs.nxv4f32(<vscale x 4 x float> [[X_INSERT]])
116+
; CHECK-NEXT: ret <vscale x 4 x float> [[V]]
117+
;
118+
%x.insert = insertelement <vscale x 4 x float> poison, float %x, i32 0
119+
%v = call <vscale x 4 x float> @llvm.fabs(<vscale x 4 x float> %x.insert)
120+
ret <vscale x 4 x float> %v
121+
}
122+
123+
define <4 x float> @fma_fixed(float %x, float %y, float %z) {
124+
; CHECK-LABEL: define <4 x float> @fma_fixed(
125+
; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
126+
; CHECK-NEXT: [[X_INSERT:%.*]] = insertelement <4 x float> poison, float [[X]], i32 0
127+
; CHECK-NEXT: [[Y_INSERT:%.*]] = insertelement <4 x float> poison, float [[Y]], i32 0
128+
; CHECK-NEXT: [[Z_INSERT:%.*]] = insertelement <4 x float> poison, float [[Z]], i32 0
129+
; CHECK-NEXT: [[V:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[X_INSERT]], <4 x float> [[Y_INSERT]], <4 x float> [[Z_INSERT]])
130+
; CHECK-NEXT: ret <4 x float> [[V]]
131+
;
132+
%x.insert = insertelement <4 x float> poison, float %x, i32 0
133+
%y.insert = insertelement <4 x float> poison, float %y, i32 0
134+
%z.insert = insertelement <4 x float> poison, float %z, i32 0
135+
%v = call <4 x float> @llvm.fma(<4 x float> %x.insert, <4 x float> %y.insert, <4 x float> %z.insert)
136+
ret <4 x float> %v
137+
}
138+
139+
define <vscale x 4 x float> @fma_scalable(float %x, float %y, float %z) {
140+
; CHECK-LABEL: define <vscale x 4 x float> @fma_scalable(
141+
; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
142+
; CHECK-NEXT: [[X_INSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[X]], i32 0
143+
; CHECK-NEXT: [[Y_INSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[Y]], i32 0
144+
; CHECK-NEXT: [[Z_INSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[Z]], i32 0
145+
; CHECK-NEXT: [[V:%.*]] = call <vscale x 4 x float> @llvm.fma.nxv4f32(<vscale x 4 x float> [[X_INSERT]], <vscale x 4 x float> [[Y_INSERT]], <vscale x 4 x float> [[Z_INSERT]])
146+
; CHECK-NEXT: ret <vscale x 4 x float> [[V]]
147+
;
148+
%x.insert = insertelement <vscale x 4 x float> poison, float %x, i32 0
149+
%y.insert = insertelement <vscale x 4 x float> poison, float %y, i32 0
150+
%z.insert = insertelement <vscale x 4 x float> poison, float %z, i32 0
151+
%v = call <vscale x 4 x float> @llvm.fma(<vscale x 4 x float> %x.insert, <vscale x 4 x float> %y.insert, <vscale x 4 x float> %z.insert)
152+
ret <vscale x 4 x float> %v
153+
}
154+
99155
; TODO: We should be able to scalarize this if we preserve the scalar argument.
100156
define <4 x float> @scalar_argument(float %x) {
101157
; CHECK-LABEL: define <4 x float> @scalar_argument(
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt < %s -S -p vector-combine | FileCheck %s
3+
4+
define <4 x float> @fneg_fixed(float %x) {
5+
; CHECK-LABEL: define <4 x float> @fneg_fixed(
6+
; CHECK-SAME: float [[X:%.*]]) {
7+
; CHECK-NEXT: [[X_INSERT:%.*]] = insertelement <4 x float> poison, float [[X]], i32 0
8+
; CHECK-NEXT: [[V:%.*]] = fneg <4 x float> [[X_INSERT]]
9+
; CHECK-NEXT: ret <4 x float> [[V]]
10+
;
11+
%x.insert = insertelement <4 x float> poison, float %x, i32 0
12+
%v = fneg <4 x float> %x.insert
13+
ret <4 x float> %v
14+
}
15+
16+
define <vscale x 4 x float> @fneg_scalable(float %x) {
17+
; CHECK-LABEL: define <vscale x 4 x float> @fneg_scalable(
18+
; CHECK-SAME: float [[X:%.*]]) {
19+
; CHECK-NEXT: [[X_INSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[X]], i32 0
20+
; CHECK-NEXT: [[V:%.*]] = fneg <vscale x 4 x float> [[X_INSERT]]
21+
; CHECK-NEXT: ret <vscale x 4 x float> [[V]]
22+
;
23+
%x.insert = insertelement <vscale x 4 x float> poison, float %x, i32 0
24+
%v = fneg <vscale x 4 x float> %x.insert
25+
ret <vscale x 4 x float> %v
26+
}

0 commit comments

Comments
 (0)